I. Context
For those interested in delving deeper, here is the project’s GitHub. (It is a remake of StoneHearth.)
I aim to create a voxel game, where a voxel is a cube with a single color (later, some blocks may be semi-transparent, like water). The game features a fixed-size map, with everything generated at the beginning because it is a settlement management game. The game will have minimal animation, and all entities aside from the voxels will be created in voxel art and imported as objects, resulting in a low polygon count.
The map is composed of many small blocks, and the player has an eagle-eye view.
II. Technical Requirements
The game needs to run on “low-end” computers, meaning it should operate with less than 8GB of RAM and minimal or no GPU. This should not be a significant issue given the game’s concept.
The chunks are: 16 * 256 * 16 blocks
The map is: 32 * 1 * 32 chunks
III. The Problem
How can I display all chunks in the game without encountering performance issues?
IV. The Concept Solution
Reduce the number of vertices, triangles, etc., that need to be rendered.
V. The Attempts
V.1: Initial Approach
I already have some code to remove faces between two opaque blocks, which significantly reduces the number of vertices and triangles. However, I am still facing almost 4 to 6GB of RAM usage solely for the terrain.
Since blocks are voxels, I would like to merge faces of blocks that have the same color. I am aware of algorithms like greedy meshes and already have an algorithm for this.
V.2: Self-Made Solution
I created a solution where I instanced all chunk meshes by instancing a mesh for each block’s face. I optimized it by merging blocks of the same color. However, I now face an issue with having numerous game objects. I tried to merge their meshes, but the colors did not follow because it was using the material’s color.
V.3: Using Voxel Master
I noticed they had a good foundation, but when I created the map of my size, I still encountered performance issues. They use texture atlases, which are suitable for textured blocks, but my blocks are only one color, so it is not what I am looking for. I managed to find that they can merge meshes, but they display all faces of each block.
V.4: Opening
I am unsure if I should try to keep the texture atlases and apply the greedy mesh algorithm, or stick to “real” voxels with a single RGBA color but find a way to merge the meshes.
Or perhaps I am too deep into something that is not feasible, and I should explore other optimization methods for the game.