Skip to content

Cocoa Engine ​

Cocoa Engine is a modern C++ game engine project focused on rendering architecture, asset management, resource ownership, ECS design, and testable low-level systems.

The goal of this project is to build a small but real engine from the ground up while learning the parts of graphics and engine development that are usually hidden behind larger commercial engines.

Project Goals ​

Cocoa Engine is being built to explore:

  • 2D rendering architecture
  • GPU resource management
  • Asset metadata pipelines
  • Shader, texture, and material systems
  • Entity Component System design
  • CMake-based C++ project structure
  • Testable graphics-adjacent architecture
  • Clean boundaries between engine systems

This is not a toy “draw a sprite” project. The focus is on building the engine systems underneath the renderer in a way that can grow toward a real game/editor workflow.

Technical Stack ​

  • C++
  • CMake
  • OpenGL
  • GLFW
  • GLEW
  • GoogleTest
  • JSON-based asset metadata
  • Custom renderer, resource, and ECS systems

Current Engine Areas ​

Cocoa is organized around several engine modules:

Graphics ​

The graphics layer owns the renderer-facing abstractions and GPU resource interfaces.

Current graphics systems include:

  • GraphicsDevice
  • Renderer2D
  • Shader
  • Texture2D
  • VertexBuffer
  • IndexBuffer
  • VertexArray
  • TextureManager
  • ShaderManager
  • MaterialManager
  • OpenGL-backed implementations

The design keeps rendering code behind a GraphicsDevice abstraction so that higher-level renderer code is not directly coupled to raw OpenGL calls.

Assets ​

The asset system is responsible for turning resource IDs into engine resources.

Current asset systems include:

  • AssetDatabase
  • JsonAssetDatabase
  • AssetManager
  • AssetLoader
  • AssetSource
  • FilesystemAssetSource
  • ResourceLoader

The long-term goal is for game code and renderer systems to work with resource IDs and handles instead of manually passing file paths throughout the engine.

Scenes and ECS ​

The scene layer contains the early Entity Component System work.

Current ECS/scene systems include:

  • World
  • Entity
  • ComponentStorage
  • ComponentType
  • System
  • Transform, camera, velocity, collision, and render-related components
  • Render, movement, camera, and collision systems

This gives the engine a path toward scene-driven rendering instead of manually issuing draw calls from application code.

Rendering Pipeline ​

The current 2D rendering flow is moving toward this shape:

txt
Scene / ECS
   ↓
Render System
   ↓
Renderer2D::DrawQuad(...)
   ↓
MaterialHandle
   ↓
MaterialManager
   ↓
ShaderManager + TextureManager
   ↓
GraphicsDevice
   ↓
OpenGL

The important design decision is that renderable objects do not need to own raw GPU resources directly. They can reference engine-managed resources through handles.

That keeps ownership centralized and gives the renderer a cleaner path toward batching, sorting, resource reuse, and future material expansion.

Asset Pipeline ​

The asset pipeline is designed around metadata and stable resource IDs.

The target flow is:

txt
Resource ID
   ↓
AssetDatabase metadata lookup
   ↓
AssetSource reads bytes
   ↓
AssetManager loads image/shader source
   ↓
TextureManager / ShaderManager creates GPU resources
   ↓
MaterialManager combines shader + texture + material data
   ↓
Renderer2D draws using MaterialHandle

This separates the question of “what asset do I want?” from “where is it on disk?” and “how does it become a GPU resource?”

That separation matters because the engine can later support packed assets, editor workflows, hot reload, or game-specific asset sources without rewriting the renderer.

Renderer2D Direction ​

The current Renderer2D is intentionally simple, but it is being shaped toward a production-style 2D renderer.

Current focus areas:

  • Draw command submission
  • Material-based rendering
  • Shader and texture resolution through managers
  • Indexed quad rendering
  • Clear renderer boundaries
  • Preparing for transforms, cameras, batching, and sorting

Near-term renderer goals:

  • Add transform support
  • Add camera/view-projection data
  • Support drawing multiple sprites
  • Improve material binding
  • Introduce batching
  • Add sprite components through ECS
  • Move toward scene-driven rendering

Why This Project Matters ​

Cocoa Engine demonstrates the kind of C++ engineering I want to do professionally:

  • Building systems from first principles
  • Designing clean boundaries between subsystems
  • Managing ownership and lifetime explicitly
  • Working close to the rendering pipeline
  • Using CMake and native C++ tooling
  • Keeping architecture testable even in graphics-heavy code
  • Growing a codebase incrementally instead of over-engineering upfront

The project is intentionally built in public as a learning engine, but the engineering decisions are real: resource handles, managers, renderer layers, asset metadata, OpenGL abstraction, ECS structure, and testable components.

What I’m Learning ​

This project is helping me deepen my understanding of:

  • How textures, shaders, buffers, and draw calls move through a renderer
  • How asset metadata becomes runtime resources
  • How to separate CPU-side engine data from GPU-side resources
  • How to design APIs that can grow without becoming tightly coupled
  • How to apply test-driven design in C++ systems programming
  • How engine architecture changes once rendering, assets, scenes, and resources start interacting

Repository ​

View Cocoa Engine on GitHub