Randomly generated game worlds are currently very popular. Can anyone recommend an open-source Java library for tile-based maze (bird's-eye view) creation?

Features I have in mind:


  • two exits, that are always connected
  • adjustable x / y dimension
  • output: two dimensional array
  • cycles


  • rooms
  • wide corridors
  • empty space
  • multiple number of exits
  • additional output: solution path


  • teleport fields
  • a key / door concept
  • multi-layer spreaded maze

Update: The book Mazes for programmers helped me. The code is in Ruby.


1 Answer 1


I am currently working on a maze generation library written in Java 7+, and would be willing to discuss its use.

I also found an example of a simple maze generation algorithm here, that should help put you on the path to writing your own maze generator if you don't find something that suits your purposes.

  • 2
    And, is the maze generation library available now? Commented Feb 20, 2015 at 19:29
  • 2
    The algorithm isn't anywhere near where I want it to be, it mainly just generates a maze at a given size, but is not a "perfect" maze generation. Just added my email to my profile. I'd be happy to discuss it in more detail with anyone that would like to know more.
    – Aterxerxes
    Commented Feb 21, 2015 at 1:36
  • Create a grid. Treat it like a graph; every neighbor is connected to 4 other neighbors except at the edges and corner. Pick a random cell, Build a spanning tree with this cell as the starting place; when expanding the spanning tree, choose random edges. Place walls on every graph edge not used by the spanning tree. Done.
    – Ira Baxter
    Commented Mar 2, 2016 at 17:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.