Game & Simulation
Open Source

x86-64 Assembly Turn-Based RPG Engine

x86-64 AssemblyNASMWindows x64 ABIGCC / MSVC LinkerC Standard Library (msvcrt)

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.

Tech Stack

x86-64 AssemblyNASMWindows x64 ABIGCC / MSVC LinkerC Standard Library (msvcrt)

System Metrics

Zero heap allocations; all mutable game states (health pools, move tracking, user buffers) are statically allocated in the `.bss` section for instantaneous memory access
Microsecond-level execution throughput per game tick, constrained strictly by OS-level user input interrupts (`scanf` blocking)

Why Did I Build This?

"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 flawlessly 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

  • 01.Strict compliance with the Windows x64 ABI, including explicit shadow space allocation and stack boundary alignment
  • 02.Modular assembly architecture linking multiple `.asm` objects into a single cohesive executable binary
  • 03.Hardware-level pseudo-RNG integration for calculating hit chances, flat damage variance, and percentage-based scalar attacks
  • 04.Real-time ANSI-colored terminal rendering and persistent flat-file telemetry logging (`game_log.txt`) directly via `msvcrt` hooks