Terrain System Changes

William Pheloung

Terrain Update

We have some exciting changes coming to procedural generation in Pigeon Simulator. We’re working on a new system that leverages Unity’s built-in terrain system to create more variety and gameplay possibilities.

Our new system will empower designers to handcraft features into the map with increased flexibility—a nice blend of procedural and handmade content. Some exciting possibilities include custom terrain and unique features that cut under the map, including subway systems and caves.

Further, this system has improved performance and eliminated many tricky bugs we’ve run into, including issues where vegetation was placed in the incorrect space.

We leveraged Unity’s existing tools for terrain editing to manipulate terrain at run time. Currently, we can paint terrain while the map is generated to place tarmac under urban plazas, for example. 

Documentation was sparse for Unity’s editor tools, so it was difficult to learn how to leverage these APIs. We wound up manually having to flush the buffer for the terrain texture layer. We currently believe that this system can be expanded to manipulate the height of the terrain.

Below we can see two screenshots that illustrate terrain being painted at runtime.

Before…

After… the terrain has been painted at the location of the cube.

It may not look like much right now, but soon this will allow for better anchoring of buildings and other structures with the terrain.

After the terrain textures are updated, we can place vegetation where appropriate (ie- trees on grass instead of concrete). As we make updates like this, we run Manual Verification Tests to ensure everything is functioning as intended before adding it to the game. Below, are two screenshots from running these tests. The code under test is used to determine where we can place vegetation. Essentially the code samples Unity’s terrain system to find out if a specific set of coordinates is concrete or grass. A red cube indicates a bad zone for vegetation, while green indicates a good one.

Setting up this system was fairly tricky. Fortunately, we were able to leverage our test harness (see previous dev logs) to write Unit Tests which covered our translation between coordinate systems. Overall, our emphasis on solid testing and update review practices is leading us to more stable builds and fewer regressions, which means much better updates for our players once we enter Early Access.

Below you can see this system in action where plants are spawning on the grass but not the dirt or sand.

This system can sample more than just terrain type though. We have expanded it to also sample terrain height. The power and robustness of these API’s are just the beginning and will afford the team much flexibility in design.

Below is a screenshot of a procedurally generated city leveraging some of the new features. This is a work in progress.