So before diving into the intricacies of AI, I want to make sure my architecture is at least at a good starting point. (I understand I could use the GCC4 code base as an example, but I'm having a hard time searching through and understanding the LUA scripts and since I'm in the XNA world, scripting isn't really necessary so I don't want to take a ton of time learning it.) Anyways, right now I have an "IBehavior" abstraction (essentially the State) with different implementations (Patrol, Attack, etc.).
A Brain is responsible for determining the best IBehavior to apply, and the AIStateMachine is responsible for 2 things...
1) Telling the Brain to figure out which IBehavior it should currently apply
2) Telling the current IBehavior to update
...then each actor that needs AI gets an AIComponent who on each tick tells it's state machine to...
1) ChooseBestBehavior()
2) Update()
...this is then all wrapped up in an AIProcess that on each tick loops through each Actor in the system and for those who have an AIComponent, tells the component to update.
So from front to back for any given Tick it looks like...
(-> can be though of "resulting in")
AIProcess.Update ->
Actor.AIComponent.Update -> (2 things)
1) AIStateMachine.ChooseBestBehavior -> Brain.Think,
2) AIStateMachine.Update ->
IBehavior.Update ->
Actor doing some intelligent stuff
Does this look like a good start? Anyone have any ideas as to how I could improve this?
Thanks!
A Brain is responsible for determining the best IBehavior to apply, and the AIStateMachine is responsible for 2 things...
1) Telling the Brain to figure out which IBehavior it should currently apply
2) Telling the current IBehavior to update
...then each actor that needs AI gets an AIComponent who on each tick tells it's state machine to...
1) ChooseBestBehavior()
2) Update()
...this is then all wrapped up in an AIProcess that on each tick loops through each Actor in the system and for those who have an AIComponent, tells the component to update.
So from front to back for any given Tick it looks like...
(-> can be though of "resulting in")
AIProcess.Update ->
Actor.AIComponent.Update -> (2 things)
1) AIStateMachine.ChooseBestBehavior -> Brain.Think,
2) AIStateMachine.Update ->
IBehavior.Update ->
Actor doing some intelligent stuff
Does this look like a good start? Anyone have any ideas as to how I could improve this?
Thanks!
-bullgoose