Map Format
Maps are stored as JSON files. The map editor exports this format, and the Mortar engine reads it at startup.
Top-Level Structure
Section titled “Top-Level Structure”{ "version": 1, "name": "My Map", "entities": [...]}| Field | Type | Description |
|---|---|---|
version | number | Format version (currently 1) |
name | string | Display name of the map |
entities | array | List of entity objects |
Entity Object
Section titled “Entity Object”Each entity has a unique ID and a set of components:
{ "id": "entity-uuid", "name": "Floor", "components": { "transform": { "position": [0, 0, 0], "rotation": [0, 0, 0, 1], "scale": [10, 0.1, 10] }, "mesh": { "type": "box" }, "material": { "color": [0.3, 0.3, 0.35, 1.0] }, "rigidBody": { "type": "static" }, "collider": { "type": "box", "halfExtents": [5, 0.05, 5] } }}Component Types
Section titled “Component Types”transform
Section titled “transform”| Field | Type | Description |
|---|---|---|
position | [x, y, z] | World position |
rotation | [x, y, z, w] | Quaternion rotation |
scale | [x, y, z] | Scale on each axis |
| Field | Type | Description |
|---|---|---|
type | string | Primitive type: box, sphere, plane, cylinder |
material
Section titled “material”| Field | Type | Description |
|---|---|---|
color | [r, g, b, a] | RGBA color (0-1 range) |
rigidBody
Section titled “rigidBody”| Field | Type | Description |
|---|---|---|
type | string | static or dynamic |
mass | number | Mass in kg (dynamic only) |
collider
Section titled “collider”| Field | Type | Description |
|---|---|---|
type | string | box, sphere, capsule |
halfExtents | [x, y, z] | Half-size (box only) |
radius | number | Radius (sphere/capsule) |