Skip to content

LD60: either controller plays, and the cameras follow a moment behind like the prototype's - #182

Merged
alecu merged 3 commits into
mainfrom
ld60-either-controller-and-tunnel-camera
Oct 30, 2026
Merged

alecu merged 3 commits into
mainfrom
ld60-either-controller-and-tunnel-camera

Conversation

@alecu

@alecu alecu commented Oct 30, 2026 •

Copy link
Copy Markdown
Collaborator

Two follow-ups to the LD60 Circular Arcade games (after #181).

Either controller plays all five games

The games are one-player, but they only read joy1. Anyone holding the second controller, or using the WASD half of the emulator's keyboard, couldn't even get past the title screen. Each game now reads its stick and buttons through held()/pressed(), which accept either controller. That covers A on the title and end screens too. It's the same joy1 … or joy2 … pattern the dream garden demo uses.

The cameras follow a moment behind, as in the prototype

In the prototype you move at once and the view eases after you. Here the camera was pinned to the player.

  • Around the disc (all five games): the prototype turns its view by a share of the gap that grows with the gap: 4% of it per hundredth of a turn, each 60 fps frame. A gap of a twentieth of a turn or more is jumped. The ports turn by 1/36 of the gap per column of it per 30 ms tick, which is the same speed. A moving player is drawn about 5 columns ahead of the top, a little more at full speed. When you stop, the view drifts back onto you.
  • In and out (Spiral Tunnel, Catch the Robots, Rim Runner): these are the levels the prototype scrolls that way, because they're taller than its screen. Its scroll closes 7% of the gap each frame; the ports close 12% per tick. Dodge 'Em and Defender fit on screen in the prototype too, so they only lag around the disc.
  • Dodge 'Em's crash explosion now stays where the crash happened instead of on a fixed spot on screen, since the camera keeps moving after the crash.

Tests

  • Second controller: the headless test harness now has one. Each game is played twice from the same seed, once on each controller, and must end in exactly the same state. A from joy2 must also restart from the end screen. This test fails on the old code for all five games.
  • Around the disc: every game must draw the player 3 to 12.8 columns ahead while going around. In the three where you can stop, the camera must come back onto the player afterwards. In Spiral Tunnel and Dodge 'Em, faster must mean further ahead. Those checks average over ten ticks, because the camera snaps to whole columns.
  • In and out: Spiral Tunnel steering, running down the maze, and a Rim Runner jump each show the player drawn off its usual depth while the view catches up.
  • Existing tests: the ones that moved the player instantly now wait for the camera to catch up.
  • Suite and build: tests/run_tests.py passes and mpy-cross compiles all five games. The menu icons are unchanged.
  • Web emulator: each game was played briefly. joy2 starts and restarts games, and nothing shows a MicroPython error.

🤖 Generated with Claude Code

alecu and others added 3 commits October 30, 2026 12:00
All five are one-player games, but they only read joy1, so whoever picked
up the second controller (or the WASD half of the emulator's keyboard) got
nothing, not even past the title screen. Each game now reads its stick and
buttons through held()/pressed(), which take either controller, the same
"joy1 or joy2" idiom the dream garden demo uses.

The test harness gains a second controller on the headless comms, and every
game is played twice from one seed, once on each controller, to check that
the second one moves the world exactly as the first and starts a new game
from the end screen.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
In the prototype, steering in or out moves the ship at once and the view
scrolls after it a moment later; here the camera was pinned to the ship, so
the tunnel jerked with every press. The prototype's scroll closes 7% of the
gap to its target each 60 fps frame (its momentum term resets whenever the
camera heads for the target, so in play it is that plain ease); 12% per
30 ms tick is the same pace. While you steer, the ship is drawn about a tile
off its usual depth, and it settles back when you let go.

Only the depth eases. Round the disc the camera still turns exactly with the
ship.

The camera tests teleport the ship, so they now clear the walls and UFOs and
let the camera catch up instead of expecting it there on the next tick.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The prototype eases its view after the player in every level. Round the
disc it turns by a share of the gap that grows with the gap (4% of it per
hundredth of a turn, each 60 fps frame), so a moving player is drawn a few
columns ahead of the top and the view drifts back onto them when they stop;
a gap of a twentieth of a turn or more is jumped. In and out it scrolls
only the levels taller than the screen: the tunnel, the maze and Rim
Runner, at 7% of the gap a frame.

All five ports now turn the same way: TURN_FOLLOW = 1/36 of the gap per
column of it, per 30 ms tick, which is the prototype's pace. That's about 5
columns ahead at cruising speed, a column more flat out in Spiral Tunnel and
Dodge 'Em. Catch the Robots and Rim Runner also ease in and out at 12% a
tick, like Spiral Tunnel already did. Dodge 'Em and Defender fit on screen in
the prototype too, so they only turn. Dodge 'Em's crash explosion now keeps
its place in the world, since the camera keeps moving after the crash.

Every game's tests now check that the player is drawn 3 to 12.8 columns
ahead while going round. In the three games where you can stop, they also
check that the camera comes back onto the player. Spiral Tunnel and Dodge
'Em check that faster means further ahead, averaging over ten ticks because
the camera sits on whole columns. Catch the Robots and Rim Runner check the
in/out lag. The tests that moved the player instantly now wait for the
camera to catch up.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@alecu alecu changed the title LD60: either controller plays, and Spiral Tunnel's camera eases after the ship LD60: either controller plays, and the cameras follow a moment behind like the prototype's Oct 30, 2026
@alecu
alecu merged commit 57b4044 into main Oct 30, 2026
4 checks passed
@alecu
alecu deleted the ld60-either-controller-and-tunnel-camera branch October 30, 2026 16:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant