Ok, the first two ways are simple enough but I’m not sure if I got the third right. Are you suggesting we should run Pathfinding (maybe customized) for each unit separately? I’m doing something like that now.
As to the details. In my case the average move range is 4 tiles per turn (more likely 2 tiles per turn if you want to move and attack in the same turn) and attack range is 1-2 tiles (except light ranged units but those don’t do much damage and it’s ok to leave their danger calculations distance-based as it is now). Maps are single-level and no more than 20x20 tiles. There aren’t many obstacles but a number of units can be pretty high though, at around 16 units per side, so the units can be obstacles themselves, that is why I’m thinking that GetIndexesInRange is not enough.
I had a couple of ideas to speed up the process too. First is to check for danger only the tiles that can be reached through move by a current pawn. Second is to exclude enemy units that cannot attack those tiles by any means. Third is to run pathfinding only for a limited number of pawns (let’s say 4) that are closest to the current pawn/or move target tile. It could also emulate imperfect human thinking. I think so at least.
I agree that AI doesn’t need to be perfect but I’d like to test how it’ll work at least. Currently I’m getting perfectly accurate values by running customized Pathfinding for each pawn as I described before. I just don’t know how slow It’ll be in the end. At worst I have an option of returning to default AI settings of the toolkit with a few light modifications as the units seem to behave themselves fairly good and I can even lose sometimes when the odds are even in terms of numbers.