TypePersonal project.
EngineOccam – Hadmade Hero inspired engine.
TimeframeStarted summer of 2025
IntentLearning more about the building blocks of games and game engines.

Table of Contents

Intro

Last year I got around to playing Animal Well and it was fantastic.

I later watched an interview with the creator Billy Basso on the architecture of the game. He mentioned being inspired by the video series Handmade Hero by Casey Muratori. I watched the first ~20 episodes of the series and was inspired as well.

Design Philosophy

  1. Building from scratch. I’m refraining from using packaged solutions as much as possible in the purpose of learning.
  2. Data oriented programming. Since my previous experience has all been object oriented I was inspired to expand my horizon and try a different approach.
  3. Game before engine. I want to practice game making, not just software architecture. This means my focus is building a game. All engine work must have a clear game purpose.

Engine Architecture

The basic architecture is the same as Handmade Hero, so if you want more in depth information I recommend checking out the series.

Most importantly, there is a separation between the platform and the game.

// This is the game from the perspective of the platform
// game_update is a function that takes memory and input as arguments. 
struct win32_game_code {
    HMODULE GameCodeDLL;
    FILETIME DLLLastWriteTime;
    game_init *Init;
    game_update *Update; };

Platform

  • Main executable file.
  • Allocates one block of memory for the program to use as needed. This is the only memory allocation that the program ever does.
  • Handles platform specifics like window and input.
  • Provides services for the game like file read/write and debug print.

Game

  • DLL (library) with functions like GameInit() and GameUpdate().
  • Platform agnostic game code.
  • Recieves input and memory from the platform.

Apart from simplifying potential new platform implementations, the separation enables some really cool features, almost out of the box:

  • Hot reloading of game code - since the game doesn’t own any memory it can simply be reloaded at runtime comparing file write times.
  • Save states/ replay system - we just feed stored state and input to the game. For the replay scenario the game update needs to be deterministic.

Hot reloading of game code.

Rollback Netcode: A How-To Guide

Ever since the release Project Slippi back during the pandemic I’ve been interested in understanding Rollback Netcode.
I thought I’d write up a short how-to based on my understanding from impleneting it in my game.

How It Works (Why It Feels Good)

Rollback Netcode is a peer-to-peer networking model where only game input and frame sequence number is being transmitted.
The remote- and local input is then used to simulate the game state locally.

struct network_input_message {
    uint64_t Frame;
    uint16_t ButtonsPressed;
    uint16_t ButtonsReleased; };

This all happens with a fixed, about 2-8 frame, input delay. The delay based on the connection speed with the goal to receive the remote input in time to simulate the frame.

If remote input was not received in time, we do not wait to simulate the frame, we do a prediction on the remote input. This is the key to why Rollback Netcode feels good.
As a player, there is consistency in the between input and and feedback that can make it feel like you’re playing .

So what happens if we incorrectly guessed the remote input? You guessed it: we roll back. The state of the game is reset to where the incorrect guess occurred, and then re-simulated to the current frame.

Prerequisites

As with everything, Rollback Netcode comes at a cost. The main prerequisites for implementation are:

  • Having a Game Update that…
    • … is deterministic.
    • … has a fixed delta time.
    • … is fast (fast enough run many times within a target frame rate).
  • The ability to quickly copy and save the game state.

Implementation


Credits & inspiration

Interview with Billy Basso, creator of Animal Well.
Handmade Hero episodes, by Casey Muratori.