Skip to content

[9/16] feat: follow the hero with directional camera lead - #131

Merged
arudaev merged 4 commits into
feature/30-platforms-and-laddersfrom
feature/32-camera-follow
Oct 24, 2026
Merged

arudaev merged 4 commits into
feature/30-platforms-and-laddersfrom
feature/32-camera-follow

Conversation

@Vatsal2005

@Vatsal2005 Vatsal2005 commented Oct 23, 2026 •

Copy link
Copy Markdown
Collaborator

What and why

The camera now follows the hero with up to 120px of directional look-ahead and smooth vertical follow. It clamps to the full four-direction chunk grid, retains fractional smoothing internally and sends only integer coordinates to Phaser. The renderer keeps the stage manifest's authored parallax factors and list order. Development inspection mode retains manual panning for annotation review.

Issue

Closes #32
Refs #29

Stack

Base: feature/30-platforms-and-ladders. Human merges bottom up; retarget the next PR to main and merge origin/main into every open branch, never rebase.

Acceptance criteria

  • Directional look-ahead and smooth vertical follow
  • Every layer retains its authored scroll factor from the accepted export contract
  • Chunk-grid bounds and whole-pixel camera output

Verification

  • Node 22: npm run typecheck, npm test (81 tests), npm run build; includes main integration at e8577ab
  • py -3.13 scripts/check_docs.py — 614 files
  • git diff --cached --check
  • Camera tests: lead reversal, vertical smoothing, frame-rate independence, four-direction bounds, negative chunks and integer output
  • Browser: anomaly route's first ladders and 39.3-degree slope, walk/run reversal and first chunk seam; the seam fix is in lower PR [7/16] feat: follow ground slopes and slide downhill #125 and merged upward
  • Browser: crossed all three clean chunks to x=6458 and the right wall; camera clamps at the end, parallax remains continuous, no console errors
  • Full anomaly route and manual 2× display review remain; current desktop viewport also exercised fractional fit, and existing viewport tests cover integer 1×/2× scaling
  • Physical gamepad and Vercel preview: Vatsal2005 needs Vercel project access to create deployments

Contract note

docs/13 and #110 require the exported list order and scroll values. The current Creek export uses distance 0.2, near rails 1.1 and foliage 1.15, whereas docs/04 gives general layer roles from 0.1 to 1.2. This change follows the actual export; changing those art values belongs in lane A's config.

Screenshots

Captured in ignored tmp/verification/32-slope.png, 32-seam.png, 32-clean-end.png and shown in chat. The full clean traversal also confirms both authored chunk boundaries in the running game.

Ease toward a speed-based horizontal lead and the player feet vertically, while clamping to the complete chunk grid. Retain precise smoothing state but render the camera on whole pixels.

Reuse grid bounds in the stage renderer and preserve the accepted export parallax values. Keep manual panning available in development inspection mode.
@vercel

vercel Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
wincs Error Error Oct 24, 2026 12:30am UTC

Request Review

@Vatsal2005 Vatsal2005 self-assigned this Oct 23, 2026
@Vatsal2005
Vatsal2005 requested a review from arudaev October 23, 2026 22:20
@vercel

vercel Bot commented Oct 23, 2026

Copy link
Copy Markdown

@Vatsal2005 must be a member of the arudaev's projects team on Vercel to deploy.
- Click here to add @Vatsal2005 to the team.
- If you initiated this build, request access.
- If you're already a member of the arudaev's projects team, make sure that your Vercel account is connected to your GitHub account.

Learn more about collaboration on Vercel and other options here.

@arudaev

arudaev commented Oct 23, 2026

Copy link
Copy Markdown
Member

Lane A review: the stack is merge-ready except one gap – the hero never plays its approved idle/walk/run clips on the ground. Details and the requested change on #122. Merge order once fixed: #111 → #116 → #120 → #122 → #123 → #125 → #126 → #131.

@arudaev

arudaev commented Oct 23, 2026

Copy link
Copy Markdown
Member

Next, after the animation fix – lane A's story work (#50, #51, #52, #54, #56, #58) needs two hooks from lane B, as contracts in core/events.ts / stage/:

  1. Trigger events. When the hero's body enters/leaves a collision trigger box (docs/13 annotation layer), emit 'trigger-entered' / 'trigger-left' with { id, region, chunk, position }. Story listens (pond crossing [M3-S4] The crossing: damage sprite, THD.exe window, landing #51, coffee machine [M4-S4] Dexter waits at the coffee machine with the pocket computer #52, Jenny's bridge [M4-S1] Jenny rams you on the bridge and the creek turns #54, ending [M4-S7] Dexter absorbs Jenny and the slice ends #58).
  2. Region swap. A call the story can make, e.g. swapRegion(scene, { region, state, spawn? }), that reloads stage + collision for another region/state and places the hero (the crossing lands you in Rusty Creek; Jenny's ram turns the creek clean → anomaly, [M4-S1] Jenny rams you on the bridge and the creek turns #54), then emits region-turned. Today Preload only reads ?region=&state= from the URL.

Plus Player exposing its body position read-only (it does: player.body) is enough for camera-relative story beats. A short Vitest per hook, like the others. Thanks – the rest of the stack looks good.

@Vatsal2005 Vatsal2005 changed the title [9/9] feat: follow the hero with directional camera lead [9/10] feat: follow the hero with directional camera lead Oct 23, 2026
Carry human-merged lane A changes upward without rewriting published commits.
@Vatsal2005 Vatsal2005 changed the title [9/10] feat: follow the hero with directional camera lead [9/11] feat: follow the hero with directional camera lead Oct 23, 2026
@arudaev
arudaev added this pull request to stack #129 October 23, 2026 22:53
Carry human-merged lane A changes upward without rewriting published commits.
@Vatsal2005 Vatsal2005 changed the title [9/11] feat: follow the hero with directional camera lead [9/12] feat: follow the hero with directional camera lead Oct 23, 2026
@Vatsal2005 Vatsal2005 changed the title [9/12] feat: follow the hero with directional camera lead [9/13] feat: follow the hero with directional camera lead Oct 23, 2026
@Vatsal2005 Vatsal2005 changed the title [9/13] feat: follow the hero with directional camera lead [9/14] feat: follow the hero with directional camera lead Oct 23, 2026
@Vatsal2005 Vatsal2005 changed the title [9/14] feat: follow the hero with directional camera lead [9/15] feat: follow the hero with directional camera lead Oct 24, 2026
@Vatsal2005 Vatsal2005 changed the title [9/15] feat: follow the hero with directional camera lead [9/16] feat: follow the hero with directional camera lead Oct 24, 2026
Carry human-merged lane A changes upward without rewriting published commits.
@arudaev
arudaev marked this pull request as ready for review October 24, 2026 01:34
@arudaev
arudaev merged commit 2cb1f6d into main Oct 24, 2026
7 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:stage Chunks, layers, collision, clean/anomaly states

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[M1-S5] Camera follows with parallax layers

2 participants