Spellcaster Creatures

GUI update coming along next week or so. Hopefully.
Edit 2018-08-20: HAHAHAHAHAHA. Oh the naïveté.

Second-level creatures of the Coven faction are Moon Sisters, neophyte witches of the Circle of the Moonrise. Moon Sister is a flying spellcaster creature, able to cast one spell — Hex — on an enemy stack. When implementing spellcasters, there are a few possible approaches seen before in HoMM.

There's a Genie approach: the creature casts a spell at a fixed level of mastery, with a fixed effective spell power. There's a problem with that approach, especially with cheaper lower tier units. What's to stop the player from filling every vacant slot in the hero's army with 1-stacks of Moon Sisters and proceeding to Hex every single enemy stack essentially for free? Instant value, negligible trade-off, especially in the early game.

Like every other unit in the game, spellcasters' power should increase with the size of the stack. One way to accomplish this would be to give those units an extra stat — Spell Power. It can even be a range, say, 0-1 for Moon Sisters. Even then, amassing a hundred 2nd-level units isn't all that hard, which results in the stack casting Hex with fifty-odd Spell Power fairly early on. Whichever part of Hex is controlled by Spell Power, be it effect or duration, after a certain point having a larger stack becomes useless: a fight isn't going to drag on for fifty turns, and rare creature's defense exceeds fifty.

All this has been said with an assumption that Hex is a spell like any other, and that it's available to heroes. But what if it isn't? What if spells available to the creatures were a different class of spells entirely? While hero's abilities grow relatively slowly, gathering a considerable amount of spellcasting creatures is quick. We can account for that in the spell itself, toning it down to reasonable levels of power.

HoMM5 went a similar, yet different route, allowing creatures to cast hero spells, but making spell power of a stack grow logarithmically with stack size, instead of linearly. That addressed the problem of heroes relying on 1-stacks of spellcasters, but did little to mitigate the value of splitting stacks. While splitting melee units is generally counterproductive, 1-stacks notwithstanding, splitting a ranged stack in half is generally a good tactic on its own: you don't deal more damage, but you can damage several enemy stacks, and you don't run the risk of losing all of your shooters to a single massive attack. By splitting a stack of spellcasters (most of which are ranged units) in twain, you once again create value.

So Hex is a creature-only spell that scales linearly with spell power. It needs to be useful at low level, when the number of creatures is around a dozen, yet not totally overpowered in late game with several hundred Moon Sisters at the player's disposal. Spell power affecting the spell's duration would quickly get out of hand, so it must affect the effect instead.

Here are some possibilities I've come up with:

  1. extra damage is dealt to the target stack with each melee attack made against it;
  2. reduce defense by amount proportional to spell power divided by the number of creatures in the stack;
  3. same as (2) but affect attack instead;
  4. (2) and (3) at the same time, but lesser effect.

Snowballing

Let's talk about feedback loops.

There are essentially two ways for a player's success (or failure) to impact later stages of the game. In a positive feedback loop, a success causes future successes, or vice versa, resulting in a snowball effect. In a negative feedback loop, a success comes with a drawback that makes future successes harder to achieve. If you want to learn more about feedback loops in games, check out this article or this video by Mark Brown.

HoMM is built almost entirely on positive feedback loops:

  • getting more resources leads to getting more troops that help clear way to more resources;
  • being stuck with no resources makes the player unable to recruit troops and get more resources;
  • losing troops in early game leads to losing precious momentum as you can't break out of your starting area, so while your opponents expand and scout around, you're stuck waiting for start of the next week;
  • extra towns grant more gold and troops.

There are negative feedback loops too:

  • building up second town takes double the resources, but the number of mines you control doesn't increase;
  • more towns you capture means more towns to defend; discounting Town Portal, that means your main army is weaker than it could've been.

but those don't outweigh the snowballing effect.

Positive feedback loop isn't necessarily bad, but it does mean that the player lagging far enough behind may as well give up. On the other hand, a strong negative feedback would draw out the game, making it even longer.

So, what now? I want to counteract the early-game failure compounding, and dampen early- to mid-game snowballing. Biggest offenders are losing troops and extra towns, respectively.

