A closer look at landscape generation in Hytale

Hi there! In this post, we're going to take a closer look at Hytale's world generation system - specifically, the various techniques we use to create dramatic, procedurally generated landscapes across each of adventure mode’s zones.

We first discussed this topic in January 2019, and you may wish to go back and read our introduction to worldgen in order to get a broad sense of how our rules-driven generation system works and what we're trying to achieve with it. Today, we're going to get into some more specifics - and demonstrate how Hytale modders will be able to customize worldgen to suit their own purposes.

First, though, we need to talk about noise.

Noisemaps and heightmap interpretation

In the context of our procedural generation systems, a 'noisemap' is a set of random numbers that can be combined with a variety of functions to support a vast number of different kinds of generation.

We use noisemaps for lots of different aspects of Hytale's content generation system, including all of the various landscape-related systems that we'll be detailing later in this article. One of the most striking uses is in the formation of the zones themselves.

This image is from a simple visualization tool and previews the result of combining noisemaps with another important feature of landscape generation - heightmap interpretation. In this case, the environments being simulated are the rocky plateaus of Zone 2.

Heightmap interpretation involves additional sets of numbers that allow us to establish how high or low certain noisemap features will appear on the terrain being generated. By tweaking heightmap interpretation thresholds we can, for example, take a set of noisemaps that would create a winding waterway and adapt them to produce dramatic river canyons.

"Our technical artists learn noisemap composition as a craft" says world generation programmer Slikey. "They have a large toolbox of different noise types and operations for combining them. It takes time to learn to balance complexity, performance, and design - we're constantly discovering new ways to combine noisemaps to generate unique terrain or place prefabs in unexpected ways."

When we're happy with our configuration of a biome's noisemaps and thresholds, we implement these rules into the game itself.

This clip shows multiple noisemaps being added to a landscape one after another, starting with a general landscape and then introducing the rules for Zone 2 river and mountain biomes. The gradual growth in complexity that you see in this clip is for illustrative purposes: in reality, once the noisemaps and thresholds for an area have been established, the landscape is generated all at once.

Layers, covers and prefabs

At this stage, we've got a landscape with plenty of blocks and a few major features like rivers, mountains and shorelines. The process of giving environments their personality occurs across multiple stages, each with its own procedural generation processes.

We start with 'layers'. These are another kind of noisemap that is used to specify both the depth of certain kinds of blocks in the terrain, as well as the kinds of blocks that will appear on the surface. The screenshot above shows the various layers that comprise a landscape in Zone 3, with plants and vegetation removed to make it easier to see the underlying materials.

The next step involves 'covers'. 'Cover' refers to incidental environmental details like grass, foliage, mushrooms, crystal outcrops, and so on. By configuring the covers for a given area, we can tell the worldgen system what kinds of plants should appear on which layers. For example, we might establish that dense shrubbery should only appear on grassy layers, while moss might occur on rocky surfaces underground.

Prefabs provide the finishing touches and are frequently what give environments their specific identity. Prefabs are arrangements of blocks, created by our technical artists, that are distributed throughout the environment by the worldgen system.

Incidental prefabs like trees are encountered frequently by the player and are distributed like other kinds of ground cover.

Here's an example of the transformation that takes place when layers, cover and incidental prefabs are applied to a new landscape:

The prefab system also supports larger structures and points of interest, which you may remember from this blog post from March last year. We’ve built thousands of prefabs to support adventure mode’s worldgen system, and modders will have the freedom to use these or build their own when customizing the world.

Prefabs are configured separately in order to assure that their appearance in the world is believable and feels special. Zones where larger prefabs can appear are mapped out using a different kind of noisemap:

This is an example of Voronoi noise, which creates cell-like patterns. For Hytale, we use these 'cells' to establish where large prefabs can and can't occur. In the image above, the purple spots represent areas where a large prefab might be encountered, and collectively account for about 20% of the generated space. If we wished, we could increase or reduce this density.

When taken all together, layers, cover and prefabs help us create environments that combine the dynamism of procedural generation with the sense of purpose that comes from incorporating hand-designed buildings and environmental features.

"Worldgen is an amazing system" says technical artist Amber. "It gives us so much control and allows us to be incredibly creative with the system. We've often created landscapes and showed them to Slikey, and he's said 'wow, I had no idea you could even do that!'"

There are other aspects of worldgen that we haven’t covered in today’s blog - particularly cave systems, dungeons, and the ways that zones intersect with one another. These are huge subjects unto themselves, so we’re planning to cover them separately in our next deep-dive into Hytale’s generation systems.

We hope this article has helped you understand a bit more about how Hytale's world is created. All of the systems that we've described in this post will be accessible to modders through extensively customizable configuration files. By combining asset creation in Hytale Model Maker, our block building tools, and the underlying world generation system, you'll be able to generate unique environments of your own.

Here's one we put together ourselves!

This custom landscape uses all of the techniques outlined in this post - including new prefabs - to realize a sci-fi setting within Hytale’s worldgen system. We can’t wait to see what Hytale modders are able to do!

To download a zip containing the video clips featured in this post, click here!