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!
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:
- Part 2 – The logistics of managing a vast library of environmental objects
- Part 3 – smaller and ancillary tricks that make the entire level come together.
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).
The gang starts in the lower right:
They break into a village and get in the way of a goblin attack:
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:
The level takes about 10-20 minutes to play through, and is quite fun. So let’s talk about how we made this!
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:
Unity Terrain lets you “paint” on this surface, using different brushes and sizes:
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:
Using the texture painting tool, it is possible to apply textures to the terrain:
Start with a base texture like grass or dirt, and take it from there:
Add extra textures to create rocks, sand, any type of ground you need:
Roads are easy to create. Simply paint a specific height, and assign a road texture to the terrain:
These are the textures we used for The Fork of Truth:
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:
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.
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:
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.
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:
There are different options for the water surface. The simplest version is a simple flat square with a blue color and transparency:
Unity comes with several water shaders. This is the basic one. It has animated waves and simple reflection, but no transparency:
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:
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.
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.