Mastering Unreal Engine 4.X
上QQ阅读APP看书,第一时间看更新

The art of level design

While this is not a level design book, I've to say that designing a level and design in general is not about tools, techniques, and technology. In fact, it has nothing to do at all with techniques or engines. It is an artistic and creative thing.

But there are always major points that you have to keep in mind while designing a level; these points depend on the game itself, its genre, its story, and lots of other factors. But for Bellz, I've found the following points come in handy to the game:

  • The level has to tell a story: I need the player to tell the story of the level through it. I don't want to show the player a movie describing what happened here before he came to the level, and I don't want to display text to tell what happened at this place. But I want my level itself, and the positioning and selection of assets, to tell the story of the place on its own.
  • The level needs to look eye-catching: Having a fantastic game is not only a result of using good and polished assets, but also of the way the assets are placed and used. I need my level to use top high-end quality. I need to put a sky dome, moving skies, sun light, and water that moves. I need to add anything that makes it look amazingly real.
  • The level has to be efficient: This means that I need to use the fewest possible resources as possible. We are talking here about a top-quality game; we can't add things forever. We have to be worried about the performance, the size, and the quality. The level has to be modular and bidirectional. It has to be modular when it uses fewer assets, but in a different way; the same assets should create different things. It has to be bidirectional when I do force the player to move all over the place several times.

Those are the factors I care about for this game, but the art of level design has lots and lots of tricks and todos. If you are interested recommend you start with the following article at Wikipedia, where you can learn more skills about the level design process and get an overall idea: https://en.wikipedia.org/wiki/Level_design.

I would suggest you spend some more time, if you are interested, and read these episodic articles on about level design, at: http://www.gamasutra.com/blogs/DanTaylor/20130929/196791/Ten_Principles_of_Good_Level_Design_Part_1.php.

As we have already imported the needed assets from the launcher in Chapter 1, Preparing for a Big Project, you can now start placing the assets to build the map you have imagined.

Placing assets into the world

Now is the time to actually start visualizing the world and make it real through the process of asset placement. This is an artistic step, where you have to use your imagination in order to place the assets. The process of placement itself is just a matter of dragging and dropping items from the content browser into the map, just as expected!

As we have mentioned earlier, level design has to be modular, which means that we use as few pieces as possible in order to construct the final level, but we combine these together in different ways in order to give differently composed items.

If you have imported the assets package from the Unreal launcher, as we discussed during Chapter 1, Preparing for a Big Project, you'll end up having this set of modular assets ready to be used in the map designing process.

When I say "composing the modular assets together to build different pieces", I mean that we can take the column asset, for example, and just place it in the world to look like this:

On the other hand, I can add another decorative asset to it in order to give it more effect, such as adding damaged ground bricks, to give the feeling and story that something happened near that, as follows:

Alternatively, I could even combine both together and add one more asset to give a good visual of the bridge, as follows:

As you can see, with all three cases the asset has a different role, and it does not even look the way it should as an individual asset.

Now, you know what you have to do. It is all about combining assets and positioning them. Go into the content browser and start dragging and dropping the items into the map. You may need to drop the same asset several times; you can simply copy and paste it with Ctrl + C, and so on, as you would do with a piece of text.

I would suggest that you first make an outline on paper, when you have a chance to keep changing, erasing, and updating the design, which will make things faster for you in the editor, and perhaps will save you some time while removing and adding loops.

The point is that design is a more artistic area that depends on personal choice, where you can just imagine what you can do with the set of assets in hand, and you can keep trying. Keep what you like; if you dislike something, simply remove it. It is a process of dragging and dropping items into the map; apart from these, you can just position, rotate, and scale assets to give the feel you want.

Using brushes to enhance level design

Your world is not yet ready for players or enemies, as all those meshes you've used mostly have no collisions. This means that the player will fall from the ground and can go through walls.

When you import assets, you have the choice to build colliders for them—colliders that almost fit the shape of an asset. But this is costly when you do it for tons of assets. From a level design perspective, designers prefer to put the assets and then collisions as a layer of geometrical shapes while laying out the level.

Unreal Engine has a variety of range of meshes and shapes that could be used for different purposes. One of the most interesting shape types is brushes, called BSP. These shapes are not only placeable, but are also modifiable at the vertex and face level, which means that you can use several cubes to build a complex shape. The currently supported brush shapes are the following ones, which can be accessed from the BSP section of the Modes panel.

