Level JSON
Format
Complete reference for authoring level files. Every level is a single .json file describing the player, objects, lighting, and skybox.
Root Structure
The top-level object contains metadata and four main sections. All fields are required unless marked optional.
| Field | Type | Req | Description |
|---|---|---|---|
| levelName | string | yes | Display name of the level shown in menus. |
| levelNo | number | yes | Integer index. Used for level ordering and save data. |
| version | string | yes | Format version string. Always "1.0". |
| texelsPerUnit | number | yes | Texture scale multiplier applied globally. 1.0 is default. |
| player | object | yes | Player configuration. See player section. |
| objects | array | yes | All scene objects. See objects section. |
| lights | array | yes | All light sources. See lights section. |
| skybox | object | yes | Six skybox face image paths. See skybox section. |
player
Defines the first-person player: camera settings, spawn position, physics, and audio.
| Field | Type | Req | Description / Notes |
|---|---|---|---|
| img | string | yes | Path to the player diffuse texture. |
| img_spec | string | yes | Path to specular map. Can be same as img. |
| shader | string | yes | Shader name. Use "pointLightShader" for point-lit scenes. |
| moveSpeed | number | yes | Units per second. Typical range: 2.0–5.0. |
| position | array[3] | yes | [x, y, z] world spawn position. |
| scale | array[3] | yes | Player collision box scale. X is typically 0.0 (no model shown). |
| yaw | number | yes | Initial horizontal look angle in degrees. |
| pitch | number | yes | Initial vertical look angle in degrees. |
| height | number | yes | Camera eye height above the player's base position. |
| fov | number | yes | Vertical field of view in degrees. Typical: 45.0–90.0. |
| farPlane | number | yes | Camera far clip distance. Increase for larger levels. |
| nearPlane | number | yes | Camera near clip distance. Keep at 0.1. |
| verticalForce | number | yes | Jump impulse strength. Higher = bigger jump. Typical: 5.0–8.0. |
| isUnderWater | boolean | yes | Enables underwater post-processing effect on spawn. |
| walk | string | yes | Path to footstep audio file. |
| jmp | string | yes | Path to jump sound effect. |
| children | array | opt | Child objects attached to the player. Usually empty []. |
"player": { "img": "Assets\\Images\\lv1\\player.png", "img_spec": "Assets\\Images\\lv1\\player.png", "shader": "pointLightShader", "moveSpeed": 3.5, "position": [ -2.0, 4.0, 0.0 ], "scale": [ 0.0, 1.0, 0.5 ], "yaw": 0.0, "pitch": 0.0, "height": 1.4, "fov": 45.0, "farPlane": 100.0, "nearPlane": 0.1, "verticalForce": 5.0, "isUnderWater": false, "walk": "Assets\\Audio\\walk.wav", "jmp": "Assets\\Audio\\jmp.wav", "children": [] }
objects
An array of scene objects. Each object is a platform, wall, prop, or decoration placed in world space.
type values:
model path instead of img. Suited for complex geometry.| Field | Type | Req | Description / Notes |
|---|---|---|---|
| id | number | yes | Unique integer ID per object. Must not repeat within a level. |
| type | string | yes | "static_platform" or "model". |
| img | string | yes* | Diffuse texture path. Required for static_platform. Omit for model type. |
| img_spec | string | yes* | Specular map path. Usually same as img. |
| model | string | * | Path to .obj file. Only used when type is "model". |
| shininess | number | yes | Specular highlight sharpness. 0 = matte, 128 = mirror-like. Typical: 8–32. |
| noOfRepeationX | number | yes | Texture tile count on the X axis. Higher = smaller tiles. |
| noOfRepeationY | number | yes | Texture tile count on the Y axis. |
| hasAudio | boolean | yes | Whether this object emits audio. |
| shader | string | yes | Shader program name. See Shaders reference. |
| audio | string | yes | Audio file path. Used when hasAudio is true. Otherwise ignored (still required as empty string or dummy path). |
| is3dAudio | boolean | yes | If true, audio attenuates with distance from the player. |
| position | array[3] | yes | [x, y, z] world position of the object's center. |
| rotationAngle | number | yes | Rotation in degrees around rotationAxis. |
| rotationAxis | array[3] | yes | Normalized axis vector for rotation. [0,1,0] = rotate around Y (yaw). [0,0,1] = roll (for ramps). |
| scale | array[3] | yes | [x, y, z] size in world units. A floor might be [10, 0.1, 10], a wall [0.1, 5, 10]. |
| dynamicFriction | number | yes | Friction coefficient. 0 = ice, 1 = sticky. Typical: 0.6–0.8. |
| bounceness | number | yes | Restitution / bounciness. 0 = no bounce, 1 = full elastic. |
| mass | number | yes | Physics mass in kg. High mass = harder to push. 1000+ for immovable terrain. |
| isStatic | boolean | yes | If true, excluded from physics simulation entirely (zero cost). If false, participates in physics. |
| isMovable | boolean | yes | Whether the object can be moved by forces or player interaction. |
| meshEnabled | boolean | yes | Toggles the collision mesh. Disable for thin planes that don't need collision (e.g. carpet overlays). |
| movable | null / object | opt | Movable behaviour config. Set to null when unused. |
rotationAxis: [0, 0, 1] with a small rotationAngle like 10–20. For walls rotated in the horizontal plane, use [0, 1, 0] with 90.
meshEnabled: false for decorative overlays like carpets placed on top of floors. Use isStatic: false to let the physics engine track the object (required even for non-moving objects in most setups).
{ "id": 1, "type": "static_platform", "img": "Assets\\Images\\lv1\\ground.png", "img_spec": "Assets\\Images\\lv1\\ground.png", "shininess": 16.0, "noOfRepeationX": 4, "noOfRepeationY": 4, "hasAudio": false, "shader": "pointLightShader", "audio": "Assets\\Audio\\lv1\\bg.wav", "is3dAudio": false, "position": [ 0.0, 0.0, 0.0 ], "rotationAngle": 0.0, "rotationAxis": [ 0.0, 1.0, 0.0 ], "scale": [ 10.0, 0.1, 10.0 ], "dynamicFriction": 0.8, "bounceness": 0.0, "mass": 1000.0, "isStatic": false, "isMovable": false, "meshEnabled": true, "movable": null }
{ "id": 2, "type": "static_platform", "img": "Assets\\Images\\lv1\\wall.png", "img_spec": "Assets\\Images\\lv1\\wall.png", "shininess": 8.0, "noOfRepeationX": 4, "noOfRepeationY": 4, "hasAudio": false, "shader": "pointLightShader", "audio": "Assets\\Audio\\lv999.wav", "is3dAudio": false, "position": [ 10.0, 0.0, 0.0 ], "rotationAngle": 90.0, // rotate 90° around Y to face Z-axis "rotationAxis": [ 0.0, 1.0, 0.0 ], "scale": [ 0.1, 5.0, 10.0 ], "dynamicFriction": 0.8, "bounceness": 0.0, "mass": 1000.0, "isStatic": false, "isMovable": false, "meshEnabled": true, "movable": null }
lights
An array of light sources. Multiple lights are supported. Each light has a type, color, position or direction, and Phong shading parameters.
| Field | Type | Req | Description |
|---|---|---|---|
| type | string | yes | "point" or "directional". See Light Types. |
| color | array[4] | yes | RGBA light color tint. [1,1,1,1] = white. Values 0–1. |
| position | array[3] | * | World position. Required for point lights. |
| direction | array[3] | * | Light direction vector. Required for directional lights. |
| scale | array[3] | yes | Visual scale of the light source gizmo. Does not affect radius. Keep small: [0.1, 0.1, 0.1]. |
| ambient | array[4] | yes | RGBA ambient term. Fills shadow areas. Keep dark: [0.1–0.2, ...]. Yellow ambient causes yellow tinting. |
| diffuse | array[4] | yes | RGBA diffuse term. Main surface lighting color. For neutral: [0.8, 0.8, 0.8, 1]. |
| specular | array[4] | yes | RGBA specular highlight color. Keep neutral or match diffuse. |
| shininess | number | yes | Phong shininess exponent. Higher = tighter highlights. Typical: 16–64. |
ambient to [1.0, 1.0, 0.0, 1.0] makes the entire scene look yellow because ambient is added to every surface. Keep ambient dark and neutral — e.g. [0.15, 0.1, 0.05, 1.0] for warm torchlight.
{ "type": "point", "color": [ 1.0, 0.85, 0.5, 1.0 ], "position": [ 0.0, 4.9, 0.0 ], "scale": [ 0.1, 0.1, 0.1 ], "ambient": [ 0.15, 0.1, 0.05, 1.0 ], "diffuse": [ 1.0, 0.85, 0.5, 1.0 ], "specular": [ 0.8, 0.7, 0.4, 1.0 ], "shininess": 32.0 }
{ "type": "directional", "color": [ 1.0, 1.0, 1.0, 1.0 ], "direction": [ -0.3, -1.0, 0.2 ], // angled downward like a sun "scale": [ 0.1, 0.5, 0.1 ], "ambient": [ 0.2, 0.2, 0.2, 1.0 ], "diffuse": [ 0.8, 0.8, 0.8, 1.0 ], "specular": [ 0.6, 0.6, 0.6, 1.0 ], "shininess": 16.0 }
skybox
Six image paths for a cube-mapped skybox. Each face must be the same resolution.
| Field | Type | Description |
|---|---|---|
| top | string | +Y face (sky above). |
| bottom | string | −Y face (ground below). |
| front | string | +Z face. |
| back | string | −Z face. |
| left | string | −X face. |
| right | string | +X face. |
"skybox": { "top": "Assets\\Images\\lv1\\top.png", "bottom": "Assets\\Images\\lv1\\bottom.png", "front": "Assets\\Images\\lv1\\front.png", "back": "Assets\\Images\\lv1\\back.png", "left": "Assets\\Images\\lv1\\left.png", "right": "Assets\\Images\\lv1\\right.png" }
Shaders
The shader field on both player and objects selects the GLSL program used to render that mesh.
| Shader Name | Use On | Description |
|---|---|---|
| pointLightShader | objects, player | Phong shading driven by point lights in the scene. Use this for indoor/enclosed levels with explicit light sources. |
| directionalLight | objects | Phong shading driven by a directional light (sun-like). Use for outdoor/open levels or model objects. |
directionalLight on large terrain meshes and pointLightShader on props and the player. Match each object's shader to the light type it should respond to.
Light Types
Two light types are supported. Choose based on the scene's mood and scale.
| Type | Required Field | Behavior |
|---|---|---|
| point | position [x,y,z] |
Emits light in all directions from a world position. Attenuates with distance. Ideal for torches, lamps, and interior lighting. Place near the ceiling or inside lanterns. |
| directional | direction [x,y,z] |
Infinite parallel light with no falloff. All surfaces lit equally regardless of distance. Ideal for sunlight, moonlight. Direction should point toward surfaces, e.g. [-0.3, -1.0, 0.2]. |
Full Example
A minimal but complete level file — one room with floor, four walls, ceiling, and a point light.
{ "levelName": "The First Room", "levelNo": 1, "version": "1.0", "texelsPerUnit": 1.0, "player": { "img": "Assets\\Images\\lv1\\player.png", "img_spec": "Assets\\Images\\lv1\\player.png", "shader": "pointLightShader", "moveSpeed": 3.5, "position": [ 0.0, 1.0, 0.0 ], "scale": [ 0.0, 1.0, 0.5 ], "yaw": 0.0, "pitch": 0.0, "height": 1.4, "fov": 45.0, "farPlane": 100.0, "nearPlane": 0.1, "verticalForce": 5.0, "isUnderWater": false, "walk": "Assets\\Audio\\walk.wav", "jmp": "Assets\\Audio\\jmp.wav", "children": [] }, "objects": [ { "id": 1, "type": "static_platform", "img": "Assets\\Images\\lv1\\ground.png", "img_spec": "Assets\\Images\\lv1\\ground.png", "shininess": 16.0, "noOfRepeationX": 4, "noOfRepeationY": 4, "hasAudio": false, "shader": "pointLightShader", "audio": "Assets\\Audio\\lv1\\bg.wav", "is3dAudio": false, "position": [0,0,0], "rotationAngle": 0, "rotationAxis": [0,1,0], "scale": [10,0.1,10], "dynamicFriction": 0.8, "bounceness": 0, "mass": 1000, "isStatic": false, "isMovable": false, "meshEnabled": true, "movable": null } ], "lights": [ { "type": "point", "color": [ 1.0, 1.0, 1.0, 1.0 ], "position": [ 0.0, 4.9, 0.0 ], "scale": [ 0.1, 0.1, 0.1 ], "ambient": [ 0.2, 0.2, 0.2, 1.0 ], "diffuse": [ 0.8, 0.8, 0.8, 1.0 ], "specular": [ 0.6, 0.6, 0.6, 1.0 ], "shininess": 16.0 } ], "skybox": { "top": "Assets\\Images\\lv1\\top.png", "bottom": "Assets\\Images\\lv1\\bottom.png", "front": "Assets\\Images\\lv1\\front.png", "back": "Assets\\Images\\lv1\\back.png", "left": "Assets\\Images\\lv1\\left.png", "right": "Assets\\Images\\lv1\\right.png" } }