This post originally appeared on paladinstudios.com
- Part 1 – A look at how the terrain in Unity works
- Part 2 – The logistics of managing a vast library of environmental objects
In this final post of the series, I’ll go into all the smaller and ancillary tricks that make the entire level come together.
Point of View
Wherever feasible we try to add fun details into the environment which tell their own story and give “life” to the world.
We use a simple directional light with realtime shadows. A little tip for lighting: The sunlight color should typically be a little bit yellow, and the shadows should be a little bit blue-ish. This simulates a clear blue sky (blue coming from all directions) with a “yellow” sun (the directional light).
Changing the Atmosphere
Texturing on the ground
If at all possible, start with a little backstory on the environment. Who lives here? What kind of people are they? How do they make a living? Where do they walk? Are there any enemies? What are they up to? Where do they come from? We actually wrote a backstory for the village and its surrounding environment, even though you can’t see it. This hidden lore is the basis of everything in the region, and adds to the believability of the place.
- Fine-tune the camera angle, and adjust the environment to make it fit
- Use “open” areas and choke points to balance exploration and progression
- Lighting and atmospherics do not have to be static – change them to change the mood
- Add ambient sounds to increase believability
- Can you let the environment react to the player?
- Where are the goodies? Treasure chests? Little easter eggs?
- Use the Unity Asset Store to quickly fill the level with content (but use it wisely!)
- Write a backstory so it’s easier to fill in the details of the level
There are many, many ways to build a level. I hope this gave you some new insights into creating levels in Unity, and maybe help you with your own!
The Fork of Truth Kickstarter ends July 19th. Please back the project and spread the word!
Part 1 deals with the basic environment setup in Unity, using Unity Terrain. If you haven’t read it yet, you can find it here. In this segment I’ll go into the environmental objects, and how they are set up.
When you work on levels, you have two approaches: Using a modular tile-based system (think “Lego”) or building everything manually. Previous Paladin games, such as Momonga – Pinball Adventures and Nikko RC Racer use the build-it-manually approach. It gives you a great deal of freedom, but because the levels take more time it limits the scope of the game. The level construction also becomes an inflexible and time-intensive process, which hurts iteration and experimentation.
Tiles works differently. Instead of building every asset by hand, we create a set of building blocks, which can snap together. With a small set of blocks you can create some pretty wild variations. Perhaps the biggest advantage of a tile-based system is that it allows for a quick build-test-refine cycle. Setting up (or changing) an entire scene is easy and fast, which allows you to quickly test different variations of the level.
Everything in the game (buildings, crates, fences) is an “object”. Each is made to fit easily into the larger game, and it’s sized specifically to align to tiles. Because all objects are sized in this way, they also align to the other objects in the game. An object is essentially a 3D model in Autodesk 3DS Max. Every object sits in its own file, and this file contains everything it needs. This is what an object could look like:
This proto-watchtower appears at several points in the level, and can be complemented with other objects like palisades, crates, barrels etc. Note that the pivot point is at the bottom of the object. That way we can easily place all objects “on the ground”, as their zero-points are already there too. We save this object in a folder titled “models” in Unity. From there, they are automatically imported into Unity, ready to be used within the game. The proto-tower is not final, it is a simple blockout. The artists have made this for a general indication of size and shape, but we still need to make the final 3D model. We can already start populating the level with this mockup, by turning the 3D model into a prefab in Unity. These “Prefabricated Objects” will be the building blocks we utilize to assemble the level geometry.
We automate prefab generation with Merlin’s Prefab Lab, a plugin that automatically creates a new prefab in Unity for every 3D model. When you then change the source 3D model, Prefab Lab will update the model inside the prefab while preserving the dependencies. When the prefab is up to date, all the objects in the scene will be updated as well.
Every team member can access, modify and create objects. As such it becomes necessary that each object is clearly named, so that there is no confusion in finding them in the huge library. There are many ways to name objects, but we are looking for a structured way that allows us to find the objects in the project folders. Whatever convention you choose, be sure to follow it All The Time.
We use this convention:
“Tree Broad Leaved 01 3×3 Green”
The structure is “Identificator – Modifier – Variant – Footprint – Optical Distinction“, written with capital letters and spaces between the words. It starts with the thing (“Tree”, “Rock”, “House”), followed by the main modifier (is it a large house? A small house?). This is followed by a running number, to allow for variants of the same thing (i.e. 2 different “Rock Large”). The footprint tells us how big an object is in tiles, so we immediately know how big it is without adding it to the scene. This naming scheme groups all related objects together naturally, so we can easily navigate the object library.
To place an object in the scene, go to the prefab in your project-folder and drop in into the scene:
Placing objects in a row is quite useful too. Since all objects have been built to fit the “grid”, they can be snapped together. This way we can create farm-fields (and other constellations) in no time at all:
Using a tile-based system allows you to create levels quickly and painlessly.
- Think in terms of Lego, and determine the tile sizes you want the objects to fit into
- Name the objects consistently for easy access
- Use prefabs to let your object updates propagate throughout the levels
- Use the Snap function to quickly create arrays of objects
For the final game we will create at least 12 levels, all much larger and stuffed with content. They too will be built on the tile system, which is essential for an efficient workflow.
Next time: In the 3rd (and last) part of this series I’ll go into all the little things that make a level come together, like lighting and sound.
This article was originally posted on paladinstudios.com
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.
If you’ve seen our rockin’ trailer or kickstarter video (both now sadly no longer online) 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 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.
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.