Skip to content

[0.8.0] New IntGrid CSV format in Json

Sébastien Bénard edited this page Jan 20, 2022 · 1 revision

Summary

Starting with 0.8.0 update, IntGrid layer data in Json will use a much more simple CSV format, in a new field called intGridCsv.

The previous field (intGrid) will be dropped on version 0.10.0 and later.

Breaking JSON change in 0.8.0

New JSON field

The following array was added In levels > layerInstances:

"intGridCsv": [
  0,0,0,1,1,2,0,0,0, // ...
],

What are the differences?

  • intGridCsv is an array of all values in the IntGrid layer, stored from left to right, and top to bottom.
  • intGrid values are now 1-based instead of 0-based! So in this field, 0 means "empty cell" and IntGrid values are 1+.
  • The array size is always __cWid*__cHei.

Previous format:

"intGrid": [
  { coordId:4, value: -1 }, // note: previously, -1 meant "empty cell"!
  { coordId:5, value: -1 },
  { coordId:7, value: 2 },
  { coordId:9, value: 2 },
  // ...
];

Backward compatibility

The old intGrid JSON field can still be exported for back-compatibility purpose since LDtk hits version 0.10.0. This old field works entirely as before (-1 is empty, 0+ are values).

To enable this legacy export, open Project panel (F1), reveal Advanced Options at the bottom and enable this advanced option:

image