Building Levels in Unity – Part 1 of 3

September 6, 2016: We are looking for a Unity C# Developer and Node.js/Back-end Developer to join our team. You can find the vacancies here!

Hi! I’m Matthias Zarzecki, and I’m making the levels Looking For Group – The Fork Of Truth (among other things).

In this series we’re going to use Unity to create a game environment. The first part will deal with the basic landscape – the terrain on which the rest of the environment is built. You can find the other two post over here:

If you’ve seen our rockin’ trailer…

…or our Kickstarter video, you can see the environment the characters fight in.

To make these videos, we set out to actually built a playable level. It serves as a prototyping area, to test the combat system and overall look-and-feel of the game. We wanted to use actual footage for the Kickstarter videos, so people would know what to expect. Ultimately this resulted in a fully functional game (albeit a rather short one).

Level overview

The gang starts in the lower right:

lfg_01

They break into a village and get in the way of a goblin attack:

lfg_02

Then they get a quest from a farmer (actually a goblin in disguise), and track down the goblin menace. They are lured into a trap, resulting in the final battle in the goblin camp:

lfg_05

The level takes about 10-20 minutes to play through, and is quite fun. So let’s talk about how we made this!

Terrain

The entire level uses the Unity Terrain. It is a great way to create natural landscapes.

To get started with Unity Terrain, select “Terrain” -> “Create Terrain” in the menu bar. You start with a flat plane:

lfg_terrain_01

Unity Terrain lets you “paint” on this surface, using different brushes and sizes:

2013-07-05_1438_001

Using the Height painting tool (the first mode), you can paint height differences. Simply select the right mode, and paint your terrain on the plane in the Unity viewport:

lfg_terrain_02

Using the texture painting tool, it is possible to apply textures to the terrain:

2013-07-05_1438

Start with a base texture like grass or dirt, and take it from there:

lfg_terrain_03

Add extra textures to create rocks, sand, any type of ground you need:

lfg_terrain_04

Roads are easy to create. Simply paint a specific height, and assign a road texture to the terrain:

lfg_terrain_05

These are the textures we used for The Fork of Truth:

2013-07-05_1437

With these simple tools, you can create complex terrains that are convincing and interesting to look at. You can see the road texture painted on the right, and the height differences in the pool:

2013-07-05_1434

Unity Terrain is an awesome feature, and offers a wide array of options and ways to create a world. You can sculpt almost any kind of landscape with it. Create streets, rivers, canyons – all with a swipe of the mouse.

Verticality

But you have to be careful not to overdo it. Things may look great, but a hilly terrain could give you all kinds of level design headaches.

Height differences make placing things a chore. You might end up spending hours adjusting the vertical position of the objects in the scene, so that they don’t float in the air or are stuck in the ground.

The basis for the LFG-game is a flat plane. There are still hills and depressions, but these are purely visual. You can’t actually reach them. You can see some of these non-flat areas highlighted in the picture below. They are inaccessible due to obstacles and invisible walls:

lfg_hills_02

Another benefit of keeping your level flat is simpler attacks. Attacks and abilities become much more complicated when there is an uneven terrain. Does a summoned tornado move horizontally, or does it move along with the floor? If so, could it move up a cliff? If you are standing on a hill, does your fireball hit the enemies below or do they fly over? What about if there is a hill between you and the enemy?

Keeping the level “flat” gently sidesteps these problems. Games like Diablo, Torchlight and Magicka use a mostly planar environment as well. And with good reason.

Note that even though we kept the walkable areas flat, we did add uneven ground in some places to give the impression of depth. For the extended game we plan on using height in the levels. Height-differences and cliffs make for interesting level design, so we don’t want to leave it out for the real thing.

lfg_04

Water

The characters can’t interact with water in The Fork Of Truth (yet).  Should anything fall into the water anyway, like a goblin thrown by an attack, it is killed immediately.

The river in the level is a depression in the terrain, moving down to 30 units below the “floor-level”. Here you can see the river “canyon”, with some decorative objects placed within. All it needs is a bit of water:

lfg_water_01

There are different options for the water surface. The simplest version is a simple flat square with a blue color and transparency:

lfg_water_02

Unity comes with several water shaders. This is the basic one. It has animated waves and simple reflection, but no transparency:

lfg_water_03

This one is a more advanced version (the coloring is a bit off at the moment). It is transparent, and has all of the wave-animations of the previous one:

lfg_water_05

The next one is just about perfect (it is called “Water4” in Unity Pro). It is transparent, reflects the environment, has animated waves, and nicely fits the cartoony visuals of the game. It also has an interesting “fizzle” area at the borders. Even though it has all of this great stuff, it doesn’t kill the framerate like some of the other advanced water types.

lfg_water_04

Conclusion

The level building process in Unity starts with the general terrain layout. Here is a summary of the tips:

  • Use the Unity Terrain for fast landscape sculpting and texturing
  • Keep the walkable paths flat for easier level design
  • Unity has several great water shaders, we used the Pro shader “Water4”

Running around in an essentially empty level with just the ground and water beneath your feet can still be satisfying. If that is indeed the case, you have built a solid foundation for the rest of the level.

Next time: We’ll have a look at placing the objects in the level, and fill up the environment with trees, bushes, fences, and other doodads.

Curious about the The Fork of Truth? We are running a crowdfunding campaign on Kickstarter. Check it out, and if you like what you see, be sure to back the project and spread the word!

Thanks,
Matthias

19 Comments

Post A Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.