Artificial intelligence and more

Finally the time has come to make good on my promise from last year to tell you more about strategic planning.

My original idea was to go back to the book about strategic planning I read as a young promising chess player thirty years ago, and then see whether someone had written something similar for strategy games in general, including computer strategy games.

Doing a Google search isn't really helpful here, as a search for strategic planning primarily turns up results about organizational and corporate planning. Trying to look for results pertaining to games, isn't doing much better. So I resorted to looking for strategic planning for chess. You know what? It turned out that the book I read back then is still regarded as a top read in this category.

This book is Luděk Pachman: Modern Chess Strategy, published in three parts. In truth, it shouldn't have surprised me that this book stood the test of time rather well, as its subject is universal and excellently explained.

I read it in the 1980s and it helped me a lot as a chess player, but in life and many other strategy games as well.

Lessons, lessons, lessons

Luděk Pachman provides you with a sound theory of strategic thinking and reinforces it by giving you plenty of practical examples. Of course it is chess, so for a strategically minded Heroes of Might & Magic player it would be a big ask if I merely recommended you to read these books.

So I will try my best to give you an overview of the important lessons and how these apply to HoMM.

What stuck with me above any other lesson is the need to formulate a strategic plan and then to execute it step by step. However, this isn't an automatism, you are required to review your strategic goal consistently and adapt your strategic plan whenever the situation changes. This is truly the most important lesson that you should never forget.

As this is fairly abstract, the next logical question is how do you arrive at a strategic plan and goal.

The strategic situation

While the rules of HoMM are mathematically defined, almost as in chess, there are a number of important differences. One important difference is that you don't know the entire situation from the outset as the map is partly shrouded, i.e. exploration is an important part of the game. The second important difference is that HoMM has some rules that define the outcome of an action as a probability. So you have to plan accordingly. There is a long standing debate in HoMM whether this is good for the game, and HotA, i.e. the modern reincarnation of Heroes III, has recently moved away from it. The third important difference is of course that HoMM has many more rules than chess.

In principle there are three classes of strategic situations: (1) when you first start out knowing little about the map and go about establishing a base and exploring the map; (2) when you have encountered opposition and have to balance gaining the upper hand and exploring the map; and (3) when you have a fair idea of every important part of the map and have to improve your situation to gain the upper hand.

Let's call these game phases: exploration, assertion, and competition.

Your immediate strategic goals shift considerably from phase to phase.

In the exploration phase your immediate goal is to maximize the power of your faction as fast as possible while you also have to make an effort to explore the regions in your reach. These tasks often go hand in hand, you should explore the map to find the resources you need, while building up your power helps you to explore further afield.

The exploration phase is already a very good testament to the richness and versatility of HoMM. The base you start with can be more or less powerful, sometimes resources are scarce, sometimes readily available, sometimes you have to fight for resources step by step, sometimes you can gain by exploring your surroundings, sometimes you are boxed in, sometimes the exploration phase lasts a long time, sometimes you encounter opposition very early.

HoMM also offers you a wide range of possibilities to tackle the challenges, you can build up your castle and recruit troops conservatively, or you can be more reckless and build a powerful hero who gains power and experience from battles. You also can choose between different buildings in your castle and recruiting different troops, as well as developing your hero differently, for example as a strong magic caster or a general who specializes in martial arts.

In principle you survey your initial situation, what means are at your disposal, make a guess about the value of exploration, and then you make a plan how to go about it.

This plan is more often than not directly influenced by particulars of the situation. If the resource wood is important for building up your base of power and you see that a sawmill that yields wood is guarded, you make a plan how to overcome the guards and how long it will take you to do so. Usually there are many such tasks and your main imperative is to find a plan to go about it as efficiently as possible.

Typically this requires you to make a plan what you do in which order. Eventually you end up with a plan consisting of many different actions, like collect wood, build an archer tower, recruit archers, fight the guards of the ore pit, build a mage tower, learn magic spells, collect a treasure chest at the edge of the visible area to gain gold and explore the nearby area and so on.

