EncounterForge
Released2026

EncounterForge

A C++20 combat sandbox with an integrated encounter editor and verified replays

Platform
Windows · Linux build and tests verified
Team
Personal portfolio project
Time
Playable prototype · September 2026
Role
Gameplay, tools and simulation architecture
About the project

What it is

EncounterForge is a top-down action-combat prototype built with C++20, CMake and raylib 5.5. Fight enemy waves and a two-phase boss, or switch to the integrated editor to build an arena, save it as JSON and play it immediately. The visuals use procedural shapes, particles and readable attack telegraphs.

What I worked on

My contribution

I built EncounterForge with Codex assistance to study modern C++ through a playable project. The review notes explain ownership, simulation order, replay checks and caching changes, including how their performance was measured. The source repository is private.

Key features

Main systems

  • Movement, shooting and an invulnerable dash, with chaser, ranged and charging enemies and a two-phase boss.
  • An arena editor for obstacles, enemies and spawners, with selection, movement, resizing, undo and validated JSON save/load.
  • Input recording and replay with a state checksum at each simulation tick.
  • Debug overlays for hitboxes, AI states, spatial buckets and collision-check counts.
Technical deep dive

How it works

Modern C++

Explicit ownership and simulation order

The simulation library has no raylib dependency. World owns its entities, while the renderer borrows read-only std::span views and consumes gameplay events. RAII handles the window and render texture; value types and standard containers keep lifetime management direct.

  • A fixed 60 Hz simulation is separated from interpolated rendering.
  • Named update phases make the order of AI, collisions, damage and encounter completion reviewable.
  • A dedicated navigation field caches arena occupancy and rebuilds path costs with a bounded BFS.
Encounter tools

Edit, save and play

The editor keeps a draft separate from the active simulation. Arena files and enemy definitions are validated before use, so a saved encounter can be tested immediately without recompiling gameplay code.

  • Undo and backup saves support iteration on encounter layouts.
  • Three sample arenas demonstrate survival waves, obstacles and spawners, and the boss encounter.
Measured optimization

Avoid repeated work without changing results

Caching the RNG's serialized state and preparing navigation occupancy reduced median time for a 3,600-tick simulation-plus-checksum benchmark from 1.14–1.22 seconds to 0.332 seconds on the same Windows machine: 71–73% less time, with identical final state digests.

  • Seven measured samples follow a warm-up; before/after execution order is reversed to expose timing variability.
  • This CPU benchmark excludes rendering and file serialization. It is not an FPS claim, and the two optimizations were measured together.
  • Spatial buckets also reduce collision candidates; their separate microbenchmark excludes bucket rebuild cost.
Regression checks

Preserve combat and replay behavior

Four test suites pass locally in Debug and Release. GitHub Actions also passed Windows Debug, Windows Release and Linux Release builds and tests. A real OpenGL smoke test exercises editor save/load/play, boss phases and replay verification.

  • All 860 ticks of a historical boss replay still match their recorded checksums under MSVC.
  • Navigation costs are compared with a geometry-based reference across 249 traversals.
  • Replay determinism is scoped to the same build/platform; cross-compiler floating-point equivalence is not promised.
Challenges

What was difficult

The engineering challenge was improving readability and avoiding repeated work without changing deterministic update behavior. Cached data needs explicit invalidation, and borrowed views must not outlive the entities they reference. Historical replays and reference calculations provide stronger evidence than timing results alone.

Screenshots

Gallery

Integrated encounter editor
Place obstacles, enemies and spawners, then save the arena and switch directly into play.
Warden boss — second phase
A real gameplay capture showing the boss health bar, attack telegraphs and hostile projectiles.
Simulation debug views
Hitboxes, AI states, spatial cells and runtime counters make combat behavior inspectable.
Stack
C++20raylibGameplayToolsCMakeJSONGitHub Actions
OpsTrack
Next project
OpsTrack
A full-stack workspace for incidents, service requests and resolution tracking