Generated Terrain

CSC3095-Stage 3 Project (C++ / OpenGL)

Introduction

The aim of this project was to create an infinite scrolling terrain using procedural generation. I researched various uses and algorithms for procedural generation, created a system for infinite scrolling terrain using a couple of these algorithms, and compared them on performance and graphical detail.

What I Learnt

As part of the research, I gained a far greater insight into procedural generation, including the different types and uses, as well as several algorithms. The software engineering element also taught me the importance of good project management, planning the project with plenty of room for problems to occur, and making sure that I kept to the plan, updating it where necessary.

Images

Implementation

Scrolling Terrain (Scene Graph)

To achieve infinite scrolling, I spilt the world into square chunks, organised in a scene graph. The renderer stored a 5x5 grid of these chunks around the player. When the player moved into a new chunk, rather than unloading and reloading in new chunks, chuncks were moved into a new position.

Procedural Generation (Perlin and Value Noise)

Two different procedural generation techniques were compared: Perlin Noise and Value Noise. I ran each of them at 1, 2, and 3 octaves (the more octaves used, the greater the detail but the slower the generation). I then compared the generation time and how detailed the output was. For the same number of octaves, Perlin Noise took longer but produced better results than Value Noise. However, after several octaves, Value Noise could be ran with more octaves quicker than Perlin Noise, producing more detailed terrain. Though, it's still generally considered that Perlin Noise produces more natural looking terrain, regardless of performance or level of detail.

Possible Improvements

  • The infinite scrolling was left toward the end of the project, and suffered from slow down, with little time to see what was causing it. As I now have far more experience with C++ and OpenGL, I would reduce the slowdown of the effect. Possible solutions may be to improve the memory management of the meshes on the GPU, or using shaders to help with/control the generation of the terrain.
  • the original project mostly only focused on two PCG algorithms, both of which relied on noise. Were I to continue this project, I would look at far more PCG algorithms, including several which do not rely on noise as much, such as the diamond square algorithm.
  • The program constructed the terrain using a 2D heightmap. It would be interesting to see what effect would happen if the PCG techniques were applied to higher dimensions, such as 3D or 4D space.
  • The program focused purely of the generation of the base terrain shape, however, I would also like to look at adding additional features, such as biomes, vegetation or settlements and see how each of the algorithms reacted with each other.