Skip to content
All Projects

TiniMilitia-Shooter — 2D Game Engine

A high-performance 2D shooter engine in modern C++17 using OpenGL and GLFW, sustaining 60 FPS with 100 active entities via RAII resource management and deterministic game loops.

TiniMilitia-Shooter — 2D Game Engine

Overview

A from-scratch 2D shooter game engine built to explore systems programming, real-time rendering, and game architecture. The engine runs at a locked 60 FPS with 100 simultaneously active entities — no engine dependencies, no garbage collector.

Why Build an Engine From Scratch?

Using Unity or Unreal hides the hard problems. Building from scratch forces you to understand:

Core Architecture

Game Loop

while (running) {
    processInput();
    update(fixedDt);   // deterministic, physics
    render();          // variable, visual interpolation
}

Using a fixed timestep for update (16.67ms) and a variable timestep for rendering makes physics deterministic and reproducible — identical input always produces identical game state.

Entity Hierarchy

Entity
  ├── Gunman  (player character)
  ├── Enemy   (AI-controlled)
  └── Bullet  (projectile)

Inheritance + polymorphism for entity update/render dispatch. Value semantics for bullets (cheap to copy, no pointer indirection) vs. reference semantics for Gunman/Enemy.

Memory Management

Rendering Optimizations

Performance

ScenarioFPS
100 entities, all moving60 (locked)
100 entities + 200 bullets60 (locked)
Stress test: 500 entities~45

Build System

CMake handles cross-platform builds (Windows/Linux/macOS):

cmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build

External dependencies (GLFW, GLM, stb_image) managed via CMake FetchContent — no manual download required.

Tech Stack

Language: C++17 Graphics: OpenGL 3.3 · GLFW · GLAD · GLM · stb_image Build: CMake · FetchContent Patterns: RAII · Object Pooling · Batched Rendering · Fixed Timestep

All Projects