One way to counteract snowballing is to introduce an upkeep cost: the more towns you have and the further apart they are, the higher the cost. This forces the expansion to take longer, as the player has to spend turns and resources making sure they can afford that extra town, or spend time recovering from having no resources due to short-sightedness.

Dealing with compounding losses is trickier. If you lose an army, you lose an army, there's no getting around that. But maybe, if you win a fight with heavy losses, you recover a portion of lost troops? Give each hero a persistent Healing Tent that will let them recover, say, 100 HP worth of troops after battle. That's a hefty boost in early game, but becomes almost worthless in late game.

Breaking: Programming is Hard

I may have rewritten the entire source code since last post. Let me explain.

So I started restructuring the game based on stuff you've seen in previous post, and some small stuff you haven't. GUI was getting overcomplicated, so I started to pull different states into dedicated classes. Then it turned out pathfinding was coupled with almost everything, such that when I tried to move it from movement component to the game board everything broke. After I jumped from file to file adjusting little details I thought it'd be easier to just throw everything away and rewrite it from scratch.

Wasn't as bad an idea as it might seem. Of course, I didn't really throw everything out. I just started writing from scratch, taking parts of old code and fitting them where appropriate. And it's worked out okay so far, the only thing missing from this new version is movement. So fingers crossed, and please put all your comments about how stupid that was in the reddit discussion.

Also (who would have thought) GUI programming is hard! It seemed so much simpler at first. I mean, it's just a button, right? Well, a simple button drags with it enough stuff that I'm already considering putting GUI aside until later. Bu-u-ut I suppose there's no better time to figure it out than now. Although now that philosophy lectures have ended my productivity might decline.

Bloody hell, October already?

Don't have much to show for all that time, to be honest. Life's been kinda hectic, and RoH had to take a back seat. In the brief moments of free time I thought a bit about code structure and how to best manage modules without too much coupling. Even drew a few diagrams, like I'm an adult or something.

Apparently I'm most productive during philosophy lectures.

