This is a really technical question about how to setup the game AI architecture...
Right now I have a GameAIProcess which actually just generates a DoGameAI event, which is then sent to the GameObjectManager via the EventManager...
Then once the GameObjectManager recieves a DoGameAI event, it loops through all the GameObjects and actually does something.
Now I imagine an NPC could just have two AI states and it would probably be ok from a gameplay standpoint: an attacking algorithm, and an idle routine.
I'll worry about the attacking algorithm later, right now I'm wondering, how to get an NPC to go through a sequence or routine of events, like walk 5 tiles east, look north, look south, walk 5 tiles west, look north, look south, then repeat.
It seems like this could itself be a process... since the book GameCodeComplete already discusses how to link processes together with wait processes between them and each one would be sending out a game event.
Soooo... would it be better to have a separate process for each NPC or to continue the way I'm going now with one DoAIProcess ?
But if each NPC had its own AI process I imagine it would look something like..
1. pick an AI state/routine based on an evaluation of the current situation
2. if that routine is already in execution then execute the next step in it, if not, execute the first step of the appropriate routine
Right now none of my processes directly affect any of my game systems, they just generate messages, however an AI process for a particular NPC would probably need to contain a reference to that NPC so it could actually do things right then and there.
This is already seeming like a lot of work and I am leaning towards just have one AIProcess... But of course, if I do that I will need to create somekindof AIRoutine class for defining the steps in the routine, and index to the current point, etc etc
Who knows... is one way any better than the other?
Right now I have a GameAIProcess which actually just generates a DoGameAI event, which is then sent to the GameObjectManager via the EventManager...
Then once the GameObjectManager recieves a DoGameAI event, it loops through all the GameObjects and actually does something.
Now I imagine an NPC could just have two AI states and it would probably be ok from a gameplay standpoint: an attacking algorithm, and an idle routine.
I'll worry about the attacking algorithm later, right now I'm wondering, how to get an NPC to go through a sequence or routine of events, like walk 5 tiles east, look north, look south, walk 5 tiles west, look north, look south, then repeat.
It seems like this could itself be a process... since the book GameCodeComplete already discusses how to link processes together with wait processes between them and each one would be sending out a game event.
Soooo... would it be better to have a separate process for each NPC or to continue the way I'm going now with one DoAIProcess ?
But if each NPC had its own AI process I imagine it would look something like..
1. pick an AI state/routine based on an evaluation of the current situation
2. if that routine is already in execution then execute the next step in it, if not, execute the first step of the appropriate routine
Right now none of my processes directly affect any of my game systems, they just generate messages, however an AI process for a particular NPC would probably need to contain a reference to that NPC so it could actually do things right then and there.
This is already seeming like a lot of work and I am leaning towards just have one AIProcess... But of course, if I do that I will need to create somekindof AIRoutine class for defining the steps in the routine, and index to the current point, etc etc
Who knows... is one way any better than the other?
The post was edited 1 time, last by JamesFord ().