Skip to content

Entity AI #86

Open
Open

Description

@IntegratedQuantum

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.

Activity

  1. added
    enhancement
    contributor friendly
    experimental
    on Sep 17, 2023
  2. GeraForever commented on May 26, 2024

    @GeraForever
    Contributor

    You could use something like boids for herding animals

  3. removed
    contributor friendly
    on Jul 4, 2025
  4. Touff-97 commented on Aug 9, 2025

    @Touff-97

    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!

  5. IntegratedQuantum commented on Aug 9, 2025

    @IntegratedQuantum
    MemberAuthor

    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.

  6. Touff-97 commented on Aug 9, 2025

    @Touff-97

    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

  7. IntegratedQuantum commented on Aug 9, 2025

    @IntegratedQuantum
    MemberAuthor

    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.

  8. Touff-97 commented on Aug 9, 2025

    @Touff-97

    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.

  9. calebstenberg commented on Jun 27, 2026

    @calebstenberg
    Contributor

    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.

  10. added
    needs design decision
    on Sep 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    engineenhancementexperimentalneeds design decision

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions