Compare commits

...

21 commits

Author SHA1 Message Date
60436a18d0 music note 2024-11-25 14:15:51 -05:00
d113460fea grey hangar with linear color space conversion on hex color inputs 2024-11-25 14:11:30 -05:00
67b6cd40e8 visual prompt > txt prompt 2024-11-25 14:04:53 -05:00
dd862a89cc hide tongue in menu 2024-11-25 14:03:45 -05:00
d65a9fb8a5 dynamic menu btn colors 2024-11-25 14:00:37 -05:00
46a0b2ded7 egg is first food! 2024-11-25 13:51:45 -05:00
dd304ae2c8 update s_array on init 2024-11-25 13:51:18 -05:00
d46910812f egg start 2024-11-25 13:38:22 -05:00
360a075906 food eaten var 2024-11-25 13:37:23 -05:00
a490da743d next 2 menu btns 2024-11-25 13:27:14 -05:00
6a27162c5c chonkier food chunks 2024-11-25 13:21:21 -05:00
024e9939f4 slight adjustment to score_pos 2024-11-25 13:13:23 -05:00
4edf176efe ignore third party fonts 2024-11-25 12:50:39 -05:00
d7768a8803 reprioritize todo 2024-11-25 12:49:47 -05:00
a37cce18a0 score font size++ 2024-11-25 12:49:07 -05:00
0531167976 use aim pose instead for fullstick 2024-11-25 12:48:47 -05:00
2c73baf5f9 taller fullstick 2024-11-24 20:51:53 -05:00
d2566e90fd proper box hanger 2024-11-24 20:51:17 -05:00
9a2a67b296 bigger score 2024-11-24 20:49:45 -05:00
07b69426af delta hole face 2024-11-24 19:29:49 -05:00
9a1bd9ebac faked fixed width 2024-11-24 19:25:13 -05:00
9 changed files with 128 additions and 69 deletions

2
.gitignore vendored
View file

@ -8,6 +8,8 @@ obj/
Raw/
_frames/
*.otf
*.ttf
.vscode
anchors.txt

BIN
Assets/meshes/assets.glb (Stored with Git LFS)

Binary file not shown.

View file

@ -2,8 +2,8 @@
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.dofdev.snake"
android:versionCode="34"
android:versionName="1.38"
android:versionCode="46"
android:versionName="1.50"
android:installLocation="auto"
>
<uses-sdk android:minSdkVersion="29" android:targetSdkVersion="32" />

View file

@ -62,6 +62,15 @@ todo
fun to play daily for a couple weeks or so
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*)
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
@ -74,16 +83,6 @@ todo
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
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)
snake can accidentally cover the menu

View file

