Overview of the Techniques Used within my Implementation:
- ‘Ooze’-Style biome generation (inspired by an article on Procjam).
- Scriptable Objects - To cleanly store the data on each kind of biome.
- Unity Terrain Features -
‘Ooze’-Based Biome Generation
Inspired by an article on Procjam, this terrain uses an ‘ooze’-based method of creating different biomes. This method is very similar to the common ‘drunken walk’ technique. However, the difference between the two techniques being that the ‘drunken walk’ only expands the area one cell per iteration whereas this method expands in multiple directions per iterations (making it slightly more efficient).
From the mentioned Procjam article!
Scriptable Objects for Data Management
- Scriptable objects were used to store the data for each of the biome types. There is a single ‘biome’ scriptable objects and each type of biome has its own instance. This allows for easy tweaking for each biomes features and settings.
- These settings include:
- The biome’s name
- The biome’s intensity & decay rate (used in the ‘ooze’-based generation)
- The biome’s noise settings such as height, noise scale and number of octaves
- The biome’s terrain texture & normal map
- Any prefabs that dynamically spawn in the biome such as trees
Perlin Noise Height Maps
Integration with Unity’s Terrain Features
- Rather than dynamically building a mesh based, this implementation utilises the built in terrain engine that comes included with Unity. The advantage of this comes approach is that a lot of the optimisation of the terrain done automatically (including back face culling & dynamically reducing the amount of polygons on the parts of the map that are furthest from the player).
Dynamic Game Object Placement
- A game terrain wouldn’t be complete without objects in the world that the player can interact with. Instead of using the object placement features included in Unity’s terrain engine, I chose to dynamically place individual game objects on the terrain. Having these objects as separate from the terrain opens up many advantages such as:
- Additional game logic & classes can be attached to the prefabs that the terrain manager spawns. This opens up the possibility of interaction with these objects at runtime (a key feature of almost all survival games with procedural terrain).
- There is more control over the customisation & optimisation of game objects compared to objects placed as part of the terrain engine. As mentioned earlier, different prefabs will be spawned in each biome (creating a more varied world for the player). These game objects would also be easy to optimise (on a per prefab bias) with components such LODs and systems such as object pooling.