MARIO.GAME
en
Infinite Mario

Infinite Mario Bros Guide: How the Random Levels Work

How to play Infinite Mario Bros in the browser, how its procedural level generator works and tips for surviving harder random levels.

5 min read

Infinite Mario Bros Guide: How the Random Levels Work

Infinite Mario Bros is one of the most influential fan games ever made. Written in Java by Markus “Notch” Persson in 2008 and ported to HTML5 by Robert Kleffner, it never runs out of levels: each one is generated when you enter it.

Getting started

Press S on the title screen. A world map appears with paths, level dots and castles. Move with the arrow keys and press S to enter a level. In the level itself, S jumps and A runs (and throws fireballs once you have a flower).

How the generator builds a level

The generator works from left to right, choosing a sequence of zones and filling each with features:

  • Straight sections with ? blocks, coins and enemies
  • Hills — raised platforms you can stand on, sometimes stacked
  • Tubes — pipes, some with Piranha Plants
  • Jumps — gaps of varying width, sometimes with stairs on both sides
  • Cannons — Bullet Bill launchers on short columns

A difficulty value grows as you progress through the map. Higher difficulty means wider gaps, more enemies, and more winged and armoured foes. Level type (overground, underground or castle) changes the tiles and the music.

Why it mattered

Because the code was public and the levels were endless, researchers adopted Infinite Mario as a test bed. From 2009 the Mario AI Competition challenged programmers to write agents that could play its levels, and later tracks asked for programs that design levels. The famous A* agent by Robin Baumgarten, which ran flawlessly through generated stages, became a viral video. Many papers on procedural content generation still cite the Infinite Mario framework.

Survival tips

  1. Run whenever the ground ahead is clear — gaps get wide at higher difficulty.
  2. Watch for Bullet Bill cannons: shots are fired at intervals, so wait for one to pass.
  3. Winged enemies hop in arcs; stomp them once to remove the wings.
  4. Use the map: if a stage is too hard, there is often another route.
  5. Take your time in castles — they mix narrow platforms with enemy groups.

More guides