@ -34,7 +34,7 @@ static class Arts
}
text_style = TextStyle.FromFont(
Font.FromFile("HurmitNerd.otf"),
Font.FromFile("Staatliches.ttf"),
1.0f * U.cm,
Color.White
);
@ -68,7 +68,7 @@ static class Arts
);
Lines.Add(
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,
2 * U.mm
);
@ -77,11 +77,33 @@ static class Arts
box_shake = Vec3.Lerp(box_shake, Vec3.Zero, Time.Stepf / 0.333f);
// 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);
Hierarchy.Push(Matrix.TRS(
Mono.box_pose.position + (box_shake * U.cm * 0.333f),
Vec3 box_pos = Mono.box_pose.position + (box_shake * U.cm * 0.333f);
Matrix box_m4 = Matrix.TRS(
box_pos,
Mono.box_pose.orientation,
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_box,
@ -91,24 +113,32 @@ static class Arts
Mono.in_dist.state ? mat_justcolor : mat_unlit,
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)
{
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(
mat_unlit,
Matrix.TR(
V.XYZ(0, 0, Mono.SD_Z - 0.5f + 0.1f),
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(
mat_unlit,
@ -122,7 +152,7 @@ static class Arts
// snake
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;
if (!food_next)
if (!Mono.menu && !food_next)
{
meshes["Tongue"].Draw(
mat_mono,
@ -136,6 +166,7 @@ static class Arts
string face = "Face0Default";
face = Mono.grow_buffer > 0 ? "Face2Eaten" : face;
face = Mono.in_box.delta != 0 ? "Face3Bump" : face;
face = food_next ? "Face1Eat" : face;
meshes[face].Draw(
mat_mono,
@ -206,28 +237,42 @@ static class Arts
);
}
// food
if (!food_next)
if (Mono.eaten == 0)
{
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(
// starting egg
meshes["Egg"].Draw(
mat_mono,
Matrix.TRS(
Mono.food.ToVec3,
food_ori,
food_t
Vec3.Zero,
Quat.Identity,
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
Particle[] particles = VFX.particles;
@ -245,16 +290,21 @@ static class Arts
}
// score
char[] score_txt = Mono.snake_len.ToString("000").ToCharArray();
Quat score_ori = Quat.LookDir(Rig.head.position - Mono.box_pose.position);
Text.Add(
Mono.snake_len.ToString("000"),
Matrix.TRS(
score_ori * V.XYZ(0, -Mono.SD_Y - 1, -Mono.SD_Z - 1),
score_ori,
32
),
text_style
);
Vec3 score_pos = score_ori * V.XYZ(0, -Mono.SD_Y - 1.5f, -Mono.SD_Z - 1);
for (int i = 0; i < score_txt.Length; i++)
{
Text.Add(
score_txt[i].ToString(),
Matrix.TRS(
score_pos + score_ori * V.XYZ((1 - i) * 0.4f, 0, 0),
score_ori,
48
),
text_style
);
}
Hierarchy.Pop();

View file

@ -22,15 +22,25 @@ static class Mono
s_array = 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[
Maths.u_length(SD_X) * Maths.u_length(SD_Y) * Maths.u_length(SD_Z)
];
public static int snake_len = 4;
public static int grow_buffer = 0;
public static int snake_len = 1;
public static int grow_buffer = 3;
public static XYZi snake_dir = new(0, 0, 1);
public static DeltaBool in_box = new(true);
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 double eat_timestamp = 0.0;
@ -51,6 +61,7 @@ static class Mono
{
snake[i] = new XYZi(0, 0, 0);
}
update_s_array();
}
public static void Frame()
@ -184,11 +195,7 @@ static class Mono
holes.Remove(snake[snake_len - 1]);
}
s_array.Clear(-1);
for (int i = 0; i < snake_len; i++)
{
s_array[snake[i]] = i;
}
update_s_array();
// eat
if (!eaten_latch.state)
@ -198,6 +205,7 @@ static class Mono
{
eat_timestamp = Time.Total;
grow_buffer += 3;
eaten++;
VFX.Play(snake[0]);
SFX.crisp_nom.PlayBox(snake[0]);

View file

@ -64,7 +64,7 @@ class Program
Mono.Step();
Arts.Step();
if (Mono.grow_buffer > 0)
if (Mono.eaten > 0)
{
Mono.intro = false;
}

View file

@ -55,9 +55,9 @@ static class Rig
Vec2 stick = r_con.stick;
Quat stick_rot = Quat.FromAngles(stick.y * -90, 0, stick.x * +90);
float stick_sign = r_con.IsStickClicked ? -1 : +1;
r_con_stick = r_con.pose;
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 = r_con.aim;
// 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);
fullstick = r_con_stick.orientation * stick_rot * Vec3.Up * stick_sign;
// Vec3 fullstick = r_hand.palm.orientation * Vec3.Up;

View file

@ -5,7 +5,7 @@ namespace snake;
static class VFX
{
public static Particle[] particles = new Particle[32];
public static Particle[] particles = new Particle[64];
static int index = 0;
public static void Init()
@ -25,7 +25,7 @@ static class VFX
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.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());
}
}