Follow Your Dream
A 2D top-down tile-based game engine built from scratch in C++ using only the Win32 API — no engine, no framework, no third-party libraries. The project covers all the fundamental layers of a game: world management, entity systems, physics, input, and software rendering, each implemented by hand to understand the mechanics from first principles.
Tech
World
- Tile map chunking — the world is split into 128×128 chunks that are loaded and unloaded independently, keeping memory usage flat regardless of world size.
- Procedural generation — tile maps are generated at runtime with walls, passable tiles, and doors connecting different floors.
- Multi-level layout — vertical doors link floors together, enabling dungeon-style exploration across interconnected rooms.
Entity System
- Residence states — each entity lives in one of three states (Dormant, Low, High) that determine update frequency and memory residency, reducing CPU overhead for off-screen entities.
- Camera follow — the camera tracks the player and culls entities outside the visible region.
Physics & Input
- Physics simulation — gravity, velocity integration, and collision detection against the tile grid are computed every frame without any physics library.
- Controller support — analog sticks and directional buttons are read directly via Win32, with dead-zone handling for smooth movement.
Rendering
- Software renderer — pixels are written directly to a back buffer using Win32 GDI; no GPU API is used.
- Alpha blending — sprites are blended over the background per-pixel, supporting transparent character art and directional animations (front, back, left, right).