Devlog / Entry 002 / Phase 1: Heartbeat

Heartbeat: a client, a server and a steady 60 Hz

Phase 1 is done: Lintel has a window, a fixed 60 Hz simulation shared by client and headless server, live-tweakable data, a job system, a profiler, a crash handler and an asset pipeline.

18 Oct 2026 Phase 1

Phase 0 gave me a folder that builds everywhere. Phase 1 had to give that folder a pulse: an engine core that runs a simulation at a steady rate, on a client with a window and on a server without one, and that I can look inside while it runs.

There is still nothing to see but a dot on a grid. That is the point. Everything after this, from ray-traced lighting to suspects who decide whether to surrender, stands on these parts.

A fixed heartbeat

The simulation runs at exactly 60 ticks per second, no matter how fast the screen draws. Real time goes into an accumulator, and every full 1/60 of a second in it becomes one tick. The window then draws as often as it can and blends the last two ticks, so movement looks smooth at any frame rate.

Each tick takes one PlayerCommand: move, turn, walk slowly. The simulation never reads the keyboard. That one rule is why the same code runs on the headless server, where the commands will later arrive over the network, and why a test can feed the same commands to two worlds and check that they end up identical.

Change it while it runs

Movement speeds live in a JSON file, read by my own parser. When it finds a mistake it reports the exact line and column, because whoever edits data files needs to know where the problem is. A file watcher (inotify on Linux, ReadDirectoryChangesW on Windows) notices when the file is saved, and the new walk speed applies from the next tick.

For everything else there is a console. Press the key left of 1, type set sim.time_scale 0.25, and the world runs in slow motion: still exact 1/60-second ticks, just fewer of them per real second.

Memory I can account for

Every allocation goes through a tracked heap that remembers the file and line it came from. When the game closes, anything still allocated is reported, and the run counts as failed. Per-frame data goes into a linear allocator that resets every frame, and fixed-size objects come from pools. Phase 1 ends with zero leaks, including Dear ImGui, whose memory goes through the same tracker.

Every core busy

The job system starts one worker per core, minus one for the main thread. Work is split into jobs, counted with an atomic counter, and whoever waits for a counter runs queued jobs itself instead of sleeping. That keeps every core busy and makes it impossible for a job to deadlock waiting for jobs it started. ThreadSanitizer checks it on every push.

Next to it sits the ECS: entities are an index plus a generation number, so a handle to a deleted entity is recognised as stale instead of quietly pointing at whatever took its place.

Seeing inside

Three tools to understand what the engine is doing:

  • The console, in the game or in the terminal that started it.
  • A stats panel with ticks per second, a frame-time graph and memory use.
  • Tracy, a profiler that shows every zone on a timeline per thread, down to the nanosecond. The game only collects data while the profiler is connected, and only accepts connections from my own computer.

When it goes wrong

When the game crashes, it writes a report first: a minidump on Windows, which Visual Studio opens as if a debugger had been attached, and a backtrace on Linux. Failed assertions and uncaught exceptions name themselves in the report.

Testing that was its own lesson. CI crashes a small program on purpose, in four different ways, and checks each report. The deliberate segfault passed on my machine and failed in CI: GCC 13 had optimised the write to a null pointer away entirely, so the program never crashed. Making the write volatile fixed it. The compiler is allowed to remove code you meant as a crash.

Assets

Assets are named by path, like props/door.texture, but the engine stores a 64-bit hash of that path. Loading returns a handle immediately and the file is read on a job worker. When the last handle is gone, the asset is freed.

Source files from Blender and image editors go through a cooker first. It turns PNG into raw texture data, WAV into float samples and glTF into meshes, so the game never parses those formats. It also turns every model around: glTF models face +Z, while forward in Lintel is −Z.

The numbers

Estimate 80–150 h
Engine code about 6,100 lines in 7 modules, plus client, server and cooker
Tests 85 unit tests, plus crash-handler tests
CI 7 builds per push (GCC, Clang, MSVC, AddressSanitizer, ThreadSanitizer), all green

Next: Two APIs, One Picture

Phase 2 replaces the placeholder 2D drawing with a real renderer interface, built on DirectX 12 and Vulkan in lockstep: clear the screen, then a triangle, then a textured cube, with both APIs drawing the same picture.