Monday, September 30, 2024

Procedural Building Conference Rooms

I'm pretty happy with the look of glass upper retail floors added in my earlier post. Maybe they're not very practical for public spaces, but they make the room look larger while also allowing for increased usable space. I need more glass in these buildings. It would be interesting to have glass walls as well. Maybe for conference rooms? We have some real conference rooms with glass walls/windows at my work office.

The first step is to choose which rooms will be conference rooms. Since most of the buildings in 3DWorld share the same vertical floorplan across many floors, it makes the most sense to have one or more dedicated conference room on each floor. The ground floors of office buildings do have some special rooms such as storage rooms, security rooms, and utility rooms, so I can have the floorplanner overwrite the conference room with a special room type on the first floor.

Since I want to add glass walls to conference rooms, it makes the most sense to place them adjacent to hallways. A glass wall between two conference rooms, or a conference room and an office, would be odd. And I don't even want to think about what a glass wall shared with a bathroom would be like! I also have a constraint that the conference room can't have an exterior wall, since the interior window won't alpha blend properly with the exterior windows. (I spent a long time trying to solve this with glass floors and never found a solution I was happy with.) Fortunately, this means I don't need to worry about walkways connecting between buildings that end at conference rooms. The candidates are all rooms next to an interior hallway that have doors that either open into a secondary hallway that meets the other hallway at a 90 degree angle, or to another parallel hallway one row over. Another requirement is that conference rooms don't have any overlapping stairs or elevators. This rules out some rooms that have notches cut out where elevators are placed along the sides of the main hallway.

There is also a size preference. I want to add large conference room tables and many chairs to these rooms, with space around the sides for people to walk. The conference room should be the largest room that meets the placement requirements. I gather a list of all legal room candidates, find the largest one, and select all rooms within 90% of the largest room's area as possible conference rooms. Then one or more of these rooms are selected. Any room that has a conflict (such as intersecting stairs) on one floor is changed to a different room type such as an office for that floor. This sometimes happens with conference rooms at the top or bottom of a building stacked partition where stairs extend above or below.

Each conference room has a single large table that runs most of the length of the room, with as many rolling office chairs as will fit along each side. One of the walls at an end of the table has a large TV hanging on the wall, and another wall has a large whiteboard. Neither of these can be placed over the window or door(s). I found a conference room phone 3D model that I placed on most of the tables in a random position and orientation. Then I added some random items on top of the tables such as laptops, pizza boxes, books, cups, and water bottles. Some rooms have trash cans, recycling bins, and/or potted plants. Maybe I should add pens, pencils, and papers as well.

Here is what an example conference room looks like. There are actually two adjacent conference rooms with glass windows on this hallway. The doors open into the next hallway over, toward the back.

Two conference rooms in an office building, viewed from the hallway through glass windows.

I added proper collision detection for these glass panels that works with the player, building people, zombies, rats, snakes, insects, thrown objects, etc. Spiders can climb on the surface. I had to fix a number of problems related to lighting and occlusion culling so that objects on the other side of the glass were lit and visible even though there was no doorway between the rooms. I was originally worried that the AI would have path finding problems if a zombie saw the player on the other side of the glass but couldn't pass through it. But no, the existing system worked fine and the zombie walked out the door and around the corner to reach me. They target the last known location of the player when the player isn't visible.

Lighting isn't perfect for these rooms. Light will pass through the glass from the adjacent room, but the sides of the glass are only lit by lights on the same side. This means that the glass on the inside of a room will appear dark when the room lights are off but the adjacent room lights are on. This is one reason why I turned all the lights on for these screenshots. I did make sure to flag conference room lights with motion detection logic so that they automatically come on when the player enters, which helps to hide this problem. The player can manually switch them off though.

Conference room in an office building, viewed from inside.

Sometimes the window is on the shorter wall of the room. The conference room below has a long whiteboard and short glass window. This room is large enough that it needs two ceiling lights, rather than the more common (and efficient) one light per room. I believe there were 7 chairs on each side of the table.

Larger conference room with a long table that has a phone and a laptop on it. There are 14 chairs.

I haven't made these windows reflective yet. That's a complex process that reduces framerate significantly as some parts of the building interior must be drawn twice. Most indoor windows are designed to be anti-reflective anyway, so the reflections are only visible at sharp angles. I don't feel that the benefit of adding reflections justifies their cost.

While writing this post I though that it would be interesting if the player could break, or at least crack, these windows. Maybe throwing a large enough object at the window will create a crack, similar to throwing a ball at a mirror. The problem is that the largest object the player can actually throw is a ball. I don't think a basketball or soccer ball would normally crack a window. Maybe I should add some new object that can be thrown, where the only purpose is to crack windows. Should the player be able to throw a fire extinguisher? That would do it. Currently fire extinguishers can only be dropped. Or maybe the player can throw a laptop left on the conference room table, or the phone? Should I allow zombies to break through windows to get to the player?

2 comments:

  1. The "what other rooms can share a glass wall with the conference room?" question immediately brought several possibilities to mind.
    Operating room
    Swimming pool with fish
    Parking garage
    Residential bedroom
    Security room
    Indoor arboretum/ Zen garden with procgen bonsai trees

    Speaking of trees, have you seen Tiny Glade? It is a procgen "game" which is almost the exact compliment to 3dWorld.

    ReplyDelete
    Replies
    1. Most of the room types you suggest aren't currently placed in the same types of buildings and on the same floors as conference rooms. Some sure would be amusing though! I haven't added operating rooms yet, but I might add them eventually if I ever go back to assigning rooms to hospitals. Swimming pools with glass sides would be interesting (and probably very challenging).

      I've never heard of Tiny Glade. I took a look and it seems like a more complex version of Townscaper. This is user-driven procedural generation, which is a very different system from what I'm working on. I don't think the two systems can easily coexist in the same game framework. But who knows, maybe I can do something like this eventually.

      Delete