So what came out of all that was basically an overhaul of the graphics system. It's still in progress, but it's not really impeding anything else. (Side note: I really need to use git more for proper feature branch management. The way I'm doing things right now is a mess.)

As the stuff I can show for all this time — minimap! Also, the game board isn't restricted to the size of the window anymore, and I've added some basic scrolling, but I'm not going to make a whole video just for that. Just gaze upon that glorious minimap for now.

Screenshot at 2017-10-13 20:04:02.png

... Okay, turns out I've done more than I remembered at first. Good on me.

Town screen and music

I think it's a good sign that I was able to pick the project back up after almost two months long break. Though, to be fair, I am the one who wrote the code in the first place. Still, one can hope it's not going to be an unreadable mess once released into open-source.

So last time in the "I'm not dead" post I showed you the first steps with the resource manager. It's grown since then. Sprites, sounds, and music, oh my. Parallel with that, I started working on game states, and made a faux-town screen to show. See for yourself:

It really is coming together, isn't it.

Next up — probably some basic GUI, with some more polish for graphics and sounds, fade-outs and transitions and whatnots.

Town screen background is Coven by brilliant reddit user u/revesvans.

Sprites are Cavalry, Stone Pile, and heavily edited Castle by Delapouite and Crystal growth by Lorc. Music is Angevin by Kevin MacLeod. Horse sound effect lifted from HoMM III (you're not gonna believe how hard it is to find a suitable free gallop sound effect!).

Nation of Pehaam

Pehaam is a nation ruled by a coven of witches known as the Circle of Moonrise. Fearsome creatures roam its forests, and spellbound soldiers comprise its armies.

The Circle of Moonrise appeared some 120 years ago, and established itself at the border between then warring Ithear and Ashea. As the coven grew more and more powerful, feeding on the deaths of soldiers, its magic started warping the forests and the mountains around the coven's grounds. Ferocious animals, shadow creatures, and horrifying walking trees filled the area, striking fear into the hearts of local people.

Soon, surrounding villages pledged themselves to the coven, begging the witches to protect them from their own creations. They would give their sons and daughters to the Circle as their tribute. The daughters were to become the younger Sisters of the Circle and the sons, through blood magic, the mighty Heartless warriors, fully subservient to the coven.

These days Pehaam, still ruled by the thirteen witches of the original coven, is wholly separate from both Ithear and Ashea, both of which dare not test its borders. Inside Pehaam, most of the monstrous creatures have been exiled to the forests and mountains, leaving plains to the people.

Creature Upgrades

Let's talk about creature upgrades.

Being able to upgrade a creature is a double-edged sword. On one hand, you can still have army of a bit weaker basic creatures if you're short on resources, and upgrade them later, if ever. On the other hand, basic creatures may be underwhelming or completely useless compared to upgraded version (looking at you, Vampire Lords), and you are forced to spend a turn of building and extra resources on getting access to upgraded version of the creature.

The Heroes III approach of "ᴜᴘɢʀᴀᴅᴇs ғᴏʀ ᴇᴠᴇʀʏᴏɴᴇ, ғʀᴇᴇ, ᴀɴᴅ ʟᴇᴛ ɴᴏ ᴏɴᴇ ɢᴏ ᴀᴡᴀʏ ᴜɴsᴀᴛɪsғɪᴇᴅ!" is unhelpful at best. You can even tell that some creatures only had upgrades because they had to — way too many Queens and Kings for one army.

No. Upgrade is a privilege, not a right. Some creatures get that advantage of getting stronger if you pour some more resources into their training. Skeletons don't need an upgrade, their strength is in numbers thanks to Necromancy. Hippogriffs and Pegasi are already mystical flying creatures, they don't need an upgrade to present challenge on the battlefield.

Having said that, here are some upgrade guidelines I made for myself when thinking over factions and their creatures.

  • An upgrade is justified when:
    • upgraded version is connected to the basic version by lore or theme (e.g. Vampire Spawn ⇒ Vampire, Hellhound ⇒ Cerberus);
    • it's an upgrade of gear on a gear-based creature (e.g. Swordsman ⇒ Knight);
    • it changes attack method of the creature (e.g., double attack, spellcasting, melee ⇒ ranged).
  • If upgraded creature's name is basic creature plus any of King, Lord, Master, or similar, rethink your decisions.

Interactions!

This week was a little bit painful. This little addition called for pretty substantial reworking of both pathfinding and map logic, and all because the resource piles are both obstacles and something you'd want to be able to interact with.

On the bright side, game logic is now pretty much decoupled from most of the rest of the game, and I thought I'd throw in some basic sound effects while I'm at it. Behold!

Ideally, when an object gets removed from the map, it should fade out rather than just disappear like that, but I'll save that until I've got sprites to fade out in the first place.

Next up — proper resource management. I have some static placeholder sprites and sound effects prepared, now to get some tiles and generic music.

Kingdom of Ithear

Ithear (ee-THE-ar) is a kingdom on the western shores of Ishon (EE-shon). It is the largest state on Ishon and is inhabited almost exclusively by humans.

In the year 1227, previously small and peaceful kingdom of Arrath turned to theocracy under the rule of king Cassius the Pious, who has established himself as the Patriarch and started the Ithearian Conquests. The Conquests lasted ten years, until in the year 1238 king Lionel the Uniter has annexed the last of the eleven provinces of the Itherian Empire.

Now, Arrath is the capital province of Ithear, though it is sometimes subdivided into North Arrath and South Arrath along the river Faeran (fah-er-AHN), mostly for the sake of being able to say that Ithear consists of twelve provinces. Capital of Ithear, Faereth (fah-er-ETH), then ends up on that division line.

The province of Uther, named Demakh before its annexation, is the most restless of the provinces. The duke of Uther is on good terms with both neighboring dukes and queen Flavia herself, and was invited to Arrath on a few occasions to advise at the royal council. There are rumors of another insurgence brewing in Uther's many abandoned mines, but the duke of Uther staunchly denies them all.

Ithear doesn't get along well with neighboring nations. Reasons for that are many territorial disputes in the aftermath of the Conquests, and general attitude of Ithearian nobility towards non-humans and heathens.