C++ library for converting w3x files to structs

Level 9
Joined
Aug 19, 2008
Messages
492
Hi people,

I started working on w3x_t this autumn. It's meant to be a C++ library for converting W3X files into easily navigable data structs, and vice versa, very much like how WC3MapTranslator converts W3X files to JSON. I wanted it to be easy to integrate with StormLib so everyone could use it instead of writing their own w3x interpreter every god damn time like it is now.

Right now it can read every w3x sub-file (output as a string by StormLib) except .wai as a struct, and can write one or two of the sub-files back (to a string which can be read by StormLib). There are no usage instructions for the library unfortunately, but if you're familiar with CMake and have look around /lib/ and /src/main.cc it shouldn't be too hard to figure out how to use it.

That's as far as I got before I lost interest. I dunno if it'll ever be finished. It's open source now and if anyone thinks this is a worthy side project then I'll be sure to review and merge pull requests.
 

Frotty

Code Moderator
Level 19
Joined
Jan 1, 2009
Messages
1,509
There are no usage instructions for the library unfortunately

So add some? :ugly:

I wanted it to be easy to integrate with StormLib so everyone could use it instead of writing their own w3x interpreter every god damn time like it is now.

Reminds me of
standards.png


I don't really understand how this is related to StormLib? There are existing projects to parse map files into common data formats, like tdauth/wc3lib

It's open source now and if anyone thinks this is a worthy side project then I'll be sure to review and merge pull requests.

It think it could definitely use some tests, but I'm not a c++ guy myself.

Good luck with the project. Btw this probably belongs into tool forum?
 
Level 12
Joined
Jun 13, 2016
Messages
494
I'm totally guilty of not doing this myself either, but it would be really nice if someone updated the documentation for WC3 map file formats. The only one I know of is the one at thehelper and it's hideously old. The formats themselves aren't that hard to parse, so the plethora of parsing libraries for them isn't a huge deal IMO. What is significantly harder is e.g. reproducing the logic for field lookup in object data, and reading the object data from WC3's SLKs into a sane format that you can work with, and also much more interesting.

This isn't to discourage or downplay your work, just a train of thought spurred on by this thread.
 

TriggerHappy

Spell Moderator
Level 37
Joined
Jun 23, 2007
Messages
4,027
I took a quick look at your w3i parser and it appears to only support format version 25 (TFT). Ideally it should support 18 (RoC), 25 (TFT), 28 (TFT 1.31), and 31 (Reforged).

These links might help you with supporting 18 and 25.

W3M and W3X Files Format
stijnherfst/HiveWE

Format version 28 contains the build number and a flag for Lua scripting. Version 31 contains data for the map's graphic mode as well as some other changes.
 
Level 9
Joined
Aug 19, 2008
Messages
492
Thanks for all the comments :)

@Frotty thanks for linking tdauth/wc3lib, i didn't know it existed. I'll have a look at it when I'm not drunk. Look for comments later.

@mori I made this in conjunction with w3x_t to keep my head clear. Is it what you were looking for? There's also the wiki of this ChiefOfGxBxL/WC3MapTranslator

@TriggerHappy Yes, I've been thinking about that stuff. The 'final product' should absolutely support parsing of every (known) version og every file type, but I needed to limit the scope somehow to get something working. The priority is to get the latest version of all file types read and writable, older versions later.
 
Top