WC3MapSpecification icon indicating copy to clipboard operation
WC3MapSpecification copied to clipboard

Reconsider how file formats are described here?

Open Luashine opened this issue 2 years ago • 7 comments

The way you intended the formats to be described is one file per format version. That'd work well, if the file formats were radically different, but they're not. Looking at w3i (Info), the file format evolved incrementally, where each version only added new fields in between, without major changes.

I really liked how Hodor described the formats here (in Russian). Open war3map.w3i as an example, additional fields of newer versions are conveniently described within IF VERSION > 28 tags, which makes multi-version support trivial when writing a parser.

Bringing everything to one file (as long as the formats stay roughly the same) has the advantage that all changes don't affect 2+ files. Further, while writing a parser it's practically zero effort to support multiple formats. IF-ELSE-PROFIT!

I'd rewrite the format descriptions later and make a PR if you agree. I would probably follow Hodor's approach too, its readability is miles ahead of this: https://github.com/stijnherfst/HiveWE/wiki/war3map.wtg-Triggers

Further resources:

  • https://xgm.guru/p/wc3/w3-file-format by Hodor from above
  • https://www.hiveworkshop.com/threads/parsing-metadata-from-w3m-w3x-w3n.322007/
  • @Drake53's .NET library: https://github.com/Drake53/War3Net/tree/master/src/War3Net.Build.Core (has EnemyPlayerPriorities described, last unknown thing in current Info)

Luashine avatar Jul 31 '22 17:07 Luashine