Build a Procedurally Generated Maze Escape Game with Timer and Fog of War
You get a single HTML file containing Lantern Labyrinth, a maze game with always-solvable random mazes, three difficulty sizes, a timer, swipe and keyboard controls, and an optional fog-of-war mode.
The prompt
Act as a senior front-end game developer who ships polished browser games in a single file. Build Lantern Labyrinth, an original maze escape game where the player guides a glowing lantern from the top-left corner to a mint-green exit in the bottom-right of a procedurally generated maze. Carve every maze with an iterative recursive backtracker (depth-first search using a stack) so it is a perfect maze that is always solvable, and generate a fresh one for each new game.
Rules:
1. Controls: arrow keys or WASD move one cell. Swiping or dragging on the maze slides the lantern straight until it reaches a junction or a wall. Show on-screen D-pad buttons for touch. Tapping the maze steps toward the tap.
2. Difficulty buttons: Easy 10x10, Medium 16x16, Hard 24x24. The timer starts on the first move. Show moves and a best time per difficulty, kept in memory only.
3. A Fog toggle limits sight to a small radius around the lantern and dimly remembers explored cells.
4. Draw on a crisp, devicePixelRatio-aware canvas that resizes to fit frames 360-1280px wide. Use a navy background, pale walls, a gold lantern, a mint exit and a faint gold breadcrumb trail.
5. Show a win overlay with time, moves and a Next maze button. Use smooth gliding movement, turned off under prefers-reduced-motion.
6. Add Web Audio blips for steps and bumps plus a win chime. Create the AudioContext on first input, keep volume low and include a visible mute toggle. No external assets, storage or alerts.
Output format: one complete HTML file in a single code block, then 3 short ideas to extend it.Example output
Tips and common edits
Why this works
- Naming the recursive backtracker guarantees a perfect maze, so every generated level has exactly one path between any two cells and is always solvable.
- Slide-to-junction swipes make big mazes playable on phones without hundreds of taps, while the keyboard keeps precise single steps.
- Fog of war with remembered cells adds a memory challenge, so the same difficulty plays differently every round.
Paste into ChatGPT, Claude or Gemini. Save the returned code as lantern-labyrinth.html and open it in any browser, or run it in the chat's preview or canvas panel.
Common edits
- Change the theme by swapping the CSS color variables and renaming the game, for example a neon circuit board or a hedge garden.
- Make it harder by adding a 32x32 size to the SIZES array or shrinking the fog radius in RADII.
Prompt details
- By
- Prompts-GPT editors
- Published
Did this prompt work?
Keep exploring
More like this
Build a Color Sequence Memory Game with Synth Tones in One HTML File
A ready-to-paste prompt that builds Echo Garden, a four-pad color-and-shape sequence memory game with Web Audio tones, a strict mode and rising speed.
Build a Daily Five-Letter Word Guessing Game with Colorblind Mode in One HTML File
A ready-to-paste prompt that produces Quillmark, an original daily five-letter word game with correct duplicate-letter coloring, an on-screen keyboard and a colorblind mode.
Build a Four-Lane Rhythm Tap Game with a Generated Beat in One HTML File
A ready-to-paste prompt that builds a complete four-lane rhythm tap game with a live Web Audio beat, Perfect/Good/Miss timing grades, combo scoring and a results screen.
Build a Garden Caterpillar Snake Game with Swipe and Wrap Mode in HTML
A prompt that produces Leafline, an original snake-style game where a caterpillar eats garden leaves, with swipe controls, buffered turns, wrap mode and a speed slider.
Build a Gnome-Popping Whack-a-Mole Game With Decoys in One HTML File
A ready-to-paste prompt that makes an AI build Gnome Pop Garden, a fast whack-a-mole style tapping game with speed that ramps up, hedgehog decoys that cost points, and number-key controls.
Build a Match-Three Tile Swapping Puzzle with Cascades and Combo Scoring
Generates a complete single-file match-three puzzle with swap validation, gravity refill, chain-reaction combo scoring and an automatic reshuffle when no moves remain.