Tuesday, July 21, 2020

Procedural Buildings: Room Assignment

I've definitely made a lot of progress in 3DWorld's procedural cities. I started with placing cities, then I populated them with buildings, then I added building interior walls, floors, and rooms. Next I added room lighting, details, furniture, and people. Now it's finally time to officially assign purposes to rooms and populate them with the correct furniture, appliances, and other objects according to room type.

I added bathrooms and then bedrooms to houses a few weeks ago. This past month I added hallways, offices, kitchens, living rooms, and dining rooms. I also added bathrooms and kitchens to some types of office buildings. Bathrooms previously had toilets, but now they have sinks and tubs as well. Bedrooms continue to have beds, bookcases, and sometimes desks placed in them. Kitchens currently have refrigerators and stoves, while living rooms have couches and TVs added against their walls. Kitchens, dining rooms, and living rooms also have tables and chairs. Residential offices have desks with a chair and sometimes a bookcase, while commercial offices contain up to two desks and a whiteboard. Any house rooms can have pictures, rugs, trashcans, and lights.

Walls, floors, and rooms are generated when each building is created. Interior details are only generated and drawn when the player gets within a specified distance of the building. This distance is relatively large to prevent visual artifacts as furniture and appliances pop in. Smaller and more numerous items such as books and pillows are generated and drawn at a closer distance to reduce their resource usage. Generation time has a minimal overall impact on framerate, except for when the player is moving at maximum speed through a densely populated area of the map.

Before we get into room assignment, let me show off my book/bookcase improvements. If you look at the bookcase below you'll see that some of the books are leaning against other books. This is something new I added since the last post. However, books can only lean to one side within an individual bookcase.

Bookcase with some tilted books.