Single Hero: a one-hero-per-player mode (Olden Era style), and a small engine setting I'd like to upstream

Hi VCMI Team and everyone,

After Arena Battles, I’ve made a second fan project on top of VCMI: Single Hero: A HoMM3 Fan Mod. It’s inspired by the Single Hero mode of Olden Era: every player has exactly one hero for the whole game, and if that hero is killed, retreats or surrenders, the player is defeated, even with towns left. The AI follows the same rules, and it works on any scenario or random map.

How it works

Most of it is plain VCMI settings in the mod’s mod.json:

  • heroes.perPlayerOnMapCap: 1 and heroes.perPlayerTotalCap: 1 (standard VCMI)
  • heroes.defeatOnHeroLoss: true, a new setting I added (off by default)

The engine changes are small, on top of the 1.7.5 tag, and all marked with “Single Hero” comments:

  • defeatOnHeroLoss in IGameSettings, GameSettings, gameConfig.json and the settings schema, checked in CGameState::checkForVictoryAndLoss
  • a guard in visitDismissHero so the only hero can’t be dismissed
  • initSingleHeroes in CGameState: at game start each player keeps one hero (one named by a map objective, else the chosen starting hero, else the most experienced), and a player with towns but no hero gets one in the main town
  • plus the mod’s own main menu and credits, and keeping the mod enabled (ModManager)

No original HoMM3 files are included. The menu art is original and generated by script.

Links

Could this become a regular mod in the launcher list?

Unlike Arena Battles, the gameplay part is small enough to upstream. If you’d accept it, I’d like to prepare a PR to vcmi/vcmi with:

  1. the defeatOnHeroLoss setting (off by default, so nothing changes for existing games), together with the dismiss guard;
  2. optionally, the “one hero per player at game start” setup, perhaps behind its own setting.

Once that’s in a VCMI release, I’d drop the custom menu and engine hooks and submit Single Hero to vcmi-mods-repository as a normal mod, so players can simply enable it in the launcher. Would that work for you? I’m happy to use different setting names or a different approach if you prefer.

Thanks again for VCMI.

Tihomir Ivanov (TishGamer)
GitHub: tishonator · YouTube: TishGamer