Engineering

The guaranteed line: making an endless game hard without making it unfair

An endless game gets harder until you lose. That is the entire form. The interesting question is what the player thinks in the half-second after they lose — I misjudged that, or there was nothing I could have done.

Only one of those brings them back. And the difference between them is not skill or tuning. It is whether the obstacle field they just died in actually contained a route they could have taken.

Generate the path, then the danger

Both of the one-button games on this site use the same construction, and it is the single most transferable idea I have to offer.

A hidden line is laid down before a single obstacle exists. In the flying game it is a corridor: a wandering centreline through the sky, sampled at intervals, with a height around it. In the wall-jumping game it is a chain of landing points — alternating walls, each exactly one jump's climb above the last, each offset sideways by a random amount within reach.

Then the band around that line is marked protected, and the hazards are filled into whatever is left. A cloud that would intrude on the corridor is rejected and re-rolled. A spike that would sit in a landing band or the approach above it is never placed.

The result is a field with a clean route through it by construction. Not by testing, not by tuning, not by a heuristic that usually works. The generator is structurally incapable of producing a wall you have to die on, because the route existed before the walls did and the walls were never allowed to touch it.

This inverts the usual approach, which is to scatter obstacles and then check whether the result is survivable — with some pathfinding pass, or a simulation, or a rule of thumb about spacing. That works right up until it doesn't, and when it fails it fails silently, on somebody else's run, in a way you will never reproduce.

Checking the whole extent, not the middle

One implementation detail that took a second attempt to get right, and generalises well beyond games.

The naive check asks whether an obstacle's centre is clear of the corridor. That is wrong whenever the corridor is sloping, because a wide obstacle can have its centre comfortably outside the lane while one of its edges reaches into the lane further along. The centre is clear; the shape is not.

So every candidate obstacle is checked across its entire horizontal extent, sampling the corridor at each point it spans. It is more work per candidate and it is the difference between a guarantee and a near-guarantee. A near-guarantee is worth almost nothing here, because the one run in two hundred where it fails is exactly the run where a player concludes the game cheats.

Difficulty ramps by narrowing, never by blocking

If the route is guaranteed, where does the difficulty come from?

From narrowing it. The corridor gets tighter as the run goes on and the cloud cover gets denser around it. In the wall game, the shaft gets narrower — and because horizontal flight speed is fixed, a narrower shaft means a shorter flight: the same climb with less time in the air, so the timing window tightens. The difficulty ramp does its work through the physics rather than through a multiplier bolted on the side.

Notice what stays constant. The route never disappears. Your margin for error shrinks toward zero, and at some point your reaction time is no longer good enough for the margin you have left, and you die. That death is legible: it happened because the gap was small and you were late, and both of those are facts you observed.

The other rule that follows: every knob has a floor, and the floor is a value the game is still playable at. Corridor height ramps from a starting value toward a minimum and never below it. The temptation is to let a difficulty parameter drift toward zero on a curve, on the reasoning that nobody survives that long anyway. Somebody always survives that long, and when they do they meet a game that has quietly become impossible rather than merely brutal. The third value of every knob is the cap, so the ramp cannot silently steepen past the point where the guaranteed lane stops being flyable.

A guarantee is not a rail

The corridor is not a track. The clouds outside it are real, the spikes outside the landing bands are real, and you can absolutely fly into any of them. Nothing steers you.

The promise is narrow and precise: a line exists that you could have flown. It is not marked, and finding it is the game.

That narrowness matters, because the obvious over-correction is to make the safe route obvious, at which point there is no game left — just a rail with decoration. The guarantee is a promise about the space, not about the player's performance in it. It survives your mistakes: get badly out of position and the route is still there, further away, and recovering to it is a thing you can attempt.

Fairness at the edges

Two smaller decisions do a disproportionate amount of work on how fair a death feels.

The hitbox is smaller than the drawing. In the wall-jumping game the collision circle is meaningfully smaller than the ninja as drawn. Every near-miss that looks like a graze is a clean pass. This is standard practice in arcade games and it is standard for a good reason: players judge collisions visually and generously, and matching their generosity costs nothing while matching the sprite exactly produces a steady drip of deaths that look wrong.

There is never a hidden second question. In the wall game, "which wall do I jump to" is never a decision — it is always the other one. The only input is when. A game with one input can afford to be merciless about timing precisely because it has removed every other source of doubt; a death is unambiguously about the moment you tapped, which is the only thing the game ever asked you about.

Why this matters beyond arcade games

The same principle governs the trail-survival game on this site, in a different costume. Its rule is that no single card, however bad the weather, may end a run that started the day healthy. Danger accumulates; it never ambushes. That is the guaranteed line, in a game with no obstacles at all — a promise that a well-played run is never lost to one draw.

The underlying claim is the same in both cases: a game may be as hard as it likes, provided the player can always locate the mistake. Difficulty is not the enemy of fairness. Opacity is. What players will not forgive is not losing; it is losing without learning anything, and the way to prevent that is to make sure there was, always, something there to be learned.