Mighty Terrain Generator

Mighty Terrain Generator Is a highly configurable, efficient and fairly easy to use terrain generator that could add a stunning landscape to your game and massively boost its replayability.


Please note that this package is still in a very early version and could be subjected to breaking changes. In case if you are using it in your game and you are experiencing issues caused by the update, please do not hesitate to contact me via Discord.


Package contains three terrain generator templates.

BlankTerrain - is a boilerplate for new terrain. It contains only the default settings and only recommended for advanced users.

SampleFuturisticTerrain - contains a SciFi terrain. It features very cool futuristic design, has massive and interesting caves and pillars that are very cool to climb on.

SampleForestTerrain - contains classic forest terrain. It uses a spherical brush to create natural-looking scenery. It also utilises a bunch of decorative templates for a real forest look.

Template Structure

Controller

TerrainControllerScript is a main point of communication with your terrain generator.

To start generating call TerrainControllerScript:GenerateTerrain() method
To destroy the generated terrain call TerrainControllerScript:DestroyTerrain()

Properties:

debugMode - when checked will automatically call GenerateTerrain. Useful for debugging and development.

Very important: NEVER leave the editor with the “simulate on” on the template entity and “debugMode” enabled. It is known that large simulated voxel meshes can crash the editor on the startup which might put you in a situation where you have to rollback the changes to your game or even start from scratch

onProgress - event that is fired during the generation process. Your callback will receive the progress argument.

onComplete even that is fired when generation is complete.

Builder

TerrainBuilderScript manages the whole generation process.

Properties:

size - is a dimension of the cube containing the terrain. As units it uses a bitSize * voxel size (25). For example, if you have specified size of 200 and a bitSize of five 5, the resulting cube size containing your terrain will be 200 * 5 * 25 = 25000

bitSize - the size of the terrain grid cell and the terrain brush. Uses voxel size (25) as units

alwaysRandom - if checked will always generate a random terrain

seed - allows you to specify a seed for a random generator which allows you to build a specific terrain over and over again. Same seed values will always result in the same generator output.

surfaceLevel - allows you to control the size of the underground section of your terrain. The value should be specified relative to the result size of the cube container cube.


surfaceLevel 0 on the left and 0.05 on the right

closeMapBottom - covers the bottom of the underground section of the terrain to make sure that no caves end up with holes underneath.

closeMapBottom unchecked on the left and checked on the right

surfaceModifiers - contains the list of surface modifier script assets (These modifiers scripts should also be put into Modifiers script directory within this template) which allow you to affect the surface of your terrain. Currently, the package only contains two modifiers but more will be added to the future. I will cover modifiers in more details in an upcoming tutorial.

Brush

TerrainBrushScript is responsible for drawing voxels and picking correct voxel materials

Properties:

brushType - defines if generator uses SetVoxelBox or SetVoxelSphere function.


brushType set to “Sphere” on the left and “Box” on the right

brushVariation - defines max random scaling factor applied to each individual brush stroke
brushVariation only scales up. For example value 0.6 mean that the brush could gain an additional 60% to its size

distortBrush - allows unconstrained scaling of the brush, which means that brush could be scaled differently on x y and z axes

materialHeights - a list that defines at what relative altitudes the voxel material could appear. 0.0 marks the surface level and the values are specified in relation to container cube size.

materials - a list of voxel materials. This list is closely coupled with materialHeights and should always have the same number of elements

secondaryMaterialChance - how likely the secondary material will be picked instead of the primary one.

secondaryMaterials - a list of secondary materials that could be used on the same altitudes as the primary ones. This list is closely coupled with materials and materialHeights and should always contain the same number of elements unless the secondaryMaterialChance is 0

materialNoiseFrequency - defines the frequency of the noise function that applies the secondary materials.


materialNoiseFrequency is set to 10 on the left and 20 on the right

Decorations

TerrainDecorationsScript scatters decoration templates instances over the surface of the terrain

Properties:

zMin - defines the minimum relative altitude for the decoration to appear on. 0.0 marks the surface level of the terrain.

zMax - defines the maximum relative altitude for the decoration to appear on

chance - defines how likely the generator will choose to use the decoration after the terrain brush stroke

templates - a list of decoration templates to pick from. Right now all decorations have an equal chance to be spawned. If you need to increase the chances of a particular template, just duplicate the entry.

Topography

TerrainTopographyScript manages cave or surface topography by utilising multiple layers of 3D Perlin Noise

Properties:

topographyType - defines if this topography script is used to define caves or a surface

valueThreshold - defines how likely it is for the cave to appear. Only available for cave topography

octaves, scale, offset, lacunarity and persistence allow you to control the noise that defines your terrain surface or a cave typography. To learn more about them please refer to my blog post about procedural terrain generation.

All this information will help you to set things up and add amazing landscapes to your games.
Tutorial videos and more exciting features are coming soon!

4 Likes