Commit Graph

23 Commits

Author SHA1 Message Date
Axel Meyer
60eac65bce feat(vagrant): Tab-Toggle inventory panel + right-click context menu
- lib-core.panel and lib-core.inventory-list-display added to deps (v0.1.0 each)
- backpack-widget created in M.init with label-resolver returning "Rock"
- Drop action registered: removes from backpack, relocates to player position,
  re-registers pickup trigger
- Inspect action registered: prints reg_id via engine.print
- M.update: panel.update(dt) + is_pausing() early-return added after
  quit_to_launcher check
- interaction.update wrapped in panel.is_open() guard to block world triggers
  while panel is visible
- M.draw: panel.render() added at z-top after CI traces
- Q-drop (LIFO quick-drop via Q key) unchanged and parallel to panel Drop action
2026-06-13 23:42:55 +02:00
Axel Meyer
e38d396b87 feat(vagrant): backpack as inventory container — end-to-end pickup/drop demo
- Add container={kind="list"} to the backpack template so inventory.add
  accepts it as a valid list-container
- Remove old backpack proximity-trigger (print-only callback, pre-B.5);
  the rock's register_pickup is now the sole interaction trigger
- Emit unconditional inventory inspection trace after every add/remove:
  backpack count + item reg-ids for user-facing demo feedback
- Add CI-gated tree-check traces: tree_check_after_pickup=ok and
  tree_check_after_drop=ok verify composition-tree child placement
- Bump version 0.7.3 -> 0.8.0 across init.lua header, manifest.module,
  and README
- README: rewrite Controls section into full demo walkthrough; add Demo
  Walkthrough section; update Demonstrates + Interactions sections;
  add v0.8.0 CHANGELOG entry

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-13 19:00:12 +02:00
Axel Meyer
f874813498 feat(vagrant): spawn rock entity with pickup trigger
- Rock template (stack_mode=individual, tags=renderable+item) defined
  alongside backpack and vagrant_player templates.
- state.rock entity created in M.init using slot_00_isolated UV from
  the blob_rect_stone atlas (lib-asset.prototype-blob-geom); position
  (270, 400) — 80px left of the backpack.
- register_pickup(state.rock) wires an interaction trigger; existing
  render.draw_entities{tag="renderable"} draws the rock with no
  special-case render code.
- CI trace: engine.print("vagrant: rock_spawned") emitted once on init.
- Version bump 0.7.2 -> 0.7.3.
2026-06-13 18:27:25 +02:00
Axel Meyer
f1e27d8183 feat(vagrant): pickup/drop glue + lib-core.inventory-list dep
- Add lib-core.inventory-list v0.1.0 to manifest deps; bump module
  version 0.7.1 -> 0.7.2
- Import inventory = require("lib-core.inventory-list") in init.lua
- Add Item-Template-Convention comment block after vagrant_player
  template: documents stack_mode/tags/sprite/position contract that
  B.4 (rock) and B.5 (backpack-as-container) will fulfill
- Add register_pickup(item) factory: reads item position, registers
  interaction trigger; callback calls inventory.add + unregisters
  trigger on pickup
- Bind "drop" action to Q; drop handler in M.update pops last item
  from backpack via inventory.remove (renderable tag restored by
  library), repositions item at player pos +30px, re-registers pickup
- Update README Controls section: document E (pickup) and Q (drop)
  with note that end-to-end use requires B.4 + B.5
2026-06-13 18:18:52 +02:00
Axel Meyer
3c5e63ea18 feat(0.7.0): Player als Actor-Entity, Puppet syncs (Phase A.6)
Refactor: Player gesplittet in zwei Handles. state.actor (composition-
Entity) ist canonical position-owner. state.player (puppet handle)
bleibt für Animation + Render zuständig und syncs each frame via
puppet.move_to(state.player, actor.position(state.actor)).

vagrant_player-Template ist UNTAGGED — render.draw_entities sieht ihn
nicht, da puppet.render(state.player) das Sprite-Rendering schon macht.
Tag-Konflikt vermieden.

Movement-Refactor in M.update:
- CI_DRIVE-Branch: actor.move(state.actor, dx*speed*dt, 0)
- Normal-Movement: actor.move(state.actor, mx*speed*dt, my*speed*dt)
- Sync-Punkt nach beiden Branches: puppet.move_to(state.player,
  actor.position(state.actor))
