I’ve been looking through some answers, but I have not found any that helped. My problem is, how would I have the A.I look for the player character or just walk around if the A.I can’t find the player character.
This is how I’m doing it, or would like to do it. I’m almost finished with this prototype and this is the last step I’m taking. I’ve made a forum if anyone would like to look. HERE
What I would do is: make a behaviour tree with a blackboard, wich has has a variable TargetActor which is a Actor reference, and a Enum variable for state. The Enum has to contain Combat and Idle and if you want to make your system better probally Looking for player too.
Then you will need to create a service in your behaviour tree wich sets the state to combat if your AI senses your player. And sets the state to Idle if it doesn’t senses the player. You could also work with a memory marker and a state for searching for player.
What says is a very good point to start building a tree to manage an AI with different behaviors. However, I think that what you want is how to obtain the position for the AI to move where they don’t see the player.
If I am not wrong what you want is to predict the position of the player. To do that you should store some data in order to be able to do a good prediction. For example, I would use the last time the AI saw the player, the last position, orientations and probably also the speed. With this data you can assign a probability (the probability of the player to be there) to every position in the map at a specific time. Then, once you have calculated the most probable position you move the AI to that position and if the player is not there, you update the probability map and try again. To implement this sort of probability map I use influence maps ().
Take into account that, as the time passes the probabilities decrease. You will arrive at a point when all the probabilities will be low and almost equal. For this reason, it will be impossible to predict where is the player. In that moment the prediction algorithm turns into a search algorithm (wonder). This algorithm should be very simple: you must assign a low probability at the positions that you have seen recently. As the time passes, this probability increase because you are no longer certain if the player is there or not. From here, the mechanic is the same as before, you move the AI to the most probable position and update the positions.
One note. If you have multiple agents, instead of sending the AI to the most probable position, you move them to the top 5 or top 10 for example. You should also, use all the gathered information together, as if it was only one agent.
I was hoping I wouldn’t have to mess around with Behaviour Tree, but it seems that I have to. I just wanted the A.I to walk around aimlessly, if I’m not in sight.
I’ve watched what tutorials I can find, none are giving me what I need. Also, I’ve done what I can and what I know regarding blueprints, but none work and just have the A.I flinch in place. There are probably just a few nodes (3-5) I could use, but I’m not knowledgeable in this to do myself or even know about them. Is it possible you can point me in the right direction?
surprise! did you ever make your AI move?
are you using navigation mesh?
did you set your character BP to use that AI?
did you run your behavior tree at begin play?
if you watched all that tutorials you must have solved your problem!
as you said you need your AI to just aim and walk around when the player is not in his sight. in that tutorial I sent you first he implemented an AI that walks around and looks for player if player is not in his sight. so you can use the same system and replace AI walk animation with an aiming walk animation.
If you just want the AI to walk aimlessly and without any logical control, you can use in yours BP the function Get Random Reachable Point In Radius. This function returns a random point of the Navmesh inside the given radius.
What you can do is, every time the player is not in sight, just execute a loop getting a random point and moving to it until the player is in sight again.