Level file
The level format Level Lab downloads and Ember and Delve ship, version by version, with every field, limit, tile and thing.
Last updated
A level is a JSON file. Level Lab's Download writes it, and the games load it exactly as it is. Every level that ships with Ember and Delve is one of these files.
An example
{
"version": 2,
"type": "level",
"game": "ember",
"name": "First light",
"width": 64,
"height": 17,
"layers": [
{ "name": "ground", "tiles": [0, 0, 1, 1] },
{ "name": "decor", "tiles": [0, 6, 0, 0] }
],
"entities": [
{ "type": "spawn", "x": 2, "y": 12 },
{ "type": "brazier", "x": 30, "y": 11 },
{ "type": "goal", "x": 60, "y": 11 }
],
"links": []
}The example's tile lists are cut short. A real file has one number for every tile of the map.
Fields
| Field | Type | Rules |
|---|---|---|
version | number | 2. A file newer than the reader knows is refused, rather than guessed at. |
type | text | Always "level" |
game | text | "ember" or "delve" |
name | text | Shown in the game's menu. An empty name reads as "Untitled level". |
cognivoMayUse | true, optional | Written when the maker ticks Allow Cognivo to use this. Absent, or anything but true, means no permission. |
width | number | 16 to 240 tiles |
height | number | 10 to 60 tiles |
layers | list | One per layer the game has: ground and decor |
layers[].tiles | list of numbers | Exactly width × height tile ids, row by row from the top left. 0 is empty. |
entities | list | The things on the map: type, and the tile x and y, counted from the top left |
entities[].id | text, optional | 1 to 16 characters, unique in the level. Only needed on a thing that is linked. |
entities[].props | object, optional | Named settings: a number, true or false, or a list of [x, y] tile points. Each thing says which it takes. |
links | list, optional | { "from": id, "to": id }: which thing drives which, such as a plate opening a gate |
Level Lab writes one row of tiles per line, so a level reads as a map in a diff.
Versions
- Version 2 added
id,propsandlinks. No thing in Ember or Delve takes settings or links yet; the worlds still to come bring the first (plates and gates, moving platforms). - Version 1 files are read as version 2 with none of them, so every level made before still plays. Level Lab saves as version 2.
Playable or not
A file can be valid without being ready to play. Level Lab saves drafts too. A game only offers a level when:
- every tile on a layer belongs on that layer;
- each thing that a level needs (a start and a goal) is there, and no more of each than allowed;
- no thing is of an unknown type, or off the map;
- every setting is one that kind of thing takes, in its range, and every link joins things that can be linked.
Level Lab's Ready to play? lists any of these in words.
Ember's tiles and things
| Id | Tile | Layer | Behaves |
|---|---|---|---|
1 | Earth | ground | Solid |
2 | Stone | ground | Solid |
3 | Plank | ground | Stand on it, jump up through it |
4 | Spikes | ground | Puts you out |
5 | Water | ground | Puts you out |
6 | Grass | decor | Decoration only |
7 | Flower | decor | Decoration only |
8 | Mushroom | decor | Decoration only |
| Type | Thing | How many | What it is |
|---|---|---|---|
spawn | Start | Exactly one | Where Ember appears. One per level. |
goal | Lantern | Exactly one | Reach it to finish. One per level. |
spark | Spark | Any number | A collectible. |
brazier | Brazier | Any number | A checkpoint. Touch it to light it; going out brings Ember back here. |
drip | Drip | Any number | Walks to and fro. Land on it to put it out. |
Delve's tiles and things
| Id | Tile | Layer | Behaves |
|---|---|---|---|
1 | Rock | ground | Solid |
2 | Water | ground | Puts you out |
3 | Door | ground | Solid |
4 | Moss | decor | Decoration only |
5 | Pebbles | decor | Decoration only |
6 | Glowshroom | decor | Decoration only |
| Type | Thing | How many | What it is |
|---|---|---|---|
spawn | Start | Exactly one | Where the delver begins. One per level. |
exit | Stairs | Exactly one | The way down. One per level. |
key | Key | Any number | Opens one door. |
gem | Gem | Any number | A collectible. |
lamppost | Lamp post | Any number | A checkpoint. Touch it to light it; going out brings the delver back here. |
bat | Bat | Any number | Flies left and right. |
spider | Spider | Any number | Crawls up and down. |