Scene System
Feature: Scene System
Section titled “Feature: Scene System”The Scene System provides a high-performance simulation environment that bridges the gap between game engine mechanics (ECS) and content interchange (USD).
Key Concepts
Section titled “Key Concepts”- Hybrid Architecture: Combines Flecs (Entity Component System) for runtime performance with USD (Universal Scene Description) for persistent storage.
- Schema-Driven Sync: Network replication is defined by data schemas. You define the data structure, and the system handles delta compression and transport.
- Lifecycle Management: Supports both Transient (temporarily in-memory) and Persistent (saved to disk) scenes.
1. The Scene Graph
Section titled “1. The Scene Graph”The SceneGraph wraps the underlying ECS to provide a familiar, object-oriented hierarchy API.
SceneGraph graph;
auto parent = graph.createEntity("Car");auto wheel = graph.createEntity("Wheel");
// Hierarchy is managed automaticallygraph.setParent(wheel, parent);2. USD Interop
Section titled “2. USD Interop”Seamlessly move data between the runtime simulation and USD format.
// Import a level (requires Stage + USDA content)usdService.importUsdIntoWorld(world, stage, usdaContent);
// Export the current stateauto usda = usdService.exportWorldToUsd(world, stage);3. Automatic Replication
Section titled “3. Automatic Replication”Components registered with the system automatically synchronize across the network.
// 1. Setup observers (one-time)client.setupBuiltinSyncObservers(world);
// 2. Changes are now instantly replicatedentity.set<Transform>({0, 10, 0});