It's important to note that this is the first step to building a strategic plan. Naturally you always have to review your current plan, maybe you find additional resources once you begin to explore your surroundings, sometimes you encounter tough guards, sometimes you loose more troops than planned.

Your strategic plan in the exploration phase is rather limited, it is usually of a makeshift nature to get you going.

Opposition

Once you encounter opposition, i.e. other factions that also try to win the game, the situation changes.

You have to figure out whether and how you guard the assets that you own, i.e. have flagged. You also have to consider whether you or your opponent will reach valuable objects on the map first, and whether it is safe for your heroes to enter regions where your opponent might have stronger forces.

In short your heroes can't move freely about the map anymore, but have to consider defensive duties and competition for resources and other valuables as well.

In general if an opposition hero enters the region close to your base, usually your important castle(s), it is best to eliminate this interloper as quickly as possible, but it is not always expedient. In the latter case you have to consider whether you can garrison your castle with sufficient troops to keep it save. If this isn't the case your other options are to reinforce the castle's garrison to cause the attacker casualties, or to perform an orderly retreat.

This is a typical way of thinking about your castles as strategic assets, i.e. to view the options available to you in the order of strategic desirability. The worst case is loosing a castle without any form of compensation. Somewhat better is at least to safe a castle's current troops. If you can cause the attacker considerable casualties, or at least attrition, it might be a better option. Eliminating an intruder early in order to safeguard your castle and the other assets you have flagged in the nearby staging area is even better. Your base not being threatened at all is what you want ideally, so that your own heroes can explore freely or threaten to capture your opponent's castle.

This is a considerable array of options that you can use to develop a strategic plan for the current situation.

The plan that you develop depends a lot on the relative strength of forces and their mobility. HoMM is a very versatile game in this regard, with different terrain and heroes apt at traversing different terrain types with different speed, depending on their native faction, many strategic situations tend to be assymetric.

A good metric to assess a situation is to gauge the time heroes need, accompanied by a sizeable force, to reach individual castles. The most important metric is here, in the assertion phase and assuming regular gameplay, often the time needed from your main base to the opposition's main base. The reason for this is that you usually recruit your forces at your base, calculate the time to reach the target castle, and then consider whether the forces you can recruit will be sufficient to capture the target.

If the castles are farther away from each other, which means that a defender can recruit additonal forces while your hero is under way, it becomes increasingly harder to win the siege. The defender also enjoys defense boni, like the castle walls, moat, and castle towers. With other words you have to arrive with superior forces.

On the other hand, if opposing castles are close to each other, the situation tends to be more tactical and you always have to be on your guard, either to ward off an attack or use an opportunity when a defender carrying a sizeable contingent of forces has moved away too far to intercept you in time.

These are the typical considerations you have to make in the assertion phase. In practice the situation can be much more involved, as you may encounter multiple opposition factions and you may know or not know the location of their castles and the forces they have. The tavern can provide you with valuable intel about the relative strength of your opposition, there you can get an idea of the attributes of their main heroes and the forces they have recruited.

The strategic plan you have to make is driven by these strategic considerations in relation to your opposition, while at the same time you have to keep building up your base and continuing to explore the map.

Competition

Once you have sufficient intel about the significant locations on the map and your opposition, either by exploring the map or having it open from the get-go, the strategic planning changes again.

You have to make a plan to win the map.

What you need to survey first is which factions own the castles on the map, and what forces they have under their command. You need to augment this with a reasonable guess what additional forces they can recruit from their castles. This can be a bit tricky because you usually don't know how much gold they have, and how many recruits are still available in their castles. You have to be smart here and observe your opponents over time. If you check what forces they recruit and when they do it, for example by observing opposition heroes after they entered a castle, you can develop a good idea about which buildings they have in their castle and how much gold they can spend on new recruits.

