Asset - Project Procedural Terrain Generation

chaz13

Member
Hey, GMC, it's been a while! (Try 3-4 years). I couldn't help but test out GMS2, and I figured what better way then play about with some ideas I had... So, presenting, Procedural Terrain Generation.



This is a selection of scripts (and demos), showing how perlin noise can be combined with filtering and propagation to make realistic worlds with a number of parameters/attributes that are inter-connected. It is a perfect starting place for a variety of different games which require randomised maps or terrain. From the Marketplace:

A set of scripts/examples for a fully-fledged terrain generator, based on perlin noise.

Allows the generation of a vast variety of world attributes - from elevation, to temperature, to wind strength and direction. Any of the values can be propagated by another. In other words, you can generate the terrain elevation, and from this decide upon the temperature. The temperature gradient can be used to define a wind speed, and then you can propagate moisture and temperature using the wind direction - forming very realistic worlds!

At its core, it's a number of scripts based around generating attributes using perlin noise, filtering, masking and propagation. The final maps can then be created depending on a mix of any number of the attributes. Is it low elevation, and extremely dry? Maybe it's a desert! Mid-elevation, very wet and with reasonably high temperature? Set it as as jungle. There's no limit to what the basic framework can be used for. There are two examples included:

1) An island generator. Generates mountainous islands, where the moisture is propagated by the wind. Jungles, tundra, and forests are decided based upon temperature and moisture levels.

2) A desert generator. Generates slowly changing sand dunes with some mountains. Perlin noise is used to determine the location of oil deposits within the terrain, and sandstorms are formed based upon the wind speed, which is based upon temperature gradients.

The best part of generating complex, interlinked terrains in this way, is that changing any parameters will result in interesting changes the the generation - but all terrains generated with the same parameters will have the same basic attributes.

The examples show 2D, top-down uses of the engine, but there's no reason it can't be extended to work with 3D worlds such as in minecraft, or side-view games like Terraria. The examples also contain rudimental drawing code, to display the results. It can be used to generate anything from islands, to barren wastelands, to simulating nuclear fallout or just about anything in-between. There's some drawing code which helps bring the terrain to life, too, with some rudimentary shading - but this can be extended much further. There's no reason the elevation map can't be used as a heightmap for a 3D terrain, for example.

I can't wait to see what people decide to use this for, please drop a reply here with your creations!
 
Top