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
ecs.jl

# 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.jl

# Scene Traversal

Traverse the scene graph depth-first, query parent-child relationships, or collect all descendants of a subtree.

traversal.jl

# 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.

pipeline.jl

# Backend Abstraction

All rendering backends implement AbstractBackend. Switching backends is a one-line change — the rest of the engine is backend-agnostic.

render.jl

OpenGLBackend

OpenGL 3.3 core profile. Works on all platforms. Default backend.

VulkanBackend

Full deferred PBR, CSM, IBL, SSAO, SSR, TAA. Linux and Windows.

MetalBackend

Native macOS Metal API via FFI bridge.

WebGPUBackend

Browser-ready via Rust FFI and WASM export.