thomasnewmancomputer engineer
  • work
  • writing
  • about
  • contact
All projects

Thomas Newman / Computer Engineer

Explore projects ↗GitHub ↗Get in touch ↗

SpriteForge

Project 06Systems programming / game engine

A 2D game engine in C with an ECS core, fixed-timestep simulation, AABB physics, and embedded Lua scripting.

CSDL2LuaCMake
SpriteForge
Software1 min read
View source

Role: Solo. Engine architecture, all subsystems, and the sample scene.

Architecture#

Source codetext
Input / events -> Lua scripts -> ECS systems -> Physics (AABB) -> SDL2 render
  • ECS: entities are IDs, components are plain data, and systems iterate over the components they need.
  • Fixed timestep: simulation runs at a fixed rate with an accumulator, separate from rendering, so physics behaves the same at any frame rate.
  • Collision: AABB overlap tests with resolution along the axis of least penetration.
  • Event bus: subsystems publish and subscribe to messages instead of calling each other directly.
  • Lua scripting: gameplay behaviour lives in Lua scripts bound to entities, so it can change without recompiling the engine.
Challenges
  • Designing the C ↔ Lua binding layer
  • Memory ownership across subsystems in C

The hardest part so far was developing the how Lua interacts with the engine. As of right now, I’ve designed the engine with pre-defined functions that allow you to make changes to the scene.

My vision for the future is to provide enough pre-defined functions that users will be able to make their own functions that do even more than what I provide.

Build: CMake + vcpkg (SDL2, Lua), targeting Windows / MSVC.

On this page

  1. Architecture
  2. Source code

Source code

Open repository

Last edited on October 27, 2026 at 12:17 AM EDT

← Previous projectAutomatic Wall-Avoiding RobotNext project →WUWA Builds