Holy!
Yeah, I wonder what you will do with external dwelings, for example
Holy!
Yeah, I wonder what you will do with external dwelings, for example
Short version: do not crash.
Long version:
I think that VCMI should handle such cases like empty tavern (all H3 classes have 0 chance to appear in Cove tavern), missing dwellings, 0 chance for all spells, etc correctly - right now most of them will cause crash.
There are also such issues like numeric IDâs - right now cove creatures were added to town using numeric IDâs - this will break with different list of mods. This should be fixed too.
After all of this is done - such missing objects like dwellings or heroes should be implemented as well.
Bravo!
Seeing how fast we are getting new units and new towns is kind of reassuring that our approach (rewriting the game from scratch) does have sense.
Yes and no. :-p
I say âcrash earlyâ. We operate under certain assumptions. It could have been reasonably assumed (well, till now) that the dwellings wonât be missing. And if they are, it means that game installation is seriously broken and itâs better crash right now (with an apparent reason), rather then suppress the issue and let it break somewhere later (in place that may be not obviously related to the actual problem). However the assumptions change, as the engine evolves and new features are available. The code that is now offending may now have been that evil when it was written. [Or it could have⌠we do have many pieces Iâm ashamed of. ]
I remember specifically fixing the crash when there are no available heroes⌠mustâve got broken in the meantime, being not tested. [Some day I should certainly think about some kind of automatic tests for such issues.]
Other issues⌠I can fix it right away, if you provide me some âreproducibility packageâ, otherwise do it yourself.
How about using CCreature::refName as an string creature ID for config for the current (interim) period? It was useb by the H3 itself to cross-reference creatures.
Yeah. And VCMI 1.0 still have chances to beat WoG 3.59 time-wise
I agree that delaying crash is a bad idea. But if crash can be avoided entirely (for example change dwelling to any other available) similar to how this is done for heroes then why not?
Anyway it seems that most crashes were from bugs in my âmodâ - vcmi code is fine. Letâs see what happens after I hexedit Cove into another map - no bugs on Arrogance so far.
I noticed some already present checks. At least part of this crash was due to out of range array access - heroes from Cove supposed to have IDâs > HEROES_QUANTITY. Not something you expected back that time I suppose.
Of course. That string ID -> numeric ID conversion we discussed earlier is still TODO. More than enough time to implement it for next release.
This is just how upgrades for new creatures are already done. See CModhandler::RecreateHandlers:
BOOST_FOREACH (auto creature, creatures)
{
creature->idNumber = VLC->creh->creatures.size(); //calculate next index for every used creature
BOOST_FOREACH (auto bonus, creature->getBonusList())
{
bonus->sid = creature->idNumber;
}
VLC->creh->creatures.push_back (creature);
//TODO: use refName?
//if (creature->nameRef.size())
// VLC->creh->nameToID[creature->nameRef] = creature->idNumber;
VLC->creh->nameToID[creature->nameSing] = creature->idNumber;
}
recreateAdvMapDefs();
BOOST_FOREACH (auto creature, VLC->creh->creatures) //populate upgrades described with string
{
BOOST_FOREACH (auto upgradeName, creature->upgradeNames)
{
auto it = VLC->creh->nameToID.find(upgradeName);
if (it != VLC->creh->nameToID.end())
{
creature->upgrades.insert (it->second);
}
}
}
Good news: new town looks to be quite stable - no crashes anymore
Now I need to correctly integrate this into modhandler.
But there is one ting that I want to do first: move creature loading (Json -> CCreature to be precise) to CreatureHandler. Instead ModHander should only store json config (and possibly make some guesses regarding mod content). Why?
It will be more easy to manage - all loading will be done by existing handlers, ModHander will be used only for mod handling - set load order, set enabled\disabled mods, resolve string IDâs between different mods.
Right now it is impossible for several mods to modify same object. This can be fixed easily by merging json tree from different mods before sending it to handlers.
For example this will allow localization mods to consist from only localized strings instead of full config, rebalance mods wonât affect graphics or texts, etc.
Looks like a good idea, +1.
Go on, I planned Mod Handler to be somewhat more sophisticated, but itâs not really used. At the moment mod loading is as straightforward as possible.
String ID -> Numeric ID conversion is done. Already replaced all cases where VCMI used string IDâs (creature upgrades and initial hero armies) as well as all town-related cases (creaturesâ factions and recruitable creatures)
Now heroes and external dwellings are probably the most notable missing pieces in new towns (+some graphical bugs in old code - pregame and messages)
What is about a light house when you conquer a city? You have not constructed it nor is the game loaded. Or is the construction function called when you conquer a city?
And what is about lighthouses? Not sure if I got your post correctlyâŚ
Lighthouse as well as some other buildings are implemented using our âbonus systemâ - player owning a town will receive +500 sea movement bonus. After conquering town all bonuses attached to the city will be transferred to new owner.
One more (hopefully last) breaking change into mod system - filesystem.json is merged with config/mod.json. I have one more change planned in FS but it wonât break compatibility with these mods.
Updated main menu mod is here: dl.dropbox.com/u/22372764/vcmi/ ⌠w-menu.zip
Nothing really new here.
Now to HotA mod: dl.dropbox.com/u/22372764/vcmi/mods/cove.zip
Consist from two mods, right now these mods depend on each other:
cove-creatures: all 15 creatures from HotA, slightly reorganized filesystem.
cove-town: yes. This is town #10, town itself is mostly functional apart from two cove-specific buildings. Also comes with
a) some maps with playable Cove
b) Russian fonts (too lazy to translate text myself or to ask HotA team for translation)
Missing parts I know about:
Apart from this everything should work.
Now to mod system itself. How it works:
Note that content (right now - creatures and factions description) is stored separately to keep mod.json small. Full descriptions will be assembled from one or several config files.
This allows to keep individual files small and some neat features like separating localizeable strings from the rest of file. Not a full-scale localization system but better than nothing.
Amazing job
I donât get why there are no heroes to recruit at all in Cove. Even if theere are no native heroes available, tavern should pick ones from other factions, shouldnât it?
Donât know that either. Especially why there is difference between mage guild and tavern? All hero classes have 0 chance to appear in Cove tavern so no heroes at all is technically a correct behavior. But the same should apply to spells - there is definitely a bug somewhere.
Empty tavern is definitely the biggest issue with Cove right now so Iâm planning to fix that soon.
Updated my cove package, same link: dl.dropbox.com/u/22372764/vcmi/mods/cove.zip
In case if you havenât noticed - hero and hero classes formats description are on wiki:
wiki.vcmi.eu/index.php?title=Hero_Classes_Format
wiki.vcmi.eu/index.php?title=Hero_Format
Interesting, good job.
I wonder how to handle hero specialty in this case. Original specialties were translated to bonuses with hard-coded parser (CGObjectHandler.cpp). It is also important than some of specialties grow with hero level, while others - do not. Probably some extension of hero specialty mechanism is a good thing to do soon.
Some of issues (unknown numeric IDâs of creatures for creature specialists) should be possible to fix using name resolver.
In this case IDâs should be full e.g. âcreature.piratâ because bonuses can have different type - like spells. So specialty for archers specialist, Valeska, will look something like this:
{
"type": "creatureSpec", // some hardcoded specialty type ID
"val": 0,
"subtype": 0,
"info": "creature.archer" // already present ID that can be resolved to number by modHandler
}
(BTW - I think that this stringID -> number should be also implemented for bonus system itself - to allow bonuses like âhateâ)
Anyway - I wanted to implement everything but specialties and give it to you for finishing - you know this code better than me.
So we need âlevelâ parameter for calculation of bonus value in bonus system.
(And use it for growing artifacts and specialties)
One more update: dl.dropbox.com/u/22372764/vcmi/mods/cove.zip
Tavern is still empty, starting hero selection in pregame is a bit weird due to way VCMI checks for available heroes.
None of heroes have any specialty apart from text\icons.
Apart from this - everything should work.
And a nice screenshot
Hosting provided by DigitalOcean