13 min read

In this article by John P. Doran, the author of the book Unity 5.x Game Development Blueprints, we will be creating a first-person shooter; however, instead of shooting a gun to damage our enemies, we will be shooting a picture in a survival horror environment, similar to the Fatal Frame series of games and the recent indie title DreadOut. To get started on our project, we’re first going to look at creating our level or, in this case, our environments starting with the exterior.

In the game industry, there are two main roles in level creation: an environment artist and a level designer.

An environment artist is a person who builds the assets that go into the environment. He/she uses tools such as 3Ds Max or Maya to create the model and then uses other tools such as Photoshop to create textures and normal maps.

The level designer is responsible for taking the assets that the environment artist created and assembling them in an environment for players to enjoy. He/she designs the gameplay elements, creates the scripted events, and tests the gameplay. Typically, a level designer will create environments through a combination of scripting and using a tool that may or may not be in development as the game is being made. In our case, that tool is Unity.

One important thing to note is that most companies have their own definition for different roles. In some companies, a level designer may need to create assets and an environment artist may need to create a level layout. There are also some places that hire someone to just do lighting or just to place meshes (called a mesher) because they’re so good at it.

(For more resources related to this topic, see here.)

Project overview

In this article, we take on the role of an environment artist who has been tasked to create an outdoor environment. We will use assets that I’ve placed in the example code as well as assets already provided to us by Unity for mesh placement. In addition, you will also learn some beginner-level design.

Your objectives

This project will be split into a number of tasks. It will be a simple step-by-step process from the beginning to end. Here is the outline of our tasks:

  • Creating the exterior environment—terrain
  • Beautifying the environment—adding water, trees, and grass
  • Building the atmosphere
  • Designing the level layout and background

Project setup

At this point, I assume that you have a fresh installation of Unity and have started it. You can perform the following steps:

  1. With Unity started, navigate to File | New Project.
  2. Select a project location of your choice somewhere on your hard drive and ensure that you have Setup defaults for set to 3D. Then, put in a Project name (I used First Person Shooter).

    Unity 5.x Game Development Blueprints

  3. Once completed, click on Create project. Here, if you see the Welcome to Unity popup, feel free to close it as we won’t be using it.

Level design 101 – planning

Now just because we are going to be diving straight into Unity, I feel that it’s important to talk a little more about how level design is done in the game industry. Although you may think a level designer will just jump into the editor and start playing, the truth is that you normally would need to do a ton of planning ahead of time before you even open up your tool.

In general, a level begins with an idea. This can come from anything; maybe you saw a really cool building, or a photo on the Internet gave you a certain feeling; maybe you want to teach the player a new mechanic. Turning this idea into a level is what a level designer does. Taking all of these ideas, the level designer will create a level design document, which will outline exactly what you’re trying to achieve with the entire level from start to end.

A level design document will describe everything inside the level; listing all of the possible encounters, puzzles, so on and so forth, which the player will need to complete as well as any side quests that the player will be able to achieve. To prepare for this, you should include as many references as you can with maps, images, and movies similar to what you’re trying to achieve. If you’re working with a team, making this document available on a website or wiki will be a great asset so that you know exactly what is being done in the level, what the team can use in their levels, and how difficult their encounters can be. In general, you’ll also want a top-down layout of your level done either on a computer or with a graph paper, with a line showing a player’s general route for the level with encounters and missions planned out.

Of course, you don’t want to be too tied down to your design document and it will change as you playtest and work on the level, but the documentation process will help solidify your ideas and give you a firm basis to work from.

For those of you interested in seeing some level design documents, feel free to check out Adam Reynolds (Level Designer on Homefront and Call of Duty: World at War) at http://wiki.modsrepository.com/index.php?title=Level_Design:_Level_Design_Document_Example.

If you want to learn more about level design, I’m a big fan of Beginning Game Level Design, John Feil (previously my teacher) and Marc Scattergood, Cengage Learning PTR. For more of an introduction to all of game design from scratch, check out Level Up!: The Guide to Great Video Game Design, Scott Rogers, Wiley and The Art of Game Design, Jesse Schell, CRC Press.

For some online resources, Scott has a neat GDC talk named Everything I Learned About Level Design I Learned from Disneyland, which can be found at http://mrbossdesign.blogspot.com/2009/03/everything-i-learned-about-game-design.html, and World of Level Design (http://worldofleveldesign.com/) is a good source for learning about of level design, though it does not talk about Unity specifically.

Introduction to terrain

Terrain is basically used for non-manmade ground; things such as hills, deserts, and mountains. Unity’s way of dealing with terrain is different than what most engines use in the fact that there are two mays to make terrains, one being using a height map and the other sculpting from scratch.

Height maps

Height maps are a common way for game engines to support terrains. Rather than creating tools to build a terrain within the level, they use a piece of graphics software to create an image and then we can translate that image into a terrain using the grayscale colors provided to translate into different height levels, hence the name height map. The lighter in color the area is, the lower its height, so in this instance, black represents the terrain’s lowest areas, whereas white represents the highest.

The Terrain’s Terrain Height property sets how high white actually is compared with black.

In order to apply a height map to a terrain object, inside an object’s Terrain component, click on the Settings button and scroll down to Import Raw….

For more information on Unity’s Height tools, check out http://docs.unity3d.com/Manual/terrain-Height.html.

If you want to learn more about creating your own HeightMaps using Photoshop while this tutorial is for UDK, the area in Photoshop is the same: http://worldofleveldesign.com/categories/udk/udk-landscape-heightmaps-photoshop-clouds-filter.php 

