Friday, May 6, 2022

Procedural Buildings: Office Building Utilities

I spent a lot of time improving my procedural houses last year and in the beginning of this year. Now I'm getting back to putting more work into office buildings. Two posts ago I showed some parking garages with sewer pipes in the ceilings. I've been working on several different areas in the past month rather than a single big feature. I've added cold and hot water pipes, a vertical fire suppression system pipe, electrical panels, utility rooms, water heaters, and vents since the last post. The pipes are all connected to water heaters and other plumbing fixtures to form a complete system. Each of these additions increases draw time, so some of my effort has also gone into making optimizations to the code to get back to my framerate targets of 100 FPS outdoors and 60 FPS indoors.

Here are some more details on these additions to my procedural office buildings.

Cold and Hot Water Pipes

I definitely liked the way sewer pipes turned out in my earlier post. I want to add more pipes to parking garage ceilings, and water pipes seemed like the obvious next step. And why add just cold water when I can have hot water pipes as well?

I reused most of the sewer pipe code to add water pipes. These were placed above the sewer pipes, closer to the ceiling, using a smaller pipe diameter. I used copper material for the pipes and shiny brass for the fittings. I didn't have enough space near the ceiling to route hot water pipes above cold water pipes, so I put them at the same level and added cold water pipes as blockers going into the hot water pipe routing algorithm. This way cold water had a priority, and hot water was added where there was space between everything else. In many situations the hot and cold water mains ran parallel to either side of the risers feeding the main bathrooms.

Here's a screenshot. I don't particularly like how water pipes must pass through ceiling beams, but I guess it's good enough for now. I disabled cars to avoid distracting from and blocking the view of pipes in the ceiling. Note that parking garages now have yellow curbs at the ends of parking spaces and some handicap spots near the elevator(s). I also made the occasional parking garage ceiling light flicker, though you can't see that in screenshots.

Water pipes in the ceiling of a parking garage with no cars. I've also added handicap parking spots and yellow curbs.

Hot water pipes have an additional layer of white thermal insulation. I've seen buildings with this style of pipes and feel it has good contrast against the copper while also matching the ceiling so as not to stand out too much.

Hot water, cold water, and sewer pipes in the ceiling of the parking garage.

Fire Suppression

The fire suppression/sprinklers pipe is currently just a big red tube placed near an exterior wall that extends vertically from the lowest level of the parking garage up into the building. However, I did add support for extruded N-gon shapes, which I used to add hexagon bolts to connect the pipe sections together. Now I can use this system to add bolts and similar details to other building objects.

I haven't added any horizontal pipes or actual sprinklers yet. I might add these to parking garage levels at some time in the future if I can find a way to fit them. Maybe they can hang down lower than the other pipes. Or maybe I can get away with only having them along walls and away from other types of pipes. I'll have to look through some reference images to help me decide what approach would work the best and fit within the constraints of my buildings.

Fire suppression/sprinkler water pipe running vertically through the parking garage, with hex bolts.

Utility Rooms and Water Heaters

Each large office building now has a dedicated utility room on the ground floor. This is assigned to a windowless room that's as close as possible to a bathroom to minimize the average length of water pipes. So far utility rooms contain only a row of water heaters. I used the same style of vertical cylinder water heater that I used for houses, except the pipes bend down and pass into the floor below instead of extending to the ceiling as with houses. This is because the plumbing is in the basement below the water heater, while water heaters are placed in the basement of houses. At some point in the future I plan to add other objects such as HVAC components to utility rooms to use up all that wasted floor space.

Water heaters have their own hot and cold water lines that connect through the floor to the pipes in the parking garage below. The hot water main connects between these and plumbing fixtures that use hot water such as sinks. The number of water heaters is determined by the number of hot water fixtures, which generally scales with building size. Hot water flow is evenly distributed between heaters. If some of them can't be connected, a section of the pipe joining the row of water heaters is moved inside the floor itself, or somewhere else not visible by the player.

I've added signs to the doors of utility rooms as well as storage rooms and libraries using the same style I previously used with men's and women's restrooms. I plan to add more types of building signs in the future. For now they're placed on the wall next to the door rather than the door itself to avoid having to deal with rotating them when doors are opened and closed.

Office building utility room with a row of five water heaters with pipes reaching down to the floor. I even added a sign next to the door.


Electrical Panels

Once I had the plumbing done I started working on the electrical system. Houses have an electrical panel with circuit breakers placed on an exterior wall of the basement. Office buildings can have multiple electrical panels placed on the wall of the underground parking garage, if there is one. These boxes have metal conduits exiting from their tops and going into the ceiling above. I found a circuit breaker texture that I can tile to show vertical rows of breakers on the inside of the box when it's open. For some reason I was only able to find marine breaker pictures. Most of the normal circuit breaker images had poor lighting, hands or tools in the way, labels for breakers that I didn't want, etc. So I clipped off the picture of a boat and used the rest of the image as the texture.

Currently the player can only open and close the metal doors of each panel. I might add more functionality to these later. For example, I can make individual breakers clickable so that the player can disable lights on different floors and possibly other electrical items such as the elevators. I'm not sure how to implement this yet, or what gameplay purpose this would serve. I can pretty easily expand electrical panels into a series of breakers that the player can interact with to switch on and off. I would need a new system to handle tracking of which areas are powered, with some sensible default positions for breakers in panels that haven't yet been opened and generated. Maybe each breaker will need to search through the lights and other appliances in the building and disable the correct ones. That means I also have to figure out what "zone" each breaker controls. I feel that having one breaker per room is too many, and one breaker per floor is too few. For example, the building I took these screenshots from has 19 floors and 913 rooms.

This is what the breaker panels currently look like when open and closed.

Two breaker panels in an underground office building parking garage, one open and one closed.

Ah, wait. It's too hard to see the panel with the poor lighting of the parking garage ceiling. Here, the flashlight makes it all better:

An open breaker panel lit with a flashlight.

Vents

I added vents near the ceiling on walls of offices, storage rooms, and utility rooms. These are placed on interior walls to avoid having to deal with windows. If you look closely you can see one in a screenshot above. They don't connect to anything yet, they're simple wall decorations. Building walls and ceilings are too thin to add internal vents anyway. I think I would have to fix that before I can add a proper ventilation system. Sorry, I don't plan on adding gameplay where the player climbs through ceiling vents any time soon.

An air vent in the wall of a bathroom near the ceiling.

There are many possible ways to improve on these systems. Buildings have thousands of different types of objects and many different interacting systems. This is certainly an endless project!

Also, this is post #128. Yay, a power of two!