Post news RSS Ultima Ratio Regum - AI that cares about its own survival

The challenge: make AI that cares about its own survival, like any real-world creature, but provides interesting gameplay and doesn’t simply flee...

Posted by on

This is the first time I've posted news, but I find I have something actually worth posting about now. A key part of my 'strategy roguelike', Ultima Ratio Regum, is to make AI that cares about its own survival, like any real-world creature, but provides interesting gameplay and doesn’t simply flee at the slightest sign of trouble.

The solution?

Well, firstly, I don’t want AI that just runs blindly into your sword-swings like in most games. Ultima Ratio Regum is instead populated by creatures that – while they have their own objectives, often involving killing the player – also care about their own self-preservation. An Orc will not charge into combat with a Titan by itself; if pressed, it will flee, and if pressed further, it might even lose its mind from terror. Hilarity ensues. Other activities - such as allies fighting over a good item, or rallying their team-mates - hopefully contribute to the realism and self-serving objectives of the AI.

To demonstrate something about the AI, I present to you this flowchart. This is something of a simplification as creatures can choose whether or not to follow certain links based on certain factors/variables, but this diagram still demonstrates the connections between varying conditions – indicated by diamonds – and states, indicated by the shaded rectangles.

Click for a larger version:

The specifics will be explained in detail later, but a three key points include:
- Starting states

Barring a few, rare, exceptions – can only be spawned as the black states. If they begin wandering, they just move themselves around the map. Monsters who begin waiting will remain where they are until they catch sight of an enemy. Guards will remain at their post until they either see a foe they despise so much they simply must come out and fight, or – much more likely – until they are attacked, or in some other way angered. Some monsters can spawn sleeping, in which case their behaviour until they are attacked, or hear something that wakes them, is pretty self-explanatory.

- Morale

This system merits several posts of its own. Firstly, and foremost – it is not designed anything like morale systems in other games, which I’ve generally found to be aggravating, and often seem rather arbitrary. In Dawn of War, for instance, I recall lone groups of soldiers sometimes fighting to their deaths and sometimes instantly losing all their morale with no apparent reasoning. While I intend to keep the specifics of the morale system hidden, it is designed to emulate as closely as possible a player’s evaluation of the battle. Which is to say – if a monster thinks it has a good chance of winning, or something happens that reinforces this view, it gains morale. If it thinks it might lose, and something that might reinforce this view occurs, it will lose morale. Monsters – especially in larger battles – are getting increasingly skilled at judging the pace of a battle they’re involved in, and deciding whether or not it’s worth fighting you to the end, or fleeing to wait another day. Again, an entry for another day, but variables as diverse as the armour you wear, the damage to a monster’s body, your combat history, the states of your allies, and even stories of past fights you’ve won that your enemies spread amongst themselves play a role.

- Artifacts

Monsters, like players, love artifacts. If they see one – and are intelligent enough to recognise what it actually is – they are almost certain to drop anything they’re doing and make a dash for it. However, because many factions have a rigid command structure, stronger enemies will often bully/persuade weaker allies to gift artifacts to them. Disagreements can occur, and therefore battles between allies can even take place over artifacts, potentially deadly if neither party backs down…

That's all from me for this first entry. If you have any suggestions for logical activities for the AI to perform, or think this sounds interesting, it would mean the world to me if you followed along on Facebook, or the website, upon which you can find a lot more info. Thanks for reading, and I'd love any thoughts on logical/illogical connections, or other actions that would make sense, or anything else.

luaudesigndf - - 4 comments

Very nice stuff.

Reply Good karma Bad karma+1 vote
Post a comment
Sign in or join with:

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.