-
Notifications
You must be signed in to change notification settings - Fork 0
Content Maps
NGine can use maps from Tiled and LDtk and will export them as CSV files for each layer you have.
You can use the CSV files generated by either creating a parser yourself (a simple CSV parser should work), or by using the Tiled Support on Libdragon-Extensions (it will work on the files generated by both apps).
After importing a map (see Content Browser on how to import an asset) you will see the following options:
- Name: name of the map (in LDtk's case, it will be the name of the project)
- DFS Folder: root of where the files will be created when building (see Export for more info)
- Layers: list of all the layers inside the file (read-only)
When editing a map, you will only have access to the Name
and DFS Folder
settings, the layers should be changed inside Tiled or LDtk, and re-imported by using the Refresh Assets
button at the top of the Content Browser.
When exporting the maps during build, each layer will be imported as an individual CSV file that will have the tile id of each tile separated by ,
. Spaces that do not have anything (empty spaces) will contain -1
, so make sure to use signed integers when creating your own parser.
Example of a CSV file generated:
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
-1,-1,-1,-1,3,4,-1,-1,-1,11,-1,-1,-1,-1,3,4,-1,-1,-1
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,-1,-1,-1,-1,-1,-1,-1,-1
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,-1,-1,-1,-1,-1,-1,-1
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
-1,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,-1
For each map the exporter will generate a folder, and put all CSV files related to that map inside that folder.
The only difference between the Tiled and LDtk exporters, is that the LDtk exporter supports multiple maps, so it will generate an additional folder (using the map's Name
field), before the folder for the map. You can see the difference on the examples below.
Given a Tiled map named "plains", with a DFS Folder "/maps/", and 3 layers called "background", "objects", and "foreground", the generated files will be:
- /maps/plains/background.map
- /maps/plains/objects.map
- /maps/plains/foreground.map
Given an LDtk map named "plains", with a DFS Folder "/maps/", with 2 maps inside called "level-1" and "level-2", and 3 layers on each called "background", "objects", and "foreground", the generated files will be:
- For map "level-1":
- /maps/plains/level-1/background.map
- /maps/plains/level-1/objects.map
- /maps/plains/level-1/foreground.map
- For map "level-2":
- /maps/plains/level-2/background.map
- /maps/plains/level-2/objects.map
- /maps/plains/level-2/foreground.map