How to Make a Game Like Spelunky with AI

Create two repeatable cave layouts and test a safe route through each.

Seele Editorial TeamUpdated November 11, 2026

Build an original cave-exploration game with a small room graph and a repeatable seed. In the fictional Lantern Caves, one seed places a hazard on the left branch and treasure on the right. Another swaps them, while a safe route to the exit stays open.

Start with discrete room moves and one health point. A visible seed, movement log and safe-path check make the level easy to replay and diagnose before you add jumping or larger maps.

Start with a repeatable cave

An original explorer with a lantern in connected cave chambers
Lantern Caves is a fictional game concept. The coordinate grid below defines the playable layout.

Mossmouth's Spelunky listing describes a platformer with randomized levels, traps and treasure. Use the broad idea of exploring a changing cave to design your own rooms, hazards and visual identity.

For this prototype, use a 3 by 3 room grid. Coordinates are written as (column, row), starting at zero in the upper-left. The player begins at S, the exit is E and the two branch rooms can hold a hazard or treasure.

Build the room graph

RowColumn 0Column 1Column 2
0S (0,0)Open (1,0)Wall (2,0)
1Branch (0,1)Open (1,1)Branch (2,1)
2Wall (0,2)Open (1,2)E (2,2)
An original explorer pauses near a cave hazard
Make a hazard readable before a player enters its room. The grid supplies the exact location.

Connect each open room to its orthogonally adjacent open neighbors. A move enters one adjacent room and costs one turn. Reject a move into a wall, outside the grid or diagonally, leaving the position and turn count unchanged.

The guaranteed backbone is S → (1,0) → (1,1) → (1,2) → E. Those five rooms remain safe in both layouts. Branch rooms at (0,1) and (2,1) create a small choice without breaking the route to the exit.

Compare two seeds

For an even integer seed, put the hazard at (0,1) and treasure at (2,1). For an odd seed, swap them. Start with health 1 and treasure 0. Entering a hazard reduces health to zero and ends the run. Entering treasure collects it once and clears the room. Entering E completes the run whether or not treasure was collected.

SeedHazardTreasureMove down from S
8(0,1)(2,1)Run ends after one move.
9(2,1)(0,1)Collect one treasure; health remains 1.
An explorer carrying treasure near a glowing exit in an original cave
Show a distinct exit cue and keep the collected-treasure count in text.

For either seed, the backbone reaches E safely in four moves. With seed 8, the path right, down, right reaches the treasure in three moves. One more move down reaches E. On a reset with the same seed, restore the same room contents, health and treasure count.

Check the generated route

Before allowing a run, search the room graph from S to E while treating the hazard room as blocked. Accept the layout only if a path exists. A breadth-first search can record visited rooms and add each unvisited safe neighbor to a queue until it reaches E or exhausts the queue.

If the search fails, show a generation error and reject the layout. If the same seed produces different hazard positions after reset, inspect the seed rule and make sure reset does not silently draw a new seed. These are checks for the authored room model, not measurements from a finished game.

Give AI the complete cave fixture

Build an original browser cave game called Lantern Caves.
Use a 3x3 grid with coordinates (column,row), zero-based from the upper-left.
Start S=(0,0); exit E=(2,2).
Open rooms: (0,0), (1,0), (1,1), (1,2), (2,2), (0,1), (2,1). All other cells are walls.
Connect orthogonally adjacent open rooms. One valid move enters one adjacent open room and costs one turn.
Reject walls, outside-grid moves and diagonal moves without changing position or turn count.
An even integer seed places hazard (0,1), treasure (2,1). An odd integer seed swaps them.
Start health 1, treasure count 0. Entering the hazard sets health to 0 and ends the run.
Entering treasure collects it once and clears the room. Entering E completes the run with or without treasure.
Before play, graph-search from S to E treating the hazard as blocked. Reject a layout if no safe path exists.
The backbone (0,0), (1,0), (1,1), (1,2), (2,2) is safe for seeds 8 and 9.
With seed 8, moving down once ends the run. With seed 9, that move collects treasure and leaves health 1.
With seed 8, right, down, right collects treasure; down then reaches E.
Give each move an ID. Ignore a repeated event with the same ID.
Reset with the same seed restores room contents, health, treasure, turn count and action IDs.
Show the seed, current room, turn count, health, treasure and a readable movement log.
Use original cave art and keyboard-accessible controls.

Test the safe backbone with both seeds. Then repeat the first downward move under each seed and compare the outcomes. Try a wall move and a duplicate event ID. See the first-build guide for adapting the fixture.

Build Lantern Caves in SEELE AI Game Maker and verify the graph and reset behavior before adding more hazards.

Frequently asked questions

How large should a first cave level be?

Start with a small room graph that you can inspect completely. A three-by-three grid is enough to show a guaranteed route and two changing branch rooms. Once the reset and path checks work, expand the generator while retaining the same validation rules.

Why keep the seed visible?

A visible seed lets you reproduce a particular room arrangement and report it when something goes wrong. Resetting the fictional seed 8 layout should restore the hazard and treasure to the same rooms. A new seed can be introduced deliberately after the replay passes.

How can I check that a generated cave is solvable?

Search from the start to the exit using only safe connected rooms. Treat the hazard as blocked for this check, and reject a layout if no route exists. The Lantern Caves fixture keeps a five-room backbone safe for both example seeds.

What should an invalid move do?

Leave the player's position and turn count unchanged when a move targets a wall, the edge of the grid or a diagonal room. Explain why the input was rejected. This makes movement errors distinguishable from a valid move into a dangerous room.

SEELE AI

Turn this guide into a playable build.

Start with a focused brief, then iterate in the Seele AI Workspace.

Start creating