Skip to content

Wilson's Maze Generator

Generate perfectly unbiased mazes using Wilson's loop-erased random walk.

Wilson's Settings

40
30
12
2

Preview

Generation time: -- | Algorithm: Wilson's | Size: 40x30

About Wilson's Algorithm

Wilson's Algorithm is a loop-erased random walk algorithm that generates unbiased, uniform spanning trees. It produces mazes where all possible mazes of the same size are equally likely.

  • Characteristics: Creates perfectly unbiased mazes with uniform distribution
  • Complexity: O(n) expected time, slower initially but guarantees uniformity
  • Best for: Fair puzzles, roguelike games, unbiased procedural generation
  • Path type: Completely random and unbiased maze structure

How to Use This Tool

  • Select Algorithm: Choose between DFS, Prim's, or Wilson's algorithm using the navigation links above
  • Adjust Parameters: Customize maze size, cell size, and wall appearance
  • Generate: Click "Generate Maze" to create a new maze with current settings
  • Preview Controls: Use zoom buttons to inspect maze details, pan by dragging
  • Export: Download your maze as JSON (for data) or TMX (for Tiled map editor)

Export Formats

JSON Format

Exports maze data as a JSON file containing:

  • Maze grid structure (walls and paths)
  • Dimensions and cell information
  • Algorithm metadata
  • Easy to parse for custom game engines

TMX Format (Tiled Map Editor)

Exports maze as a TMX tilemap file compatible with:

  • Tiled Map Editor for visual editing
  • Game frameworks like Phaser, Unity, Godot
  • Layer-based structure with walls and floors
  • Embedded tileset definitions

Maze Generation Algorithms Explained

Maze generation algorithms are essential in game development, procedural content generation, and computer science education. Each algorithm produces different maze characteristics suitable for various applications:

Choosing the Right Algorithm

  • For puzzles and traditional mazes: Use DFS for its long, winding corridors that create challenging navigation
  • For dungeons and organic layouts: Prim's algorithm creates more natural, branching structures
  • For fair, unbiased generation: Wilson's algorithm ensures no algorithmic bias in maze structure

Game Development Applications

These mazes are perfect for:

  • Roguelike and dungeon crawler games
  • Puzzle games requiring navigation challenges
  • Procedurally generated levels in indie games
  • Educational projects teaching pathfinding algorithms
  • Game jams and rapid prototyping