- interaction.update + camera.set_target lesen actor.position

Sprint-Logic unverändert (eigene WALK_SPEED constants; movement_speed
auf actor ist informational/120).

Bumps: 0.6.0 → 0.7.0; +actor v0.1.0.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-09 14:14:18 +00:00
Axel Meyer
c976353637 feat(0.6.0): Backpack as composition-Entity (Phase A.4)
Refactor: Backpack ist composition-Entity mit Atlas-UV-Render-Pfad.
Template at top-level declares sprite_atlas + sprite_uv.{x,y,w,h} +
position. create() in M.init nach atlas-load setzt reale UV-Werte aus
state.furniture_uvs["backpack_001"].

render.draw_entities{tag="renderable"} ersetzt den direkten
draw_sprite_transform-Call für Backpack. interaction.register liest
position aus entity-properties.

Bed + Bench bleiben hardcoded Atlas-Furniture — kein
Interaction-Trigger, kein Demo-Pflicht zur Entity-Promotion in
Phase A. Phase B (container-on-bed) oder Phase D wäre der Trigger.

Atlas-Texture wird doppelt geladen (state.world_tex für bed/bench,
render-internal-cache für backpack) — ineffizient aber nicht
kaputt; single-handle-merge ist späterer Slice.

Bumps: render 0.1.0 → 0.2.0; +composition v0.1.0; module 0.4.4 → 0.6.0.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-09 13:51:02 +00:00
Axel Meyer
c04dea7f3e ESC -> lib-management.launcher (renamed per ADR-0045)
The launcher migrated from lib-sporel.launcher to lib-management.launcher
per ADR-0045 (three-tier library naming). Update the quit_to_launcher
handler to match the new module id.
2026-05-31 00:22:30 +02:00
Axel Meyer
b5b8318aa3 Migrate vagrant-skeleton to atlas-uv consumers
Asset-aliases now reference the three baked subterrain atlas-sets
(subterrain_player, subterrain_tiles, subterrain_world) rather than
the legacy indexed pack labels. The rig asset_pack updates to
subterrain_player and each bone gains a calibrated anchor offset.
Furniture-draw loads the subterrain_world atlas once and renders
via source-rect draw_sprite_transform. The map tilemap field updates
to subterrain_tiles to match the new atlas-id. Dep-bumps for
lib-core.maps 0.3.0, lib-core.puppet 0.5.0, and
lib-asset.prototype-subterrain 0.2.0. Replace r_lib.draw_map with
draw_map_pre/post_entities.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-21 23:28:24 +02:00
Axel Meyer
c4f2c9cda9 feat(vagrant): sprint (shift+wasd) + backpack interaction
Sprint: holding shift while WASD doubles player_speed (120 → 240) and
walk-anim play-speed (0.45 → 0.9). Mid-walk sprint toggle uses puppet
v0.4.4 set_play_speed → no cycle restart. Releasing shift or stopping
WASD reverts to normal speed in next frame.

Interaction: 'interact' bound to E. Proximity trigger registered on
the backpack sprite at (350, 400) with range 40px. Pressing E within
range fires callback that prints a log message with the actor distance.
Uses existing lib-core.interaction (registered at init, polled by
interaction.update(player.x, player.y) each frame).

New dep: lib-core.interaction ^0.1.0. Module version 0.4.0 → 0.4.4
(syncs with puppet bump).
2026-05-18 23:46:23 +02:00
Axel Meyer
cfd5d71546 fix(vagrant): walk anim speed 0.4 → 0.45 (user tuning)
Note re user observation 'hat sich die animationslänge durch negative
skalierung verändert': no, anim duration (0.8s) and play speed (the
dt multiplier) are independent of bone-state values. The full cycle
visually traverses scl=+1 → 0 → -1 → 0 → +1 over 0.8s × 1/0.45 ≈
1.78s effective. Previous 0.4 gave 2.0s — slightly slower than
desired walking cadence.
2026-05-18 22:38:06 +02:00
Axel Meyer
b66c4ca4dd fix(vagrant): substrate leg.scl cycle restored; feet inherit_scale=false
User feedback after iteration-4: legs SHOULD cycle through +1/0/-1
(substrate-style — leg renders forward, under body, then behind body).
But feet must NOT Y-flip when leg.scl_y goes negative, and must NOT
collapse when leg.scl_y=0. They should follow leg-end position only.

