Martyn Patrick / Portfolio
Blocky Life
A small vertical slice of a Voxel based, town building game built in Unreal Engine, featuring procedurally generated worlds.
Players have an independent camera which they can move around the map, as well as the ability to drag select on multiple 'worker units' which they can they order to move around the map (RTS style.) If the player clicks on a tree, when the worker units get close enough they will cut it down. Due to this being a blocky world our poor workers have to jump over every block in their way. To do this, I implemented a simple ray cast Infront of the worker which when an object collides with it, the AI jumps. Unfortunately I didn't get time to implement the 'town building' aspect of the game. But this shows how the 'resource gathering' aspect of the game is supposed to work.
The purpose of this project was for me to brush up on my procedural generation again, delve into unreal engine, to try building something akin to Minecraft's world generation while putting my own spin on it. Which I think I achieved perfectly.
The world generation algorithm uses Perlin noise, Greedy Meshing and a depth based block decision system. So that, blocks below a certain depth are stone, above are dirt and the dirt blocks on surface level become grass. The blocks are split into 32x32x32 chunks (which is where most of the magic happens), and the world generator generates lots of chunks including setting some to generate cave chunks rather than 'surface chunks.'
While I did use a tutorial series to help me make the world generation, I heavily modified it to support: correct tree placement on the surface and cave generation. The greedy meshing algorithm I took whole-sale from a 3rd party project there was no use re-inventing the wheel, especially when you understand what it's doing. The greedy meshing algorithm reduces the number of vertices (and thus polygons) in the meshes of our voxels at runtime by merging them together. So instead of the world being made of thousands of separate cube meshes. They join together, into a larger but far less resource intensive singular mesh now this does make editing the mesh later more troublesome. Not to mention more performance intensive when you want to say.. remove a large clunk of blocks. Nut its most certainly worth it for the overall performance, unfortunately this is another problem I didn't have time to delve deeper into.