Pawn mover: walk waypoints at a configurable speed #93
No reviewers
Labels
No labels
assets
bug
duplicate
enhancement
help wanted
invalid
question
testing
ui
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
liamjd/UntitledColonyBuilder!93
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "80-pawn-mover-walks-waypoints"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #80
Turns a
find_path()result into a capsule crossing the map. The record holds state; the view holds the walk.What is here
PawnView—follow(),stop(),remaining_path(), and a_process()that spends a per-frame distance budget across as many waypoints as it reaches, so a fast pawn is not capped at one tile per frame. Faces its direction of travel on Y only. Emitscell_enteredper waypoint andarrivedonce at the end.Pawns.move_to()/Pawns.stop()— a facade so the record and the view cannot drift:stateflips and the walk starts in one place, rather than every caller remembering to do both around a bareview.follow().cellandstatefollow the view's signals.tools/probe_pawn_terrace.gd— the headed visual check, see below.Two units of measure carry most of the risk and both are covered:
speedis in tiles per second while positions are world units (tile_sizeis 2.0, not 1.0), and Y is resampled from the terrain every frame rather than interpolated between waypoints — an interpolated Y passes straight through a riser.Verification
Unit tests: 332 tests, 331 passing, 1 pre-existing pending (
test_task_tree, tracked as #85). 18 new tests intest_pawn_view.gdplus additions totest_pawns.gd. Each drives the mover with explicit_process(delta)calls rather than awaiting frames, so "known delta → known distance" is exact arithmetic.Headed visual check: done, via a probe rather than in the game scene. There is no in-game way to command a pawn yet — #78 owns selection and #81 owns the right-click move — so the AC could not be met the obvious way.
tools/probe_pawn_terrace.gdbuilds a staircase (up three terraces, down two), walks a pawn across it, and drops a marker every 0.2s. A single frame cannot tell riding a terrace apart from cutting through it; a trail can.Findings:
surface_y(level) + pawn_height / 2— 1.50 → 2.30 → 2.80 → 3.30 → 3.80 and back down, never an intermediate value.find_pathreturned 13 waypoints for the 12-tile crossing, somax_step_levels = 1permits the climb rather than treating each terrace as a cliff. Worth proving rather than assuming.arrivedfired exactly once, and the probe loop exited on it rather than on its step cap.Images land in
tmp/(gitignored):probe_pawn_terrace_trail.pngside-on,probe_pawn_terrace_angled.pngfrom the game's own camera angle as a sanity check that the pawn is where the side-on view claims.Left undone
The vertical step is instantaneous — the pawn's Y jumps a full
level_heightin the single frame its XZ crosses the tile boundary, with no intermediate sample on any riser. That is what_move_to_ground()is written to do and what the unit test asserts, and it is the correct model: the pawn is on one terrace or the other, never halfway up a cliff face. But in motion it will read as a teleport, and at the boundary frame the capsule's lower half briefly clips the riser corner.Filed as #92 rather than fixed here, because the obvious fix breaks
test_height_steps_with_the_terrain_instead_of_ramping_between_waypointson purpose — smoothing belongs in a presentation layer that lags the authoritative Y, and that wants its own decision about hop-vs-ease and whether it generalises to vehicles later.The probe is kept rather than deleted, matching
tools/screenshot_buildings.gdand friends.🤖 Generated with Claude Code
https://claude.ai/code/session_012V5CmAgcjna6fBrgZebqjZ