A 2D game engine built with C++ and SDL2, using an Entity Component System (ECS) architecture. This project is intended as a technical demo and learning exercise, featuring hardware-accelerated rendering, physics-based gameplay, procedural level generation, and comprehensive audio/input systems.

Gameplay

Spatial Grid

Start Menu

Game Over
ECS
Architecture
Pooled
Memory
Stack
Allocator
Chunk-based
Level System
Built a custom ECS architecture with singleton-based managers (Renderer, Audio, Input, Assets), delta-time based game loop, object pooling for entities and resources, and binary serialization for save data.
SDL2 hardware-accelerated rendering with TGA/PNG texture loading, sprite sheets with configurable clip sizes, parallax scrolling backgrounds, camera with entity following, and logical resolution scaling for resolution-independent rendering.
Tiled (.tmx) map loading via tmxlite with infinite scrolling using procedural chunk system. Supports chunk types: start, random, gap, and floating platforms with tile collision detection and object layers for spawn points.
Gravity with ground detection, adjustable jump height (hold to jump higher), coyote time grace period, dash ability with cooldown, punch attack with range detection, patrol AI for enemies, health system with invincibility frames, and collectibles.
16-channel sound effect mixing with background music support (play/pause/stop) and channel completion callbacks for dynamic audio feedback.
Comprehensive input system supporting keyboard key down/up detection, mouse position and button states, game controller support, and text input handling.
Creating infinite procedural levels without loading screens
Designed chunk-based map system that procedurally generates and loads map chunks ahead of the player, with different chunk types for variety.
Handling collision detection with many entities
Built a SpatialGrid that divides the world into cells and tracks which cells each entity occupies. Only entities in the same or adjacent cells are checked using AABB overlap tests, reducing collision checks from O(n²) to O(n).
Loading sprites without memory allocation overhead
Used object pools for Texture, SpriteAnim, and Asset classes to reuse existing objects instead of allocating new ones. Combined with ImageInfo caching and GUID-based asset lookup to avoid unnecessary file access and processing.
Understanding of ECS architecture and its benefits for game development
Gained experience in procedural content generation and level system on a chunk basis
Improved C++ skills including memory management, object pooling, and binary serialization
Understanding of spatial partitioning techniques for efficient collision detection and entity queries
Gained experience with texture loading and sprite rendering
Add more enemy types with different AI behaviors
Implement power-ups and special abilities
Create a level editor for custom chunk design
Add online leaderboards for score tracking
Implement difficulty scaling based on player performance
Add boss fights with unique attack patterns
Explore more projects