Now, the goal is simple! While those brush shapes could be invisible, we will be throwing lots of them around the map, and making them invisible and not renderable. At the same time, we will be enabling collision for them. This way, the brushes we use will be behaving as invisible walls.

Using this method will guarantee that, regardless of the amount of collision surfaces we have in the level or in the game in general, they will be basic shapes at the end of the day: no hulls, no convex shapes, no mesh colliders that are costly in large numbers.

In order to convert any brush shape you create into a blocking surface, you have to run through the following two important steps:

  1. After creating the shape itself, you will need to convert its actor to a blocking surface by setting the value Convert Actor of the Actor settings from the Details panel to Blocking Volume.
  2. Converting to a blocking volume will add few more settings to the brush in the Details panel. All you have to do now is set Collision Presets to something that fits your need. I found Invisible Wall or Block All Dynamics; both choices will get the job done.

Adding lights to the level

Now we have a map that is well made and well designed; it has all we need to serve our story, and it also has collisions and layouts to give the player a good and realistic experience.

Talking about realistic experience, our level still isn't lit, which means that it is not going to be visually appealing or even realistic (if the game has to be realistic). This means that we need to add some sort of lighting to the map in order to make it clear and vivid!

The process of lighting a map is an artistic process in its core, where you have to decide where to put the lights, the color for each light, and even the type of light, and the angle for its rotation. All these factors affect the final result and that will in turn affect the player's experience. But while it seems so artistic, it is also a very technical topic, as you have to be aware of light types, shapes, and performance in order to guarantee a smooth experience.

In case you have no experience with lighting within Unreal Engine, I highly recommend you to read one of my previous Unreal books, Unreal Engine Lighting and Rendering Essentials (https://www.packtpub.com/game-development/unreal-engine-lighting-and-rendering-essentials). It is all about mastering lighting and rendering within Unreal.

For such a level, or in general for most of my games, I do count on lightmaps, which we will discuss next, in order to get the best quality and the best performance. But also, building the lightmaps itself requires us to add some lights throughout the earlier level.

Now, you probably have a map that looks different from the one I have, so the number of light sources or even the light settings might be different. But in my case, I needed to put the following:

  • Directional Light: Directional Light is essential for any outdoor scene and, perhaps, for some indoor scenes, as it is simulates sunlight (infinite rays in one direction), which means that it is probably essential for the map you've created too. The most interesting part of Directional Light is that rotating it will give you a different timing of the sun and it has the ability to create light shafts! You can find the Directional Light source inside the Lights section of the Modes panel. Adding it to the map is a matter of drag and drop. Then, you can change the color and light settings that will make your level look the way you want it to.
  • Point Light: Point Light is less important than Directional Light, and you might make an entire game without the need to use one! Point Light, as its name implies, emits light from a point in all the directions in a spherical shape; the emitted light is not infinite, unlike Directional Light, which means the light rays decay after a specific distance that you can define. I put a few point lights in my map to enhance the visual; it well good for fire and such light sources that light specific distances. Point lights are accessible from the Lights section of the Modes panel, and are placed by dragging and dropping them into the level.

    Put in some point lights if your map requires them; they don't have that much effect on performance, but they do have a huge effect on the visual, especially if they have a variation of different colors rather than the main sky/directional light color.

  • Lightmass Importance Volume: Lightmass Importance Volume is one of the volume types that you can find inside the Modes panel under the Volumes section.

Also, you can create one from scratch in a shape that fits your needs. If you have just created a brush, as we mentioned earlier, you can convert it into a Lightmass Importance Volume rather than into Blocking Volume.

Lightmass Importance Volume is very essential as long as you are using lightmaps and as long as you have a huge level. Sometimes, there are a lot of meshes and details out of the player's reach, for example, far away mountains, and you are sure that the player will not be reaching it. In cases like these, you need to somehow exclude those items from the process of building the lightmaps.

Building lightmaps is a matter of throwing photons around the level while having lots of faraway meshes. This means throwing more and more photons and, at the same time, taking even more time while building the lightmap itself this is even worse at the end, when you get huge lightmap files!

So, if your levels have some parts that are not required to be lit, I would recommend you put in a Lightmass Importance Volume and scale it to fit the playable and reachable area of the level. In my case, the following is how it looks when it just includes the playable section of the map.

Now with all that in the level, I bet you have a very vivid and visually appealing level, with everything lit and looking as nice as it should. But, as we are making a game that needs to run almost 60 frames per second, we have to worry about the performance, not only on the development machine, but also on the weakest computer a player might have. This means that we have to start baking and saving some lightmaps, which we will do next.