Spielerando

Make an Endless Runner With AI That Never Feels Unfair

An endless runner moves you forward by itself while you dodge, until you fail and try again, so the whole game is one button and a challenge that keeps climbing. Build your obstacles as small hand-made blocks that the game joins at random, because pure randomness creates jumps nobody can make.

What makes "endless" hard?

You cannot design what you never reach. In a normal level you place every gap by hand. Here the game has to produce fair challenges forever, at speeds you never tried while building it.

Think of a paper boat rushing down a rain gutter during a storm, hopping over twigs and drain grates. Now do some sums. Say a twig appears 600 pixels ahead of the boat. At a speed of 300 pixels per second you have two full seconds to react. At 900, you have two thirds of a second. The same twig has quietly become a different game, and at some speed it stops being possible.

That is the core design problem. Speed eats reaction time, so gaps have to grow as speed grows, and speed needs a ceiling.

Why not just place obstacles at random?

Because random does not care whether you can survive. Sooner or later, it puts a high twig straight after a low grate with no room to land. The player loses through no fault of their own and thinks the game is cheating.

So make blocks instead: a few seconds of obstacles, designed by hand. Build ten or twenty, sort them from gentle to nasty, and let the game pick randomly from those that suit the current speed. Random order, human design. It still feels fresh for a long time, and you can judge each block on its own.

How do you build it up?

  1. The boat moves by itself, and one button hops. A variable jump gives a tap and a press different meanings from one button.
  2. Fairness for fingers: coyote time and jump buffering.
  3. Five blocks made by hand.
  4. Joining them at random.
  5. Speed that climbs, then levels off.
  6. Score, best distance and an instant restart.
  7. New block sets as you get further: drizzle, downpour, storm drain.

One piece of quiet advice for your AI: keep the boat still and move the world past it. If the boat really travels for ten minutes, its position becomes a huge number, and that can show up as jitter.

Why do people stop trying again?

A slow restart. This genre lives on "one more go", and that feeling lasts about a second. Every menu, animation or loading pause between failing and running again gives the player a chance to stop. Failing and moving again should be one press apart.

If the failure also felt unfair, they will not press at all. For each obstacle that hits a player, you want them to think: "I should have jumped sooner."

Paste this to your AI

Build a simple endless runner: the character moves by itself, one button hops, obstacles keep coming, speed slowly climbs, and I restart the moment I fail.

Start with a state machine in a Mermaid diagram of the run: running, hopping, landing, near miss, hit, score screen, restart. Count the presses from hit to running again. I want one. Build from that.

Obstacles come in small hand-made blocks joined at random. The world moves past a character who stays in place.

For each block, work out how much time I have to react at top speed, and show the sum. Then run a simulated player with a slow reaction and list any block or pair of blocks it can never pass. If you have not worked a block through, say you do not know if it can be passed.

Or skip this and connect the MCP: your AI then finds all of this by itself.Connect the MCP

How to check it worked

  • Fail ten times fast. Count the seconds lost between tries.
  • Play at top speed. Ask for a switch that starts you there. Every block should still be possible.
  • Ask whose fault it was. After each failure, be honest. Too many "the game's fault" answers mean a bad block.
  • Watch the joins. Look at where two blocks meet. That is where unfair pairs hide.
  • Run for ten minutes. The game should stay smooth, with no shaking or drifting.

Last updated: 2026-11-02