Documentation

Core Concepts

Understanding scenes, objects, and components in Modularity Engine.

Scene Format and Serialization

Scenes are stored in a text format handled by SceneSerializer:

  • Header keys include version, nextId, timeOfDay, and objectCount.
  • Each object is written as an [Object] block with key/value pairs.
  • Transforms are stored as local position/rotation/scale relative to the parent.

This text format is intentionally human-readable for diffing and manual edits.

Scene Objects & Components

Every object is a SceneObject with a core transform and a set of component flags/data. The engine uses flags such as hasRenderer, hasLight, hasUI, etc., to decide which systems apply.

Core Components

ComponentDescription
TransformPosition/rotation/scale, plus local transform and parent/child relationships.
RendererMesh type + material + textures + shader paths.
LightLight type, color, intensity, range, and light-specific parameters.
CameraFOV, near/far, 2D settings, post-FX toggle.
PostFXGlobal effects settings (bloom, color adjust, motion blur, vignette, etc).
ScriptsOne or more script components (C++ or managed C#).

Physics Components

3D (PhysX, optional):

  • Rigidbody - mass, damping, gravity, kinematic, lock rotation
  • Collider - box, mesh, convex mesh, capsule

2D (built-in):

  • Rigidbody2D - velocity, gravity
  • Collider2D - box, polygon, edge
  • ParallaxLayer2D
  • CameraFollow2D

Audio Components

  • AudioSource - clip path, volume, spatial, rolloff
  • ReverbZone - shape, blend distance, preset/custom parameters

Animation Components

  • Animation - keyframe clip, interpolation
  • SkeletalAnimation - GPU skinning, clip index, bone data

UI Components

The UI component represents Canvas + UI elements:

  • Anchoring, positioning in pixels, size, color, text, and interaction state.
  • UI elements can optionally render in 3D to a texture target.

Object Types

Examples of built-in object types:

3D Primitives

  • Cube, Sphere, Capsule, Plane, Torus

Imported Meshes

  • OBJMesh - OBJ file import
  • Model - Assimp-based (FBX, GLTF, etc.)

Lights

  • DirectionalLight, PointLight, SpotLight, AreaLight

UI Elements

  • Canvas - UI container
  • UIImage, UISlider, UIButton, UIText
  • Sprite (3D), Sprite2D (screen space)

Miscellaneous

  • Camera
  • PostFXNode
  • Mirror
  • Empty