Help with AI

Right now I am working on AI for animals and humans.
How should I make it.
For Animals, they walk around, hunt, run away, attack/defend, eat, sleep…
Humans AI has a lot more
walk around, sleep, eat, attack/defend, follow, do task(like work), guard, patol…

The way I think I should do it is to have states, that jump one to another depending on outcome and stuff.
The other way is to have it so that the states dont commuicate with each, and have one function that controls the states…

I think you sort of got it there. You could use a function that manages and run the diff states(functions/coroutines/codes) when required. That way you only have your manager calling your functions and not all the functions intercalling each other. Just my 2 cents.

Thanks for the help

what you look for are finite state machines. for a sample implementation and explanation look here:
http://www.ai-junkie.com/architecture/state_driven/tut_state1.html

look here for some video tutorials on Finite State Machines.

I think that’s the video it starts on. technically it’s for his hack and slash tutorial but he tries to do it in a way that you can come in right then and there and learn about the topic, which right there is setting stuff up to be put into a FSM (Finite State Machine).

they’re pretty neat.

I started with the AI for my game about four days ago, at first I started looking into a FSM’ like playmaker or using the Beta of uScript.
I never used FSM’s nor visual scripting before and I could never really get it to work the way I wanted. I then looked into AngryAnts Behave library, spent a day learning about behavior trees and reading tutorials, then one day of testing stuff out and now I got it working the way I want.

For some FSM’s and visual scripting might be the way to go, but for me the simplicity and logic in a behaviour tree just makes more sense, also has the benefit of requiring no additional changes to your code. Just putting it out there as an alternative if your like me and couldn’t get into FSM or visual scripting.