Three changes:
1. walk_fwd_lower keyframes restored to substrate-style (leg.scl_y
   sign-flip on both halves: leg_l +1↔-1, leg_r -1↔+1). foot.pos
   animations REMOVED — cascade through leg.world.scl now correctly
   moves foot to leg-end position automatically (foot.local.pos
   stays at rest 25 in y).
2. foot.rest.scl: [1, -1] → [1, 1] (no Y-flip in rest, natural
   sprite orientation). inherit_scale=false → foot.world.scl stays
   at foot.local.scl=[1,1] regardless of leg.scl_y. Foot sprite
   never flips, never collapses.
3. Procedural extended: writes foot.local.rot = -leg.local.rot so
   foot.world.rot = body.world.rot (feet stay body-oriented even
   when legs rotate to walk-direction).

Speed slowed further from 0.5 → 0.4 (user: still too fast at 0.5).
2026-05-18 22:31:42 +02:00
Axel Meyer
bf5fe12e4c fix(vagrant): walk anim — slow to 0.5x, no leg.scl_y sign flip
User manual-test feedback after iteration-3 hip-stable + leg-rotation
fixes:

1. Animation too fast for actual map traversal → play walk_fwd_lower
   and walk_upper with speed=0.5 (effective 1.6s cycle, was 0.8s).
2. Second half visually broken → was substrate's sign-flip trick where
   leg.scl_y goes +1 (opposite of rest -1) and foot.pos.y flips
   negative. Cascade foot.world.scl_y = +1 * -1 = -1 → foot rendered
   Y-flipped. User: 'die füße ... darf hier die skalierung nicht negativ
   werden'.

   New cycle: each half extends ONE leg (scl_y=-1 matching rest) while
   the other stays at scl_y=0 (collapsed/invisible). foot.world.scl_y
   never goes negative — only [0, +1]. Alternating-leg gait. Substrate
   first-half preserved verbatim; second-half mirrors with role swap.
2026-05-18 22:13:56 +02:00
Axel Meyer
77f3e726ae fix(vagrant): hip-anchors body-relative; leg-orientation procedural
User feedback: 'anchorpoints sind hüftgelenke und können sich nicht
frei drehen. hüfte bleibt zum körper statisch'.

Architecture:
- legs.parent = body (was lower_control). Hip position cascades from
  body.world.rot, so hips stay at body-frame left/right regardless of
  body rotation. lower_control virtual bone removed (no longer needed).
- Procedural 'leg_orientation' sets leg.local.rot = walk_dir - body.rot
  each frame, so leg.world.rot = walk_dir (independent of body cascade).
  Requires puppet v0.4.2 per-channel write_bone (walk_anim writes leg.scl
  while procedural writes leg.rot — disjoint channels).

Result: legs visually attach at body's anatomical left/right hips no
matter where body faces; stride oscillation aligns with WASD walk
direction. Hip position no longer drifts with walk direction.
2026-05-18 21:57:20 +02:00
Axel Meyer
0a7ef7f270 fix(vagrant): legs rotate to walk direction (user preference)
User feedback: 'Beine sollten in die richtung oszillieren, in die
gegangen wird, nicht nach norden/süden relativ zum fenster.'

Old: lower_control.rot = wedge_deg (substrate's body-relative ±30°
sub-angle), legs always oscillated near world-up axis.

New: lower_control.rot = atan(move_x, -move_y) = walk direction in
sprite-top-up convention. Legs visually rotate to align with WASD
direction → stride animation cycles along the walk axis.

Side-effect: 4-direction-anim picker collapsed to single
walk_fwd_lower (the rotation handles directional differentiation;
4 anims kept on disk for later gait-style work). Bumps puppet dep
to 0.4.1 (head south-flick fix).
2026-05-18 21:48:10 +02:00
Axel Meyer
3f176f6105 fix(vagrant): remove head sprite_rot + invert signed-angle cross-sign
Two fixes from manual interactive verification after iteration-3:

