- Home /
Free Roaming AI
Me and a friend are working on a unity game. (actually my friend, I'm just modeling) Its a hunting game and were talking about the system for the animals, he wants to use something from some FPS tutorial where the enemies follow a path and react when your x amount of distance away.
or so he describes.
I don't find this appropriate for the game, I'd much prefer it if the animals free roamed the environment, and even engaged in hunting activities themselves, or simply went to the nearest water source to get some water.
Does anyone know how to achieve a system where they would roam freely across the land and act like natural animals, not just drones waiting to kill or be killed? If you have links to tutorials or you can explain it yourself please tell, because we both are not that experienced in the scripting field.
Answer by Random Indie · Apr 28, 2010 at 06:53 AM
My suggestion would be to start with a simple agent based model such as BOIDS (little history). There's a tutorial on the unity wiki that should get you started.
I'll give you a quick rundown, each boid has three behaviours:
- they try to stay close to other nearby boids
- they try not to run into anyone close by
- they try to go in roughly the same direction as other nearby boids
These three simple rules give rise to fairly complex behaviours (ie: bird flocking) such as flock splitting and merging.
You can expand on this pretty easily. There are variations on this that introduce "hawks" that when hungry attack boids (chase them) which makes the boids try to run away from the hawks. You can also add obstacle avoidance or any number of behaviours. I've modified and used them for schools of fish (just make sure they know not to fly or burrow :P), wolf packs, Zombie hoards, etc... It's a really powerful little algorithm.
Simple agent based models are really easy to understand conceptually so that might be the best place to start.
Looking into ALife is definitely a good idea too. You might want to glance over cellular automata while you're at it, may not need it but it might come in handy.
If you go with something like BOIDS you might want to think about making them finite state machines with states such as hungry, sleepy, curious or some such.
There are a tonne of resources out there that should help you out, you should be able to find most of what you need with the links I've provided. Good luck!
Answer by spinaljack · Apr 28, 2010 at 04:37 AM
You can google ALife AI which will give you plenty of links to libraries and research in the field and STALKER will also pop up as they used ALife in their game. It's a huge topic but boiled down you can think of it like the sims, characters have certain factors that influence their behaviour such as thirst or fear which can be modelled with fuzzy logic with the combination of these factors ultimately leading to a decision on the next action the character will make (doing nothing is also a decision). If you want an in-depth discussion I suggest the forums as it's difficult to answer here.
Here's a nice set of AI related links
Your answer
Follow this Question
Related Questions
AI Monster Problem 3 Answers
What would be the best way to setup Target priority 1 Answer
Assign gameObject to a variable at runtime 2 Answers
Enemy Ragdoll help 1 Answer