Guard AI

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.


By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.