Cognivo

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

FieldTypeRules
versionnumber2. A file newer than the reader knows is refused, rather than guessed at.
typetextAlways "level"
gametext"ember" or "delve"
nametextShown in the game's menu. An empty name reads as "Untitled level".
cognivoMayUsetrue, optionalWritten when the maker ticks Allow Cognivo to use this. Absent, or anything but true, means no permission.
widthnumber16 to 240 tiles
heightnumber10 to 60 tiles
layerslistOne per layer the game has: ground and decor
layers[].tileslist of numbersExactly width × height tile ids, row by row from the top left. 0 is empty.
entitieslistThe things on the map: type, and the tile x and y, counted from the top left
entities[].idtext, optional1 to 16 characters, unique in the level. Only needed on a thing that is linked.
entities[].propsobject, optionalNamed settings: a number, true or false, or a list of [x, y] tile points. Each thing says which it takes.
linkslist, 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, props and links. 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

IdTileLayerBehaves
1EarthgroundSolid
2StonegroundSolid
3PlankgroundStand on it, jump up through it
4SpikesgroundPuts you out
5WatergroundPuts you out
6GrassdecorDecoration only
7FlowerdecorDecoration only
8MushroomdecorDecoration only
TypeThingHow manyWhat it is
spawnStartExactly oneWhere Ember appears. One per level.
goalLanternExactly oneReach it to finish. One per level.
sparkSparkAny numberA collectible.
brazierBrazierAny numberA checkpoint. Touch it to light it; going out brings Ember back here.
dripDripAny numberWalks to and fro. Land on it to put it out.

Delve's tiles and things

IdTileLayerBehaves
1RockgroundSolid
2WatergroundPuts you out
3DoorgroundSolid
4MossdecorDecoration only
5PebblesdecorDecoration only
6GlowshroomdecorDecoration only
TypeThingHow manyWhat it is
spawnStartExactly oneWhere the delver begins. One per level.
exitStairsExactly oneThe way down. One per level.
keyKeyAny numberOpens one door.
gemGemAny numberA collectible.
lamppostLamp postAny numberA checkpoint. Touch it to light it; going out brings the delver back here.
batBatAny numberFlies left and right.
spiderSpiderAny numberCrawls up and down.