I want to learn how AIs can flank and hold positions, according to the situation, without manual settings places. I am trying to make an AI ready or not. An FPS AI, my AI currently knows strafing when he spots an enemy.
They probably use a machine learning algorithm, which trains based on what players do in the game.
I think, they use raycasting and checking properties of meshes and parts.
They probably do that too, to get the world as a readable map. However, I’m not sure where the intelligence from the AI could possibly come from if it wasn’t machine learning.
Well the easiest approach would probably be to mark out all the advantagous spots for an AI in your map. Using the players position and raycasts, you can give each spot that the enemy can hold within range a rating. This rating would take into account stuff like cover, visibility and other gameplay mechanics.
Whichever scores the highest, the enemy will move to. Flanking is sort of the same thing. Just change the parameters to pick a spot closer to the player, and communicate with other AI to make a team effort in surrounding the player. If one AI has an opportunity to find a path to flank the player with a high enough rating, they do it.
Human AI in the last of us provides some really great insight into how enemy AI is handled in big games, with everything from enemy behaviour types to player stealth systems. I would recommend checking it out, it is well worth the read.
Thanks for a good explanation!