I’m in the begginning more or less of a project, its a kinda Inventory bassed hunting game, and… dare I say it… AI! Yes, I’m at the stage where I would need to start looking into it.
So I turn to you good people! From what I’ve been looking at, it’s as if the best way is through A*, UnitySteer and a few others of which I have no idea how to use! xD.
What I would like to achieve is for an enemy(animal), to flee at a certain distance(typical hunting style).
And so I have some questions:
1- Is the pathfinding method the best aproach to what I what to achieve? And is it as complicated as it looked at first? I’m not the best at coding, but can get along.
2- Or would it be easier to use some kind of follow script (in reverse of course) & the navmesh?
Would someone please give me even a brief description on either one of my questions, and point me in the right dirrection?
I’m not sure there is a good FREE A* for unity so maybe try navmesh if you have the asset already.
your AI should actually be pretty simple because your talking about an animal (AKA lower intelligence) fleeing a predator.
There isn’t any calculations, its not going to juke and move to avoid the cheetah even, its a hunter with a gun.
The animal might dart side to side some but other than that its a headlong rush away from danger.
you honestly should basically cast a ray from the animal to the hunter. inverse it to find the oppisite direction and travel X distance away along the navmesh.
just make good use of random to help screw up the hunters aim while fleeing.
store the final destination but dont go there right away, go a small short distance towards a vector rotated a small random amount of degrees off course. Call jump at random and on jump have a chance to aim again a small random amount of degrees off heading.
after you reach your first point randomly decide whether to go off course or head straight for the destination. AKA whether to call the first function that finds a points slightly off to aim for. if true go off course again. If false run towards the final destination and after 5 seconds or so roll again to see if the animal changes its mind and veers once more. Do this until your within X distance of your final destination at which point you go for it and stop checking.
Eventually you’ll make it to your destination. Then you check for hunters and if the animal doesnt sense hunters you go back to no predator AI.
thank you for your very rapid response! I understando the way you are describing and sounds just like what I need! Could you be so kind as to point out which type of raycasting I should dive into because as you know it is kinda steep to start with and I am definitly a begginer when it comes to Raycasting. Im not asking for a ready made code just a general overview of how it should be done using actual code. Thank you yet again as what you have provided is perfect in getting me started at least.