Jump to content

Random Dungeon/Maze Generator


Selacius

Recommended Posts

Does anyone out there have or know of a method/algorithm written in PHP or Javascript that is designed to create a random dungeon/map. I am not looking for a script that creates doors, staircases, treasure chests, etc but simply creates an area with open rooms, corridors, etc. An arena of sorts to battle in (throw-back to the online game Droidarena). I have seen some online versions which do exactly what I would like, but these are designed to be printed off for D&D, etc. I just simply need to generate a random dungeon and store the layout in an array for use in my game. Suggestions even as to how to go about coding one would be great. I currently have a few attempts going, but none of them work all that great.Thanks.

Link to comment
Share on other sites

I am not necessarily looking to make a rogue-like maze however. I would like there to be big rooms, small rooms and corridors connecting them.
After the algorithm is complete, you just remove a bunch of walls around randomly chosen cells until the space reaches a randomly selected size.
Link to comment
Share on other sites

You can also randomly create rooms while the maze generates, or even before the maze generates, then just ignore them while the corridors are filled in. If you don't care about spatial accuracy (i.e., that everything actually "fits") you can also just pretend some of the corridor units are rooms :). "You enter a big room..."

Link to comment
Share on other sites

Algoritm is just the (context independant) description of a process. You don't download it, you implement it in some language or fashion.On the Wikipedia page, you can see a Python implementation. You'd need to write a similar implementation in PHP that would fit with the rest of your code.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...