Nithilan's Website

Custom 2D Game Engine

Built from scratch with modern C++ and optimized rendering pipeline

Engine in Action

Watch this comprehensive demo showcasing the key features of the engine: real-time rendering, physics simulation, particle systems, and the Entity Component System architecture in action. The video demonstrates performance optimizations and the seamless integration of all engine components.

Try It Live

Interactive Demo

Experience the engine directly in your browser:

Open in Full Screen

What I Built

A high-performance 2D game engine built from the ground up using modern C++ and OpenGL

🎮

Entity Component System

Implemented a flexible ECS architecture for maximum performance and modularity, allowing for complex game object behaviors and efficient memory usage.

🖼️

Advanced Rendering

Custom OpenGL renderer with batch processing, texture atlasing, and shader pipeline optimizations for smooth 60+ FPS performance even with thousands of sprites.

Physics System

Built-in 2D physics engine with collision detection, rigid body dynamics, and spatial partitioning for efficient broad-phase collision detection.

🎵

Audio Engine

Multi-channel audio system with 3D positional audio, sound mixing, and dynamic loading for immersive game experiences.

🔧

Asset Pipeline

Streamlined asset loading and management system with hot-reloading capabilities for faster iteration during development.

📱

Cross-Platform

Designed to run on Windows, macOS, and Linux with consistent performance and behavior across all platforms.

Key Design Decisions

Entity Component System Architecture

Chose ECS over traditional inheritance-based architecture for better performance and flexibility:

class Entity { EntityID id; ComponentMask componentMask; }; template<typename T> class ComponentManager { std::vector<T> components; std::unordered_map<EntityID, size_t> entityToIndex; public: void AddComponent(EntityID entity, T component); T& GetComponent(EntityID entity); };

Batch Rendering Optimization

Implemented sprite batching to minimize draw calls and maximize GPU efficiency:

class SpriteBatch { static constexpr size_t MAX_SPRITES = 10000; std::vector<SpriteVertex> vertices; GLuint VAO, VBO; public: void Begin(); void Draw(const Sprite& sprite, const Transform& transform); void End(); // Flushes all sprites in one draw call };

Memory-Efficient Component Storage

Used contiguous memory layout for cache-friendly component iteration:

// Components stored in contiguous arrays for better cache performance std::vector<TransformComponent> transforms; std::vector<SpriteComponent> sprites; std::vector<PhysicsComponent> physics; // Systems iterate over packed arrays for (size_t i = 0; i < activeEntities; ++i) { UpdateTransform(transforms[i]); UpdatePhysics(physics[i]); }

Get Started

Ready to build your own games? Download the engine and start creating!

📦 Download Engine 📚 View Documentation ⭐ Star on GitHub

Quick Start Guide

# Clone the repository git clone https://github.com/sathariels/2DGameEngine.git cd game-engine # Build the engine mkdir build && cd build cmake .. make -j4 # Run the sample game ./bin/sample-game

The engine comes with comprehensive documentation, sample projects, and tutorials to help you get started quickly. Check out the GitHub repository for the latest updates and community contributions.

Let's Connect