x86-64 Assembly Turn-Based RPG Engine
A modular, turn-based RPG engine written entirely in raw x86-64 Assembly, demonstrating strict adherence to the Windows x64 calling convention, manual stack frame management, and hardware-level state mutation.
Performance & metrics
- Zero heap allocations; all mutable game states (health pools, move tracking, user buffers) are statically allocated in the
.bsssection for instantaneous memory access - Microsecond-level execution throughput per game tick, constrained strictly by OS-level user input interrupts (
scanfblocking)
Why I built it
High-level game engines abstract away memory layouts, register allocations, and OS-level calling conventions. I engineered this project to explore the absolute foundational layer of game state management. The objective was to manually construct stack frames, manage shadow spaces, and execute procedural combat loops while interacting directly with the C runtime (msvcrt) for I/O and RNG, proving that complex software can be cleanly architected at the lowest possible abstraction layer.Architecture & decisions
The codebase is strictly modularized (main, game_logic, combat, file_io, ui), resolving global symbols during the linking phase. It adheres strictly to the Windows x64 ABI: passing the first four parameters via RCX, RDX, R8, and R9, allocating 32 bytes of shadow space, and maintaining 16-byte stack alignment. Combat mechanics utilize dynamic RNG bounds and percentage-based scalar multiplications (imul, div) executed entirely within CPU registers. File I/O is managed directly via fopen/fprintf external calls bridged to the C runtime, maintaining an autonomous, state-driven combat ledger.
Key features
- Strict compliance with the Windows x64 ABI, including explicit shadow space allocation and stack boundary alignment
- Modular assembly architecture linking multiple
.asmobjects into a single cohesive executable binary - Hardware-level pseudo-RNG integration for calculating hit chances, flat damage variance, and percentage-based scalar attacks
- Real-time ANSI-colored terminal rendering and persistent flat-file telemetry logging (
game_log.txt) directly viamsvcrthooks
Related projects
The Burglar's Quest
A stealth-based game built in Unity, featuring a procedural generation engine that ensures unique spatial layouts and asset configurations per session.
- C#
- Unity
PTSD VR Simulation
A virtual reality simulation designed for PTSD awareness, featuring branching psychological narratives and real-time telemetry via Firebase.
- C#
- Unity
- Firebase
- +1
Games & Simulation
Okey & 101 Multiplayer Game Engine: .NET 9 SignalR Backend
A highly concurrent, authoritative multiplayer game engine built under a commercial contract for a Unity-based Okey/101 board game, featuring real-time state synchronization.
- C#
- SQL
- .NET 9.0
- +7
Need something similar?
I can build a system like this for you, too.
Describe your project in a few sentences, and we'll work out the right approach and an estimated scope together.