An endless runner looks like a character running forward through a world. Mechanically it is the opposite: the character holds a fixed screen position and a world coordinate advances beneath them.

The scrolling model

Every frame, a worldX value increases by the current speed times delta time. Everything in the level is stored at world coordinates, and drawing converts them to screen coordinates by subtracting worldX.

The character sits at roughly 20% of the screen width, which is a deliberate choice: it leaves 80% of the view ahead for reading upcoming obstacles, and enough behind to see what you just cleared.

The advantages of this model are practical. Collision only ever needs to consider entities near the screen, floating-point precision never degrades because the character's position stays small, and the camera requires no logic at all.

Chunk streaming

The track is generated ahead of the player in sections. The rule is to keep generating while the generator's cursor is less than about 2.2 screen widths ahead of the current world position.

That distance is chosen to balance two costs. Too little lookahead and content pops into existence visibly; too much and you are holding and updating entities that will not be relevant for several seconds.

Culling happens at the other end: anything whose right edge is more than 200 units behind the player is discarded. Without culling, a five-minute run accumulates thousands of dead entities and the frame time climbs steadily.

Gaps and the floor

The ground is drawn as a continuous surface and gaps are cut out of it, which is the reverse of how it might seem. A gap is stored as a world-coordinate range, and two things happen with it:

  • The renderer draws a dark pit over the ground in that range, with highlight edges so the boundaries are unmistakable.
  • The physics checks whether the character's centre is inside any gap range; if it is, the ground collision is skipped and the character falls.

Gap width is computed from the character's actual jump reach — speed × 2 × jumpSpeed / gravity — at 62% of that maximum. The 38% margin covers imperfect timing and the coyote-time window.

Jumping and ducking

Vertical movement uses the shared jump controller: coyote time of 110 milliseconds, jump buffering of 120 milliseconds, and variable height through releasing the key early.

Ducking shrinks the character's collision box to 60% of its full height and moves it down so the feet stay on the ground. That is the entire implementation, and it is enough to clear hanging hazards.

One detail that matters: the shrink happens instantly but the visual transition does not, which means a player who ducks very late is protected slightly before it looks like they are. That is a deliberate forgiveness, matching the same philosophy as coyote time.

Distance scoring

Distance is derived from worldX divided by a constant — 24 in most games — to produce a figure in metres. It accumulates automatically and is paid out in small increments: 5 to 9 points per 240 world units depending on the game.

Those payments are deliberately unmultiplied. Distance is a consolation reward for surviving, and making it multiplied would mean that simply travelling far outscored collecting well, which would teach the wrong lesson.

Food Jump Challenge pays the highest rate at 9 points per 240 units, acknowledging that travelling far at 360 units per second on Expert is genuinely difficult.

What changes between the runners

All eight runners on this site share the loop above. What differs is configuration and a single per-game mechanic.

GameBase speedGrowthIts twist
Ice Cream Run2850.70Melt meter
Donut Run3100.85Sugar rush
Burger Rush3200.90Ingredient build order
Rolling Pizza Quest3300.85Speed/jump tuck trade
Food Monster Escape3450.80Pursuer
Pizza Dash3501.00Delivery window
Food Jump Challenge3600.55Precision landings
Sushi Sprint3900.75Focus window

Note that the fastest game has a below-average growth factor and the precision game has the lowest of all. A game that starts fast does not need to accelerate hard, and a game about accuracy should not accelerate much at all.

Try it yourself: Burger Rush

Sprint the burger line, grab ingredients in order and complete whole burgers for huge bonuses.

Play Burger Rush

Key takeaways

  • The character holds a fixed screen position at about 20% width; a world coordinate advances beneath them.
  • Chunks are generated about 2.2 screen widths ahead and culled 200 units behind, or frame time climbs over a long run.
  • Gaps are cut out of a continuous ground surface and sized at 62% of the character's real jump reach.
  • Ducking shrinks the collision box to 60% height instantly, slightly before the animation shows it.
  • Distance pays 5–9 points per 240 units, unmultiplied, so travelling far never outscores collecting well.
  • All eight runners share one loop; base speed, growth factor and a single per-game mechanic are what differ.

Frequently Asked Questions

Does the character actually move forward in a runner?

No. The character holds a fixed screen position at about 20% of the width, and a world coordinate advances beneath them. Everything in the level is stored in world coordinates and converted for drawing.

How far ahead is the track generated?

About 2.2 screen widths. Less and content visibly pops in; more and you are updating entities that will not matter for several seconds.

How are gaps made jumpable?

Gap width is computed from the character's real jump reach at the current speed and set to 62% of it. The remaining margin covers imperfect timing and the coyote-time window.

Why does distance pay so few points?

Because it is a consolation reward for surviving and is deliberately unmultiplied. If distance were multiplied, travelling far would outscore collecting well, which teaches the wrong lesson.

Why does the fastest runner not accelerate the most?

Because a game that starts fast does not need a steep ramp. Sushi Sprint starts at 390 units per second with a growth factor of 0.75, while Food Jump Challenge uses 0.55 because accuracy should not be eroded by speed.