DevDiary 30 - Tuning the AI
Hello friends and welcome to the 30th DevDiary for “Knights of Honor II: Sovereign”! This time, we decided to delve a bit deeper into the world of AI and difficulty, explaining our thought process behind balancing pacing, making sure players are engaged in all stages of the game, and what sort of obstacles we met along the way. It must be said that much of the feedback we’ve seen from our closed beta testing has been invaluable on that front, for which we thank you all!
So what makes an AI “fun” to play against? While it must be challenging, it should also behave in a human way. In KoH2, the AI is constantly thinking about what actions to perform, with different priorities dictating which ones it will perform at any given time.
Early in development when systems were still being added to the game, the AI used to simply gather all of its armies and send them to a single location, which was simply overwhelming and not fun to play against. But as more decisions were added to the AI’s thinking process, waging war against another kingdom felt more manageable. While you move in with your armies, it might be considering its defenses against other hostile kingdoms, upgrading fortifications, gathering garrison troops, asking other kingdoms for support via diplomacy or even constructing buildings.
By adding these sorts of distractions, the AI starts to think (and feel) less like a machine, giving players time to react and adapt their strategies. And after a few campaigns, you might begin to notice small nuances like the AI preferring to defend its towns under siege and lead battles in home territories.
Behind the scenes, each AI kingdom also has a certain “budget” reserved for different areas of development. These are dictated to a certain extent by their current king’s abilities – for example, a ruler with good stats in religion focuses more on developing his kingdom’s piety and clerics, while someone well-versed in diplomacy would take extra care of maintaining strong bonds with other kingdoms and employing powerful diplomats. These are subtle factors and don’t dictate an AI’s behavior completely, but do play an important role in the grand scheme of things.
And then, with all these tools in play, comes the fun (albeit sometimes grueling) part of balancing how AIs behave in certain scenarios. Diplomacy is a system that highlights this in interesting ways, as certain diplomatic offers have adjusted pros and cons, depending on if the recipient (or the subject) is an AI kingdom. For example, AI kingdoms are more likely to form royal marriages with players, so that you may have an easier time finding spouses for your king and ensuring the continuation of your royal dynasty. This is only valid on easy difficulty, though, with AIs being more reluctant to marry their princesses in general (to avoid losing lands to inheritance claims).
Yet, there are moments when even the AI surprises us with advanced plays, which aren’t exactly by the book. For instance, you may experience a kingdom inviting you to wage war against someone, only to find out moments later that they are in a defensive pact against you, alongside that kingdom. Or, seconds after marrying your princess to their prince, you receive a message that a foreign spy from the same kingdom has murdered your king, followed by foreign claims for inheritance. As painful as it might be on the receiving end, such experiences can define a campaign and make it more memorable.
Of course, the AI may sometimes seem clever by random, but most of it is driven by the game’s difficulty. For example, higher levels increase how much gold, books, religion and levies an AI kingdom gains. Starting conditions are also affected, such as how many wars you might end up in at the beginning of a campaign, or how long it might take before rebellious population starts to amass in your provinces.
In tactical battles, AI armies can also react better at higher difficulties. This may manifest in your marshals being more susceptible to being flanked and picked out by enemies, cavalrymen tending to prioritize archers more and ranged cavalry micro-managing against you while shooting.
In a sense, you could say that the AI “cheats” on some difficulty levels. In other cases, it is not unfair to say it makes mistakes intentionally, from time to time. But in the end of the day, our main goal is to deliver fun and memorable moments, and sometimes that extra spice can be the deciding factor.
Naturally, AI and difficulty is a constantly-evolving part of our game (as in any game) and we’d love to hear from your thoughts on the topic. What do you think is the most critical part of making an AI feel “good”? Do you think an AI should have some extraneous elements added to help it, or should it be on an equal playing field with players?
We’re sure you’ll have many questions and comments on the topic, so feel free to raise them in the comments section below or on Twitch, during our DevStream on Thursday, November 3rd, @ 3:00 PM GMT / 11:00 AM EST. The Twitch stream will be hosted on the THQ Nordic channel: http://twitch.tv/thqnordic and we’ll be grabbing responses from this post and playing the game live!
Until then, we bid thee farewell. Go forth and conquer!