Skip to content

Service Architecture

EntropyPortal is built on a Service-Oriented Architecture (SOA). Each major system is encapsulated as an EntropyService, managed by the central application. This promotes modularity, testability, and clear lifecycle management.

The heart of the graphics engine.

  • Responsibilities:
    • Owns the GpuRenderDevice and swapchain.
    • Manages the rendering loop (beginFrame, renderFrame, endFrame).
    • Orchestrates the RenderGraph and WorkGraph.
    • Handles per-object resource management (buffers).
  • Dependencies: SceneService (for data), MesherService (for assets), MaterialService.

The bridge between the network and the ECS.

  • Responsibilities:
    • Maintains the local Flecs world.
    • Receives snapshots/deltas from the NetworkSession.
    • Manages entity lifecycle (creation, destruction).
    • Provides spatial queries via VisibilityService.
  • Integration: It exposes the RenderWorld (a double-buffered extraction of scene state) for the renderer to consume safely.

Handles spatial indexing and culling.

  • Mechanism: Uses a loose octree (or similar spatial structure) to track dynamic and static objects.
  • Culling:
    • CPU Frustum Culling: Extracting potentially visible sets for the main camera.
    • GPU Culling: Uploading bounds buffer for compute-shader based culling.
    • PVS: Optional Potential Visibility Set checks.

Manages material assets and shader variants.

  • Responsibilities:
    • Creates and caches Material instances.
    • Compiles shader variants on demand via ShaderCompilerService.
    • Manages the ShaderMaterialRegistry for batched rendering.

Manages Global Illumination.

  • Responsibilities:
    • Captures and integrates Spherical Gaussian (SG) light probes.
    • Manages the 3D probe grid structure on the GPU.
    • Handles streaming and update scheduling for probes.

Manages high-fidelity shadows.

  • Responsibilities:
    • Allocates and updates the virtual shadow map atlas.
    • Manages page tables for shadow memory.
    • Handles shadow caster culling and rendering.
graph TD
    App[Application] --> Render[RenderService]
    App --> Scene[SceneService]

    Render --> Device[GpuRenderDevice]
    Render --> Mat[MaterialService]
    Render --> Mesh[MeshService]
    Render --> VSM[VirtualShadowMapService]
    Render --> Probes[ProbeVolumeService]

    Scene --> Visibility[VisibilityService]
    Scene --> Input[InputService]

    Render -.->|Reads| Scene
    Mat -.->|Uses| Device