Cardia Engine

A C++ game engine with Python scripting capabilities

3-year development • Open Source • Vulkan, ECS, Python Integration

Available on github

Cardia Engine represents my most ambitious personal project - a comprehensive 3-year journey into low-level game engine development. Born from a desire to explore the depths of game engine architecture and challenge myself with complex systems programming, this C++ engine showcases advanced rendering techniques, innovative Python integration, and modern architectural patterns.

While Cardia's active development has concluded as I focus on my current research with Zenyth Engine, it remains a testament to extensive learning in rendering technology, large-scale project management, and advanced C++ programming techniques.

Project Evolution & Technical Foundations

From OpenGL to Vulkan: A Rendering Revolution

The engine's development began with OpenGL, leveraging its extensive documentation and community resources. However, as the project evolved, OpenGL's architectural limitations became increasingly apparent. The lack of fine-grained control over the rendering pipeline prompted a complete migration to Vulkan - a decision that dramatically expanded both the technical complexity and capabilities of the engine.

This transition involved implementing fundamental Vulkan concepts including command buffer management, descriptor set handling, and manual memory allocation. The engine now provides direct control over GPU resources, enabling future support for concurrent rendering architectures, though full multi-threading implementation remains a future enhancement.

Core Architecture & Design Patterns

Entity-Component-System Implementation

Drawing inspiration from data-oriented design principles and utilizing the powerful EnTT library, Cardia embraces the Entity-Component-System paradigm throughout its architecture. This approach prioritizes composition over inheritance, eliminating many traditional object-oriented architectural complexities.

The ECS pattern proves particularly effective in rendering systems, where iterating through transform and model components for scene rendering becomes highly efficient. Multiple rendering passes benefit significantly from CPU cache optimization, as the system processes homogeneous data blocks rather than scattered object hierarchies. This data-oriented approach extends beyond rendering to input handling and Python scripting integration.

Advanced Python Integration

One of Cardia features is its seamless Python scripting integration using pybind11. This system required solving complex challenges in C++ compile-time reflection through template metaprogramming and macro systems.

The Python-C++ bridge maintains strict memory management boundaries, with nearly all allocations occurring in C++ while Python serves as a safe interface layer. This architecture prevents Python scripts from corrupting engine state while providing developers with an accessible, high-level scripting environment for game logic implementation.

Technical Systems & Capabilities

Rendering Pipeline

The Vulkan-based rendering system supports modern graphics techniques including:

  • Physically Based Rendering Foundation: Material system implementation with plans for full PBR workflow
  • Manual Memory Management: Direct control over GPU memory allocation and resource lifecycle
  • Command Buffer Architecture: Efficient GPU command recording and submission
  • Descriptor Set Management: Optimized resource binding for shader programs

Asset Management System

Developed a sophisticated asset management framework that automatically tracks resource usage patterns. The system employs reference counting similar to smart pointers, automatically releasing unused assets after predetermined idle periods. This approach optimizes memory usage while maintaining responsive asset access for frequently used resources.

Asset loading leverages industry-standard libraries including Assimp for 3D model import, ensuring compatibility with common content creation workflows and file formats.

Cross-Platform Support

Cardia targets Windows and Linux platforms, demonstrating portable C++ development practices and cross-platform Vulkan implementation. The engine's architecture supports future platform expansion through abstraction layers and platform-specific optimizations.

Development Challenges & Solutions

C++ Compile-Time Reflection

Implementing reflection capabilities in C++ - a language without native reflection support - required extensive template metaprogramming and macro manipulation. This system enables automatic Python binding generation and component registration, significantly reducing boilerplate code while maintaining type safety.

Memory Safety in Multi-Language Environment

Bridging C++ and Python required careful attention to memory ownership and lifecycle management. The solution maintains clear boundaries where C++ owns all game engine data, while Python operates through controlled interfaces that prevent memory corruption and ensure engine stability.

Practical Demonstration

Cardia's capabilities are showcased through RollingOut, a complete puzzle game demonstrating the engine's asset loading, input handling, Python scripting, and rendering systems in a real-world scenario.

Technical Stack

  • Core Language: C++20
  • Graphics API: Vulkan
  • Scripting: Python (pybind11)
  • ECS Framework: EnTT
  • Asset Loading: Assimp
  • Platforms: Windows, Linux
  • Architecture: Data-oriented design
  • Memory: Custom allocation systems

Learning Outcomes & Professional Impact

This three-year journey provided invaluable insights into advanced rendering techniques, large-scale C++ project architecture, and the intricacies of systems programming. The experience of building an engine from scratch illuminated the complexity behind commercial game engines and reinforced the importance of architectural planning in long-term software projects.

The challenges overcome during Cardia's development - from Vulkan's steep learning curve to C++ template metaprogramming - have significantly enhanced my ability to tackle complex technical problems and architect scalable software systems.

Open Source & Continued Innovation

Cardia Engine is available as open source at GitHub/TNtube/Cardia, providing transparency into its implementation and enabling community learning from its architectural decisions.

While Cardia's development phase has concluded, the knowledge and techniques developed continue to influence my current research in advanced engine architecture through the Zenyth Engine project, exploring next-generation rendering techniques and engine design patterns.