Saturday, March 14, 2015

Environment in Savage Lands: Part 1 - Concept & Sculpting

screenshot from Savage Lands
screenshot from Savage Lands

In my last post I talked about a recent project I'm working on called Savage Lands. Following is the first in a series on how the environment was created.

Concept Phase

Back when we started the project, there were several ideas on the table for what our world should look like. What I was hoping to do was differentiate our world from numerous other survival games, and present a harsh unforgiving climate for a grittier survival experience.

It's funny, I've never been a player of medieval games, or watched Game of Thrones. Most every game I've worked on previously was current, near-future, or futuristic in setting. But as I started to research I became very interested in how GoT treated a setting called "The North", blending both brutal realism and mythical elements in the world.

This research produced our "key" image, the reference that would set the tone for the environment.

key inspirational reference image
The North from GoT, a key inspirational reference image

From there, I made a visual style guide for for the World elements. On large studio games I've worked on, we would typically go way deeper and into greater detail with concept drawings, etc.. But this being an indie project and working with experienced artists, I made a 'lite' style document that provided a broad visual overview.

You can download the style guide here: [zipped Word doc 8mb]

That's a key phrase to remember in all of this: Indie Game. Our hope was to have the core of everything up & running in 3 months. That proved to be wildly optimistic, but the essence of the development process was to move as efficiently as possible, and not rat-hole on anything too specific.

We would start with this direction, then shape it and make it our own interpretation.

Scale & Topology

A lot of discussion ensued about the size of the world. This decision is driven by a variety of factors like the number of players, the speed of player movement, and what the balance is between exploration and player constructed content.

But the reality is, you don't get a true sense of scale until you can actually run around on a map and measure commute times through the space. Some early test maps were experimented with, and the general feeling was that we'd need at least 2x2 km and maybe as much as 8x8 km.

Another classic issue is boundaries, and we decided to go with an island to solve a host of potential issues. Players hate invisible walls, and creating a steep terrain wall around the space makes the world look like a bowl. An island would create interesting water/land interaction spaces, and offer variety to the landscape. If players decided to run into the water, they would die quickly of hypothermia.

So at that point I knew I had to build a big honkin' arctic island. In my head I saw a design that transitioned from sea level up eroded slopes, leading to rolling hills on a broad plateau in the higher elevations.

Crafting the Height Map - Tools

I've been building height map terrains since the first days of KPT Bryce, but it's been a while since setting out to create a game world this way. We needed a tool that would allow iterative design, and generate elements like splat maps, normal maps, and other terrain data.

A colleague of mine had been checking out World Machine, a stand-alone package that uses a node-based interface, and offers a good low-level control for sculpting. It also is designed to work well with Unity 3D, the engine we selected for the game.

Another tool called Terrain Composer seemed like a good fit for texturing & vegetation, and works with World Machine. So the environment pipeline became World Machine -> Terrain Composer -> Unity 3D.

Sculpting the Island

It was very important to me to create a natural, realistic terrain that didn't feel contrived or "gamey". Knowing the play area would be vast, I also wanted as much variation as possible in the topology while keeping things procedural.

After a fair amount of experimentation, I started to envision a 'dual-peak' design. If you only have a single peak, players would just make a beeline straight up the hill to find the highest point. Breaking it into two or more peaks would make the island feel bigger.

In the graphic below, you see the node construction and shaping that takes place in this first stage:

First stage shaping of terrain
Defining the initial shape of the terrain

It starts with a blend of 4 radial gradient peaks, smooshed together then limited using a Constant node. Next we need to add natural break-up to the slopes and some terracing. So we start with the always-magical Perlin noise, and feed that to a Terrace node while using a second Perlin node to modulate it.

Here is the node flow for this stage:

Noise, erosion, and terracing
Breaking up the terrain with organic features

After the Terrace node, we add Erosion and Coastal erosion to emulate the natural flow of water down the slopes. Erosion is brutally expensive in World Composer, it can take up to 10 minutes to calculate the final height map even on a fast system. But it is crucial to providing organic feel and effects of gravity on the terrain.

Adding Game Features

Natural feel is great, but you also need to allow for specific game play features in the design of the terrain. Our designer asked for flat areas to place buildings and other content that would make up abandoned villages and ruins sites. This was partially necessary since the structures were not modeled with "skirts" that would let us sink them into uneven ground.

In the above graphic you may have noticed a node called Layout Generator. This lets you draw spline shapes, then essentially boolean them into the height map. It's pretty tricky to make this feel organic, even with some of the tools they provide to soften the transition of the shapes into the landscape.

Here is a look at a sample shape and it's properties:

Layout Generator & Game Features
Carving features into the terrain

You can see in the above image that the shape cuts into the slope, creating a ridge above and a dropoff below. The area has a roughly 50-75m footprint, with a 10m falloff. The spline shape is easily modifiable, and can be locked when design is complete.

This process was repeated for each village & ruins site on the map. The same technique can be used to create other features like roads, troughs, etc..

Ultimately this tool didn't provide enough true flatness to make the structure placement consistent, so some post-processing was needed on the height & normal maps to ensure we were truly flat in these areas.

The exact issue here is whether you place these features before or after the Erosion passes. You want natural erosion to break up the shape, but it's hard to control how much break up actually gets applied by the erosion. If you place the feature after, you get a really inorganic look with a perfect shape cut into an eroded hill.

Output Stage

The final nodes in the graph create the bitmap output for the main height map, global normal, and masks for defining areas like cliffs.

final output from World Machine
final output from World Machine

The masks are used to limit vegetation, so for example trees & grass don't appear on really steep slopes. They are also used to specify where certain texture maps are applied, ie. steep slopes get rock, flat get snow, etc..

It's important to note that these bitmaps are the starting point for a lot of downstream work. I create many additional masks for things like meadows and clearings, as well as accommodating game objects like large rocks and structures. For example, you don't want grass growing inside houses.

I will go into more detail on masks and splat maps in the next post.

Lessons & Thoughts

It took a lot of iteration to decide just how tall the island is. In the examples shown above, the terrain is MUCH steeper and more vertical than we ultimately settled on.

I like extreme terrain, but early on it became clear that people didn't enjoy running around on 45-degree slopes. It left many people disoriented, and pushed them to keep moving until finding flatter ground. This is an interesting psychological phenomenon, but it also makes a lot of sense for things like situational awareness.

None of my work would have seen the light of day without the outstanding support of my colleagues at Digital DNA Games, an exceptional group of experienced game developers.

Next up, how we displace & texture the terrain:

Part 2 - Terrain Composer & Splat Textures in Unity 3D

Cheers, -H

No comments:

Post a Comment