Creating a Sci-Fi Lab Room In Unity
Part 1: Basic layout
Using the techniques from my previous article, we can continue on fleshing out a full room.
Firstly, we need to accumulate various assets to use. GameDevHQ’s Filebase plugin allows for quick integration of high definition game objects into our scenes.
Starting with the walls, I made three main variations. Each of these contain multiple different game objects of different colours and textures to create height and depth.
With our ‘game’ being set inside a lab building, I want the main room to portray a large daunting area, creating a sense of intrigue. As part of a larger back story idea, I’m drawing from environments such as Dead Space and Resident Evil.
Having the base of the wall be somewhat darker, with orange accents sticking out in the middle, helps to create a large scale when explored at character height.
Creating and adding extra elements such as pillars, archways, and roof supports, allows for a more believable environment as opposed to a box shaped room.
Finishing the room off with a simple ceiling, allows for our shape to be mostly complete.
The main focal point of this room, is going to be three large tubes used for some kind of experiment. To create further pull to this area, we can introduce simple elevation elements. Different height in gaming can provide a lot more realism as well as exploration. When it comes to indoor environments, we don’t necessarily need a bunch, as this wouldn’t always be practical or natural. But for this scene, a simple raised scaffolding area with stairs can help to further break apart the room, whilst bringing the player to the main area.
Leading into this room is a hallway. As the player travels down the hallway, we want the main room to feel much larger. To do this, our hallway is already narrow, but we can also decrease the height.
Of course, we also need an entry point. This is where our doorways come in to play. We need to think about how the door opens, and therefore, which parts will need to move. To really make this scene come to life, I’ve actually extended the hallway past the door, so the player has to open the door before stepping through to the main room. The asset I found, exists as a prefab of multiple game objects, which allows the inside elements to ‘open up’ by moving them through the use of scripts or the animator.
Lastly, to make this scene somewhat playable, we can add a placeholder character controller. Luckily Filebase has both a First and Third Person Controller we can quickly implement.
For the character controller to work though, we need to add some physics to our room through the use of colliders, otherwise the player will just fall through the floor! We also don’t want to be able to walk through walls!
Colliders can be implemented in various different ways, and it largely depends on the scope of the project. Generally, with a third person view, we need to be a bit more detailed on our collisions, as the user will see a lot more of the character interacting with the environment. For this scene though, I’m wanting to use a first person view, while this makes things somewhat easier, I prefer it for the immersiveness, especially with the horror-esque undertones involved.
Unless I decide to incorporate being able to see the players feet, we can get by with simple box colliders covering the rough floor area. These boxes can also be replicated for the walls, and we can simply extend the size of these past the edge of the surface to prevent the player getting too close. A couple of playtests can go a long way to getting a natural feel.
Unless I decide to add rocket shoes or something, we don’t really need to bother with the roof or anything out of the player’s reach. Additionally, I added a box collider for the column game object I used in the various column and archway prefabs to prevent any collisions with them.
If we wanted to implement the likes of guns leaving bullet holes, or blood splatters appearing on the walls, we would need to repurpose the colliders to instead be Mesh Colliders. These are much more expensive in terms of running power, but would allow us to ray trace accurate positions.
Lastly, one of the banes of both game developers and Claptrap — stairs! As a gamer, this is one of the first things I try to observe in any new highly acclaimed game. I probably shouldn’t, but I can’t help it. We need to create collisions for our stair cases so the player can ascend and descend. The simplest solution is to angle a box collider, making the staircase essentially function as a ramp! Of course, if we were in a third person scenario, we would probably want to try make things look a bit nicer, but that’s a problem for another day!
PS — I imagine realistic stair movement is very much possible, but probably just not worth the expense for a detail so minute. Do feel free to point out games that achieve this, or different methods as to how!
A video game stair enthusiast.
Read Part 2 here.