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.20.0: C23, climbing hand by hand
- Build as C23 (-std=c23, or -std=c2x on compilers that call it that); everything compiles clean, nothing needed changing - Climbing a high ledge: one hand reaches the edge first, the other follows
commit_message.txt | 9 ++++----- entropie/Makefile | 7 +++++-- entropie/README.md | 2 +- entropie/STATE.md | 8 ++++++-- entropie/src/people/climb.c | 3 +++ entropie/src/people/hands.c | 3 +++ entropie/src/people/hands.h | 2 ++ 7 files changed, 24 insertions(+), 10 deletions(-) diff --git a/commit_message.txt b/commit_message.txt index da2065b..0e1a9a7 100644 --- a/commit_message.txt +++ b/commit_message.txt @@ -1,6 +1,5 @@ -entropie 2.19.1: menus tested for real, shorter save labels +entropie 2.20.0: C23, climbing hand by hand -- Save labels shorter ("13:04 - saved Oct 20, 18:01"), menus wider, so - the load list and Continue no longer cut them off -- All menus run in the real game: new game, save as, quick save/load, - load list, quit with autosave, continue +- Build as C23 (-std=c23, or -std=c2x on compilers that call it that); + everything compiles clean, nothing needed changing +- Climbing a high ledge: one hand reaches the edge first, the other follows diff --git a/entropie/Makefile b/entropie/Makefile index 7e1a32b..df6f81e 100644 --- a/entropie/Makefile +++ b/entropie/Makefile @@ -1,5 +1,5 @@ APP := entropie -VERSION := 2.19.1 +VERSION := 2.20.0 PREFIX ?= /usr BINDIR ?= $(PREFIX)/bin @@ -14,8 +14,11 @@ PKGS := sdl3 sdl3-ttf PKG_CFLAGS := $(shell $(PKG_CONFIG) --cflags $(PKGS)) PKG_LIBS := $(shell $(PKG_CONFIG) --libs $(PKGS)) +# C23 (GCC 14+, Clang 18+); older compilers know it as c2x (GCC 9+, Clang 9+) +CSTD := $(shell echo 'int main(void){return 0;}' | $(CC) -std=c23 -x c -fsyntax-only - 2>/dev/null && echo c23 || echo c2x) + CFLAGS ?= -O2 -CFLAGS += -std=c11 -Wall -Wextra -Wpedantic -MMD -MP +CFLAGS += -std=$(CSTD) -Wall -Wextra -Wpedantic -MMD -MP CPPFLAGS += -Isrc -I$(BUILD_DIR) $(PKG_CFLAGS) LDLIBS += $(PKG_LIBS) -lGL -lm diff --git a/entropie/README.md b/entropie/README.md index 2d9f51a..5c1fb1d 100644 --- a/entropie/README.md +++ b/entropie/README.md @@ -739,7 +739,7 @@ Heavy things need help: strength of everyone holding adds up. ## Build -Needs a C11 compiler, `make`, `pkg-config`, SDL3, SDL3_ttf and OpenGL 3.3. +Needs a C23 compiler (GCC 9+ or Clang 9+: older ones call it c2x), `make`, `pkg-config`, SDL3, SDL3_ttf and OpenGL 3.3. On Debian: diff --git a/entropie/STATE.md b/entropie/STATE.md index e7a94bf..0c36bf7 100644 --- a/entropie/STATE.md +++ b/entropie/STATE.md @@ -280,6 +280,10 @@ Round 2.19.1: - The menus run for real now (SDL3 built locally, the game offscreen with scripted keys): start menu, New game, Esc, Save as while driving in ("Not while you're driving in"), Save as with a typed name, quick save (F5), quick load (F9), the load list, loading, Quit (autosaved), and the next start: Continue loads the autosave. All fine. - Save labels shorter ("13:04 - saved Oct 20, 18:01"; the version is still in the file), the menus wider (600): the load list cut them off. +Round 2.20: +- C23: the Makefile asks the compiler for `-std=c23` and falls back to `-std=c2x` (GCC 13 / Clang 17 and older call it that); everything compiles clean as C2x with -Wall -Wextra -Wpedantic -Wshadow. (It was C11 from the start, out of caution; nothing needed changing.) README: a C23 compiler (GCC 9+ / Clang 9+). +- Climbing up a high ledge: one hand reaches the edge first (your main hand), the other follows from down by the shoulder (`Hands.edge_lead` / `edge_trail`, set by `Climb_update`: trailing till t 0.24, the unfit a bit longer). Checked on a 1.7 m wall: hand, hand, pull up, a knee on the top, over. + Unfinished building (Shell_build, at SHELL_AT in the frame's frame): brick shell 6.4 x 4.7, walls 2.9, open front (2 m) to the frame (now only the front half: pillars at z -13.8 / -9.2), window holes, bare floor, tiled roof with slabs. Barn: brick courses on BUILDING_BRICK walls (`addBrickCourses`: mortar a shade lighter, so the ink doesn't trace it), ivy (`Shapes_ivy`, OBJ_STRUCTUREs) on both long sides; the woodpile (OBJ_WOODPILE "Woodpile", WOODPILE_A/B) left of the toilet, everybody's woodpile from the start (`scene.c` Scene_finish). Fireplace tripod: wooden poles, feet TRIPOD_OUT 0.9 m outside the stones, TRIPOD_PAST 0.4 m past the top, a lashing; each pole an OBJ_WALL along it ("Tripod pole"). Gates (FURN_GATE, green boards): in your garages' doorways (GATES: hinge, end), `gate_open` / `gate_t`, `hinge`, `gate_shut` / `gate_out`; Object_swingGate (1.2 s), driven by showProps; a click within 1.2 m opens / shuts both leaves. Props that show (1.89, `world.c` showProps every frame): the tin's mesh is built again when its butts change (`Shapes_ashtray`: up to 12 show, the ash rises, a heap from 14; `shown` = what's built). @@ -415,7 +419,7 @@ Most important first. **Body and moving** - Obstacle approach, still to do: thin round logs (under 0.2 m) are still stepped over; a step in between on top of something unstable (if clumsy); NPCs: pull up on their own for their own reasons (now only following a leader), jumping onto things -- Climbing rework: hands first (one reaches first, shoulder ahead), a knee up, the other foot next to it; or sit on it and lift the legs; or belly first and roll; by height, surface and person +- Climbing rework, still to do: the shoulder going ahead with the first hand; other ways up by height, surface and person: sit on it and lift the legs, or belly first and roll (one hand first, the knee up, the other foot next to it: in) - Balance: hips over the feet, look for stable footing, play with balance - Personal movement styles, still to do: gesture variants; stepping over and climbing their own way; sporty ones more elegant (walking styles are in) - More gestures and feelings to pick personalities from: the lists in Body / Fidgets and Gestures can grow @@ -439,4 +443,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.19.1 (build af7a78f)` +State of `entropie 2.20.0 (build 025b698)` diff --git a/entropie/src/people/climb.c b/entropie/src/people/climb.c index d234e08..d6bfe67 100644 --- a/entropie/src/people/climb.c +++ b/entropie/src/people/climb.c @@ -226,6 +226,9 @@ bool Climb_update(const World *world, Object *p, float dt) { /* (coming over the edge the hands go on ahead onto the top: pressed flat on it, under the shoulders) */ Vec3 on = vec3_add(c->edge, vec3_scale(fwd, 0.35f * s * smoothstepf(0.55f, 0.9f, t))); Hands_holdEdge(p, vec3_lerp(before, on, onto), vec3_scale(c->across, lerpf(1.9f, 1.0f, onto)), knees); + /* (one hand reaches up first, the other after it - the sporty quicker; that shoulder goes ahead) */ + p->hands.edge_lead = p->main_hand; + p->hands.edge_trail = 1.0f - smoothstepf(0.1f, 0.24f + 0.08f * (1.0f - p->fitness), t); } else if (t < 0.8f) Hands_touch(p, c->edge); if (t >= 1.0f) { diff --git a/entropie/src/people/hands.c b/entropie/src/people/hands.c index 9396297..8445b10 100644 --- a/entropie/src/people/hands.c +++ b/entropie/src/people/hands.c @@ -1077,9 +1077,12 @@ void Hands_update(Object *who, float dt) { float side = hand == HAND_LEFT ? -1.0f : 1.0f; b->hand_active[hand] = true; b->hand_target[hand] = vec3_add(h->edge_point, vec3_scale(h->edge_across, side * 0.2f * s)); + if (hand != h->edge_lead && h->edge_trail > 0.0f) /* (one hand reaches up first; the other follows from down by the shoulder) */ + b->hand_target[hand] = vec3_add(b->hand_target[hand], vec3(0.0f, -0.5f * s * h->edge_trail, 0.0f)); } b->crouch_goal = fmaxf(b->crouch_goal, h->edge_crouch); h->on_edge = false; + h->edge_trail = 0.0f; } } diff --git a/entropie/src/people/hands.h b/entropie/src/people/hands.h index a1ddd2b..ac1d299 100644 --- a/entropie/src/people/hands.h +++ b/entropie/src/people/hands.h @@ -52,6 +52,8 @@ typedef struct { bool on_edge; /* this frame: both free hands hold on to an edge (climbing up) */ Vec3 edge_point, edge_across; float edge_crouch; + int edge_lead; /* ... this hand gets there first ... */ + float edge_trail; /* ... the other still this far behind (1: down by the shoulder, 0: on it too) */ float settle[2]; /* 0 -> 1 just after taking an item: it turns into the carry pose */ bool by_neck[2]; /* bottles: held at the neck (rare) instead of low around the body */ float miss_time; /* grabbing: seconds the hands couldn't reach their grip */