Compare commits
21 commits
f38a9b19d7
...
60436a18d0
Author | SHA1 | Date | |
---|---|---|---|
60436a18d0 | |||
d113460fea | |||
67b6cd40e8 | |||
dd862a89cc | |||
d65a9fb8a5 | |||
46a0b2ded7 | |||
dd304ae2c8 | |||
d46910812f | |||
360a075906 | |||
a490da743d | |||
6a27162c5c | |||
024e9939f4 | |||
4edf176efe | |||
d7768a8803 | |||
a37cce18a0 | |||
0531167976 | |||
2c73baf5f9 | |||
d2566e90fd | |||
9a2a67b296 | |||
07b69426af | |||
9a1bd9ebac |
9 changed files with 128 additions and 69 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -8,6 +8,8 @@ obj/
|
||||||
|
|
||||||
Raw/
|
Raw/
|
||||||
_frames/
|
_frames/
|
||||||
|
*.otf
|
||||||
|
*.ttf
|
||||||
|
|
||||||
.vscode
|
.vscode
|
||||||
anchors.txt
|
anchors.txt
|
BIN
Assets/meshes/assets.glb
(Stored with Git LFS)
BIN
Assets/meshes/assets.glb
(Stored with Git LFS)
Binary file not shown.
|
@ -2,8 +2,8 @@
|
||||||
<manifest
|
<manifest
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="com.dofdev.snake"
|
package="com.dofdev.snake"
|
||||||
android:versionCode="34"
|
android:versionCode="46"
|
||||||
android:versionName="1.38"
|
android:versionName="1.50"
|
||||||
android:installLocation="auto"
|
android:installLocation="auto"
|
||||||
>
|
>
|
||||||
<uses-sdk android:minSdkVersion="29" android:targetSdkVersion="32" />
|
<uses-sdk android:minSdkVersion="29" android:targetSdkVersion="32" />
|
||||||
|
|
19
readme.md
19
readme.md
|
@ -62,6 +62,15 @@ todo
|
||||||
fun to play daily for a couple weeks or so
|
fun to play daily for a couple weeks or so
|
||||||
playable with a half engaging vid or conversation in the background
|
playable with a half engaging vid or conversation in the background
|
||||||
|
|
||||||
|
make depth easier to judge
|
||||||
|
pseudo light source is coming from your face (maybe at a diagonal *higher up* angler fish)
|
||||||
|
|
||||||
|
benchmark
|
||||||
|
need to be able to play without moving/turning the box
|
||||||
|
|
||||||
|
start music on egg eat
|
||||||
|
to keep prior tutorial phase focused and a strong indication that auto move has kicked in
|
||||||
|
|
||||||
my tempo (zen mode *after initial release*)
|
my tempo (zen mode *after initial release*)
|
||||||
on l_con tap (a) btn to step, and repeatedly to set tempo
|
on l_con tap (a) btn to step, and repeatedly to set tempo
|
||||||
once a tempo has been set you can stop tapping and you'll coast at that tempo
|
once a tempo has been set you can stop tapping and you'll coast at that tempo
|
||||||
|
@ -74,16 +83,6 @@ todo
|
||||||
this makes it easier to play alongside a video, as your attention span can drift in and out
|
this makes it easier to play alongside a video, as your attention span can drift in and out
|
||||||
and you can take tougher parts slower
|
and you can take tougher parts slower
|
||||||
|
|
||||||
user prompt
|
|
||||||
for start and any other times we need to communicate simple instructions to the player
|
|
||||||
|
|
||||||
make depth easier to judge
|
|
||||||
pseudo light source is coming from your face (maybe at a diagonal *higher up* angler fish)
|
|
||||||
need some surface detail on the box faces (that fit within the art style)
|
|
||||||
|
|
||||||
benchmark
|
|
||||||
need to be able to play without moving/turning the box
|
|
||||||
|
|
||||||
bug(s)
|
bug(s)
|
||||||
snake can accidentally cover the menu
|
snake can accidentally cover the menu
|
||||||
|
|
||||||
|
|
132
src/Arts.cs
132
src/Arts.cs
|
@ -34,7 +34,7 @@ static class Arts
|
||||||
}
|
}
|
||||||
|
|
||||||
text_style = TextStyle.FromFont(
|
text_style = TextStyle.FromFont(
|
||||||
Font.FromFile("HurmitNerd.otf"),
|
Font.FromFile("Staatliches.ttf"),
|
||||||
1.0f * U.cm,
|
1.0f * U.cm,
|
||||||
Color.White
|
Color.White
|
||||||
);
|
);
|
||||||
|
@ -68,7 +68,7 @@ static class Arts
|
||||||
);
|
);
|
||||||
Lines.Add(
|
Lines.Add(
|
||||||
Rig.r_con_stick.position + V.XYZ(0, 0, 0),
|
Rig.r_con_stick.position + V.XYZ(0, 0, 0),
|
||||||
Rig.r_con_stick.position + Rig.fullstick * U.cm,
|
Rig.r_con_stick.position + Rig.fullstick * 1.5f * U.cm,
|
||||||
Color.White,
|
Color.White,
|
||||||
2 * U.mm
|
2 * U.mm
|
||||||
);
|
);
|
||||||
|
@ -77,11 +77,33 @@ static class Arts
|
||||||
box_shake = Vec3.Lerp(box_shake, Vec3.Zero, Time.Stepf / 0.333f);
|
box_shake = Vec3.Lerp(box_shake, Vec3.Zero, Time.Stepf / 0.333f);
|
||||||
// scale in
|
// scale in
|
||||||
float box_scale = Mono.box_scale; // Maths.min(Maths.smooth_stop(Maths.u_scalar(Time.Totalf - 3)) * Mono.box_scale, Mono.box_scale);
|
float box_scale = Mono.box_scale; // Maths.min(Maths.smooth_stop(Maths.u_scalar(Time.Totalf - 3)) * Mono.box_scale, Mono.box_scale);
|
||||||
Hierarchy.Push(Matrix.TRS(
|
Vec3 box_pos = Mono.box_pose.position + (box_shake * U.cm * 0.333f);
|
||||||
Mono.box_pose.position + (box_shake * U.cm * 0.333f),
|
Matrix box_m4 = Matrix.TRS(
|
||||||
|
box_pos,
|
||||||
Mono.box_pose.orientation,
|
Mono.box_pose.orientation,
|
||||||
box_scale
|
box_scale
|
||||||
));
|
);
|
||||||
|
|
||||||
|
// hanger
|
||||||
|
if (Mono.in_cone.state && Mono.box_mode == Mono.BoxMode.Hold || Mono.box_mode == Mono.BoxMode.Mount)
|
||||||
|
{
|
||||||
|
float box_head_dist = Vec3.Distance(box_pos, Rig.head.position);
|
||||||
|
Lines.Add(
|
||||||
|
box_m4 * V.XYZ(0, Mono.SD_Y - 0.5f, 0),
|
||||||
|
Rig.head.position + Rig.head.orientation * V.XYZ(0, 6 * U.cm, -box_head_dist),
|
||||||
|
Color.Hex(0x808080FF).ToLinear(),
|
||||||
|
1.0f * U.mm
|
||||||
|
);
|
||||||
|
Lines.Add(
|
||||||
|
Rig.head.position + Rig.head.orientation * V.XYZ(0, 6 * U.cm, -box_head_dist),
|
||||||
|
Rig.head.position + Rig.head.orientation * V.XYZ(0, 6 * U.cm, 0),
|
||||||
|
Color.Hex(0x808080FF).ToLinear(),
|
||||||
|
1.0f * U.mm
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// box contents
|
||||||
|
Hierarchy.Push(box_m4);
|
||||||
// meshes["InsideOut"].Draw(mat_unlit, Matrix.Identity);
|
// meshes["InsideOut"].Draw(mat_unlit, Matrix.Identity);
|
||||||
meshes["InsideOut"].Draw(
|
meshes["InsideOut"].Draw(
|
||||||
mat_box,
|
mat_box,
|
||||||
|
@ -91,24 +113,32 @@ static class Arts
|
||||||
Mono.in_dist.state ? mat_justcolor : mat_unlit,
|
Mono.in_dist.state ? mat_justcolor : mat_unlit,
|
||||||
Matrix.Identity
|
Matrix.Identity
|
||||||
);
|
);
|
||||||
if (Mono.in_cone.state && Mono.box_mode == Mono.BoxMode.Hold || Mono.box_mode == Mono.BoxMode.Mount)
|
|
||||||
{
|
|
||||||
Lines.Add(
|
|
||||||
V.XYZ(0, Mono.SD_Y - 0.5f, 0),
|
|
||||||
V.XYZ(0, Mono.SD_Y + 3.0f, 0),
|
|
||||||
Color.White,
|
|
||||||
1.0f * U.mm
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if (Mono.menu)
|
if (Mono.menu)
|
||||||
{
|
{
|
||||||
meshes["Tape"].Draw(mat_mono, Matrix.Identity);
|
meshes["Tape"].Draw(mat_mono, Matrix.Identity);
|
||||||
|
meshes["uiRestart"].Draw(
|
||||||
|
mat_unlit,
|
||||||
|
Matrix.TR(
|
||||||
|
V.XYZ(-1.333f, 0, Mono.SD_Z - 0.5f + 0.1f),
|
||||||
|
Quat.FromAngles(90, 0, 0)
|
||||||
|
),
|
||||||
|
Color.Hex(0x928CA7FF).ToLinear()
|
||||||
|
);
|
||||||
meshes["uiPlay"].Draw(
|
meshes["uiPlay"].Draw(
|
||||||
mat_unlit,
|
mat_unlit,
|
||||||
Matrix.TR(
|
Matrix.TR(
|
||||||
V.XYZ(0, 0, Mono.SD_Z - 0.5f + 0.1f),
|
V.XYZ(0, 0, Mono.SD_Z - 0.5f + 0.1f),
|
||||||
Quat.FromAngles(90, 0, 0)
|
Quat.FromAngles(90, 0, 0)
|
||||||
)
|
),
|
||||||
|
Color.Hex(0x333333FF).ToLinear()
|
||||||
|
);
|
||||||
|
meshes["uiConfig"].Draw(
|
||||||
|
mat_unlit,
|
||||||
|
Matrix.TR(
|
||||||
|
V.XYZ(+1.333f, 0, Mono.SD_Z - 0.5f + 0.1f),
|
||||||
|
Quat.FromAngles(90, 0, 0)
|
||||||
|
),
|
||||||
|
Color.Hex(0x928CA7FF).ToLinear()
|
||||||
);
|
);
|
||||||
meshes["uiCursor"].Draw(
|
meshes["uiCursor"].Draw(
|
||||||
mat_unlit,
|
mat_unlit,
|
||||||
|
@ -122,7 +152,7 @@ static class Arts
|
||||||
// snake
|
// snake
|
||||||
float snake_t = headmove.state ? Maths.u_clamp(Maths.smooth_stop((float)Mono.step_t) * 3.0f) : 1.0f;
|
float snake_t = headmove.state ? Maths.u_clamp(Maths.smooth_stop((float)Mono.step_t) * 3.0f) : 1.0f;
|
||||||
bool food_next = !Mono.eaten_latch.state && (Mono.snake[0] + Mono.snake_dir) == Mono.food;
|
bool food_next = !Mono.eaten_latch.state && (Mono.snake[0] + Mono.snake_dir) == Mono.food;
|
||||||
if (!food_next)
|
if (!Mono.menu && !food_next)
|
||||||
{
|
{
|
||||||
meshes["Tongue"].Draw(
|
meshes["Tongue"].Draw(
|
||||||
mat_mono,
|
mat_mono,
|
||||||
|
@ -136,6 +166,7 @@ static class Arts
|
||||||
|
|
||||||
string face = "Face0Default";
|
string face = "Face0Default";
|
||||||
face = Mono.grow_buffer > 0 ? "Face2Eaten" : face;
|
face = Mono.grow_buffer > 0 ? "Face2Eaten" : face;
|
||||||
|
face = Mono.in_box.delta != 0 ? "Face3Bump" : face;
|
||||||
face = food_next ? "Face1Eat" : face;
|
face = food_next ? "Face1Eat" : face;
|
||||||
meshes[face].Draw(
|
meshes[face].Draw(
|
||||||
mat_mono,
|
mat_mono,
|
||||||
|
@ -206,28 +237,42 @@ static class Arts
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Mono.eaten == 0)
|
||||||
// food
|
|
||||||
if (!food_next)
|
|
||||||
{
|
{
|
||||||
food_ori *= Quat.FromAngles(
|
// starting egg
|
||||||
90 * Time.Stepf,
|
meshes["Egg"].Draw(
|
||||||
30 * Time.Stepf,
|
|
||||||
10 * Time.Stepf
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if (!Mono.eaten_latch.state)
|
|
||||||
{
|
|
||||||
float food_t = Mono.eaten_latch.delta == -1 ? Maths.smooth_stop((float)Mono.step_t) : 1;
|
|
||||||
meshes["Food"].Draw(
|
|
||||||
mat_mono,
|
mat_mono,
|
||||||
Matrix.TRS(
|
Matrix.TRS(
|
||||||
Mono.food.ToVec3,
|
Vec3.Zero,
|
||||||
food_ori,
|
Quat.Identity,
|
||||||
food_t
|
Mono.s_array[new XYZi(0, 0, 0)] > -1 ? 1 : 0.5f
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// food
|
||||||
|
if (!food_next)
|
||||||
|
{
|
||||||
|
food_ori *= Quat.FromAngles(
|
||||||
|
90 * Time.Stepf,
|
||||||
|
30 * Time.Stepf,
|
||||||
|
10 * Time.Stepf
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (!Mono.eaten_latch.state)
|
||||||
|
{
|
||||||
|
float food_t = Mono.eaten_latch.delta == -1 ? Maths.smooth_stop((float)Mono.step_t) : 1;
|
||||||
|
meshes["Food"].Draw(
|
||||||
|
mat_mono,
|
||||||
|
Matrix.TRS(
|
||||||
|
Mono.food.ToVec3,
|
||||||
|
food_ori,
|
||||||
|
food_t
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// particles
|
// particles
|
||||||
Particle[] particles = VFX.particles;
|
Particle[] particles = VFX.particles;
|
||||||
|
@ -245,16 +290,21 @@ static class Arts
|
||||||
}
|
}
|
||||||
|
|
||||||
// score
|
// score
|
||||||
|
char[] score_txt = Mono.snake_len.ToString("000").ToCharArray();
|
||||||
Quat score_ori = Quat.LookDir(Rig.head.position - Mono.box_pose.position);
|
Quat score_ori = Quat.LookDir(Rig.head.position - Mono.box_pose.position);
|
||||||
Text.Add(
|
Vec3 score_pos = score_ori * V.XYZ(0, -Mono.SD_Y - 1.5f, -Mono.SD_Z - 1);
|
||||||
Mono.snake_len.ToString("000"),
|
for (int i = 0; i < score_txt.Length; i++)
|
||||||
Matrix.TRS(
|
{
|
||||||
score_ori * V.XYZ(0, -Mono.SD_Y - 1, -Mono.SD_Z - 1),
|
Text.Add(
|
||||||
score_ori,
|
score_txt[i].ToString(),
|
||||||
32
|
Matrix.TRS(
|
||||||
),
|
score_pos + score_ori * V.XYZ((1 - i) * 0.4f, 0, 0),
|
||||||
text_style
|
score_ori,
|
||||||
);
|
48
|
||||||
|
),
|
||||||
|
text_style
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
Hierarchy.Pop();
|
Hierarchy.Pop();
|
||||||
|
|
||||||
|
|
24
src/Mono.cs
24
src/Mono.cs
|
@ -22,15 +22,25 @@ static class Mono
|
||||||
s_array = new(SD_X, SD_Y, SD_Z, -1),
|
s_array = new(SD_X, SD_Y, SD_Z, -1),
|
||||||
tail_fill = new(SD_X, SD_Y, SD_Z, -1);
|
tail_fill = new(SD_X, SD_Y, SD_Z, -1);
|
||||||
|
|
||||||
|
static void update_s_array()
|
||||||
|
{
|
||||||
|
s_array.Clear(-1);
|
||||||
|
for (int i = 0; i < snake_len; i++)
|
||||||
|
{
|
||||||
|
s_array[snake[i]] = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static XYZi[] snake = new XYZi[
|
public static XYZi[] snake = new XYZi[
|
||||||
Maths.u_length(SD_X) * Maths.u_length(SD_Y) * Maths.u_length(SD_Z)
|
Maths.u_length(SD_X) * Maths.u_length(SD_Y) * Maths.u_length(SD_Z)
|
||||||
];
|
];
|
||||||
public static int snake_len = 4;
|
public static int snake_len = 1;
|
||||||
public static int grow_buffer = 0;
|
public static int grow_buffer = 3;
|
||||||
public static XYZi snake_dir = new(0, 0, 1);
|
public static XYZi snake_dir = new(0, 0, 1);
|
||||||
public static DeltaBool in_box = new(true);
|
public static DeltaBool in_box = new(true);
|
||||||
public static Dictionary<XYZi, XYZi> holes = new();
|
public static Dictionary<XYZi, XYZi> holes = new();
|
||||||
public static XYZi food = new(0, -1, 0); // [!] start random to keep new game fresh?
|
public static XYZi food = new(0, 0, 0); // [!] start random to keep new game fresh?
|
||||||
|
public static int eaten = 0;
|
||||||
public static DeltaBool eaten_latch = new(false);
|
public static DeltaBool eaten_latch = new(false);
|
||||||
public static double eat_timestamp = 0.0;
|
public static double eat_timestamp = 0.0;
|
||||||
|
|
||||||
|
@ -51,6 +61,7 @@ static class Mono
|
||||||
{
|
{
|
||||||
snake[i] = new XYZi(0, 0, 0);
|
snake[i] = new XYZi(0, 0, 0);
|
||||||
}
|
}
|
||||||
|
update_s_array();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Frame()
|
public static void Frame()
|
||||||
|
@ -184,11 +195,7 @@ static class Mono
|
||||||
holes.Remove(snake[snake_len - 1]);
|
holes.Remove(snake[snake_len - 1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
s_array.Clear(-1);
|
update_s_array();
|
||||||
for (int i = 0; i < snake_len; i++)
|
|
||||||
{
|
|
||||||
s_array[snake[i]] = i;
|
|
||||||
}
|
|
||||||
|
|
||||||
// eat
|
// eat
|
||||||
if (!eaten_latch.state)
|
if (!eaten_latch.state)
|
||||||
|
@ -198,6 +205,7 @@ static class Mono
|
||||||
{
|
{
|
||||||
eat_timestamp = Time.Total;
|
eat_timestamp = Time.Total;
|
||||||
grow_buffer += 3;
|
grow_buffer += 3;
|
||||||
|
eaten++;
|
||||||
|
|
||||||
VFX.Play(snake[0]);
|
VFX.Play(snake[0]);
|
||||||
SFX.crisp_nom.PlayBox(snake[0]);
|
SFX.crisp_nom.PlayBox(snake[0]);
|
||||||
|
|
|
@ -64,7 +64,7 @@ class Program
|
||||||
Mono.Step();
|
Mono.Step();
|
||||||
Arts.Step();
|
Arts.Step();
|
||||||
|
|
||||||
if (Mono.grow_buffer > 0)
|
if (Mono.eaten > 0)
|
||||||
{
|
{
|
||||||
Mono.intro = false;
|
Mono.intro = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,9 +55,9 @@ static class Rig
|
||||||
Vec2 stick = r_con.stick;
|
Vec2 stick = r_con.stick;
|
||||||
Quat stick_rot = Quat.FromAngles(stick.y * -90, 0, stick.x * +90);
|
Quat stick_rot = Quat.FromAngles(stick.y * -90, 0, stick.x * +90);
|
||||||
float stick_sign = r_con.IsStickClicked ? -1 : +1;
|
float stick_sign = r_con.IsStickClicked ? -1 : +1;
|
||||||
r_con_stick = r_con.pose;
|
r_con_stick = r_con.aim;
|
||||||
r_con_stick.position += r_con_stick.orientation * V.XYZ(0.0065f, -0.012f, -0.05f);
|
// r_con_stick.position += r_con_stick.orientation * V.XYZ(0.0065f, -0.012f, -0.05f);
|
||||||
r_con_stick.orientation *= Quat.FromAngles(-50, 0, 0);
|
// r_con_stick.orientation *= Quat.FromAngles(-50, 0, 0);
|
||||||
fullstick = r_con_stick.orientation * stick_rot * Vec3.Up * stick_sign;
|
fullstick = r_con_stick.orientation * stick_rot * Vec3.Up * stick_sign;
|
||||||
|
|
||||||
// Vec3 fullstick = r_hand.palm.orientation * Vec3.Up;
|
// Vec3 fullstick = r_hand.palm.orientation * Vec3.Up;
|
||||||
|
|
|
@ -5,7 +5,7 @@ namespace snake;
|
||||||
|
|
||||||
static class VFX
|
static class VFX
|
||||||
{
|
{
|
||||||
public static Particle[] particles = new Particle[32];
|
public static Particle[] particles = new Particle[64];
|
||||||
static int index = 0;
|
static int index = 0;
|
||||||
|
|
||||||
public static void Init()
|
public static void Init()
|
||||||
|
@ -25,7 +25,7 @@ static class VFX
|
||||||
particle.pos = pos.ToVec3;
|
particle.pos = pos.ToVec3;
|
||||||
particle.vel = Quat.FromAngles(Random.Shared.NextSingle() * 360, 0, 0) * Quat.FromAngles(0, Random.Shared.NextSingle() * 360, 0) * Vec3.Forward * 6.0f;
|
particle.vel = Quat.FromAngles(Random.Shared.NextSingle() * 360, 0, 0) * Quat.FromAngles(0, Random.Shared.NextSingle() * 360, 0) * Vec3.Forward * 6.0f;
|
||||||
particle.ori = Quat.Identity;
|
particle.ori = Quat.Identity;
|
||||||
particle.scl = (1.0f / 8) * Maths.smooth_stop(Random.Shared.NextSingle());
|
particle.scl = (1.0f / 3) * Maths.smooth_start(Random.Shared.NextSingle());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue