Recently, I made a simple space combat shooter as a school project for a programming class. It was very simple, and far from complete, but I thought it’d be cool to post it here. Be warned: it is not high quality, and is the result of limited time in the classroom. Here is the webplayer link for anyone interested. WASD to move, mouse to look, left click/space to shoot, right click for rockets.
Using a code library for Unity called CoherentNoise, I have generated perlin noise and used it to apply a height map technique to my chunks. It looks nice, but biomes and saving are other hurdles to jump next.
The piece of the world is a 4×4 group of chunks where each chunk is 16x64x16. This is essentially creating over 250 thousand voxels, but with the optimized drawing far fewer are rendering, since only those who are visible or those on the side of the chunk are created.
Next up, I am going to work on more interesting terrain, and infinite generation of the terrain. Some more optimization may also be in order to hide faces between chunks, but the tradeoff between 2 chunk updates and less rendered faces may not be the best, more experiments to come.
Over the last few weeks, time has been invested towards a voxel engine in my engine of choice, Unity3D. This includes optimization, procedural world generation, and other aspects aimed to create a randomly generated cubic world. So far, the game can draw chunks of 16x64x64 with a very good speed and I have altered the code to set 1/10 cubes to air randomly for testing.
- Image one is the chunk drawn from a distance with regular rendering and a gray diffuse texture.
- Image two is the same chunk drawn with a wireframe on the regular cubes.
- Image three is just the wireframe drawn.
- Image four is the overdraw setting showing the density of drawn faces.
Faces on the inside of the chunk that are between two cubes are not drawn as to optimise rendering, a huge frame rate saver. The next step to tackle is setting up multiple chunks with a simplex or perlin noise height map to create a hilly landscape.