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.