Core Concepts

Understanding scenes, objects, and components in Modularity Engine.

Scene Format and Serialization

Scenes are stored in a human-readable text format handled by SceneSerializer. This format is designed for easy diffing and manual editing, making it suitable for version control systems like Git.

Scene Structure

Each scene file contains:

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

Note

The text-based format allows for manual scene editing, merging, and debugging using standard text tools.

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