How galacean/engine works
Main Components
• Core Engine: The central module (found under packages/core) that manages components such as scene management, entity/component systems, rendering pipelines, asset management, and core utilities.
• Graphics Module: Encompassing 2D and 3D graphics; it includes modules for shaders, materials, meshes, textures, and lighting, distributed among packages like rhi‑webgl, shader‑lab, and shader‑shaderlab.
• Animation System: Contains support for animation clips, animators, state machines, and interpolation, evident in packages/core/animation.
• Physics & Collision: There are various physics implementations (physics‑lite and physics‑physx) along with support for physics scenes, colliders, joints, and forces.
• UI System: The engine’s GUI capabilities, provided by packages/ui, which include canvas, interactive components, and event handing suitable for dynamic GUI.
• XR Support: XR modules come in several parts (packages/xr, xr‑webxr) handling XR input, session management, and trackable features.
• Loader & Asset Management: The packages/loader contain various loaders (GLTF, KTX, prefab, etc.) designed to deserialize and load external assets.
• Math & Utility Libraries: Modules like packages/math provide essential support (vectors, matrices, bounding volumes, collision utilities, etc.).
• Editor and Development Tools: Documentation, examples, tests, and e2e are included to showcase usage and ensure quality.
Relationships and Interactions
• The Core Engine serves as the central orchestrator for the engine’s subsystems. It initializes the rendering pipelines, asset managers, and scene managers.
• Graphics and shader modules interact closely with the core engine to render both 2D and 3D scenes. The shader modules (shader‑lab and shader‑shaderlab) provide the shader logic and compile shaders that run on the GPU.
• The Animation and Physics systems both attach to entities managed by the core engine, updating state each frame.
• The UI system sits on top of the rendering engine, receiving input through shared mechanisms found in the input modules.
• Loader and asset management modules feed required resources (like textures, models, audio, etc.) into the core engine.
• XR modules interact with input and rendering to provide immersive experiences.
• Math and utility libraries are cross‑cutting and used by nearly all other modules for calculations and common helper functions.
Architectural Patterns & Design Principles
• Component-Based Architecture: Each entity in a scene is built from components (e.g., rendering, animation, physics) that can be composed flexibly.
• Modular/Plugin Structure: The engine is split into multiple packages distributed within a monorepo, facilitating scalability and independent upgrades.
• Separation of Concerns: Graphics, physics, input, and asset loading are all logically separated, with clear APIs and data flows.
• Event-Driven Updates: Several subsystems use events (from input or physics triggers) to signal changes or transitions, as seen in event dispatcher utilities.
Additional Notes for the Principal Software Engineer
• Be detailed in capturing every essential architectural element and interconnection.
• Explicit dependencies (e.g., how the loader modules interact with asset management in the core engine).