Hi all, Oliver here! Today I’m going to be talking in a little more detail about how our AI system will work.

Because Alliance of the Sacred Suns is a turn-based game, the AI isn’t constantly calculating what to do. Instead, each character, including the player, takes a turn, and over the course of that turn, the (other) AIs mostly just react to the active AI’s actions. (We may do some clever things with AI decision-making in the background of other characters’ turns, in order to shorten the turn calculation time, but the basic principle is IGOUGO.) The active character, in contrast, will be running quite a sophisticated algorithm to decide what exactly they’re going to do with their time.

First of all, they have to take stock of their situation. At the start of each character’s turn, they check their Attention Bidding System. This is a function that chooses between different possible goals for the character to work towards, based on weights assigned to those goals. For some goals, such as getting rich, these weights are pretty constant, only varying with the character’s fundamental personality and Ultimate Goal (their overall desire in life). For others, the weight will depend on their circumstances – ‘Survival’, for example, takes a weight determined by the highest Threat Level of any character to the active character. (Threat Level is a figure set by a combination of a character’s Power with modifiers for other factors, such as threats they’ve made and Secrets the active character knows about them.) The goal they’re currently working towards also has a bonus to its weight, to make sure characters stay plausibly focussed.

Once the Attention Bidding System’s check has been made, the character then starts moving on the Strategy Tree. This is a branching tree of hand-written decision nodes, designed to try and emulate real human reasoning by proceeding from ultimate motives, through general strategies, to specific actions. But rather than starting from the top of the tree each time, unless they’ve changed their end goal, the character will pick up wherever they left off at the end of their last turn. (Again, this is to make sure they maintain coherent courses of action over time.) The character will then proceed through the tree according to the rules on each node they come to, until they come to a node telling them to perform an action of some kind. When they come to a node of this sort, they will spend an Action Point, perform the action, and then check their Attention Bidding System again, to make sure circumstances haven’t changed what they ought to be doing – for example, if they’ve Challenged a character more powerful than they are, they may suddenly need to move to the Survival branch of the tree! Then, if they have Action Points left, they will start moving through the tree again, repeating the process until they run out of APs.

So that’s the overview of the system. Let’s have a look at an example, to see how this’ll work in practice.

Mancy Ononoke is the young viceroy of the planet Lucidia. Her Ultimate Goal in life is Wealth, which means that’s one of the goals she has under consideration, and since she’s a very Driven young woman, its weighting is quite high, outbidding the moderate threat from the popular Gaius Locke, also resident on Lucidia, for her attention. Now since she was busy on a pilgrimage until last turn, she starts from the top of the Wealth branch of the strategy tree. First, she decides what broad strategy she will pursue to make her money: since she’s a Viceroy, she makes the easy choice to Develop her Territory (a node directly under ‘Ultimate Goal: Wealth’). Now, how to do that? ‘Develop Territory’ has three child nodes, but two of them are available only to senior clergy and province governors, respectively. So she opts for the third, ‘Improve Economic Sector’.

‘Improve Economic Sector’ is a node that can be accessed from a number of different places, so it has options for which planet and sector of the economy to improve. Choosing which planet to improve is easy when there’s only one option, but selecting which sector to improve is more complex. Mancy considers unemployment, production capacity, and the skill of her workers in order to pick the Energy sector. She then, following the node’s script, determines that the best way to improve that sector is by building more power plants. Therefore, she moves down to Adjust Build Plan, and spends an Action Point to alter her planet’s build plan to favour building them. The instructions then tell her to wait to see how effective it is, so she discards the rest of her Action Points, and the turn ends.

Mancy doesn’t have to just sit around waiting, of course. Many goals can be pursued as ‘break activities’, meaning they can interrupt other activities without disrupting them completely – once the break activity is finished, the character goes right back to what they were doing. ‘Survival’ – in this case, tackling the threat of Mr. Locke – is such an activity, and, since she’s waiting, she gives break activities a higher weighting in the bidding for her attention. So, next turn, she might decide to deal with Locke once and for all! But she might also choose to start building a family, spend time with her friends, do something for the Church, or any one of a number of different things. There are over 500 nodes on the strategy tree, with twelve different goals bidding for characters’ attention, and many different ways to achieve those goals, creating a dynamic, storytelling system in which characters act plausibly in pursuit of believable motivations.