Others also use software such as Terragen to create HeightMaps. More information on that is at http://planetside.co.uk/products/terragen3.

Exterior environment – terrain

When creating exterior environments, we cannot use straight floors for the most part unless you’re creating a highly urbanized area. Our game takes place in a haunted house in the middle of nowhere, so we’re going to create a natural landscape. In Unity, the best tool to use to create a natural landscape is the Terrain tool. Unity’s Terrain system lets us add landscapes, complete with bushes, trees, and fading materials to our game.

To show how easy it is to use the terrain tool, let’s get started.

The first thing that we’re going to do is actually create the terrain we’ll be placing for the world. Let’s first create a Terrain by selecting GameObject | 3D Object | Terrain.

Unity 5.x Game Development Blueprints

At this point, you should see the terrain on the screen.

If for some reason you have problems seeing the terrain object, go to the Hierarchy tab and double-click on the Terrain object to focus your camera on it and move in as needed.

Right now, it’s just a flat plane, but we’ll be doing a lot to it to make it shine. If you look to the right with the Terrain object selected, you’ll see the Terrain editing tools, which do the following (from left to right):

  • Raise/Lower Height—This will allow us to raise or lower the height of our terrain in a certain radius to create hills, rivers, and more.
  • Paint Height—If you already know exactly the height that a part of your terrain needs to be, this tool will allow you to paint a spot to that location.
  • Smooth Height—This averages out the area that it is in, attempts to smooth out areas, and reduces the appearance of abrupt changes.
  • Paint Texture—This allows us to add textures to the surface of our terrain. One of the nice features of this is the ability to lay multiple textures on top of each other.
  • Place Trees—This allows us to paint objects in our environment that will appear on the surface. Unity attempts to optimize these objects by billboarding distant trees so we can have dense forests without having a horrible frame rate. By billboarding, I mean that the object will be simplified and its direction usually changes constantly as the object and camera move, so it always faces the camera direction.
  • Paint Details—In addition to trees, you can also have small things like rocks or grass covering the surface of your environment, using 2D images to represent individual clumps with bits of randomization to make it appear more natural.
  • Terrain Settings—Settings that will affect the overall properties of the particular Terrain, options such as the size of the terrain and wind can be found here.

By default, the entire Terrain is set to be at the bottom, but we want to have ground above us and below us so we can add in things like lakes.

  1. With the Terrain object selected, click on the second button from the left on the Terrain component (Paint height mode). From there, set the Height value under Settings to 100 and then press the Flatten button. At this point, you should note the plane moving up, so now everything is above by default.

  2. Next, we are going to create some interesting shapes to our world with some hills by “painting” on the surface. With the Terrain object selected, click on the first button on the left of our Terrain component (the Raise/Lower Terrain mode). Once this is completed, you should see a number of different brushes and shapes that you can select from.

Our use of terrain is to create hills in the background of our scene, so it does not seem like the world is completely flat.

  1. Under the Settings, change the Brush Size and Opacity of your brush to 100 and left-click around the edges of the world to create some hills. You can increase the height of the current hills if you click on top of the previous hill.

    Unity 5.x Game Development Blueprints

    When creating hills, it’s a good idea to look at multiple angles while you’re building them, so you can make sure that none are too high or too low In general, you want to have taller hills as you go further back, or else you cannot see the smaller ones since they’re blocked.

    In the Scene view, to move your camera around, you can use the toolbar at the top-right corner or hold down the right mouse button and drag it in the direction you want the camera to move around in, pressing the W, A, S, and D keys to pan. In addition, you can hold down the middle mouse button and drag it to move the camera around. The mouse wheel can be scrolled to zoom in and out from where the camera is.

    Even though you should plan out the level ahead of time on something like a piece of graph paper to plan out encounters, you will want to avoid making the level entirely from the preceding section, as the player will not actually see the game with a bird’s eye view in the game at all (most likely). Referencing the map from the same perspective as your character will help ensure that the map looks great.

    To see many different angles at one time, you can use a layout with multiple views of the scene, such as the 4 Split.

  2. Once we have our land done, we now want to create some holes in the ground, which we will fill with water later. This will provide a natural barrier to our world that players will know they cannot pass, so we will create a moat by first changing the Brush Size value to 50 and then holding down the Shift key, and left-clicking around the middle of our texture. In this case, it’s okay to use the Top view; remember that this will eventually be water to fill in lakes, rivers, and so on, as shown in the following screenshot:

     Unity 5.x Game Development Blueprints

To make this easier to see, you can click on the sun-looking light icon from the Scene tab to disable lighting for the time being.

At this point, we have done what is referred to in the industry as “grayboxing,” making the level in the engine in the simplest way possible but without artwork (also known as “whiteboxing” or “orangeboxing” depending on the company you’re working for).

At this point in a traditional studio, you’d spend time playtesting the level and iterating on it before an artist or you will take the time to make it look great. However, for our purposes, we want to create a finished project as soon as possible. When doing your own games, be sure to play your level and have others play your level before you polish it.

For more information on grayboxing, check out http://www.worldofleveldesign.com/categories/level_design_tutorials/art_of_blocking_in_your_map.php.

For an example with images of a graybox to the final level, PC Gamer has a nice article available at http://www.pcgamer.com/2014/03/18/building-crown-part-two-layout-design-textures-and-the-hammer-editor/.

Summary

With this, we now have a great-looking exterior level for our game! In addition, we covered a lot of features that exist in Unity for you to be able to use in your own future projects.  

Resources for Article:


Further resources on this subject:


LEAVE A REPLY

Please enter your comment!
Please enter your name here