Observation is a key here. It is also worth noting when they visit major adventure map objects and treasure vaults like the dragon utopia. The tavern and den of thieves is also your friend here.

Once you have this picture, it is time to take in the whole map and look at the travel times between all castles. Some castles will be well defended, some less so and possibly already threatened by an approaching enemy.

This gives you a picture that is a bit more involved, the more static and well defended core bases augmented by the dynamic which castles may change hands, once or frequently.

Here we are at the core of evaluating relative faction power. As HoMM has eight different factions, who each have their own specific troops, it is important to note which troops make up a faction's core forces. Usually the castles that provide a faction's core forces are the most important castles for each faction.

This knowledge is a tool to determine the castles that have the highest value for you, and also which are the most valuable ones for each faction and where you have to expect the stiffest defense. For example if you play with the Haven faction and own two Haven castles and can gain a third Haven castle from a faction that is not expected to defend it well, you have already an important piece of a strategic plan.

In general if there are no exchanges in castle ownership, the faction who owns the most castles of its core force type, will usually win the game in the long run, simply because it can build the largest army.

The other critical knowledge is the relative current power of each faction and where each faction's bases are located. It is relatively straightforward for a stronger faction to take the bases of a weaker faction in close proximity. That goes for you and your main competitors.

This is the level where the real strategic planning happens. You want to make a strategic plan that enhances your faction's power while at the same time you need to weaken your strongest competitors. So taking over simply the castles from your weak neighbors is not always the best plan. There is a whole range of options you have available to affect the situation in your favour. For example you can threaten your main competitors' important castles to prevent them from expanding. If you are smart you can even cause two factions to square off by positioning your forces cleverly. Sometimes it is even worth giving up one of your castles, or swap it for another one.

This is typically the kind of strategic planning you make in the competition phase. Often there are still elements of the other phases, like building up your bases and acquiring resources.

Needless to say there is so much more left that needs to be explained, or for you to discover yourself. But that is for another time. Given the subject it would possibly be more interesting if I do a livestream on a good strategic map after we have the strategic planning AI upgrade.

Strategic planning and AI

The above explanation gives you an idea of how strategic planning in HoMM works.

Naturally this is just the tip of the iceberg. Every strategic plan you make has to be executed step by step, that means you have to make many more decisions that serve your strategic plan. You have to decide which resources you acquire with a priority, which buildings you construct in your castle, which type of troops you recruit, what skills your heroes learn, whether they specialize in magic, whether it is worth to risk your troops in treasure vaults and to obtain powerful artifacts and so on.

Each of these steps affects your strategic situation and thus have ramifications for your strategic plan. With other words, the planning you do can go much deeper, if you care about it.

Currently no AI for a strategy game can match a skilled human in this area of gameplay and strategic decision making.

And this is what the strategic planning upgrade for the AI will change. The AI will do strategic planning meticulously. It will survey the map, gauge threats and opportunities and develop a strategic plan. Then it will go to execute its strategic plan step by step. The AI will go systematically about figuring out what its heroes should do to become more powerful, while supporting them with sound decisions regarding which resources to collect and what buildings to construct in its castles. It will review its strategic plan consistently and use this as a basis to consolidate its power and to decide whom to attack. With other words, the AI will employ strategic planning in everything it does. Gone are attractor values common in games today.

This is a world first and meant to give you an experience playing HoMM like never before. If you only played HoMM casually so far, you will be in for a big surprise.

HoMM offers a near infinite variety of strategic scenarios that can even occur on a single map, so there is plenty to play around for armchair generals and strategic grandmasters. The features for an extremely rich game are already there, what it needs are competent opponents.

You’ve successfully subscribed to Quantomas AI
Welcome back! You’ve successfully signed in.
Great! You’ve successfully signed up.
Your link has expired
Success! Check your email for magic link to sign-in.