Not only that, but since the system is completely modular, modders will be able to add new nodes and modify existing ones. Different branches can cross-reference one another (with a customisable limit on absolute tree depth, to prevent infinite loops) meaning that some nodes added to one branch can be used intelligently by characters pursuing other goals. (Assuming, that is, the nodes are well-written!)

Now some of you will be reading this and thinking, ‘That’s all well and good, but how many hours am I going to have to sit and wait for each turn to resolve?’ We’re very aware of the potential performance issues involved in such a procedure, so we also plan to iteratively develop an ‘AI director’ system to switch characters between this process and a much simpler, more efficient one, in order to provide the player with a better experience. This other system will be much lower-fidelity and have many fewer options, making the decision process much faster, but crucially, you won’t know which character is running what at any given time – a character who doesn’t seem to be doing much proactively might not be, but on the other hand, they might be busy plotting behind your back…

It’s a very exciting time for me right now, because having worked on the detailed design of this system for almost a year, we’re on the point of beginning to implement it! Keep your eye on the blog – we’re going to have a lot to show off in the coming weeks and months.

Ave Imperator!

Oliver

Advertisements

9 comments

  1. How will you make the “npc plotting against other npc” mechanic visible to the player at least part of the time? I probably don’t care about Mancy Ononoke and Mr. Locke, but if there is a major dispute between Bob Page and Admiral Norbank then I should be able to notice that there is some trouble happening in that region of space even if my action points over the last several turns have been spent elsewhere

    1. Hi Aleccia! Your spies will regularly feed you scraps of information regarding important characters’ secrets regardless of what else you’re doing, so you ought to get wind of that kind of trouble before it happens, allowing you to investigate further. Hope that answers your question!

      Oliver

  2. So Admiral Norbank decides to attack Page’s comparatively tiny private military using half of the fleet – my fleet – and Norbank being who he is I am sure he found a way to get my shiny new titan destroyed against a couple of Page’s frigates regardless of how unlikely that might be in the game’s combat engine. What tools does the game have to draw your attention to a major event like an internal feud costing humanity a large chunk of military power?

    I’m sure Page was plotting against me as well, but even ignoring that there is also the little detail that Page just destroyed half of my fleet and no I don’t care that he did so in a purely defensive conflict. How public can I make an execution and what are the pros/cons of broadcasting a beheading on live holo-TV?

    1. Nicking off with your fleet like that would *definitely* constitute a Challenge to your authority, making it effectively a declaration of war against you by Admiral Norbank. Maybe you let your Power slip too low, maybe you let Norbank get too big for his britches, maybe you appointed him despite knowing he was inCautious and Passionate enough to pull something like this – whichever it is, when something like this happens you will (or should) have already known you were at risk. Now Norbank might throw himself on your mercy, in which case you can have him executed (making yourself more feared but perhaps less loved by your inferiors) or you can relent (in which case the reverse happens). If he doesn’t, well – it goes without saying that the execution, when he’s captured, will be holovised!

  3. Admiral Norbank is dead! Good riddance. Page Industries now has my attention simply for being in proximity of what happened; the explosions happened in his territory so that’s where I currently have the telescope pointed. I’m sure that Bob Page’s private ships are all painted blank with “MJ-13” engraved on the hull and also have cloaking device teck that I don’t have, presumably so they can sneak off and do bad guy stuff without anyone knowing. I suddenly have a distinct distrust of Page Industries now, especially since they apparently have the firepower to take out a Titan. How does the game handle local-level militias; I’m sure every planet has at least a few warships to chase off pirates and to crush peasant rebellions but a full private navy would worry me and probably others as well.

    …Who did I put in charge of weapons research again? It might very well turn out to of been Page Industries. Will researchers try to hoard the best pieces of tech for themselves just to give the player another thing to be paranoid about? The rest of the galaxy doesn’t need to know about the cloaking devices we made. Or the FTL drives. Or the clever sonar device for locating ships that are trying to hide inside so-thick-that-there-is-enough-matter-for-sound-to-pass-though nebulas. That princess over there certainly doesn’t need to know! But hey look we invented the energy shield and the MKII Laser Cannon! We are helpful contribution to glorious space empire

    When I get my hands on the game for real I am adding extra spies to my research planets

    1. That’s where we got the name – we were trawling through various mythologies for inspiration for the characters you meet in your dreams, and the trickster nature of the Aitvaras sparked our imaginations. So as well as being the name for the AI, you’ll also meet a character named Aitvaras in the game itself. How much of a trickster he is, we’ll leave you to find out…

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s