Good morning,
I need some help getting started with creating a behavior for my game.
The idea is a Top-Down and FPS multiplayer 2vs2 game.
I want to implement a system so that, if no players are currently online, 3 bots will be spawned as replacement players.
Right now, I’ve already got the two bots for the enemy team working.
Now I want to create the bot that is on the player’s team. This bot should have more advanced behavior, and here’s my question:
How can I start creating a bot that:
Follows the player
Keeps a certain distance behind them (without getting ahead)
Can take random positions near the player, staying close enough to act like a real teammate
I’m not sure if there are extensions or plugins available to make bot AI management easier.
Well i know how to make the AI bot follow the player, to do that you need to install the behaviour on the AI : pathfinding.
So the next step depends how you want it to happen. If you want it to follow the player if the player is close (to a certain) distance or just follow it. If you want it to follow it if its close to a certain amount if pixels (if you dont you dont need any conditions) you need to add the condition to the Ai: if distance to object(Player) = 400. (you can edit this if you want 400 is example)
Then add action to AI: Ai move to position: X= player.X() Y= player.Y()
Also you can add action to change the speed if you want.
Side note, if you have walls in the game add the behaviour : pathfinding obstacles to it, so when the ai chases the player it goes around it.
I’m sure there’s a multiplayer condition to detect the number of actual players…I did do this once but a while ago. And then you can repeat event ( 4 minus number of players)…create bot and number them using a scene variable