Jump to content
  • Advertisement
Sign in to follow this  

Procedural maps, building interiors

This topic is 1315 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Given an NxM area, how to create a realistic building interior (not dungeon or cave). (Preferably with architectural design parameterization of some sort). Some prefab building segment templates can be used, but the majority of the algorithm should be procedural.

I have created a global map generator. This creates the geography of the map and such at a high level, it creates height maps, biomes.

This is used to create a territory map... or who lives where.

Using the Moore neighborhood of a cell in these maps are used to create a local map.

I have a local map generator... it works as follows:

First, generate a random maze. The maze is generated such that it ensures that any open tile is accessible from any other open tile.

Using Bisection, carve rooms into the random maze,
The rooms currently come in two flavors (choosen by a parameterized weight), building and Wild... if it is a building then the room is rectangular with a wall around the outside... While building the walls, ensure a door exists such that any accessible tiles outside the room can accessed from within the room via door. "Wild" rooms simply carve an open path along the outer edge of the room while the navigation of the interior room is left as the maze.

At this point, I have the following information for each cell in the map.
1) Open/Closed
2) RoomId cell belongs to. All rooms are rectangular (I don't mind this terribly at the moment)
3) Biome of cell geography.
4) Territory of cell (I know which "civ" owns the piece of land)

How can I take the rectangular rooms and further divide them into interior rooms in a realistic way?
Preferably with some kind of parameterization to ensure that Territory "A" buildings have consistencies among themselves,but not necessarily consistent with buildings of Territory "B".

For example, one area might not make for solid foundations... so they should not have multiple floors or basements... other areas might have an abundance of land and prefer sprawling single level buildings, while other areas may be overcrowded meaning small, efficient layouts would be predominate. Some regions might be populated by people with a penchant for building a specific type of room that doesn't appear in other regions... even within a region Commercial, Industrial and residential buildings would have different layout types.

I read an article (can't seem to find link now) that described a method using weighted bisection is some way, the article didn't go into a lot of detail of the implementation though... but I suppose they must have defined some sort of building "Recipe" that guided the layout choices

Share this post

Link to post
Share on other sites

I suggest aiming the procedural generation significantly above the level of single rooms, defining building types with a standard layout. Assuming that you have good rules to decide what building type should go into each vacant lot, you need to adapt buildings to the available surroundings:

  • stretch standard rooms which have a flexible size
  • add extra rooms to fill large spaces (usually making other rooms smaller)
  • merge walls with adjacent buildings
  • surround the exterior with alleys, courtyards, gardens etc. when this building or adjacent ones need some space
  • choose basic floorplans of room clusters according to multiple choices to add variety

Respecting very strict building structure rules ensures that the building makes sense: no room is too large or too small for its purpose, you know what rooms are (allowing for easy procedural furniture generation), every building has the rooms it needs in a reasonable arrangement.


For example, a traditional Roman domus would have a flexible but almost square aspect ratio (let's say below 3:1), a rectangular shape (possibly, but rarely, with small indentations), a street-facing short side with an entrance in the middle, a passage into a rectangular half-covered atrium with an impluvium in the middle, pretty arbitrary arrangements of wall-to-wall rooms around the courtyard, normally a cloister and small garden in the back surrounded by other rooms, few or no corridors, few outward-facing windows and even fewer back and side doors, some traditional room types, etc.

Edited by LorenzoGatti

Share this post

Link to post
Share on other sites
Re-reading my original post I can see where I did not describe the problem well... The current map i have is full of "rooms", these "rooms" represent building foot prints. The question is about proceduraly generating a building from the Footprint. The info about the Roman Domus is spot-on, but the question is how to store that type of information as a "recipe"...

Share this post

Link to post
Share on other sites

Sounds like you're looking for some kind of Bin Packing algorithm. Essentially, determine whether or not you can get a set of rectangles of particular sizes into another larger rectangle.


If one large rectangle is the property on which you can develop, the other rectangles would be the rooms or facilities that compose a building. Depending on a region's building code, the final shape of all rooms combined may or may not have to be a rectangle itself. The building codes could further say that certain facilities must exist in certain types of buildings and that a min or max amount of area needs to be allocated per person expected to use a particular facility.


Google "Minimum Housing Standards" and see if you can use that for inspiration to determine a few sets of rules that would work for your game.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!