If I remember correctly, the last thing we talked about was pursuit and evasion, which are smart extensions to the more simple seek and flee behaviors. Just slap these movement behaviors onto agents that you want to be either "melee" or "prey" type creatures. They work quite well for that.
This week, I bring to you what I believe to be the culmination of gamedevtuts+ tutorial series.
Agent Movement/Steering: Movement Manager
First off, take a look at the original post. I always say that the original authors do the best job explaining these topics, and this week is definitely no exception.
Second off, try out my code from my most glorious Github. Make sure that it works. You know, the usual.
The Movement Manager is the thing that brings all of these basic movements together. It can combine several different movements, such as seeking in one direction and wandering in another, together so that a single steering vector can be added to the current velocity. Further, instead of having to code out each individual type of movement, the Movement Manager will take care of it for you.
When coding an agent that uses the Movement Manager, there are very few things that need to be done:
- Add logic for deciding what to do.
- Make calls to seek, flee, etc.
- Update the Movement Manager.
The code up on the Github gives an appropriate demonstration of this. All that the coder has to do is decide that to move towards/away from.
This system is set up exactly like I always like to code things. It's compartmentalized, which means I can move where I want when I want. I can't really say much more than that, really... Try it out yourself!