Compare commits

..

No commits in common. "60436a18d0db588a668b7116deb6a3a3343f41df" and "f38a9b19d7fdb8423354adb67dea737b298ee81c" have entirely different histories.

9 changed files with 70 additions and 129 deletions

2
.gitignore vendored
View file

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

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

Binary file not shown.

View file

@ -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="46" android:versionCode="34"
android:versionName="1.50" android:versionName="1.38"
android:installLocation="auto" android:installLocation="auto"
> >
<uses-sdk android:minSdkVersion="29" android:targetSdkVersion="32" /> <uses-sdk android:minSdkVersion="29" android:targetSdkVersion="32" />

View file

@ -62,15 +62,6 @@ 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
@ -83,6 +74,16 @@ 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

View file

@ -34,7 +34,7 @@ static class Arts
} }
text_style = TextStyle.FromFont( text_style = TextStyle.FromFont(
Font.FromFile("Staatliches.ttf"), Font.FromFile("HurmitNerd.otf"),
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 * 1.5f * U.cm, Rig.r_con_stick.position + Rig.fullstick * U.cm,
Color.White, Color.White,
2 * U.mm 2 * U.mm
); );
@ -77,33 +77,11 @@ 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);
Vec3 box_pos = Mono.box_pose.position + (box_shake * U.cm * 0.333f); Hierarchy.Push(Matrix.TRS(
Matrix box_m4 = Matrix.TRS( Mono.box_pose.position + (box_shake * U.cm * 0.333f),
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,
@ -113,32 +91,24 @@ 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,
@ -152,7 +122,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 (!Mono.menu && !food_next) if (!food_next)
{ {
meshes["Tongue"].Draw( meshes["Tongue"].Draw(
mat_mono, mat_mono,
@ -166,7 +136,6 @@ 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,
@ -237,41 +206,27 @@ static class Arts
); );
} }
if (Mono.eaten == 0)
// food
if (!food_next)
{ {
// starting egg food_ori *= Quat.FromAngles(
meshes["Egg"].Draw( 90 * Time.Stepf,
mat_mono, 30 * Time.Stepf,
Matrix.TRS( 10 * Time.Stepf
Vec3.Zero,
Quat.Identity,
Mono.s_array[new XYZi(0, 0, 0)] > -1 ? 1 : 0.5f
)
); );
} }
else if (!Mono.eaten_latch.state)
{ {
// food float food_t = Mono.eaten_latch.delta == -1 ? Maths.smooth_stop((float)Mono.step_t) : 1;
if (!food_next) meshes["Food"].Draw(
{ mat_mono,
food_ori *= Quat.FromAngles( Matrix.TRS(
90 * Time.Stepf, Mono.food.ToVec3,
30 * Time.Stepf, food_ori,
10 * Time.Stepf food_t
); )
} );
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
@ -290,21 +245,16 @@ 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);
Vec3 score_pos = score_ori * V.XYZ(0, -Mono.SD_Y - 1.5f, -Mono.SD_Z - 1); Text.Add(
for (int i = 0; i < score_txt.Length; i++) Mono.snake_len.ToString("000"),
{ Matrix.TRS(
Text.Add( score_ori * V.XYZ(0, -Mono.SD_Y - 1, -Mono.SD_Z - 1),
score_txt[i].ToString(), score_ori,
Matrix.TRS( 32
score_pos + score_ori * V.XYZ((1 - i) * 0.4f, 0, 0), ),
score_ori, text_style
48 );
),
text_style
);
}
Hierarchy.Pop(); Hierarchy.Pop();

View file

@ -22,25 +22,15 @@ 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 = 1; public static int snake_len = 4;
public static int grow_buffer = 3; public static int grow_buffer = 0;
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, 0, 0); // [!] start random to keep new game fresh? public static XYZi food = new(0, -1, 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;
@ -61,7 +51,6 @@ 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()
@ -195,7 +184,11 @@ static class Mono
holes.Remove(snake[snake_len - 1]); holes.Remove(snake[snake_len - 1]);
} }
update_s_array(); s_array.Clear(-1);
for (int i = 0; i < snake_len; i++)
{
s_array[snake[i]] = i;
}
// eat // eat
if (!eaten_latch.state) if (!eaten_latch.state)
@ -205,7 +198,6 @@ 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]);

View file

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

View file

@ -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.aim; 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.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;

View file

@ -5,7 +5,7 @@ namespace snake;
static class VFX static class VFX
{ {
public static Particle[] particles = new Particle[64]; public static Particle[] particles = new Particle[32];
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 / 3) * Maths.smooth_start(Random.Shared.NextSingle()); particle.scl = (1.0f / 8) * Maths.smooth_stop(Random.Shared.NextSingle());
} }
} }