stijnherfst / HiveWE

A Warcraft III world editor.
GNU Affero General Public License v3.0
347 stars 52 forks source link

Support any version of Warcraft #78

Closed w4454962 closed 3 years ago

w4454962 commented 3 years ago

including 1.24e 1.27 low version of Warcraft,Just abstract MPQ and CASC and use them according to the version of Warcraft

BogdanW3 commented 3 years ago

It's not that simple: first you'd have to either get the Warcraft 3 version somehow (which is not easy as even the exe file has changed its path and name multiple times) or start loading things blindly until one of them succeeds (which would break even more if the game is open[Casclib and Stormlib can handle this well only in some cases, and versions on vcpkg might not at all] or the files malformed). Furthermore there are many things that have been inconsistent in old versions and would break compatibility with a perfect implementation (the simplest examples I can think of are the many renames of things between versions and the different MPQ files that get loaded with any version) as well as many edge-cases that even the game itself might not have been handling correctly in some of them. People would also start trying to save maps made in a newer version of the World Editor as the old version which would not only break them, but also generate needless confusion as to how it happened. HiveWE would also get so much clutter to denote which features existed before and which ones are new (for example options to set the map to Lua and many of the map flags and map-sizes as well as the absolutely messy buildnumbers which are needed for saving as any).

That large paragraph probably still doesn't cover everything, for which I apologize.

w4454962 commented 3 years ago

This is the version number of Warcraft to get the map. Just read and write according to the version on the map. When opening the map, check whether the map is consistent with the selected Warcraft directory. If not, prompt the user to choose the correct version of war3 path again

BinaryReader reader = hierarchy.map_file_read("war3map.w3i");
const int version = reader.read<uint32_t>();
if (version != 18 && version != 25 && version != 28 && version != 31) 

Each version of Warcraft has its own characteristics. By checking the characteristics, you can distinguish the version number of Warcraft

In China, there are about 2000 map authors developing 1.24 ~ 1.27 Warcraft maps every day, and less than 1% of the map developers of 1.32 reset version of Warcraft. I think people need a lower version of the map editor

BogdanW3 commented 3 years ago

It's not that number that I'm talking about, it's this one and I'm not saying that just disconnectedly from the map, I'm saying that there is a lot to worry about there, as even if the editor tries to save as the exact same version, it would have to be filled with a lot extra code to handle every possible version. While the number you wrote above is the largest indicator for how a map will be saved, it's not the only one. The easiest examples of that are the sounds and Camera files which, even with a version number field of their own, didn't have changes made to any of the data fields to help parsing and as such require using the game version. Even though this was helped by the introduction of the 4 game_version fields, it is only one of the many different seemingly small changes that would have to be handled.

If 1.26-era is what you're after, you can try disregarding all of what I wrote and write both saving and loading to only support that version, or copy parts of the old HiveWE (0.02 if I remember correctly) code into the newest version.

w4454962 commented 3 years ago

I know how to do it, but I hope hivewe can be compatible forward and expect more users to replace world editor

stijnherfst commented 3 years ago

HiveWE will only support running when the latest version of Warcraft III is used. When you save a map it will also always use the latest available file format versions so maps saved with HiveWE will only support the newest WC3 version. You can open older maps though.

The reason for this is that supporting all WC3 versions is a pain in the ass and I don't have the time for that nor the will to make the codebase a mess. You are of course free to fork HiveWE and add this support yourself.