Maze Generation



My programming graphics project for this semester is an interactive tool for maze/dungeon generation.  The initial prototype is built using an iterative python algorithm that adds random rooms to a starting room.  Room objects store references to wall and floor positions within a matrix data structure that holds the actual tile objects that compose the rooms.  Wall tiles, floor tiles, and terrain tiles.  The algorithm is based on a simple description I found online while researching maze generation.  When I find the source I will add a citation.

The algorithm works nicely in 2d to generate a series of connected rooms.  Using different distributions of room sizes enables control over the form of the maze generated.

To bring the tool into 3d and to utilize the GUI tools in the unity3d engine I am using iron python to execute an adapted version of the generation algorithm.  The different tile types are converted to integers at the end of the python function that are parsed by unity after the matrix is returned from the iron python environment to the c# unity code.  Each integer is evaluated at an x,y position and a block is instantiated.  Below only the wall blocks are instantiated as cubes.

The next steps are creating a user interface in unity to control the distributions of room sizes and the adaptation of the algorithm to create different height spaces.  I think a graph may be the correct way to organize the relationships between rooms and their heights to create the appropriate 3d models at those locations.


This entry was posted in Programming Graphics. Bookmark the permalink.

One Response to Maze Generation

  1. Sean says:

    Would be valuable to all those dungeon grinding games, especially if you could make the product closer to the kind of design a real dungeon designer creates. Lemme know if you wanna brainstorm parameters/features that might make that possible.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s