Entropie git · main
Entropie festival game; first steps
C 88.5% Markdown 9.1% GLSL 2.3%git clone https://git.christianimmanuel.de/games/Entropie.gitwget https://git.christianimmanuel.de/games/Entropie/archive/Entropie.tar.gzentropie 2.31.0: rolling over the edge
- Quite drunk, climbing something chest high ends belly first, then down flat on the top and rolled over onto it, and up again
commit_message.txt | 7 +++---- entropie/Makefile | 2 +- entropie/README.md | 2 +- entropie/STATE.md | 18 +++++++++++++++--- entropie/commit_message.txt | 8 +++++--- entropie/src/people/body.c | 22 +++++++++++++++++++--- entropie/src/people/body.h | 2 ++ entropie/src/people/body_internal.h | 11 ++++++++++- entropie/src/people/body_pose.c | 23 +++++++++++++++-------- patch.sh | 6 ++++++ 10 files changed, 77 insertions(+), 24 deletions(-) diff --git a/commit_message.txt b/commit_message.txt index caeb652..3eff3d2 100644 --- a/commit_message.txt +++ b/commit_message.txt @@ -1,5 +1,4 @@ -entropie 2.30.0: waving, creaking gates +entropie 2.31.0: rolling over the edge -- Talking, people wave hello and goodnight, shrug saying no, point over - there -- Sounds: gates creaking, car doors and the boot, pushing through a bush +- Quite drunk, climbing something chest high ends belly first, then down + flat on the top and rolled over onto it, and up again diff --git a/entropie/Makefile b/entropie/Makefile index 6c47679..7ad37cc 100644 --- a/entropie/Makefile +++ b/entropie/Makefile @@ -1,5 +1,5 @@ APP := entropie -VERSION := 2.31.0 +VERSION := 2.33.0 PREFIX ?= /usr BINDIR ?= $(PREFIX)/bin diff --git a/entropie/README.md b/entropie/README.md index 2d2ee68..59681b5 100644 --- a/entropie/README.md +++ b/entropie/README.md @@ -124,5 +124,5 @@ Dependencies point downward: `main → game → world/people → render → core ## Version -`make version` prints e.g. `entropie 2.31.0 (build 5b62340)`. The build id is +`make version` prints e.g. `entropie 2.33.0 (build 52d3a90)`. The build id is an md5 of all sources and assets. diff --git a/entropie/STATE.md b/entropie/STATE.md index 6614b54..263a338 100644 --- a/entropie/STATE.md +++ b/entropie/STATE.md @@ -602,6 +602,11 @@ and satellite pictures (about 340 x 340 m). - Some are sporty, whatever their build: quicker, surer over things, fewer trips and scrapes. Running, the body rises and falls with each stride: the sporty glide, the others bounce and nod (Tab shows how sporty you are) +- Running for real: each foot stays down a moment, the leg bending like a + spring under the body, then pushing off into a flight with both feet up; + off the toes the heel folds up under the seat, the knee drives through in + front and the foot reaches out to come down; the arms pump, bent about + square; the body leans into it. Walking: longer steps, the arms swing more - Worn out, you can't run until you got your breath back a bit - The more tired the day makes you, the less energy you have: less to give, used up quicker, back slower, everything a bit weaker. Lively and sporty @@ -948,7 +953,8 @@ say no more often and don't come to you for a bit. - Autosave every 5 minutes and on quit - Saves live in your data folder (on Linux: `~/.local/share/entropie/entropie/saves`) - Old saves keep working with newer versions -- Saved up a ladder, you load back on it +- Saved up a ladder, you load back on it; carrying something together, you + load holding it together still ## Changes by round @@ -1184,6 +1190,12 @@ Round 2.30: Round 2.31: - The roll way up (`climb.c` roll_way: a belly climb by somebody over ROLL_DRUNK 0.55 drunk): once the belly is over the edge (ROLL_ONTO 0.42 of the climb) the climb ends on the top (the hips 0.12 m in from the edge) and the body takes over (`Body_rollOnto`: down flat along the edge, face down, `roll_over` turns the body about its length once - ROLL_OVER_TIME 1.1 s, moving inwards like a log, arms in along the body - then on the back where the roll ended (`shift`), and up). Checked on a 1.3 m wall: push up, belly over, flat on it, rolled over, up. +Round 2.32: +- Saves keep holding on together (`save.c`: a `grab` line - what, lifted, one end up, where both hands hold it on it - and a `help` line - whose helper; read back after everybody is in place: helping first, then the grip (`Hands_grabObject`, the grip points as saved, lifted as it was); you hold on again without F). Checked: you and Volkram with a 75 kg log lifted, saved and loaded: both holding it, still lifted 2 s on. + +Round 2.33 (running and walking less stiff): +- Running (`body.c`, `body_pose.c`): a foot stays down STANCE_RUN 0.11 s at a full run (`Foot.planted`; it was gone again after a frame or two, both feet nearly always in the air); the wave follows the ground contact - down while a foot is on the ground, up past standing height in the flight (BOB_FLIGHT; it averaged two opposite feet to nothing: the hips moved 1 cm, now 7 cm), BOB_RUN deeper; the swing foot follows a curve with the body (cubic: from where it left, RUN_TUCK up behind the seat, RUN_DRIVE through in front, down where it lands; `Foot.swing_run` set as it leaves and easing off with SWING_RUN_EASE - slowing down mid-swing no jump); more lean (0.2 rad at a run); the elbows about square pumping. Walking: steps longer (stepLength 0.3 + 0.27 x speed, MAX_LEAD 0.48), arms swing more (ARM_SWING 1.25), the elbow bends more coming forward. Checked: side views of a sprint, a jog and a walk; the audit (sprint pops 247 -> 125, worst 15.7 -> 18.3 cm; the rest about as before - walking and turning fast the hands move that fast in the world anyway). + ## Open tasks Most important first. @@ -1210,7 +1222,7 @@ Most important first. - Sound, still to do: the house's doors (they have no doors that open yet), Alice panting **Saves, still to do** -- Things being done come back fresh: a person's part of a job half way (its progress on the thing is kept, and their order), carrying something together +- Things being done come back fresh: a person's part of a job half way (its progress on the thing is kept, and their order) **Tools for us** - Optional local AI (llama.cpp, small model) for talking and tasks; the menu stays as fallback @@ -1219,4 +1231,4 @@ Most important first. - Drawing many figures on a real graphics card: not measured (software GL: 300 people cost 3x the rest of the scene) --- -State of `entropie 2.31.0 (build 5b62340)` +State of `entropie 2.33.0 (build 52d3a90)` diff --git a/entropie/commit_message.txt b/entropie/commit_message.txt index 3eff3d2..07b592e 100644 --- a/entropie/commit_message.txt +++ b/entropie/commit_message.txt @@ -1,4 +1,6 @@ -entropie 2.31.0: rolling over the edge +entropie 2.33.0: running and walking less stiff -- Quite drunk, climbing something chest high ends belly first, then down - flat on the top and rolled over onto it, and up again +- Running: a foot stays down a moment and the leg bends like a spring, then + a push off into a flight; the heel folds up under the seat and the knee + drives through; the body rises and falls clearly, leans into it, arms pump +- Walking: longer steps, more arm swing diff --git a/entropie/src/people/body.c b/entropie/src/people/body.c index cb048ad..b793f34 100644 --- a/entropie/src/people/body.c +++ b/entropie/src/people/body.c @@ -36,7 +36,7 @@ static Vec3 turnRight(Vec3 dir, float angle) { /* Step length grows with speed: short steps when slow, long strides when running (about 2.9 steps/s at 3 m/s, 4 steps/s at 6.5 m/s). */ static float stepLength(float speed, float s) { - return clampf(0.3f + 0.2f * speed, 0.35f, 1.8f) * s; /* (a sprint: long strides) */ + return clampf(0.3f + 0.27f * speed, 0.35f, 1.8f) * s; /* (a brisk walk: long steps, not a shuffle; a sprint: long strides) */ } /* How far from the other foot a step over something may land: walking a @@ -1219,7 +1219,7 @@ void Body_update(Body *b, const BodyFrame *f) { /* The foot rises early in the swing and reaches forward late. Running: the heel kicks up behind first, then the knee drives forward. */ float run = runAmount(speed); - float t = smoothstepf(0.0f, 1.0f, powf(foot->step, 1.0f + 0.45f * run)); + float t = smoothstepf(0.0f, 1.0f, powf(foot->step, 1.0f + 0.8f * run)); /* (running: stays behind a while, then comes through) */ Vec3 pos = vec3_lerp(foot->step_from, foot->step_to, t); { /* a foot already on the move (coming down from a jump) carries on smoothly */ float u = foot->step; @@ -1231,9 +1231,21 @@ void Body_update(Body *b, const BodyFrame *f) { float want = need > 0.0f ? need + OVER_CLEAR * s : 0.0f; if (want > foot->over) foot->over = fminf(want, foot->over + OVER_RISE * s * dt); } - pos.y += fmaxf((STEP_LIFT + 0.16f * run) * s * stepArc(foot->step, 0.75f - 0.2f * run) + pos.y += fmaxf((STEP_LIFT + 0.3f * run) * s * stepArc(foot->step, 0.75f - 0.35f * run) /* (running: the heel up behind, early) */ * clampf(0.4f + speed * 0.3f, 0.4f, 1.2f) * (1.0f + 0.25f * b->shown.energy), foot->over * stepArc(foot->step, 1.0f)); /* a big step over something (no higher than that) */ + foot->swing_run = fmaxf(run, foot->swing_run - SWING_RUN_EASE * dt); /* (slowing down mid-swing: the curve goes over gently) */ + if (foot->swing_run > 0.0f && foot->over <= 0.0f) { + /* Running: off the toes the heel folds up under the seat, the knee drives through in + front, the foot reaches out and comes down (a curve that goes with the body) */ + Vec3 side = vec3_scale(rightOf(f->facing), (i == 0 ? -1.0f : 1.0f) * 0.1f * s); + Vec3 tuck = vec3_add(vec3_add(f->position, side), vec3_add(vec3_scale(f->facing, RUN_TUCK_BACK * s), vec3(0.0f, RUN_TUCK_UP * s, 0.0f))); + Vec3 drive = vec3_add(vec3_add(f->position, side), vec3_add(vec3_scale(f->facing, RUN_DRIVE_AHEAD * s), vec3(0.0f, RUN_DRIVE_UP * s, 0.0f))); + float u = foot->step, m = 1.0f - u; + Vec3 curve = vec3_add(vec3_add(vec3_scale(foot->step_from, m * m * m), vec3_scale(tuck, 3.0f * m * m * u)), + vec3_add(vec3_scale(drive, 3.0f * m * u * u), vec3_scale(foot->step_to, u * u * u))); + pos = vec3_lerp(pos, curve, foot->swing_run); + } if (foot->over > 0.0f) { /* Over something the leg swings round a little, out to the side and back in to land, while the body's momentum carries it on: the shin clears without climbing so high */ @@ -1296,9 +1308,12 @@ void Body_update(Body *b, const BodyFrame *f) { int best = -1; float best_need = 0.0f; Vec3 best_spot = vec3_zero(); + for (int i = 0; i < 2; i++) b->feet[i].planted = b->feet[i].stepping ? 0.0f : b->feet[i].planted + dt; for (int i = 0; i < 2; i++) { Foot *foot = &b->feet[i], *other = &b->feet[1 - i]; if (foot->stepping) continue; + /* (running, the foot that came down stays down a moment: the leg bends under the body and pushes off) */ + if (foot->planted < STANCE_RUN * runAmount(speed) && foot->into <= LEG_TOUCH * s) continue; /* (running, a foot left far behind while the other is still on its way over something: off it goes, a leap) */ float behind = -vec3_dot(flat(vec3_sub(foot->ankle, f->position)), f->facing); bool leap = speed > LEAP_SPEED && ((other->over > 0.0f && behind > LEAP_BEHIND * s) || foot->into > LEG_TOUCH * s); @@ -1327,6 +1342,7 @@ void Body_update(Body *b, const BodyFrame *f) { Foot *foot = &b->feet[best]; foot->stepping = true; foot->step = 0.0f; + foot->swing_run = runAmount(speed); /* off from where it was drawn (heel up, rolled over the toes): no jump */ bool shown = b->shown_valid && vec3_length(vec3_sub(b->ankle_shown[best], foot->ankle)) < 0.25f * s; foot->step_from = shown ? b->ankle_shown[best] : foot->ankle; diff --git a/entropie/src/people/body.h b/entropie/src/people/body.h index e598b65..cbffead 100644 --- a/entropie/src/people/body.h +++ b/entropie/src/people/body.h @@ -75,6 +75,8 @@ typedef struct { Vec3 air_v; /* in the air: its speed (sprung) */ Vec3 step_v0; /* this step started moving this fast (landing from the air) */ float delay; /* landing: this foot comes down a moment after the other */ + float planted; /* s on the ground since it last came down (running: it stays a moment, pushing off) */ + float swing_run; /* how much this swing is a running one (set as it leaves, easing off slowly: stopping, no jump) */ } Foot; typedef struct { diff --git a/entropie/src/people/body_internal.h b/entropie/src/people/body_internal.h index 64a142a..44ecbd8 100644 --- a/entropie/src/people/body_internal.h +++ b/entropie/src/people/body_internal.h @@ -69,7 +69,7 @@ #define MIN_STEP_TIME 0.16f #define MAX_STEP_TIME 0.42f #define RUN_SPEED 3.5f /* from here on both feet may be in the air */ -#define MAX_LEAD 0.42f /* how far ahead of the hips a foot lands */ +#define MAX_LEAD 0.48f /* how far ahead of the hips a foot lands */ #define TELEPORT_SPEED 40.0f /* faster than this: replant the feet */ #define AIR_GRACE 0.15f /* brief bumps off the ground don't count as flying */ #define LANDING_STEP_TIME 0.12f @@ -164,6 +164,15 @@ enum { #define LEG_RAISE_SPEED 2.5f /* m/s a foot comes up off the ground when its leg must */ #define OVER_LEAN 0.22f /* radians the body leans forward stepping over something high */ #define BOB_OMEGA 28.0f /* the running wave follows the strides this quickly */ +#define RUN_TUCK_BACK -0.30f /* running, the swing foot's curve: pulled up behind the seat ... */ +#define RUN_TUCK_UP 0.85f +#define RUN_DRIVE_AHEAD 0.45f /* ... then through in front, the knee up */ +#define RUN_DRIVE_UP 0.55f +#define ARM_SWING 1.25f /* rad the arms swing per m the opposite foot is ahead (walking; running more) */ +#define SWING_RUN_EASE 2.5f /* per s a running swing turns into a walking one, slowing down */ +#define STANCE_RUN 0.11f /* s a foot stays down at a full run (bending, then pushing off) */ +#define BOB_RUN 0.8f /* running: the wave this much deeper (down on the bent leg, up in the flight) */ +#define BOB_FLIGHT 1.6f /* ... in the flight the body goes up past standing height (the wave's top) */ #define SWING_CHEST 0.8f /* a two-handed swing off to one side: the shoulders turn this much with it ... */ #define SWING_HIPS 0.3f /* ... the hips ... */ #define SWING_HEAD 0.3f /* ... the head ... */ diff --git a/entropie/src/people/body_pose.c b/entropie/src/people/body_pose.c index 6667d2c..403e95f 100644 --- a/entropie/src/people/body_pose.c +++ b/entropie/src/people/body_pose.c @@ -536,7 +536,7 @@ static void solveStanding(Body *b, Vec3 position, Vec3 facing, float s, float dt hip_y[i] = b->hip_s[i]; } - float pitch = b->lean * 0.3f + b->crouch * 0.55f + fminf(speed * 0.035f, 0.22f) + 0.1f * runAmount(speed) + float pitch = b->lean * 0.3f + b->crouch * 0.55f + fminf(speed * 0.035f, 0.22f) + 0.2f * runAmount(speed) - 0.06f * proud + 0.12f * shy + 0.09f * tired + 0.08f * u - 0.08f * burpIn(b) + 1.0f * bentDown(b) + 0.1f * heaving(b) * sinf(b->clock * 20.0f) + clampf(b->grade * 0.35f, -0.1f, 0.2f) /* leaning into a climb */ @@ -552,13 +552,20 @@ static void solveStanding(Body *b, Vec3 position, Vec3 facing, float s, float dt { float sum = 0.0f; int n = 0; - for (int i = 0; i < 2; i++) + bool planted = false; + for (int i = 0; i < 2; i++) { if (b->feet[i].stepping) { sum += cosf(2.0f * PI_F * b->feet[i].step); n++; } - springCritical(&b->bob, &b->bob_v, n ? sum / (float)n : -1.0f, BOB_OMEGA, dt); + else planted = true; + } + /* (running: down while a foot is on the ground - the leg bends like a spring - and up in + the flight between, past standing height; jogging, the steps' own wave) */ + float run = runAmount(speed); + float target = lerpf(n ? sum / (float)n : -1.0f, planted ? -1.0f : BOB_FLIGHT, run); + springCritical(&b->bob, &b->bob_v, target, BOB_OMEGA, dt); float go = smoothstepf(BOB_FROM, BOB_FULL, speed) * (b->airborne ? 0.0f : 1.0f); - float amp = go * (BOB_FIT + BOB_UNFIT * (1.0f - b->fitness)) + float amp = go * (BOB_FIT + BOB_UNFIT * (1.0f - b->fitness)) * (1.0f + BOB_RUN * run) * (1.0f + 0.35f * b->style[2] + 0.25f * clampf(b->shown.energy, 0.0f, 1.0f)); /* (bouncy or flat: their own, livelier when lively) */ - wave = 0.5f * (clampf(b->bob, -1.0f, 1.0f) - 1.0f); /* (0 up .. -1 down: never stretches the legs) */ + wave = 0.5f * (clampf(b->bob, -1.0f, 1.0f + (BOB_FLIGHT - 1.0f) * run) - 1.0f); /* (0 standing .. -1 down; running a little up in the flight) */ pitch += go * BOB_NOD * (1.0f - b->fitness) * wave; wave *= amp; } @@ -726,7 +733,7 @@ static void solveStanding(Body *b, Vec3 position, Vec3 facing, float s, float dt measured from there both arms stayed forward, stiff in front of the chest) */ float foot_ahead = lerpf(ankle[side].z - j[JOINT_PELVIS].z, 0.5f * (ankle[side].z - ankle[1 - side].z), smoothstepf(0.5f, 2.5f, speed)); float run = runAmount(speed); - float amplitude = 0.85f * (1.0f + 0.25f * b->shown.energy + 0.2f * proud - 0.3f * shy) * (1.0f + 1.2f * run) + float amplitude = ARM_SWING * (1.0f + 0.25f * b->shown.energy + 0.2f * proud - 0.3f * shy) * (1.0f + 1.2f * run) * (1.0f + 0.2f * sign * b->quirk[0]); /* one arm swings more */ float reach = 0.55f + 0.3f * run; float goal = clampf(-foot_ahead * amplitude, -reach, reach) + flail * 0.5f @@ -738,8 +745,8 @@ static void solveStanding(Body *b, Vec3 position, Vec3 facing, float s, float dt float a = b->arm[side]; /* (walking: a little bend, more swinging forward; running: bent about square, closing as the arm comes forward - the hand up by the chest - and opening on the way back past the hip) */ - float walk_bend = 0.2f + clampf(speed * 0.06f, 0.0f, 0.3f) + 0.3f * fmaxf(a, 0.0f); - float run_bend = 1.2f + 0.45f * a; + float walk_bend = 0.25f + clampf(speed * 0.08f, 0.0f, 0.35f) + 0.4f * fmaxf(a, 0.0f); /* (the elbow bends more coming forward) */ + float run_bend = 1.4f + 0.35f * a; /* (pumping: about square all the way, the hand up by the chin in front) */ float bend_goal = lerpf(walk_bend, run_bend, run) + 0.15f * shy + 0.08f * sign * b->quirk[3]; spring(&b->fore[side], &b->fore_vel[side], bend_goal, FORE_STIFFNESS * quick, FORE_DAMPING * 0.8f * sqrtf(quick), dt); /* (a little loose: no robot arms) */ float bend = b->fore[side]; diff --git a/patch.sh b/patch.sh new file mode 100644 index 0000000..c21ece2 --- /dev/null +++ b/patch.sh @@ -0,0 +1,6 @@ + +if [ -f /home/Shared/Claude/entropie/commit_message.txt ]; then + cd ..; mv $SHARED_CLAUDE/entropie/commit_message.txt . && tar -xvf $SHARED_CLAUDE/entropie/entropie-patch.tar && echo "$(git add . && git commit -F commit_message.txt)" && cd entropie && make clean && make && cat ../commit_message.txt +else + echo "Missing file: /home/Shared/Claude/entropie/commit_message.txt" +fi