HeroWO-js / h3m2json

Heroes III PHP map parser and compiler. Complete .h3m format documentation.
https://herowo.game/maps.php
The Unlicense
16 stars 3 forks source link

HotA map support? #1

Closed mapron closed 1 year ago

mapron commented 1 year ago

BTW hi, another rival HOMM3 project (FreeHeroes, VCMI, HeroWO)! (just kidding about rival)

you can check freeheroes binary format spec in:

https://github.com/mapron/FreeHeroes/blob/master/src/Core/MapUtil/H3MObjects.cpp#L16 (and also search where those conditions are used).

Also, notice HotA has at least 5 different map formats for now. If you need further info for hota support (hota sprite format for example) I also can provide you some insights.

ProgerXP commented 1 year ago

Hey Vladimir, kudos for your work on FreeHeroes! Want to join forces with HeroWO?

As I could infer from the code, these differences in .h3m format exist in HotA:

Additionally, m_creatureBanksCustomization (HOTA3 v3) is unused in FH's code.

Map format byte: HOTA1 0x1E, HOTA2 0x1F, HOTA3 0x20, WOG 0x33, VCMI 0xF0.

Can you confirm this?

Also, notice HotA has at least 5 different map formats for now.

I see 3 enum members with 3 variations on m_ver1, of which v1/v2 seem to have an identical format. Is that what you meant?

If you need further info for hota support (hota sprite format for example) I also can provide you some insights.

Definitely, insights (see above) are most welcome! I strive to make h3m2json not only the most comprehensive parser and compiler but also a one-stop place for human-readable format documentation in the form of h3m-The-Corpus.txt.

mapron commented 1 year ago

m_spellResearch - is 'enable spell research in Mage Guild'. look it in map editor.

mapron commented 1 year ago

Want to join forces with HeroWO?

If I wanted to join other porject, I'd continue work on VCMI, not create my own project 3 years ago. so, no thx. If you want me to write code for you, I mean.

mapron commented 1 year ago

m_agressionExact†, m_joinOnlyForMoney (bool), m_joinPercent, m_upgradedStack†, m_splitStack

just look flags in HotA map editor for create stack on the map.

mapron commented 1 year ago

m_upgraded† (8-bit), m_artifacts - any idea what they are for?

look bank editing dialog in hota maped.

ProgerXP commented 1 year ago

If I wanted to join other porject, I'd continue work on VCMI, not create my own project 3 years ago. so, no thx.

Well, I suggested this because your own stated goals explain why you will not contribute to VCMI. HeroWO pursues the same goals (online experience, completely open source, decentralized server, better code quality, etc.).

m_spellResearch - is 'enable spell research in Mage Guild'. look it in map editor.

I see this checkbox but I don't know what it does in-game. Can you explain it briefly?

HOTA3 v3: new "object details" type for creature banks with an int and array: m_upgraded† (8-bit), m_artifacts - any idea what they are for? m_artifacts starts with an uint32_t count? are -1 values allowed, if so what they stand for?

look bank editing dialog in hota maped.

That dialog only has two options: fixed bank level (rather than randomly selected as in SoD) and random/upgraded/non-upgraded switch. There's nothing like m_artifacts.

mapron commented 1 year ago

Can you explain it briefly?

well, it enables and disables spell research in the mage guild. Are you familiar with HD mod? do you play it? you can change spells

That dialog only has two options: fixed bank level

open same dialog for Dragon Utopia. It changes (hides/shows) controls. You can select every artifact for the bank.

m_humanActivate - I suppose it complements $applyToComputer, preventing human players from triggering the event? why is it uint8_t rather than bool?

well, did not used that much other for format testing, not sure. Not play with events atm. why uint8_t instead of bool - probably did not think inside it, could be bool, yeah.

m_creatureBanksCustomization is an oversight , I renamed it to m_creatureBankSize and forget to remove, thanks for pointing out. :)

SeerHut:

do you know how 0 and >1 values work?

sorry, that part for >1 I did not reversed yet. It has pretty strange blob format... and what is worse, it changes when I save it again with current map editor (so it is inconsistent between patches, so I need to branch by format descriptor flag) map [HotA] Gold Rush AFAIR use this, not sure if I found that anywhere else. So that's my TODO.

For the rest, yeah, you did a good grasp of it.

mapron commented 1 year ago

HeroWO pursues the same goals (online experience, completely open source, decentralized server, better code quality, etc.).

well, we can have a voice talk over discord if you so desire, but you hardly can convince me to contribute code for ya.

ProgerXP commented 1 year ago

well, we can have a voice talk over discord if you so desire, but you hardly can convince me to contribute code for ya.

Not sure why you keep pointing out that it's writing code "for" somebody. It's open source and I don't earn anything from it; if you don't want to contribute then fine, I certainly won't go as far as "convince" anybody to do so.

Anyway, thanks for the tips. I have combined all your messages into one for clarity.

https://github.com/mapron/FreeHeroes/blob/7585701759973d8d8e003cfca7d2f609713c82a5/src/Core/MapUtil/H3MMap.cpp#L377-L385

    if (m_features->m_mapHotaUnknown1) {
        uint16_t unknown1; // == 16;
        uint32_t unknown2; // == 0;
        stream >> m_hotaVer.m_allowSpecialWeeks >> unknown1 >> unknown2;
        assert(unknown1 == 16);
        assert(unknown2 == 0);
        if (m_hotaVer.m_ver1 == 3)
            stream >> m_hotaVer.m_roundLimit;
    }

https://github.com/mapron/FreeHeroes/blob/7585701759973d8d8e003cfca7d2f609713c82a5/src/Core/MapUtil/H3MObjects.cpp#L21-L22

    if (format >= MapFormat::HOTA1)
        m_factions = 10;
mapron commented 1 year ago

It's open source and I don't earn anything from it;

don't be picky. I'm not interested in abstract opensource code exist in the world. I am interested in particular domain, project goals, structure, technology used etc etc (why should I even explain why I rule my own project?). I don't want explain in details especially because I don't want you feel bad for your choices (with deep dignity and respect).

mapron commented 1 year ago

Do you know if HOTA1/HOTA2 formats can have m_ver1 of 3?

well, I do not have enough old hota maps to answer, so - no, I don't know.

Are WoG/VCMI formats really an extension to HotA? no, WoG is an SoD extension and it has pretty much the same SoD format; all WoG (and Era) objects utilize Pyramid object. Map binary is the same.

VCMI is ... not an extension. Entirely new format. It has just same header as SoD and that's it. you'd better check VCMI source code (I have 0 support for both wog and VCMI) about >= HOTA1 is probably a lazy oversight.

ProgerXP commented 1 year ago

HotA support implemented. h3m2json.php is now able to parse all official HotA 1.6.1 maps. Thank you for your assistance.

mapron commented 1 year ago

Yay.