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/
_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="46"
android:versionName="1.50"
android:versionCode="34"
android:versionName="1.38"
android:installLocation="auto"
>
<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
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
@ -83,6 +74,16 @@ 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("Staatliches.ttf"),
Font.FromFile("HurmitNerd.otf"),
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 * 1.5f * U.cm,
Rig.r_con_stick.position + Rig.fullstick * U.cm,
Color.White,
2 * U.mm
);
@ -77,33 +77,11 @@ 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);
Vec3 box_pos = Mono.box_pose.position + (box_shake * U.cm * 0.333f);
Matrix box_m4 = Matrix.TRS(
box_pos,
Hierarchy.Push(Matrix.TRS(
Mono.box_pose.position + (box_shake * U.cm * 0.333f),
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,
@ -113,32 +91,24 @@ 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,
@ -152,7 +122,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 (!Mono.menu && !food_next)
if (!food_next)
{
meshes["Tongue"].Draw(
mat_mono,
@ -166,7 +136,6 @@ 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,
@ -237,41 +206,27 @@ static class Arts
);
}
if (Mono.eaten == 0)
// food
if (!food_next)
{
// starting egg
meshes["Egg"].Draw(
mat_mono,
Matrix.TRS(
Vec3.Zero,
Quat.Identity,
Mono.s_array[new XYZi(0, 0, 0)] > -1 ? 1 : 0.5f
)
food_ori *= Quat.FromAngles(
90 * Time.Stepf,
30 * Time.Stepf,
10 * Time.Stepf
);
}
else
if (!Mono.eaten_latch.state)
{
// 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
)
);
}
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
@ -290,21 +245,16 @@ 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);
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
);
}
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
);
Hierarchy.Pop();

View file

@ -22,25 +22,15 @@ 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 = 1;
public static int grow_buffer = 3;
public static int snake_len = 4;
public static int grow_buffer = 0;
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, 0, 0); // [!] start random to keep new game fresh?
public static int eaten = 0;
public static XYZi food = new(0, -1, 0); // [!] start random to keep new game fresh?
public static DeltaBool eaten_latch = new(false);
public static double eat_timestamp = 0.0;
@ -61,7 +51,6 @@ static class Mono
{
snake[i] = new XYZi(0, 0, 0);
}
update_s_array();
}
public static void Frame()
@ -195,7 +184,11 @@ static class Mono
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
if (!eaten_latch.state)
@ -205,7 +198,6 @@ 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.eaten > 0)
if (Mono.grow_buffer > 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.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);
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);
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[64];
public static Particle[] particles = new Particle[32];
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 / 3) * Maths.smooth_start(Random.Shared.NextSingle());
particle.scl = (1.0f / 8) * Maths.smooth_stop(Random.Shared.NextSingle());
}
}