ChiefOfGxBxL / WC3MapTranslator

Translate war3map ⇄ json formats for WarCraft III .w3x maps
https://www.npmjs.com/package/wc3maptranslator
MIT License
80 stars 31 forks source link

map crash with built w3a #18

Closed yatyricky closed 3 years ago

yatyricky commented 6 years ago

how to reproduce:

  1. Download this map https://github.com/yatyricky/Zulaman-WE/blob/master/ZAM_ruins.w3x
  2. Extract war3map.w3a with Ladik's MPQ Editor version 3.5.1.818 (Unicode Build) StormLib v9.21
  3. war2json
  4. json2war
  5. Inject w3a to map
  6. World editor working well, can open and save
  7. Run map, boom!
yatyricky commented 6 years ago

I thought it was me who forged illegal json because I reconstructed my excel based on the war2json-generated json, and rebuild json based on my excel data and then json2war.

But when I actually rolled back to a playable version, I simply extracted the w3a file, war2json and json2war on it. Wc3 still gives me the same error.

(Actually not only wc3 crashes the same way, my optimizer produces the same error, declaring that I have lost some files, and the optimizer asks me to provide the correct list file)

ChiefOfGxBxL commented 6 years ago

Hi @yatyricky, thanks for providing the detailed error report.

I am following your instructions and am experiencing the same issue: the map is not playable. Please note, though, that the map you linked to gives me the same blank error message even without modifying the abilities file.

It looks like the abilities file that is being produced from the translator is different from the original .w3a file. They should be the same.

Here's a screenshot of the differences between the original map's .w3a and the translated w3a. image

I'm looking into why the files are different. I am also adding "diff" unit tests to each translator, because when you take a war3map file and translate it to JSON, then back to war3map (or JSON -> war3map -> JSON) the data should never change.

Could you double check the link to the .w3x file you provided? I am receiving the error you describe even before following the next steps you provide. I'll need to know that the .w3x you provide me is in a working state, and that the .w3a file I extract from it using MPQ Editor is correct.

yatyricky commented 6 years ago

Interesting, I test this map on my 1.29.2 and it’s working well (it does not have any contents though because it’s not built yet)

I also double checked that I didn’t accidentally commit corrupted map into the repo.

yatyricky commented 6 years ago

It seems like that the problem happens in the original data, which gives me a huge relief because I only fear of my forged custom JSON

ChiefOfGxBxL commented 6 years ago

I resolved my error message issue when launching maps (not just yours, but blank ones I created on my end) by updating WC3. I was on 1.29.0, now I am updated to 1.29.2.

Your .w3a seems functional to me. I extracted the .w3a file from the map you linked, and went in to World Editor, created a blank map, placed the .w3a in and the game launches fine.

There is still the issue with the diffs not matching (see my above screenshot), and I added new unit tests to cover this. More translators have this issue, but strangely the output war3map files still work. You can put them into a .w3x map and the map launches just fine. Still worth fixing, and I'll keep looking into it.

yatyricky commented 6 years ago

It seems like that the problem happens in the original data, which gives me a huge relief because I only fear of my forged custom JSON

False, I removed the original part, and wc3 still crashes. FYI.

ChiefOfGxBxL commented 6 years ago

So is the .w3a file still presenting an issue for you? When I placed it in a blank wc3 map and launched it worked fine. Still, there are differences in the bytes the translator is producing compared to the original file you provided (which would have been written by World Editor), so I know that there are small issues lurking in the translators. But I'm not certain if this particular issue you are encountering is related to the inexact-bytes issue I am describing.

yatyricky commented 6 years ago

I must be drinking alcohol when I tested the w3a->json->w3a flow.

The map does launch.

But however, when I build the map with jasshelper. Jasshelper did not give any errors and wc3 crashes. When I use my optimizer after jasshelper, my optimizer gives

Lost 24 files - These files are discarded, Please include the complete `(listfile)`
Read (102/126) files

When I use my optimizer before jasshelper, my optimizer gives NO error.

So now we are sure that there's some strange chemical reaction with jasshelper and war->json->war.

Edit: the reaction above clearly needs another sauce, which is my map data.

yatyricky commented 6 years ago

I'll do another quick test to narrow the problem.

  1. Create an empty map
  2. Edit original ability 'Apit', chance its anam to "Apit", create a new ability based on 'ANcl', change its anam to "Custom new spell". Place a Blood Mage on map to make it w3x
  3. Write some vjass hello world code. Save, build, run, it works!
  4. Export w3a, translate it to json, then translate back to w3a
  5. Import that w3a in step 4 to the map
  6. Run without building (no jasshelper), it works!
  7. Build the map (with jasshelper), run, it ALSO works!

Conclusion: some of the abilities are not behaving correctly. To find out which, that's the problem now.

I can upload the repo if you want it.

Promises commented 6 years ago

same issue with some units, i converted from w3u and then back, map crash

ChiefOfGxBxL commented 3 years ago

I am closing this issue with the release of WC3MapTranslator 4.0. This release is tested against WC3 Reforged (1.32.9.*).