Parsing Defold Files

I need to read a .tilesource file generated by the Defold Editor. What’s the best way to read and parse the raw text? I’m not sure which format Defold uses to store the text and if there exists an API for parsing.

Here’s an example:

image: "/assets/tileset.png"
tile_width: 8
tile_height: 8
tile_margin: 0
tile_spacing: 0
collision: ""
material_tag: "tile"
animations {
  id: "id1"
  start_tile: 1
  end_tile: 2
  playback: PLAYBACK_NONE
  fps: 30
  flip_horizontal: 1
  flip_vertical: 1
}
animations {
  id: "id2"
  start_tile: 4
  end_tile: 6
  playback: PLAYBACK_LOOP_PINGPONG
  fps: 70
  flip_horizontal: 0
  flip_vertical: 0
}
extrude_borders: 2
inner_padding: 0
sprite_trim_mode: SPRITE_TRIM_MODE_OFF

Check out DefTree: A python module for editing Defold files for ideas?

1 Like

The format is Google protobuf but you can not do that without the definitions, which are not public. So unfortunately the closest you can get to reliably parse them is with DefTree :slight_smile:

2 Likes