I hope what I’m asking for isn’t a tall order but, does anyone know how to make a waypoint system for my enemy AI to follow? The game I'm making is in 3d( it's a first person shooter). Now the enemy AI that I have is good at avoiding obstacles:
It can also avoid obstacles when approaching a target:
However, it's skills would breakdown if it were to chase the player from one room to another. My solution to this problem would involve turning the doors into waypoint that would lead the enemy to the player, if the player were to move into another room. I've even implemented half of the solution. So whenever the game starts, the level would assign a number to each door. When the player opens a door, the door would tell the level to put it’s number in an array that I’ll call door_list for example and then invert that list. There is also a variable that keeps track of the last door the player opens and it’s number. If the player were to open the door reopen the last door that was opened, the door_list would be cleared while also taking the doors number. On top of all that, doors will automatically close when the player moves away from them. Even though that is unrealistic, it’s a trope that I’m sure many players would be used to( especially if they’ve placed older games). Also, it makes sure that the player has to keep opening doors when visiting previous rooms. What all of this adds up to is a door_list, that is an array of door numbers that lead to the room the player is in. Now I just need to find some sort of way to get the enemy AI to use the door_list array to chase down the doors to player but, I don’t know where to start. I already have ideas for how I’d get the enemy to open the doors. I’ve also got ideas on how the enemy would know when it’s appropriate to chase down the player as oppose to doors and visa versa; I just don’t know how to get the AI to chase down the doors to the player. Can anybody help? Does anyone have any pseudo-code that would help? I image that the solution would involve some sort of number that tells the enemy which door to chase, then alters that number when the enemy is close enough to that door. Still, I do find myself feel too burnt out to think the whole thing through. Any help? Once I get help for this, I don’t think I’ll need help for anything else where my game is concerned. I look forward to any response if I get any.