Coinbench bitcoin buy button

Notify Me

Email me when Kenshi is finished:
(You will only get one email when Kenshi is completed, nothing else, no newsletters or spam)
Guard AI
Written by Chris   
Thursday, 24 February 2011 22:38

Lately I've been working on the AI system again.  Decided to start with the town guards, because I don't yet have time to make town gates or to teach the bandits to avoid towns, so it will need guards to keep them out and provide relative safety for the player.

Its a simple AI in theory, they patrol around their town and attack anyone acting aggressive.  This means I had to start creating a system for a character to sense the nature of whats happening around him, and also to recognise the difference between actions and intent.  In other words a guard not only has to recognise that fighting is an aggressive act, but it has to realise that someone fighting out of self-defence is not aggressive in intent (you don't want the guards to attack you for being attacked).  Eventually the guards will actually arrest and imprison people, carry them wounded to doctors, and all sorts of other clever things.

It works quite nicely now, though if you try to help the guards in a fight they will see it as an unprovoked attack against the bandit, and so they will get you too.  So I've now got to teach characters to recognise the difference when someone is helping them.  It might seem a lot of effort teaching all these perceptional nuances to town guards, but its not just for them, everything I add provides a foundation for every other NPC and faction I create later.

Last Updated on Thursday, 24 February 2011 23:14