Campaign support in VCMI

In this week, the brave demeanour of Tow led us closer to campaign support in VCMI. He has filled last gap in h3m format handling - reading of one type of hero placeholders (it’s how heroes move between maps in campaign). It was rather useless for single scenarios, but essential for campaigns. I hope we will soon see more progress in this area (but don’t expect support for campaigns in the next version; if everything goes well it will be done in a few months but can take even longer).

This is great news. I can’t wait to test the first campaign in VCMI, and it’s good to hear it’s gonna happen before the end of this year. :slight_smile:

h3c’s headers’ reading done. So far so good.

VCMI reads whole h3c files. Now we just need to implement the interface.

Custom campaign selection screen is ready and quite a lot of bonus selection screen too. Left part of the second is quite complicated as is contains a map of a region with a lot of puzzles, so I need another config file with coordinates of those puzzles. Here is a list of all backgrounds:

and there are thousands of region bitmaps with names XxY_ZzSs.BMP where Xx is background code (first two characters in background name), Y is piece’s ID letter (in the range of one map), Zz is ‘subcolor’ code (En for dark, Se for light, Co for striped) and Ss is color code (red, blue, …).

Would anybody help me prepare this config?

Found my old tool for puzzle maps and adopted it for campaigns.

Made config for all backgrounds you mentioned:
There is a small problem with names: ROE use 1 symbol for color (R = red, G = green) but other versions use 2 (RE = red, GR = green), I’ve added this value to each campaign


x y


Thanks, great. It helps me a lot.

I’ve recently made some progress in campaign support. Unfortunately, there is a problem with supporting town building bonus - it seems to have a completely new format. I’d appreciate any help on mapping this format to ERM U and pictures, which seem to have no reasonable naming convention (BO*.BMP files).

H3 programmers haven’t used any naming conversion either - I’ve found this table in h3wog.exe - harcoded, with multiple errors…
I’ve moved it to .txt file and corrected errors I found
Format is simple - 1 line for each building ID, position in line = town subID
if no corresponding picture is present - placeholder %no_pic_here%

Thanks. Now I need to just map that stupid building ID format to ERM U.

Does anybody know how to easily test the mechanics of hero crossover in campaigns? The victory cheat code doesn’t work in campaigns. There are two options regarding it:

  1. hero crossover - in campaign editor a scenario and player color can be specified. I suppose the player color is used to determine the only allowed hero color for hero placeholders with unspecified hero type.
  2. Starting hero - you can select hero you’ll be starting with (?). What does player position (color) mean here? If the same hero occurred in any previous scenarios, is he moved to the new scenario or “reinitialized”? Why you can’t select starting hero in map editor for initial scenarios?
    Thanks in advance for any help.

if you want to test in h3 i would suggest launching it with /nwcgrail in command line9also windowed mode maybe it was f4?) and there’s trainer or two ,about testing in vcmi …dunno o;. but i doubt it was about that so just delete/ignore xD

Well, the alternative to victory cheat code is building maps that you can finish in 1 game day, like those in my attached screenshot.

I cannot help you much about the questions though. I’ve never used campaign editor before and I have little to no time these days to explore it. I did though manage to set the starting hero from map editor when building the source maps, before importing to campaign editor. I also managed to get hero cross-over. I failed though to get creatures/artifacts over, even though I did what seemed to be necessary to have it. But I’m not sure if that answers your questions at all.
CtestVCMI.7z (14.2 KB)

Currently I’m working on finishing campaigns code and have some questions about it:

  • I suppose that spreadsheet is correct?
  • so far I have not found any code for saving campaign state. Something that was never finished?
  • What I don’t like in H3 is that you need save with all completed campaigns to access locked ones. As result you can’t play multiple campaigns at once, can’t play locked if you’ve lost your save. Probably better to save list of completed campaigns somewhere in player profile. Any objections?

only that it would be easily to do a cheat to unlock all campaigns, but it should be player’s matter not programmers’ one.
well i feel good with that, and perhaps a cheatcode to unlock all campaigns and another one to lock campaigns to default begin state would be welcomed by some players.

well, what about multiplay in campaigns? (the easiest one is there’s one major player which gets the profit of passing campaign map, and a few minor players which can choose from computer-only players and have to disturb a major player for passing the campaign map and thus getting advanced - on next campaign map they can choose another players - and if there’s not enough the rest of minor players will be spectators)

I have an idea for new Multiplayer-Based Campaign type also. It will choose which map is next depending which player has won the last map. The feature may be used also for singleplayer ie. giving the bonus for jumping-over the ally or implementing the advance-or-flee behaviour in campaigns (the very hard scenario which gives a huge bonus after winning, but allows to passing to next scenario in campaign without the bonus if we fail) or even Hero-crossover to already played scenario. (Additionally i think there’s should be a script handle which will decide which scenario in campaign will be next triggered if somebody won the least, so it wouldn’t be hardcoded mechanism ie. getting only the winner player in mind). They can be used also to prepare Ladder type campaigns (involving some players to play or not depending on last winner and the before winners).

Yes, this is more or less correct.

Yes, I’ve never written it. But the most challenging part is moving heroes between campaigns, I suppose.

I have no objections, this is quite minor thing anyway. Now you could just write the rest of the code and then make a thread to discuss this issue.

What’s the current status of campaigns? I know Dragon is working on something, but as soon as I enter campaign selection, game crashes.

Resource with name GOOD1 and type CAMPAIGN wasn't found.
Disaster happened.
Reason: 0xe06d7363 - UNKNOWN EXCEPTION at 0023:753BB9BC
Thread ID: 14bc [5308]
Crash info will be put in VCMI_client.exe_crashinfo.dmp

Looks to be bug with new menu (file mainmenu.json) - campaign names should be “DATA/GOOD1” and such.
I’ve updated my package: …

But two AB campaigns do crash even with correct mainmenu.json. May be related to FS - will take a look on this.

I want to finally make campaigns completed. Now all campaigns should be startable without a crash. With hero crossover finished, campaigns should be playable up to bugs and less important features.

The crashes seem to be related to incorrect map extraction and IIRC Ivan is the author of the current version of that code.

Well, there is also that ugly desync bug
I doubt I’ll have this fixed by the next release. [unless it got accidentally fixed in the meantime :stuck_out_tongue: ]