I've made an attempt to write the parser according to the spec on the wiki but either I wrote it wrong or we haven't figured it out right yet. It all goes well until after reading the "TerrainPatchData" characters.

example file
- terrain 100 * 100
- 2 added texture layers

so that would mean the background layer has 50 * 50 * 24 triangles each triangle 12 bytes so that's 720000 bytes. Yet after the string there are only 24 587 bytes left in the file. So I end up with an EndOfStreamException. So either I misinterpretated the spec or we are missing something. Notice I didn't draw any textures on the terrain. Something other particular the first UINT32 read after the string is not the expected 60000 but 24576

- Created terrain 100 * 100 , cysal_base texture
- Added texture layer = grass something
- Added texture layer = stone something
- Save and then copy to experiment on

I've commited my work as is to the repository as reference the example data file is in there as well

edit:

Did a small test, I removed one texture layer, then fully painted the terrain with the remaining texture layer and the file size increased. So if there hasn't been drawn on the terrain there seems to be data missing.

edit2:

I was curious and went into the editor and counted the tiles on the border of my 100*100 terrain , the end result was 32 on either side so (32 * 2) * (32 * 2) triangles would be the end result. But maybe the triangles in the grid view aren't the same as the triangles in the data structure ... I'm not sure

Last edited by Celludriel; 25/07/14 08:27 PM.