2D Physics & Rendering System

I built a game engine from scratch. Here’s what actually happened.

Not a tutorial follow-along. Not a game jam entry. A deliberate challenge — no engine, no shortcuts, just C++ and a question: am I actually a good engineer, or do I just consume knowledge?

The Origin

Not a tutorial follow-along. Not a game jam entry. A deliberate challenge — no engine, no shortcuts, just C++ and a question: am I actually a good engineer, or do I just consume knowledge?

How it’s built

Core loop

Poll → Update → Render

Fixed real-time tick. No abstractions between stages.

Physics

Manual, no library

Each object carries its own velocity vector; update step integrates directly.

Rendering

SFML at draw level

Object batching, state updates, and frame pacing are all manual.

Collision detection

The most algorithmically interesting problem. Naïve pair-checking gives you O(m × n) per frame — fine for a handful of objects, unusable at scale.

O(m x n)

naïve

~O(m + n)

optimised

By restructuring comparison
scheduling and pruning.
Stays responsive under
dense collision events.

The honest timeline

Day 0 — The setup wall

SFML 3.0 was installed. Every guide online was written for 2.x. The API had changed, examples didn’t compile, and error messages weren’t helpful. The unblock came from a single article by someone who’d hit the exact same wall — and documented the 3.0 differences clearly.

Hour 7 — Almost quit

After a straight 7-hour session, I genuinely didn’t want to continue. Not because the problem was unsolvable — just deep fatigue. Took a break. The break was good. Going back was hard. Went back anyway. That’s the engineer’s mindset in its most unglamorous form.

The click

First time the loop ran smooth at a consistent frame rate — no stutters, no lag spikes, just clean ticks. It wasn’t just that it worked. It was that I understood why it worked, because I had built every part of the reason.

What changed

Before this project, I used tools. After it, I look at tools differently. When I see a game engine now, I have a mental model of what’s underneath — the loop, the collision pipeline, the render pass.

I understand why entity-component systems exist and what problem they actually solve. I understand what you give up when you reach for an abstraction too early. The O(m × n) → ~O(m + n) reduction wasn’t academic — it was something I debugged, measured, and felt in the frame rate.

Scope

A foundation for understanding, not a product. The goal was to reach the point where nothing in this space feels like a black box. That goal got achieved.