Case study 01Voxel fantasy sandbox game on Unity 6

Caelora

A native PC voxel sandbox set in a living medieval-fantasy valley. Unity 6 draws it; the voxel meshing, streaming, saves and living trees are my own code, on a deterministic rules core.

Status: PrototypePlayable Windows build v0.1.0, in active development
Role
Sole developer across design, architecture, game systems and integration
Timeline
Oct 2026 to present
Context
Own game, private repository
Layers
Realtime · System software
Links

01 Overview

Caelora is a native PC sandbox game set in a medieval-fantasy world made of blocks. You explore a living valley, cut trees that actually fall, build with stairs, slabs, beams and roofs, and survive. Every milestone is a slice of that first valley rather than a wider, thinner world.

Why it exists. It is the game I wanted to play, and the project where I learned what engine-side work really is: threading, determinism, memory ownership and saves that survive a crash.

What it shows. Unity draws the picture, but the world underneath is my own: a deterministic, engine-free rules core, a background meshing pipeline with version-checked results, crash-safe persistence and living trees, with an ADR for every decision and a benchmark wherever performance is touched.

Specification

Engine
Unity 6 LTS with URP; Direct3D 12 on Windows
Language
C#, with Burst, Jobs and Collections on hot paths
Structure
57 assemblies; the rules core has no engine references
World
Versioned voxel sections, streamed and meshed in background jobs
Determinism
16.16 fixed-point noise, keyed RNG, a Python reference oracle
Saves
Edited sections only, checksummed regions, one commit file
Trees
One skeleton drives wood, leaves, structure and collision
Tests
7,570 EditMode and 517 PlayMode tests; latest full run: 0 PlayMode failures, 3 known EditMode failures in first-person clearance cases
Decisions
50 ADRs and 22 benchmark records
Size
About 302k lines of C#, roughly 139k of them tests
  • Rules and rendering never trade places. An engine-free, deterministic authority owns the world; Unity only draws it and asks for changes through commands.
  • Chunk meshes are built by background jobs and accepted only while their version stamps are current, so the old mesh stays on screen until the new one is valid.
  • A crash cannot pair new world data with an old player. One commit file names every saved part with its size and checksum.
  • Trees grow, can be cut and fall, and all of it comes from one deterministic skeleton.

02 Architecture

Two layers that never trade places. An engine-free authority owns the world and every rule; Unity owns only what is seen and heard. Commands go in; versioned sections and accepted meshes come out.

Fig. 01.1

Authority, sections and saves

Authority

  • ClientPlayer input

    commands only

  • ServiceAuthority

    engine-free, integer math, keyed RNG

  • StoreVoxel sections

    versioned per section

  • StoreCommit coordinator

    edited sections only, one checksummed commit

  • StageTree skeleton

    one skeleton: wood, leaves, collision

Presentation

  • WorkerSection pipeline

    Burst jobs mesh off the main thread

  • StageVersion check

    stale results are discarded

  • ClientPresentation

    Unity 6 URP; reads, never writes

Planned

  • PlannedHeadless server

    the authority runs without Unity

  • PlannedMultiplayer

    no networking code yet

Player input reaches the game only as commands. An engine-free, deterministic authority owns the world, stored as versioned voxel sections. Background jobs mesh dirty sections, and a result is accepted only if its version stamps are still current; presentation renders the accepted meshes and never writes to the authority. Living trees come from one skeleton that feeds wood, leaves, structure and collision. Only edited sections are saved, under one commit file. The dashed row is planned and not built.

03 Media

A voxel valley seen past a large textured tree trunk; grass slopes, block trees and a stone-roofed building below.
A standalone build of the First Valley. In-engine capture.
A voxel oak with smooth, branching wooden limbs and clusters of leaf blocks at the ends of the branches, against a pale sky.
A mature oak. Tube-mesh branches follow the tree skeleton; leaf voxels sit at the tips.
Seven voxel trees of different species and shapes standing on a flat grass test plot, casting shadows.
Procedural tree species on a test plot.
A river cutting through blocky brown terrain and green fields, with a hotbar of tools and rows of hearts and stamina at the bottom of the screen.
A Windows development build with the hotbar and survival vitals.

04 Hard problems

  • Background meshing without stale frames

    Problem

    Meshes are built on worker threads while the player keeps editing. A job that finishes late would paint an old shape over a newer edit, or leak its buffers.

    What I did

    Every section moves through an ownership state machine, and a finished mesh carries the epoch, content version and boundary revision it was built from. It is accepted only if all three are still current; edits are copy-on-write, so the previous mesh stays visible until the replacement is valid.

  • The same world on every machine

    16.16fixed-point noise, no floats

    Problem

    Floating-point results can differ between managed code, Burst-compiled code and processors, and a world seed has to produce the same terrain everywhere.

    What I did

    Terrain noise uses SplitMix64 hashing and 16.16 fixed-point maths with no floats at all, and a separate Python implementation serves as the oracle the C# output is checked against.

  • Saves that survive a crash

    Problem

    A world, a player and the other saved parts are written separately. A crash between two writes could pair new terrain with an old inventory.

    What I did

    Only edited sections are stored, as checksummed, double-buffered region files. A single commit file then names every part with its size and checksum, and loading trusts only a complete commit. Fault injection tests cover the crash points.

  • Trees that grow, break and fall

    Problem

    A tree is at once a mesh, leaf blocks, something to collide with and a structure that can be cut. Four separate models would drift apart.

    What I did

    One deterministic skeleton feeds all four. Its structural graph decides where a cut lands, what detaches and how the trunk falls on an integer fall curve with swept collision, and a falling tree is saved like any other state.

