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.35.0: Alice pants
- Alice pants after a run (and in the midday sun): quick breaths you hear close by, her chest heaving; it eases off over half a minute - She no longer runs on the spot against the car when called: held up by something, she goes round it (legs move by how fast she really goes)
commit_message.txt | 9 ++++---- entropie/Makefile | 2 +- entropie/README.md | 2 +- entropie/STATE.md | 16 +++++++++---- entropie/commit_message.txt | 9 ++++---- entropie/src/game/sound.c | 6 +++++ entropie/src/people/dog.c | 56 +++++++++++++++++++++++++++++++++++++++++---- entropie/src/world/object.h | 4 ++++ entropie/src/world/world.h | 1 + 9 files changed, 86 insertions(+), 19 deletions(-) diff --git a/commit_message.txt b/commit_message.txt index 8901eb8..6a95ab0 100644 --- a/commit_message.txt +++ b/commit_message.txt @@ -1,5 +1,6 @@ -entropie 2.34.0: no bow legs +entropie 2.35.0: Alice pants -- Knees point mostly straight ahead instead of following the turned-out - toes; walking they sit slightly inside the hip-ankle line -- Feet a bit closer together; running they nearly track on one line +- Alice pants after a run (and in the midday sun): quick breaths you hear + close by, her chest heaving; it eases off over half a minute +- She no longer runs on the spot against the car when called: held up by + something, she goes round it (legs move by how fast she really goes) diff --git a/entropie/Makefile b/entropie/Makefile index 63969e2..b94de0f 100644 --- a/entropie/Makefile +++ b/entropie/Makefile @@ -1,5 +1,5 @@ APP := entropie -VERSION := 2.34.0 +VERSION := 2.35.0 PREFIX ?= /usr BINDIR ?= $(PREFIX)/bin diff --git a/entropie/README.md b/entropie/README.md index de2f170..4e59a3d 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.34.0 (build 55cf841)`. The build id is +`make version` prints e.g. `entropie 2.35.0 (build 9450b3c)`. The build id is an md5 of all sources and assets. diff --git a/entropie/STATE.md b/entropie/STATE.md index 19660b8..07f3204 100644 --- a/entropie/STATE.md +++ b/entropie/STATE.md @@ -369,7 +369,9 @@ and satellite pictures (about 340 x 340 m). for sausages, comes when called (R), lies by the fire and loves being petted (click). She runs after what you throw and brings it back (sometimes catching it in the air); a sausage on the ground she eats, an apple she keeps and chews somewhere. - She has a ball and a rope toy: now and then she brings you one to throw + She has a ball and a rope toy: now and then she brings you one to throw. + After a run (or in the midday sun) she pants for a while, heard close by. + Held up by something in the way (the car), she goes round it - A little path leads out between the garages and the barn - Across the gravel road: the orchard (two apple trees, bushes all round), then a small path and a row of other garages, some closed, some full of junk @@ -941,7 +943,7 @@ say no more often and don't come to you for a bit. bottles clinking, glass breaking, somebody hitting the ground, a tree coming down, twigs snapping, the hose, birds by day, crickets at night; people talking (a murmur, deeper or higher by who it is, the words are - on screen), Alice barking and crunching, sips and bites, the toilet, the + on screen), Alice barking, crunching and panting, sips and bites, the toilet, the gates creaking, car doors and the boot, pushing through a bush - Further away is quieter and duller, and comes from its side - M: sound off / on; the menus pause it @@ -1200,12 +1202,16 @@ Round 2.33 (running and walking less stiff): Round 2.34 (no bow legs): - Knees point mostly straight ahead (`body_pose.c` knee pole: KNEE_FOLLOWS_FOOT 0.45 of the foot's turn, KNEE_OUT -0.12 - toes turned out made the knees bow out), feet a bit closer (FOOT_X 0.085, was 0.10; running 0.07, nearly on one line). Measured: knees from 0.5-1.7 cm outside the hip-ankle line to 1-2 cm inside walking, about on it sprinting. Checked: front views of a walk and a sprint. +Round 2.35 (Alice pants, goes round things): +- Panting (`dog.c` pant): `dog.pant` 0..1 rises running (PANT_RISE 0.1/s flat out, from 1.8 m/s), eases resting (PANT_EASE 0.035/s, slower in the sun); the midday sun alone (10:30-19, no rain) keeps it at PANT_SUN 0.35. Over 0.15 she breathes 2-4.5 times a second (`pant_t`): NOISE_PANT each breath (a breath out, a quicker one in, `sound.c`), the chest heaving with it (Dog_draw); not with something in her mouth. +- Her real speed (`dog.was` / `speed`): legs and panting go by how fast she really moves (it was the speed she wanted: running into the car she trotted on the spot for ever, never arriving when called). Held up for DETOUR_AFTER 1 s, she goes off to one side for DETOUR_TIME 1.2 s (`detour`), then on. Checked: called from 25 m behind the car - round it, arrived, panting 1.0 easing to 0.4 in 30 s, about 4 breaths a second. + ## Open tasks Most important first. **Bugs** -- Joint jumps left in the audit: jog+stop 171, sprint 297 (worst 26 cm) - running into things: a hurried catch step swings through in a few frames (step 0.07 -> 0.34, the ankle up 20 cm). Capping the swing speed helped sprint (278) but made jumps, drunk walk and the NPCs worse - tried and reverted in 1.83; ladder 45: toes on the sloping roof (a landing step's toes snap onto the slope, 16 cm; blending them in made all walking worse), toes turning onto the rungs getting on from the top (14 cm) +- Joint jumps left in the audit: jog+stop 171, sprint 297 (worst 26 cm) - running into things: a hurried catch step swings through in a few frames (step 0.07 -> 0.34, the ankle up 20 cm). Capping the swing speed helped sprint (278) but made jumps, drunk walk and the NPCs worse - tried and reverted in 1.83; ladder 45: toes on the sloping roof (a landing step's toes snap onto the slope, 16 cm; blending them in made all walking worse), toes turning onto the rungs getting on from the top (14 cm). Note (2.35): the audit is chaotic - each part starts from where the one before left you, so one small change anywhere reshuffles the later parts (a fall in the drunk walk or not, the ladder test not getting on the ladder); compare parts run on their own (the harness: LADDERONLY / JUMPSONLY / JOGONLY). Tried in 2.35: easing the running swing's ends (sprint worse), a swing not hurrying when stopping (no better on its own) **Body and moving** @@ -1223,7 +1229,7 @@ Most important first. - Clothing, still to do: more outfits for extra people (only the performance test has any: they all wear trousers) - Tents, still to do: NPCs taking theirs down on their own (leaving) - Weather, still to do: hats (nobody wears one yet) blown off; umbrellas while working (now only idle people fetch one); an umbrella blown inside out -- Sound, still to do: the house's doors (they have no doors that open yet), Alice panting +- Sound, still to do: the house's doors (they have no doors that open yet) **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) @@ -1235,4 +1241,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.34.0 (build 55cf841)` +State of `entropie 2.35.0 (build 9450b3c)` diff --git a/entropie/commit_message.txt b/entropie/commit_message.txt index 8901eb8..6a95ab0 100644 --- a/entropie/commit_message.txt +++ b/entropie/commit_message.txt @@ -1,5 +1,6 @@ -entropie 2.34.0: no bow legs +entropie 2.35.0: Alice pants -- Knees point mostly straight ahead instead of following the turned-out - toes; walking they sit slightly inside the hip-ankle line -- Feet a bit closer together; running they nearly track on one line +- Alice pants after a run (and in the midday sun): quick breaths you hear + close by, her chest heaving; it eases off over half a minute +- She no longer runs on the spot against the car when called: held up by + something, she goes round it (legs move by how fast she really goes) diff --git a/entropie/src/game/sound.c b/entropie/src/game/sound.c index da17583..2cfb836 100644 --- a/entropie/src/game/sound.c +++ b/entropie/src/game/sound.c @@ -141,6 +141,12 @@ static void noiseOut(const Noise *n, const Ear *ear) { play(WAVE_NOISE, 0.0f, 0.0f, 1200.0f * dull, 80.0f, 0.002f, 0.05f, 0.2f, 0.5f * g, pan, 0.0f); play(WAVE_CRACKLE, 300.0f, 0.0f, 4000.0f * dull, 1500.0f, 0.001f, 0.03f, 0.08f, 0.3f * g, pan, 0.0f); /* (the latch) */ break; + case NOISE_PANT: { /* hah - hah: a breath out, a quicker one in */ + float per = n->surface > 0 ? 10.0f / (float)n->surface : 0.3f; + play(WAVE_NOISE, 0.0f, 0.0f, 1700.0f * dull, 450.0f, 0.012f, 0.05f, 0.11f, 0.45f * g, pan, 0.0f); + play(WAVE_NOISE, 0.0f, 0.0f, 2400.0f * dull, 800.0f, 0.01f, 0.035f, 0.08f, 0.25f * g, pan, 0.45f * per); + break; + } case NOISE_SNAP: /* a dry branch underfoot */ play(WAVE_CRACKLE, 1500.0f, 0.0f, 7000.0f * dull, 900.0f, 0.001f, 0.03f, 0.08f, 0.8f * g, pan, 0.0f); play(WAVE_NOISE, 0.0f, 0.0f, 2500.0f * dull, 400.0f, 0.001f, 0.02f, 0.06f, 0.5f * g, pan, 0.0f); diff --git a/entropie/src/people/dog.c b/entropie/src/people/dog.c index 7f2cec0..8010274 100644 --- a/entropie/src/people/dog.c +++ b/entropie/src/people/dog.c @@ -1,7 +1,10 @@ #include "people/dog.h" +#include "world/world.h" #include <string.h> +extern struct World *g_world; /* (ai.c: the world they live in) */ + enum { DOG_WANDER, DOG_FOLLOW, DOG_COME, DOG_BEG, DOG_REST, DOG_FETCH, DOG_BRING, DOG_KEEP }; #define TROT_SPEED 1.5f @@ -16,6 +19,11 @@ enum { DOG_WANDER, DOG_FOLLOW, DOG_COME, DOG_BEG, DOG_REST, DOG_FETCH, DOG_BRING #define CATCH_HIGH 0.75f /* m over the ground: in the air up to this she may snap it */ #define CATCH_CHANCE 0.55f #define CHEW_TIME 18.0f /* s an apple keeps her busy */ +#define DETOUR_AFTER 1.0f /* s held up by something (the car): she goes round it ... */ +#define DETOUR_TIME 1.2f /* ... for this long, off to one side */ +#define PANT_RISE 0.1f /* per s running flat out: out of breath (about 10 s to the full) */ +#define PANT_EASE 0.035f /* per s resting: back (half a minute; in the sun slower) */ +#define PANT_SUN 0.35f /* the midday sun alone: this much */ static float rnd(Object *dog) { unsigned *r = &dog->ai.rng; @@ -136,9 +144,41 @@ static void bark(Object *dog, const char *what) { dog->dog.bark = 0.0f; } +/* Panting: after a run, and lying about in the midday sun - quick breaths, heard close by */ +static void pant(Object *dog, float dt) { + float warm = 0.0f; + if (g_world) { + float h = g_world->hour; + warm = (smoothstepf(10.5f, 13.0f, h) - smoothstepf(16.5f, 19.0f, h)) * (1.0f - g_world->rain); + } + float effort = clampf((dog->dog.speed - 1.8f) / (RUN_SPEED - 1.8f), 0.0f, 1.0f); + float p = dog->dog.pant + dt * (PANT_RISE * effort - PANT_EASE * (1.0f - effort) * (1.0f - 0.5f * warm)); + dog->dog.pant = clampf(fmaxf(p, PANT_SUN * warm), 0.0f, 1.0f); + if (dog->dog.pant < 0.15f || dog->dog.carry || !g_world) { dog->dog.pant_t = 0.0f; return; } /* (mouth full: through the nose) */ + float rate = 2.0f + 2.5f * dog->dog.pant; /* breaths a second */ + dog->dog.pant_t += dt * rate; + if (dog->dog.pant_t >= 1.0f) { + dog->dog.pant_t -= 1.0f; + Vec3 head = vec3_add(dog->position, vec3_add(vec3_scale(Object_facing(dog), 0.45f), vec3(0.0f, 0.3f, 0.0f))); + World_noiseOn(g_world, NOISE_PANT, head, 0.15f + 0.3f * dog->dog.pant, (int)(rate * 10.0f)); + } +} + void Dog_update(Object *dog, Object *const *objects, int count, float dt) { if (dog->is_held) return; Ai *ai = &dog->ai; + { /* how fast she really goes: running into something she stops, and goes round it */ + float moved = flatDist(dog->position, dog->dog.was); + dog->dog.was = dog->position; + float real = dt > 0.0f && moved < 2.0f ? moved / dt : 0.0f; + dog->dog.speed += (real - dog->dog.speed) * clampf(10.0f * dt, 0.0f, 1.0f); + bool held = dog->ground_speed > 1.0f && dog->dog.speed < 0.3f * dog->ground_speed; + dog->dog.stuck = held ? dog->dog.stuck + dt : fmaxf(0.0f, dog->dog.stuck - 2.0f * dt); + if (dog->dog.stuck > DETOUR_AFTER && dog->dog.detour == 0.0f) { + dog->dog.detour = (rnd(dog) < 0.5f ? -1.0f : 1.0f) * DETOUR_TIME; + dog->dog.stuck = 0.0f; + } + } ai->speech_time = fmaxf(0.0f, ai->speech_time - dt); dog->dog.wag = fmaxf(0.0f, dog->dog.wag - dt); dog->dog.bark += dt; @@ -280,7 +320,13 @@ void Dog_update(Object *dog, Object *const *objects, int count, float dt) { Vec3 to = vec3_sub(goal, dog->position); to.y = 0.0f; - if (!lie && vec3_length(to) > 0.35f) trot(dog, to, speed, dt); + if (dog->dog.detour != 0.0f) { /* round what's in the way: off to the side, a bit on */ + float way = dog->dog.detour > 0.0f ? 1.0f : -1.0f, len = vec3_length(to); + Vec3 ahead = len > 1e-3f ? vec3_scale(to, 1.0f / len) : Object_facing(dog); + trot(dog, vec3_add(vec3(-ahead.z * way, 0.0f, ahead.x * way), vec3_scale(ahead, 0.3f)), TROT_SPEED, dt); + dog->dog.detour = way * fmaxf(0.0f, fabsf(dog->dog.detour) - dt); + } + else if (!lie && vec3_length(to) > 0.35f) trot(dog, to, speed, dt); else if (mode == DOG_BEG && holder) trot(dog, vec3_scale(vec3_sub(holder->position, dog->position), 0.001f), 0.0f, dt); dog->dog.lie = clampf(dog->dog.lie + (lie ? dt : -2.0f * dt), 0.0f, 1.0f); if (dog->dog.carry) { /* in her mouth */ @@ -289,7 +335,8 @@ void Dog_update(Object *dog, Object *const *objects, int count, float dt) { c->rotation = vec3(PI_F * 0.5f, dog->rotation.y + PI_F * 0.5f, 0.0f); /* (crosswise) */ Object_syncColliders(c); } - dog->dog.phase += dog->ground_speed * dt * 11.0f; + dog->dog.phase += dog->dog.speed * dt * 11.0f; /* (held up by something: her legs stop too) */ + pant(dog, dt); } void Dog_call(Object *dog, const Object *player) { @@ -324,8 +371,9 @@ void Dog_draw(Renderer *r, const Object *dog) { sk->cig_glow = -1.0f; const float lie = smoothstepf(0.0f, 1.0f, dog->dog.lie), dy = -0.09f * lie; - const float moving = clampf(dog->ground_speed / TROT_SPEED, 0.0f, 1.0f); - const float t = r->boil_time, breathe = 0.004f * sinf(t * 5.0f); + const float moving = clampf(dog->dog.speed / TROT_SPEED, 0.0f, 1.0f); + const float t = r->boil_time, pant = dog->dog.carry ? 0.0f : dog->dog.pant; + const float breathe = 0.004f * sinf(t * 5.0f) + 0.012f * pant * sinf(2.0f * PI_F * dog->dog.pant_t); /* (panting: the chest going quick, with each breath) */ const float bob = 0.008f * moving * fabsf(sinf(dog->dog.phase)); sk->joints[JOINT_PELVIS] = vec3(0.0f, 0.21f + dy + bob, -0.18f); sk->joints[JOINT_CHEST] = vec3(0.0f, 0.22f + dy + bob + breathe, 0.17f); diff --git a/entropie/src/world/object.h b/entropie/src/world/object.h index 916793f..dabb0da 100644 --- a/entropie/src/world/object.h +++ b/entropie/src/world/object.h @@ -305,6 +305,10 @@ typedef struct Object { struct Object *carry; /* ... got it in her mouth ... */ struct Object *from; /* ... thrown by (a stick goes back to them) */ float chew; /* seconds with it (an apple: she keeps it, lies down, eats it) */ + float pant, pant_t; /* 0..1 out of breath (after a run, in the midday sun); the breath going on */ + Vec3 was; /* where she was last frame: how fast she really goes (not into the car) ... */ + float speed, stuck; /* ... m/s; s held up by something in the way ... */ + float detour; /* ... s going round it (sign: which way) */ } dog; float charred; /* wood: 0 = fresh .. 1 = burnt to ashes */ float glow; /* wood: 0..1 glowing embers (in a burning fire) */ diff --git a/entropie/src/world/world.h b/entropie/src/world/world.h index d4cd5ae..9e17675 100644 --- a/entropie/src/world/world.h +++ b/entropie/src/world/world.h @@ -30,6 +30,7 @@ typedef enum { NOISE_RUSTLE, /* into a bush: leaves and twigs */ NOISE_CREAK, /* a gate opening or shutting */ NOISE_SLAM, /* a car door, the boot */ + NOISE_PANT, /* Alice panting: one breath out and in (surface: breaths per 10 s) */ NOISE_COUNT } NoiseKind; enum { STEP_GRASS, STEP_GRAVEL, STEP_HARD, STEP_EARTH, STEP_MUD, STEP_WOOD, STEP_WATER };