

Intention - 2018
Survival, RPG
Survive the Darkness, Learn What it Means to Become Omnipotent...
Intention is an exploration, boss-rush, RPG, survival game, set in a world where all hope is lost.


About
Intention, is my main side project. I started making Intention back in 2018 and it has served as a large part of my learning process. Intention is by far my largest scoped game and also my most documented. Set out to be a survival RPG, the core gameplay is focused on fighting bosses whilst telling a subtle but meaningful story through boss dialogue and item descriptions.
Terrain
All the terrain in Intention is procedually generated using a mixture of noise algorithms, all blended together, to make more natural looking terrain. The terrain is generated on a chunk by chunk basis on a seperate CPU thread. It is calculated by first getting the ground height to create hills and mountains. Then to create caves, any voxels below the hill height are cut out using another noise set. Using another noise set, ores are placed in clumps throughout the cave system.
Marching Cubes
Once a chunk receives its terrain data it uses another algorithm called marching cubes to form a mesh. This works by deviding the whole chunk into smaller cubes (cells). Then for each cell we calculate what triangles need to be added to the mesh. To do this, each corner of the cell is checked if its inside of the terrain or outside, then we insert this value into the corresponding bit of a byte. Once all corners are checked, we have a byte where each bit represents whether the voxel is empty or not. We then use that byte in a lookup table containing all 256 possible triangulation formations. All triangles are then added to the chunk mesh.
Octree Algorithm
Because a lot of chunks will contain groups of the same voxel, a lot of cells wont get drawn because they are either empty or hidden underground. Therefore the marching cube algorithm can be optimised by storing the chunk data in an octree data structure. A recursive loop goes down each branch in the octree. If a node is reached with all voxels being the same type, then the search won't continue down any child branches, saving the ray marching algorithm from having to calculate what would be nothing.
Terrain Modification
Because the terrain is stored as a bunch of points, we can actually modify the voxels at runtime, resulting in fully destructable terrian. To allow the player to place and remove voxels, we raycast into the scene until a point is hit. Then we calculate what voxel is the closest and that voxel is modified. The chunk mesh is then recalculated.
Features
-
Fully destructible terrain
-
Procedural terrain generation
-
Chunk loading and saving
-
Marching cubes
-
Multi threading
Screenshots







