Controls:
1-5 To Select Block
Toggle Lock Cursor: L
Movement: W, A, S, D
Toggle Gravity: G
Save: E
Reload Game: R
Reset Player to Spawn: T
Place Block: Right Click
Remove Block: Left Click
Jump: Space
How It Works
Chunk Base Voxel System
The world is built by default with a 4x4 arrangement of chunks. Each chunk consists of a 32x32 single-layer thick sheet of cubes which are generated upon runtime. By reducing the total amount of vertices and triangles stored in each GameObject, we can drastically reduce the time need to query triangles when the player adds or removes blocks.
Terrain Generation
All chunks are seeded with the same random seed, so they blend seamlessly across edges. To generate terrain, Perlin noise is sampled at three different frequencies, then added together. The user is further given the option to adjust the amplitude of each frequency before generating their world.
The Save System
Upon creation and again upon saving the world, the first vertex of every cube in each chunk is saved. Upon loading, the location of these vertices is used to regenerate each cube, and preserve the changes the player has made to their world.
Trees
Depending on the tree density parameter set upon world creation, a tree has about a 2% chance to be "planted" every time a cube is generated. Currently, all trees appear the same as they are all generated from the same three-dimensional array blueprint.