I’m making an isometric grid based combat game, and could use help with enemy logic/AI. This is my first attempt at any sort of ‘intelligent’ enemy in a game. I’ve made my own isometric map, and enemies and player characters can make use of line of sight.
I’ve started with an influence map, giving each ‘gridcell’ instance two values, an enemy influence and a player influence. Before a character moves, they remove their influence from the grid, then put it back once they move. The closer a cell is to them, the higher influence value gets added to it. So higher enemy influence means enemies have control of that area etc.
I’m just trying to make a very basic behavior to start with, a ‘zombie’ that just goes towards the closest enemy: (for each reachable cell, target cell = cell with highest player influence). Reachable cells are determined by grabbing all cells within the character’s movement distance, then filtering those by which cells can still be reached taking pathfinding into account.
The issue I’m facing is once a zombie finds itself on the opposite side of a long wall from a player character, it will not recognize the cells on the other side of the wall as reachable, as they can’t be reached that turn by pathfinding. So basically it will just move a space or two then end its turn. Shuffling around on the opposite side of the wall for an infinite amount of turns.
My idea was to have influence “curl” around walls in a similar way to reachable cells, but running pathfinding on every cell of a 50x50 grid every time a character moves would make the game unplayably slow.
My next idea would be something like (for each cell within my initial movement distance, if one of those has higher player influence than my reachable cells, set that as my target cell). Then I guess they’d have to save that and pathfind to it. This would require me to track a ‘distance traveled’ and snap them to the nearest empty cell once they’ve moved their allotted amount. Which just seems hacky and prone to breaking.
So before doing that I thought I’d ask if anyone has any better ideas.