05 Decisions

The rules live in engine-free assemblies.
The same code can run in tests, in a command-line harness and later on a headless server. Presentation reads that state and requests changes; it never writes it.
Store only edited sections, as full snapshots.
A later version of the terrain generator can never change what a player has already built.
No hash-order iteration in anything saved or authoritative.
Dictionary order is not stable across runs; deterministic output has to be deterministic everywhere, not most of the time.
One skeleton for every representation of a tree.
The wood you see, the leaves, the collision and the cutting structure cannot disagree if they all come from the same data.
One milestone, one worktree, one written record.
Each milestone is a slice of the first valley and ends with tests, a benchmark where performance is touched, a save-and-reload check and an ADR for every new decision.

06 What I built

World

  • Deterministic terrain generation on SplitMix64 hashing and 16.16 fixed-point maths, so managed code and Burst produce the same world on every machine.
  • Section streaming with an ownership state machine; Burst jobs fill mesh buffers in parallel and copy-on-write edits keep the previous mesh visible while remeshing.
  • Architectural blocks (stairs, slabs, beams, roofs) packed into a 32-bit block state, with faces clipped at shared boundaries by an 8-bit coverage mask.
  • 12 custom shaders for terrain, water, bark, foliage wind and block cracks.

Living trees

  • Procedural species from one generator, drawn as tube-mesh wood with leaf voxels at the tips.
  • Growth over time, verified in PlayMode and in a native Windows build.
  • Chopping and felling driven by a structural graph that decides the cut, what detaches, an integer fall curve with swept collision, saving mid-fall and the logs paid out.

Play

  • A playable First Valley with rivers, forests, a hotbar, survival vitals and field crafting.
  • A front-end shell, a loading screen and menus, with the main menu shown as v0.1.0.
  • One action state, driven by simulation events, sets the timing of swings, chops and placement for every view through a masked upper-body animation layer.
  • A cloak on a spring-chain solver written for the game, with body collision proxies, four quality tiers and no per-frame allocation; 98 µs per character frame on the top tier in a pessimistic Editor benchmark.

Persistence and tooling

  • Double-buffered, checksummed region files written through a commit coordinator, with fault-injection tests.
  • Plain .NET projects compile the same source files without Unity for headless tests and benchmarks.
  • 22 benchmark records for streaming, meshing and simulation, and a scripted Windows release build.

07 Status

Today

  • A playable Windows build of the First Valley with terrain, rivers, forests, living trees that grow and fall, architectural blocks, survival vitals and field crafting.
  • Creatures, villager memory and combat exist as tested core code, and livestock runs in lab scenes, but the game does not use them yet.
  • The release candidate is now the main line: the cinematic menu and settings screens, premium equipment and the cloak, checked in a Windows development build. Live water waits on a milestone branch for human review.

Notes

Much of Caelora’s code is written with AI coding agents (Claude Code and Codex) under rules I maintain in the repository, the same way as J.A.R.V.I.S. Design, architecture, review and integration are mine.

The screenshots here are in-engine captures. The menu background and loading video are generated art, and character models were generated and auto-rigged with a third-party tool.

08 What I learned

  • Separating the rules from the engine early means the same code can be tested headless, without opening Unity.
  • In a voxel engine most bugs are stale data. Anything a background job can see needs a version.

09 Stack

  • Unity
  • C#
  • .NET
  • Python
  • Claude
  • Git

Built with: credits and licenses

  • Unity 6 with Burst, Collections, Mathematics and URPby Unity Technologies

    The engine, renderer and job system the game runs on.

    UsedUnity Companion License (not open source)

  • SplitMix64by Sebastiano Vigna

    The hashing behind deterministic terrain noise, reimplemented in C# with fixed-point maths.

    ReferencePublic domain (reference C code)

  • Dynamic Treesby Dynamic Trees Team

    A concept reference for living trees. A clean-room audit recorded that none of its code was used.

    ReferenceMIT

  • Cinzel, EB Garamond and Caveatby Natanael Gama; Georg Duffner and Octavio Pardo; Impallari Type

    Interface typefaces, bundled with their licence files.

    UsedOFL-1.1

All credits and licenses
Now on repeatMemory RebootVØJ, NarventYouTubeOpen YouTube player
Electricity reactivity

YouTube changes the circuit through player state alone.

Synthwave selection

Memory Reboot

VØJ, Narvent

Opening the player connects to YouTube. Google’s privacy policy