top of page
Cave Gen (C++ / OpenGL)
ROLE(S)
Personal Project
Overview
Cave layout simulation in my custom engine coded in C++ using OpenGL. The simulation allows for varying grid fill percentages and levels of smoothness, which can be run one step at a time.
Project Duration
~2 Months
Engine
Custom (C++ with OpenGL)
PLATFORM
PC (VS Solution)

Project Background
This project was done as part of my university course where I chose to take up "Graphics and Simulation" as my optional module choice for my second year.
In our first few weeks, we were tasked to create our own game engines in C++ using OpenGL and to create our own shader to go with it.
Engine Summary
The engine I made has the base functionality to move around in the scene, rotate the camera and to re-size the window, allowing for full screen or standard resolutions in windowed.
I added in some basic lighting shaders I made as a first attempt to light the scene and then experimented at a first try with post-processing affects, which I used to achieve a "3D"-style view effect on the terrain, as well as adding a bit of noise as a test/learning experience but also to add some texture to the objects in scene, making it easier to see depth. I achieved the post-processing effect by creating a quad that sits in-front of the camera. I then apply the effects I made to the quad, affecting everything rendered through it, like a lens.


Cave Generation
After making the engine, we then had a week to optionally add some form of mechanic or example work that makes use of our engine, which is where I added the cave layout generation as I had yet to experiment with noise maps and I wanted to use this project to learn a little more about how to utilise them.
After some research into some solutions, I opted to use a cellular automata model that I found, using it by generating a 2D grid of data based on a variable percentage of the grid that should be filled to begin with, then taking an adjustable number of steps to smooth the grid out (using the method of cellular automata). This meaning that based on the status of neighbouring grid spaces, a grid space will determine if it should be empty or full.
For example, a grid space that started filled in, might empty/remove itself if no neighbouring tiles are filled in, hence smoothing the cave by creating the branching and sprawling pathways.
bottom of page