( search forums )
Map File Format Suggestions
Soldat Forums - Soldat Talk - Developers Corner
April 17, 2005, 9:25 am
Michal, I was wondering if you would take some suggestions on your map file format? As it is, your current format is quite wasteful, and a lot of space could be saved very easily. This is extra info that is never used by the program yet is still being written into the file anyhow, because of the way you do things. Changes probably WOULD require slight modifications to the actual game itself, but its as simple as adding a few words, and for legacy support reading over the extra info so that the correct index in the file is maintained.


[EDIT: Apologies, I had some extra additions that shouldn't have been in there by accident, they are fixed now)

Current File Size: 75897 bytes
Wasted space: 11635 bytes (15.3%)
Including Strings: 14489 bytes (19.1%)

Current File Size: 77866 bytes
Wasted space: 16112 bytes (20.7%)
Including Strings: 14489 bytes (24.5%)

Generally speaking, the wasted space, in bytes, is:

((numberOfProps * 7) + (numberOfColliders * 3) + (numberOfSpawnPoints * 3) + (numberOfWaypoints * (6 + (20 - numberOfWaypointConnections) * 4)))

note: the numberOfWaypointConnections is based on a loop, so it varies per waypoint, and thus it is possible to waste as much as 20 bytes, or as little as 0.

This does NOT track string sizes, which if made more efficient could reduce the size, on average, by 30 bytes per scenery that is added to the map. If you have 30 sceneries in a map, thats another 900 bytes of space savings. Maybe I'll calculate that later.

This is calculated by keeping track of individual bytes in the files.
As the size of the map gets bigger, the percentage of wasted space increases. A map file that has 1/4 of it's size as empty useless space isn't a very good one. ;) Smaller maps load faster, and send to people faster too.