THE POWER OF THE GODS

IN YOUR HANDS!

local vixen uses her godlike powers to control the environment around her, more at 11 a parody health and safety warning combined with ground proximity warning system alarms

there are few things more satisfying than the power to create a world at your fingertips, but, it's a big job with many ways to do it

classes

in general, there are two classes of terrain generation

flat meshes

doin a basic mesh is about as simple as it gets when it comes to terrain generation. some of the earliest CG shown on film was of this type.

as with any terrain generation shceme, step 0 is your noise function. it's all noise all the way down. please refer to

Basic Theory

 for more information on that

once you have your noise, it's time to apply it. there are implementation details to worry about depending on how specifically you do it, but for the world of infinite terrain there is a pretty simple method.

chunks. each chunk is an individual unit of processing for terrain that can, if so desired, be computed in parallel with other chunks. additionally, most terrain generation schemes are actually completely parallelizable, down to the last little point. as such if you are feeling particularly brave, make your own noise function that runs over an array of points using SIMD! a pretty big chunk of the processing time is in the noise itself so you ought to be able to make pretty good gains this way.

for a mesh system, such as is used in untitiled-car-game-thing one of the most important things to do is to determine the size of your chunk, both in terms of physical space, and in terms of number of verticies that you want to manipulate.

for the godot engine, i found a size of around 80x80 verts produces reasonably good results, and can be stretched a reasonable way without sacrificing too much detail.

if you are feeling clever, you can try and dynamically change the number of verts based on distance to the camera as a sort of LOD, but doing so introduces a multitude of problems, most notably that you are now required to recompute chunks significantly more frequently, and additonallly at quality level boundaries there can be discontinuities leading to visible gaps in the terrain.

in the case of untitled-car-game-thing i found that the cost of recomputing far outweighed the cost of higher gpu usage. (though for voxels, or extremely high vertex counts this may no longer hold true, be sure to experiment!)

for actually generating a chunk, the way to go about it is to first generate a grid of noise values, each of which corresponding to where a vertex will then be. and then using a triangle stiching algorithm to iterate through the epoints and form a series of triangles out of that.

once you have your chunks, its time to move on to the other part of an infinite terrain generation scheme: chosing which chunks to generate and in what order.

typically it is best to generate chunks as close to the player as you can instead of further away. this of course conflicts with the most simple way of doing a chunk gen system, which is a simple dual axis for loop offset by the player's position snapped to the nearest chunk. this is the system i'm currently using in untitled-car-game-thing and for basic purposes like that, you can get away with just having a loading screen or something that will render the game unplayable until enough terrain has generated that the player can begin moving around.

a prioritised system gets around this. i have done one of these once before but frankly, i dont remember how it works at the moment. so i'll have to get back to you on that.

volumetric

everyone's heard of the plethora of silly little block games that get into your head and drive you insane and lose several days of your life at a time. it's easily the most recognisable, but also the most intensive.

conceptually though, it is quite simmilar to the flat plane method. i have actually made far more functioning voxel based generators than i have mesh based.

funnily enough, my first terrain generator, which is still available for viewing, became something of a hybrid design, to cut down on generation times, i only generated a thin film of terrain, with the notable exception of water, which was set to generate a flat sea level and made to just generate water from the surface up to that point. generating water as it turns out is quite slow.