Suicidal AI - by design
Having updates around end of a working week became kind of tradition, so here goes:
I've spent most of the time altering the AI handling code. When trying to determine their best move, the AI was performing evaluation for every potential map tile that they could reach. It was evaluating potential shoot targets, the ability to flank an enemy or the risks of getting hit/flanked.
However, this was causing performance issues. The part about calculating potential hit targets was pretty heavy and included a lot of raycasting. Now, the issues were not that big (after all, it is a turn-based game) but they were noticeable (the frame rate was tanking for like half a second).
So what I did the other day was reducing the number of potential map tiles that the AI was considering as move targets. I assumed that enemies should not end their turn in coverless positions anyway, so AI started to ignore any map tiles without a cover when perfoming the calculations.
This significantly improved the performance - the framerate stuttering was gone.
However, the melee-only enemies were behaving... not in the way I wanted them to. Basically this enemy type should act suicidal. Their goal should be to run towards an enemy as soon as possible and deal some damage. They should not worry about cover.
In the end I reworked the AI, so that melee-only characters are simply ignoring all the risk/opportunity assesment during their turns, and rush directly to the player:
Rat grunts are rushing at the player, ignoring cover! And that's cool!
Leave a comment
Log in with itch.io to leave a comment.