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:

Basic

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

Advanced

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

Pro

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

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

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? – Trilarion Feb 20 '15 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 Feb 21 '15 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 Mar 2 '16 at 17:05

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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