I've been adding new room types to 3DWorld's procedural buildings lately. I wrote a blog post on conference rooms, then a short post on interrogation rooms. The topic of this post is machine rooms. I've been wanting to add procedurally generated industrial type machines/devices to basements for a while, ever since I revisited basement pipes. I've also wanted to add more variety to extended basement rooms.
I've been working on adding code to route basement and parking garage pipes down the extended basement hallways and into leaf rooms. But it only makes sense if there are objects in these rooms to connect the pipes to. I do have bathrooms with sinks and toilets down in the basement, though not every building has these. Another option is to add more water heaters and furnaces similar to the ones placed in house basements and office building utility rooms. The appliances I've created are more residential sized and look out of place in a large open basement room though.
I added a new type of building room object called a "machine" that's represented as a bounding box placed on the floor and against a wall of the room. All placement and collision detection handles this as a box. However, the drawing code is free to add any details it wants when the vertex data is generated and sent to the GPU. None of this geometry is stored CPU side, it's all created as temporary data that's drawn later. An added benefit of machines being placed in basements is that the vertex data doesn't need to be generated until the player enters the building. This allows me to create very detailed geometry without the need to worry about optimizing for memory or generation time, since these are only found in one building at a time. I do technically create machines for multiple buildings ahead of time to help with visualization and debugging, but I don't think it makes much of a performance difference.
Each machine consists of a concrete slab base and one or two main components, which can either be rectangular/cube shaped or vertical cylinders (such as storage tanks). These larger components have smaller boxes and cylinders attached to their exterior surfaces with different colors and textures. I then added some special decoration objects that are already used in other places in buildings. These include AC units, vents, valve/wheel handles, and breaker boxes. Some breaker boxes are open to expose the interior. To finish things off, I added a variety of pipes and ducts connecting the components together and going into the walls, ceilings, and floors around the machines. These use multiple materials including plastics and metals (copper, brass, bronze, steel, and rusted). I used special checks to make sure these added detail objects don't intersect each other or clip through adjacent walls or machines in incorrect ways.
I found ten free textures online to use with these machines. Most are some type of metal panel or plate texture, some of them with rust and scratches. Only one of them has a matching normal map. I may look for better textures with normal maps later, but these are fine for now. I haven't put any effort into aligning textures to geometry because it's too difficult to automate this for this many different textures.
Here is an example of a long and narrow machine room.
Machine room with random machines lined up against the walls. Each one is unique. |
Note that these rooms are somewhat brighter than they normally appear to make them easier to see. I prefer to have these deep basement rooms be darker. Here I have indirect lighting enabled, though it doesn't work very well due to the way rooms are randomly and sparsely placed, compared to the dense rectangular floorplan of above-ground building interiors. At least the shadows on the lower walls and floors are correct.
Machines are placed along the sides in a way that allows space for the player and building AI people to cross the room between them. I added extra clearance for doors so that they're not blocked. The rooms in these screenshots have up to 10 machines for testing purposes, though for normal buildings I'll probably set the max count to 4.
A different machine room with different machines and many cracks on the walls, ceilings, and floors. |
I definitely like the way the cracks and water damage fit with the scratched and rusty metal textures I'm using with machines. The crack effect only applies to the walls, ceilings and floors though. I don't think cracks go well with metal surfaces. I did apply the wet/water damage texture effect to machines. This give the surfaces a darker but more shiny appearance. Here's another machine room with water damage and stains but no cracks.
A machine room in the basement of a house, with plaster walls. |
I think I'm done with new room types for now. I plan to continue to work on extended basements in the near future. Next up is underground tunnels/pipes that the player can walk through. I'll likely have a blog post on that topic within the next few weeks.
Yay! Utility rooms! Do the pipes connect to the building piping?
ReplyDeleteAre you going to make Equipment Rooms for the elevators as well?
Another common machine type is a pump, which can be a set of concentric horizontal cylinders with some cubes stuck on for electrical boxes and such.
Happy to see progress on the mechanical details like this. Keep up the good work!
The pipes don't currently connect to the rest of the building. I initially wanted to do that, but there were issues. I would either have to routed the pipes along the rooms (which is difficult because is requires rooms to know what machines they contain at the pipe routing stage), or across space to the nearby basement or parking garage (which runs the risks of pipes clipping through objects in other rooms that occupy that space, possibly rooms of other buildings). Second, it requires the building pipe routing system to know where the pipe connections to the machines are, but this is only known during vertex generation for drawing, which is done after pipes have been placed. Note that I made this work for objects such as water heaters because the pipe locations are always at a known/fixed location. I might add this later if I can figure it out.
DeleteI've never seen an elevator equipment room, and this is likely true with most people. Does this normally go under the elevator, or to the side? I'm not sure where this is in the office building where I work. Is there some basement? Something on the roof? I suppose I could try to add one in the parking garage, using some of these randomly generated machines.
Pumps and motors, yes, I could add that. Thanks!