Game Project - Chunk System
World generation backend.
- HLSL
- Compute Shader
- Unity
- C#
This project is part of a larger hobby game project I am working on with a small team.
I am only highlighting the parts of the project I worked on.
About this project
At the core of our world tools is the chunk system. It is a collection of tools that allow us to generate large areas data-driven. The following 3 videos show some of our tools in action.
1. This video shows a combination of tools working together to allow for drastic scene changes in realtime.
We start by painting the heightmap of our terrain using the world painter tool.
This tool contains the settings you would typically expect, like different brush shapes, falloff modes and support for various operations.
While painting we can already see our second system in action, the chunk baker.
This is a compute based background task system that evaluates a dependency graph on data change and updates the world data accordingly, in this case our chunk colliders and meshes.
When we finish the paint operation (i.e. release the mouse button) we see a third system, our async GPU readback pipeline that assures that we can serialize the data we just created.
The data never leaves the GPU during the paint operation itself.
This pipeline allows us to immediately see the effect of our operation on the whole world and we can jump into the game and test what we just created, our dependency graph assures that the gameplay data is updated as well.
You can also see that all objects react to the world change and update their positions relative to the terrain.
2. To show just how efficient this pipeline is we draw a gigantic area of our game at once. Undo is fully supported.
3. The last tool is the chunk viewer. It allows us to inspect all the data we have in the game as well as manage our chunks.
We can lock them, update their areas, delete them, add new ones or read their data's values, for each individual voxel.