TinyGames · how it works

Retroburn

Land the craft. Under 2 m/s straight down, under 1.2 m/s sideways, near enough upright, and on one of the three pads. The narrow pad is worth five times the wide one.

Open index.html. No build step, no dependencies, no images.

retroburn/
  index.html       markup
  style.css        the frame around the canvas
  js/engine.js     copied unchanged from Overdrive - the fifteenth game on it
  js/lander.js     the physics, the ground and the verdict
                   - no pixels, no engine, no DOM
  js/retroburn.js  the playable layer
  test-lander.js   node test-lander.js

The integrator is a rule of the game

This game is decided by one number: the speed at touchdown. That makes the physics step a gameplay rule rather than an implementation detail, and it makes the commonest shortcut a genuine bug:

v += a * dt;
y += v * dt;          // wrong

For constant acceleration the true answer carries a half-term, y += v*dt + a*dt*dt/2, and the missing piece is proportional to dt.

The subtle part is which quantity goes wrong. The shortcut's velocity is exact — v += a*dt is right for constant acceleration — so a craft flown with it falls at all the correct speeds. What drifts is its position. It therefore meets the ground at the wrong point in the fall, and touches down carrying the speed that belonged to some other moment.

$ node test-lander.js
100 passed, 0 failed

The headline test drops the craft for four seconds at 15, 30, 60, 144, 240 and 1000 steps a second and compares against the closed-form answer. Every rate agrees to 1e-15 metres. The shortcut, on the same descent, ends up 27 mm apart between 30 Hz and 240 Hz — which works out at 0.022 m/s on a limit of 2.0, and grows with the length of the fall. A player moving from a desktop to a phone would find the game had quietly changed its mind about what counts as a safe landing.

A test that measured the wrong thing

The first version of that test flew until the craft passed a height and compared touchdown speeds. It reported both integrators as equally wrong — because the loop only checks between steps, so it overshoots by an amount that depends on dt, and that quantisation swamped the effect for both. Both came out at 0.007 m/s and the test proved nothing.

The fix was to measure the thing that is actually measurable — position after a fixed duration — and derive the cost arithmetically. It is in the file with the reasoning attached, because "my harness was the frame-rate-dependent part" is the easiest possible mistake to make when testing frame-rate dependence.


Two bugs worth recording

The craft could only be flown by a person. Keyboard and touch are both polled, so each frame overwrote the thrust flag — meaning nothing else could ever set it. The symptom was an autopilot that burned exactly zero fuel while insisting it was thrusting. There is now a third control channel, and the game reads keys, then fingers, then autopilot. It is not test scaffolding bolted on: a game whose controls can only come from hardware cannot have an attract mode either.

Pads were not always level. They were scattered at random with a retry on overlap, and when the retry gave up, flattening the second pad reached into the first and left it sloped. A pad that is not level is not a pad. It showed up on about one surface in sixty — the test generates sixty and checks every pad on every one. They are now placed one per slot, disjoint by construction.


Fuel

A clean autopilot descent uses about 53 units. The tank started at 520, which meant fuel was never a decision — you could hover indefinitely and still land. It is 240 now: a tidy descent still lands with three-quarters left, while dithering over which pad to take starts to cost something.

A crude autopilot lands 14 times in 25 at these settings, which is about the right shape: losing is normal, and the losses are precision, not fuel.


Reading the instruments

The three numbers that decide the game are on screen, and each turns red the moment it is outside the limit. A player should never have to remember what the threshold was — the readout tells them whether they are inside it right now.

When you crash, every fault is listed, not just the first. "Too fast" and "also sideways and tilted" are three different lessons, and a player told one at a time takes three goes to learn all three.


Controls

rotate
/ Space burn
R new flight

On a touch screen the two rotate pads and the burn pad track pointers individually, so you can rotate and burn at once. Rotating while burning is the entire skill; a single-touch scheme would make the game unplayable on a phone for a reason that has nothing to do with the game.


Scoring

250 for arriving in one piece, plus up to 350 for how gently, up to 150 for how level, and 4 a unit of spare fuel — all multiplied by the pad. Land, refuel, and a new site is generated. Three craft.


Things deliberately left undone