Architecture
OpenReality is built on three core abstractions: an Entity Component System for data, an immutable Scene graph for structure, and a Systems pipeline for behavior.
# Entity Component System
Every game object is an EntityID (a unique UInt64). Behavior and data are attached as Components — plain Julia structs that subtype Component. Components are stored in type-specific ComponentStores with contiguous arrays for cache-friendly iteration.
Key properties:
- • O(1) component lookup via EntityID → index mapping
- • O(1) removal via swap-and-pop deletion
- • Non-allocating iteration over all instances of a component type
- • Global registry — components are accessible from anywhere
# Immutable Scene Graph
Scenes are immutable structs. All mutations return a new Scene instance. The declarative scene([entity([...])]) DSL builds the entire hierarchy in one expression, automatically creating entities, registering components, and establishing parent-child relationships.
# Scene Traversal
Traverse the scene graph depth-first, query parent-child relationships, or collect all descendants of a subtree.
# Systems Pipeline
Each frame, the engine runs a fixed sequence of systems. These operate on components in the ECS store, updating transforms, physics, animation, audio, and particles before rendering.
# Backend Abstraction
All rendering backends implement AbstractBackend. Switching backends is a one-line change — the rest of the engine is backend-agnostic.
render(scene) without an explicit backend= keyword falls through to default_backend(): Vulkan on Linux/Windows, Metal on macOS, OpenGL as the universal fallback.
VulkanBackend
Default on Linux and Windows. Full deferred PBR, forward transparent pass, CSM, IBL, SSAO, SSR, TAA, DOF, motion blur, bloom.
MetalBackend
Default on macOS. Native Metal API via FFI bridge with the same feature set.
OpenGLBackend
Legacy / fallback. OpenGL 3.3 core profile via ModernGL. Use when Vulkan or Metal isn't available.
WebGPUBackend
Experimental. Browser-ready via Rust FFI and WASM export.