Procedural Level Generation#
Discrete Level Generation#
The level is split into discret chunks, the prodecural process will assign each chunk a mesh/entity to be spawned.
A cheap representation of the level is used to speed up the generation process.
Gamekit implements a T3DArray<T>
that can be used as such representation.
From the cheap representation we can generate a (position, class)
pair that can be used to spawn
the required meshes to build the level.
Note
Instead of spawning an AActor
or a AStaticMeshActor
into the level you can add a UStaticMeshComponent
to the spawning actor (the level actor) this will avoid the extra overhead of spawning a full actor.
T3DArray<int> grid(10, 10);
for(int i = 0; i < 10; i++) {
grid(0, i) = WALL;
grid(i, 0) = WALL;
grid(0, 9) = WALL;
grid(9, 0) = WALL;
}
See also
UGKMazeGeneration::RandomWall()
UGKMazeGeneration::RandomizedDepthFirstSearch()
Landscape Generation#
Lanscape can be generated from a height map which can be a regular image. To make a complex landscape multiple layers of maps can be used for different entity.
For that kind of image generation you will want to use GP-GPU compute capabilities to parallelize the generation process as much as possible.
Note
You can get a height map of the real world using tangrams or terrain.party.
