Tweaking the AI


So another thing I did work on in June was making sure that enemy characters finally start behaving in an interesting way.

Due to the cover system that the whole combat is based on, AI needs to be aware of its environment and perform an action which seems to be the best one (well, maybe not always best for them - to make sure that the player gets some fun out of the combat as well).

The way I implemented it was to make sure that each AI character has all the necessary information available when determining their next action. By "necessary information" I mean things like: potential cover locations, targets and threats, amount of ammunition available, etc.

Then, based on this information, the AI can evaluate its possibilities by taking into consideration all the positive (e.g. option to flank the player) and negative (e.g. option to become flanked) aspects.

I have only implemented few basic behaviors for the AI, so far which include:

  • Always take a shot if the enemy is flanked,
  • Look for a cover that allows you to target the enemy with the biggest % to hit,
  • Reload your weapon if you are out of ammo,
  • Make sure that the cover you choose does not require a full move (as that will allow you to perform a shot).

As you can see there is no melee combat related behavior here as of yet.

Now, even if in most of the cases the AI seems to be behaving quite nicely:

It turns out that sometime they have issues with determining the best cover:

Now, in theory all is correct here: the AI has chosen a location where:

  • They have full cover (well, they do stand near a solid wall)
  • Player characters are not flanking them.

On the other hand, it seems that in such situation the AI should in fact be flanked be player characters.

I definitely need to investigate this further, I guess.

Leave a comment

Log in with itch.io to leave a comment.