1. Head 90° CCW off → removed sprite_rot=-90 from head bone. The
   v0.3.3 sprite_rot fix was based on misobservation: at that point
   the persistent-state-rate-limit bug was active and head was
   wiggling within ±10° of an arbitrary initial direction, perceived
   as 90° CW off. With v0.3.2+ persistent-state fix and v0.4.0 slerp,
   head rotates correctly when sprite-natural-face is -Y (matching
   body-sprite convention).

2. Legs walked in inverted sector → signed_angle_2d cross-component
   was using Y-up math convention but Sporel screen-coords are Y-down.
   With Y-down, what's CCW in math is CW visually. Flipping the cross
   sign aligns sector selection: body up + player walks right → CW
   visually → walk_right_lower (was wrongly returning walk_left).

Front/back leg-anchor issue (#3 from user report) deferred — likely an
optical-overlap artifact from rotated body sprite + world-frame leg
positions, will reassess after #1+#2 fixes are visually verified.
2026-05-18 21:38:43 +02:00
Axel Meyer
794287fd10 feat(vagrant-skeleton): Subterrain-style lower-body control model
Add lower_control virtual bone (reparents legs for independent orientation).
Update look_at fields: body uses "soft" target with slerp=6, head uses
"aim" target with instant snap and ±60° clamp. Rename walk.anim.json to
walk_fwd_lower.anim.json and add walk_back_lower, walk_left_lower,
walk_right_lower anims ported from substrate. Port HandleAnimationLower:
signed-angle sector selection (±45°/±135°) drives 4-directional walk anim
choice; wedge clamp sets lower_control rotation. Separate aim/soft look
targets both track raw mouse for now.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-18 21:19:08 +02:00
Axel Meyer
60afa48976 fix(vagrant): wrap world rendering in camera.begin/finish
Map + furniture + puppet now render via the 2D camera so the camera
target (= puppet position) appears at screen-center. Without the wrap,
world rendering happened in raw window-coords: puppet at world (320,240)
appeared at screen upper-left, mouse-screen-to-world math was correct
but mouse cursor over the visible puppet computed dx/dy from puppet's
world position to mouse_world which was OFF-by-(w/2,h/2). Visual result:
head pointed in wrong direction relative to actual mouse position.

Spine-prototype already used this pattern (init.lua:128). Aligning
vagrant-skeleton with that convention.
2026-05-18 20:26:45 +02:00
Axel Meyer
9de4924706 exp(vagrant): try procedural lower-body, drop WASD-to-root coupling
- humanoid.rig.json: removed locomotion-block (apply_locomotion no-ops
  now). head: removed look_at_speed (instant snap). body: unchanged
  (look_at_speed=180 lazy).
- init.lua: removed set_procedural("facing", ...) — root stays at
  rest.rot=0. walk.anim + idle_lower.anim no longer loaded/played
  (files retained on disk for revert). New set_procedural("walk_cycle",
  ...) drives legs per-frame: walk_phase advances at 1.25Hz, sin-cycle
  on leg.scl, walk_dir applied to leg.rot. Idle: legs scl=0.
- Lazy body + instant head + head-leading: head responds immediately
  to mouse, body lags via look_at_speed=180.

This is an experiment. If procedural feels worse, revert by re-enabling
walk.anim + idle_lower.anim + locomotion-block.
2026-05-18 20:13:44 +02:00
Axel Meyer
03a536984d fix(vagrant): iteration — body+head look-at, WASD-driven leg-facing, idle-collapse
- humanoid.rig.json: root removed from upper track; body look_at + slow speed
  (180 deg/s, lazy); head fast speed (480 deg/s) + +-90 deg limits; puppet
  dep bumped to 0.3.1
- animations/idle_lower.anim.json (NEW): leg+foot scl=[mirror, 0] keeps legs
  invisible at idle (locomotion skips animated bones; foot cascade zeros out)
- init.lua: set_procedural 'facing' callback writes root.rot from
  last_walk_rot_deg each frame; WASD-vector updates last_walk_rot_deg
  via atan(dx, -dy); idle_lower played parallel to idle, stopped during walk

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-18 19:51:56 +02:00
Axel Meyer
fa511204c2 feat(vagrant): v0.3.0 — substrate-port rig + animations + locomotion
- humanoid.rig.json rewrite: legs->root, rest.rot+rest.scl on all bones,
  Y-mirror via scl=-1 on leg_l/r/foot_l/r, locomotion-block with
  procedural footplant config
- walk.anim.json: substrate walk_fwd_lower port; track=lower; pos+scl
  channels on legs+feet
- walk_upper.anim.json (NEW): substrate walk_upper port; arm-swing
- idle.anim.json: substrate idle_upper port; pos+rot on shoulders+arms
- init.lua: walk_upper parallel-play wiring
- manifest bump v0.2->v0.3; puppet dep ^0.3.0
2026-05-18 18:55:34 +02:00
Axel Meyer
3457a7eab8 feat: sprite-mode test-chamber with 13-bone puppet + sprite-tilemap
13-bone humanoid rig (12 visible bones + 1 root) hand-ported from
substrate reference, mapped to PROTOTYPE asset-pack via asset_aliases
indirection (asset_pack: player). Bones use texture/z_order/scale/
anchor fields from the rig-format extension. Tracks split: lower for
legs + feet (walk animation), upper for root/body/head/shoulders/arms
(idle animation).

Animations:
- idle.anim.json: 2.0s loop on upper track, subtle body+head sway
- walk.anim.json: 0.6s loop on lower track, legs+feet cycle

Sprite-tilemap: 4-tile palette (floor_001-003 walkable, floor_004
as wall). Map content: 20x20 with wall-border and interior wall
blocks. tile_rotations parallel array exercises 90 and 180-degree
rotations on a handful of cells for visual rotation-pipeline
verification.

init.lua loads textures via asset_aliases lookup:
- maps.load_textures(aliases) resolves tilemap-tile atlas-ids
- puppet.load_rig(path, aliases) loads + resolves bone textures
- furniture textures preloaded at init (bed, bench, backpack) to
  avoid first-frame load stutter; rendered via engine.render.
  draw_sprite_transform in the draw hook

Camera follows puppet via per-frame camera.set_target. Headtrack:
head bone (look_at: true) rotates to face mouse world-position.

New SPOREL_CI=1 traces from render and init hooks:
- vagrant: render_frame_ok (per frame from render)
- vagrant: sprite_mode=on (once after first sprite-draw)
- vagrant: assets_loaded=14 (once after init: 7 puppet + 4 tile + 3 furniture)
2026-05-18 03:29:54 +02:00
Axel Meyer
f7b38d984e feat: add CI-hooks for render-hook + state-transition smoke
Two env-var-gated hooks (no-op in normal play):
- SPOREL_CI=1: emits 'vagrant: render_frame_ok' per frame from
  render() and 'vagrant: frame_avg_ms=N' after 60 frames.
- SPOREL_VAGRANT_PHASE1_DRIVE=1: scripted move-right input on
  frames 21-40, idle otherwise. Combined with SPOREL_CI=1 produces
  observable idle -> walk -> idle state cycle.

State-transition trace 'vagrant: state=<walk|idle>' emits exactly
once per actual change in set_walk_or_idle, so the smoke greps
don't get noise from per-frame repeats.

Fix camera.set_target_provider (absent from camera API) to use
camera.set_target(x, y) called per frame from M.update instead.
2026-05-17 20:30:48 +02:00
Axel Meyer
2817613490 feat: initial implementation v0.1.0 — single player puppet + WASD + map
Composer module: single-player character as puppet (humanoid 4-bone
rig: torso, head, leg_l, leg_r) at world (320, 240) on a 20x20
v0.1-format tilemap.

- WASD direct movement, normalized for diagonals, 120 px/s.
- Camera-chase via lib-core.camera target-provider (camera follows
  puppet position frame-to-frame).
- Idle and walk keyframe animations: idle is a 2s torso-sway on the
  upper track; walk is a 0.6s leg-cycle on the lower track.
- Animation-state transitions driven by movement input: walk while
  WASD-active, idle when released.
- Headtrack: head bone (marked look_at: true in rig) rotates each
  frame to face the mouse cursor's world position via
  puppet.set_look_target.
- ESC -> launcher.

CI hooks (env-var-gated, no-op in normal play):
- SPOREL_CI=1: emits 'vagrant: frame_avg_ms=N' after 60 frames and
  'vagrant: render_frame_ok' per frame from the render hook, then
  engine.exit(0). Smoke stages consume these markers.
2026-05-17 20:21:31 +02:00