Map Generation

by ACWraith
A datum for abstract procedural map generation.
ID:110246
 
Keywords: development
I said I'd upload a small map generation library. It can be found here. It's just an abstract storage method with a proc to use Prim's algorithm for maze construction. There's not much to it, but it can be built on.

There's probably another implementation like this somewhere. I just wanted to get away from the floor/wall style of generation where a cell can only be one or the other. I know I'll be using this for generating maps where each cell is a screen. That means each cell takes care of its own walls.

I used a 70x70 map for the demo.


Granted, mazes probably aren't the goal for most maps. Here's an idea to make a similar map more open. I have yet to try it... but it sounds nifty! ;)
  1. Generate one Prim maze. Calculate the distance to each cell from the starting point.
  2. Generate a second Prim maze and pretend it overlays the first.
  3. If a connection between cells only exists in the second maze, find the absolute value of the difference in distance.
    • If the difference is below a certain minimum, just add the connection.
    • Otherwise, make it a door or guard or some other obstacle depending on how high the value is.