Api

Scene JSON

Scene file layout, built-in component data, load paths, and custom component registration.

Location and Loading

Scene files usually live in:

game/levels/

Load a scene by name:

Public::Engine::getInstance().LoadScene("physics");

The loader searches:

  1. physics.json
  2. levels/physics.json
  3. scenes/physics.json

Top-Level Shape

{
  "version": 0,
  "ent": [
    {
      "id": 1,
      "components": []
    }
  ]
}

Both version and ent are required.

Entity Shape

{
  "id": 1,
  "components": [
    {
      "type": "Transform",
      "data": {
        "position": [0.0, 2.0, -8.0],
        "rotation": [0.0, 0.0, 0.0, 1.0],
        "scale": [1.0, 1.0, 1.0]
      }
    }
  ]
}

id is used to create the ECS entity. Transform.parent can reference another scene id numerically.

Component Shape

Every component uses:

{
  "type": "ComponentName",
  "data": {}
}

Built-in component names include:

  • Transform
  • MeshRenderer
  • Camera
  • Light
  • ShadowProjector
  • Animator
  • Rigidbody
  • BoxCollider
  • SphereCollider
  • CapsuleCollider
  • MeshCollider
  • PostProcessingSystem
  • ACES
  • ColorAdjustment
  • Vignette
  • ChromaticAberration
  • FilmGrain
  • Bloom
  • ColorGradingLUT
  • AutoExposure

NVEditor may include showEditorGizmo; runtime component factories ignore unknown editor-only fields.

Mesh Entity Example

{
  "id": 2,
  "components": [
    {
      "type": "Transform",
      "data": {
        "position": [0.0, 0.0, 0.0],
        "rotation": [0.0, 0.0, 0.0, 1.0],
        "scale": [1.0, 1.0, 1.0]
      }
    },
    {
      "type": "MeshRenderer",
      "data": {
        "enabled": true,
        "mesh": "assets/outside/new_road.glb",
        "material": ["asphalt", "pavement", "neon"]
      }
    }
  ]
}

Physics Entity Example

{
  "type": "Rigidbody",
  "data": {
    "type": "Dynamic",
    "mass": 1.0,
    "linearVelocity": [0.0, 0.0, 0.0],
    "drag": 0.0,
    "useGravity": true,
    "lockRotation": false,
    "lockMovement": false
  }
},
{
  "type": "CapsuleCollider",
  "data": {
    "center": [0.0, 0.0, 0.0],
    "radius": 0.34,
    "height": 0.68,
    "friction": 0.5,
    "restitution": 0.0,
    "isTrigger": false
  }
}

lockRotation and lockMovement can be booleans, arrays, or {x,y,z} objects.

Post-Processing Entity Example

{
  "id": 5,
  "components": [
    {
      "type": "Transform",
      "data": {
        "position": [0.0, 0.0, 0.0],
        "rotation": [0.0, 0.0, 0.0, 1.0],
        "scale": [1.0, 1.0, 1.0]
      }
    },
    {
      "type": "PostProcessingSystem",
      "data": {
        "enabled": true,
        "priority": 0
      }
    },
    {
      "type": "ACES",
      "data": {
        "enabled": true,
        "exposure": 1.0
      }
    },
    {
      "type": "Bloom",
      "data": {
        "enabled": true,
        "threshold": 0.8,
        "intensity": 4.0,
        "radius": 4.0,
        "iterations": 8
      }
    }
  ]
}

outside.json and nevo_image1.json contain current post-processing examples.

Custom Components

Register custom scene component creators before engine initialization:

engine.RegisterComponent("Freecam", CreateFreecamComponent);
engine.Initialize();
coord.registerComponent<Freecam>();

Then scene JSON can include:

{
  "type": "Freecam",
  "data": {
    "speed": 15.0,
    "sensitivity": 0.001,
    "yaw": 0.0,
    "pitch": 0.0
  }
}

Custom creators are responsible for parsing data and calling Coordinator::addComponent.