You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
engineenhancementa new feature or improvementexperimentala feature or idea that will require lots of experimentationneeds design decisionDon't implement this before a decision on the design of the implementation has been made
Not sure how that would work out precisely.
But in general the should allow going towards some targets and there should be specific functions for attack patterns.
Additionally the AI should be generic such that one could switch the AI to a different body.
Hey @IntegratedQuantum! I'm watching your devlogs right now, and came to check up on the project. Incidentally I'm doing an AI system for a little game I'm prototyping, and this sounds like a GOAP system. Goal Oriented Action Planning. I'm sure you heard of it, but as you mentioned goals, stats and inventory in another issue, this system fits like a glove. It's a bit of an upfront cost, but once you have the planner in place, the idea is to not touch it anymore and work with goals and actions to overcome any problems.
I don't use Zig and probably wouldn't be a huge help contributing, but check it out! It's a powerful system. Also, I see you are using ECS, and GOAP is very modular as it is, so I don't think it would be a huge problem to add. I just finished the system myself and am trying to implement more complex actions or set of actions for my game. Something I would recommend before starting is to set up a good debug system because it has a tendency to perform very complex chains of actions. Also, a way to limit the speed of executing actions or timers to stall the AI a bit, so that you don't have cows speeding around trying to every grass blade around.
GOAP does seem like a reasonable system to use, thanks for the hint.
Right now though the engine is still a while away from the point where we can implement AI.
Fair enough! This is the system used in FEAR and Middle-earth: Shadow of Mordor to make the AI very complex and deep, but it's a bit intensive when trying to compute plans for 50-100+ entities, because it goes through every possible plan and computes the best one each time. So you have to think about performance as well. Although you could apply an LOD system for the AI as well, to ease things a bit
50-100 doesn't seem like a lot. I'm sure there are ways to optimize this to 10k+ entities, you just need to traverse the state graph more efficiently. Evaluating every possible plan seems rather wasteful.
Well you do check for validity first in goals and actions, and then you check for the effects to see if they accomplish the task. So it's not a huge waste. There's a GDC talk where the last speaker compares the systems implemented in various games and compares the speed and amount of entities that can simultaneously call the planner (Goal-Oriented Action Planning: Ten Years of AI Programming). You could probably get many more entities but I haven't done anything to the level you'd need for this game so that's why I mention it first.
I looked at the video @Touff-97 posted and in the comments one guy mentions Layered GOAP where you have high level plans that each make a mid level plan, that each make a low level plan. This would make the decision trees much smaller and faster to traverse. It also works as a form of intelligence, maybe a full NPC has all three layers, and a Zombie/Sheep has just the lower two layers.
engineenhancementa new feature or improvementexperimentala feature or idea that will require lots of experimentationneeds design decisionDon't implement this before a decision on the design of the implementation has been made
Activity
GeraForever commentedon May 26, 2024
You could use something like boids for herding animals
Touff-97 commentedon Aug 9, 2025
Hey @IntegratedQuantum! I'm watching your devlogs right now, and came to check up on the project. Incidentally I'm doing an AI system for a little game I'm prototyping, and this sounds like a GOAP system. Goal Oriented Action Planning. I'm sure you heard of it, but as you mentioned goals, stats and inventory in another issue, this system fits like a glove. It's a bit of an upfront cost, but once you have the planner in place, the idea is to not touch it anymore and work with goals and actions to overcome any problems.
I don't use Zig and probably wouldn't be a huge help contributing, but check it out! It's a powerful system. Also, I see you are using ECS, and GOAP is very modular as it is, so I don't think it would be a huge problem to add. I just finished the system myself and am trying to implement more complex actions or set of actions for my game. Something I would recommend before starting is to set up a good debug system because it has a tendency to perform very complex chains of actions. Also, a way to limit the speed of executing actions or timers to stall the AI a bit, so that you don't have cows speeding around trying to every grass blade around.
Hope it helps!
IntegratedQuantum commentedon Aug 9, 2025
GOAP does seem like a reasonable system to use, thanks for the hint.
Right now though the engine is still a while away from the point where we can implement AI.
Touff-97 commentedon Aug 9, 2025
Fair enough! This is the system used in FEAR and Middle-earth: Shadow of Mordor to make the AI very complex and deep, but it's a bit intensive when trying to compute plans for 50-100+ entities, because it goes through every possible plan and computes the best one each time. So you have to think about performance as well. Although you could apply an LOD system for the AI as well, to ease things a bit
IntegratedQuantum commentedon Aug 9, 2025
50-100 doesn't seem like a lot. I'm sure there are ways to optimize this to 10k+ entities, you just need to traverse the state graph more efficiently. Evaluating every possible plan seems rather wasteful.
Touff-97 commentedon Aug 9, 2025
Well you do check for validity first in goals and actions, and then you check for the effects to see if they accomplish the task. So it's not a huge waste. There's a GDC talk where the last speaker compares the systems implemented in various games and compares the speed and amount of entities that can simultaneously call the planner (Goal-Oriented Action Planning: Ten Years of AI Programming). You could probably get many more entities but I haven't done anything to the level you'd need for this game so that's why I mention it first.
calebstenberg commentedon Jun 27, 2026
I looked at the video @Touff-97 posted and in the comments one guy mentions Layered GOAP where you have high level plans that each make a mid level plan, that each make a low level plan. This would make the decision trees much smaller and faster to traverse. It also works as a form of intelligence, maybe a full NPC has all three layers, and a Zombie/Sheep has just the lower two layers.