Skip to content
bg2 engine

C++ API Overview

The C++ API provides a native runtime for the engine, designed for high-performance applications and built on top of Vulkan. It offers full control over GPU resources and rendering behavior, enabling the development of advanced graphics applications with demanding performance and quality requirements.

The API follows an imperative, object-oriented programming model, where developers explicitly manage scenes, resources, and rendering pipelines. This approach allows precise control over execution flow, memory usage, and synchronization, which is essential for performance-critical environments.

This API is intended for:

  • High-fidelity rendering applications
  • Simulation systems with complex graphical requirements
  • Asset processing and content authoring tools
  • Offline or backend rendering pipelines

The C++ API is built around modern Vulkan concepts and exposes low-level control while maintaining a structured and extensible architecture. Key characteristics include:

  • Explicit GPU resource management and synchronization
  • Use of dynamic rendering instead of traditional render passes
  • Modular graphics pipeline configuration
  • Support for advanced rendering techniques such as PBR, IBL, MSAA, and deferred rendering
  • Fine-grained control over render states, blending, depth testing, and culling

This design enables predictable performance and allows the engine to fully leverage modern GPU capabilities.

The engine is structured around a scene graph with hierarchical nodes and a component-based system. Components encapsulate behavior and rendering logic, and are designed to be extensible through a registration and serialization system.

Key elements include:

  • Strong separation between scene structure and rendering logic
  • JSON-based serialization for scenes, materials, and components
  • Binary asset formats optimized for fast loading and cross-platform compatibility
  • Factory-based component instantiation with runtime type identification

The C++ API is designed for scenarios where performance, scalability, and rendering quality are critical. It is suitable for building standalone applications, professional tools, and backend systems where full control over the rendering pipeline is required.

It also plays a central role in asset generation workflows, enabling content created with the native API to be deployed directly to the web runtime without requiring transformations, thanks to the shared architecture between both APIs.