Building levels by the numbers, Part I
I've just started working on the next level for Firefighter VR, and I thought it would be a great opportunity to kind of show how I go about it.
First off, I'd like to preface this by saying that I'm not a Unity expert and I'm not going to claim this is the best way to build a game, or even a remotely correct way to build a game. However, this is how I'm doing it and maybe it'll work for you, too. Or at least be good for a few laughs.
I start with a blank scene- standard Unity stuff. The first thing I do is set the lighting options and bake the lighting data. I disable global illumination, change the skybox, and build the lighting data. Global Illumination is beautiful, but since I'm targeting weak platforms I need to prioritize performance and the lighting is kept very simple. I build the lighting data (what little there is) at this stage because it makes a nice named folder I can put other things in. Which is, admittedly, very lazy, but it saves me a step.
The next thing I do is set up the initial scene hierarchy. I create a blank GameObject called WorldRoot and move everything under it. I also create a new scene controller script- at this point just a mostly-blank class inheriting from a mostly-implemented base- and attach it to the WorldRoot. I add a player object and game menu object from prefabs, plus two Google VR prefabs that turn out to be necessary. In this case I also added a small base to help me position the player.
At this point, it's functional. I can start it and walk around without any errors or undefined behaviour. But it's pretty boring!
I sketch my levels out before building them. This is something I started years ago building levels for Doom, and it's great to have that idea of what you're going to build before you try to put it together. For me they're not very detailed, and sometimes the final result doesn't look anything like the sketch. I don't view this as a bad thing. It's important to be flexible because what looks good on paper might not look or work well in-game, and we have tools that let us tweak and prototype rapidly.
This time, I decided to build the outside surroundings before tackling the main building- where most of the gameplay will take place. There's no good reason for this, it's just what I felt like.
To build the surroundings, I use a mixture of ProBuilder and premade objects. I started with where the building will go and worked my way outwards. First I threw down a parking lot and a base pad for the building using ProBuilder. Then I added some roads from the Asset Store and connected them with a ramp. Then an alley and a fence, then a few buildings to close off the alley. That's pretty much the extent of the gameplay part of the exterior. Everything else the player will see but won't be able to move around in.
This part isn't really planned- it's fluid. There's a lot of trickery going on with the outside of a level. As you can see, I've only built part of a street and a lot of things have no back to them, like the prop towns used in old Westerns. What's going to be visible and what's not is a big factor in how I build. Once I've built the section where the player will be, I'll start thinking about what they'll be able to see from there. I'll add a few things- a section of road, a building, a wall- then test it to see how it looks in game. I call it done once it looks okay and there are no visible edges of the world.
The low-budget/knockoff aesthetic of Firefighter VR means it doesn't have to be perfect, and the mobile focus of the game means it can't be- performance must come first. It's very difficult to draw the lines. A low-end phone may struggle with 10000 tris, while a high-end phone might handle half a million just fine. Lighting and shadowing are expensive, too. Most of these big outdoor objects cast shadows, but I disable them on many small indoor objects. I'll be the first to admit these levels don't look great, but I try my best to make them play well.
So, three hours of work later, the scene is set up. The next step from here is to start building the main gameplay part of the level. Stay tuned for Part II, where I wax eloquent on how I bodge together buildings with ProBuilder!
Get Firefighter VR
Leave a comment
Log in with your itch.io account to leave a comment.