Which AI Behavior Framework Should You Use? | AI Series 46

preview_player
Показать описание

Learn about popular approaches to implement AI behaviors in your game and see which one is right for your use case! Using a Ferrari isn't the right answer for every problem. You'll learn about Unstructured AI, State Machines, Behavior Trees, and GOAP (Goal-Oriented Action Planning), the pros and cons of each one, and in which use cases they're most suitable for.

What's next?

💸 Ongoing sales 💸

👨‍💻 Since we're not writing any code in this one, no GitHub project.

📚 Resources:

❤ Believe in LlamAcademy's mission and have received value from the videos? Become a Supporter:

----
Some links may be affiliate links, which at no additional cost to you, gives me a small portion of the purchase.

#unitytutorial #tutorialtuesday #gamedev #tutorial #unity #llamacademy #gamedevelopment

Chapters:
00:00 Introduction
00:24 Unstructured AI
04:34 Sponsor - Southern New Hampshire University
06:06 State Machine
08:53 Behavior Tree
11:50 GOAP - Goal Oriented Action Planning
16:30 Support LlamAcademy
Рекомендации по теме
Комментарии
Автор

Thanks for mentioning my project! Means a lot ❤

CrashKonijn
Автор

Thanks for the nice video! As some other comments have mentioned, combining hierarchical state machines with behavior trees can be very powerful. I've done this with behavior trees as the base framework of the AI, and the state machines existing as "Selector" nodes in the tree. When the state machine node is ran, it runs the statemachine logic and selects the branch that corresponds to that state. If a single state's tree becomes too complex, it can be broken down into smaller substates each having their own behavior tree and a new statemachine node at the root of them.

I suppose it all comes down to preference but I prefer to handle scripted decision making with heirarchical state machines as you can have short lists of all the conditions that cause state transitions in one spot for each state or substate. Whereas behavior trees can become quite unruly if you have a single large tree jumping around to different points in that tree. (You have to remember which parts of the tree jumps to which other parts and how those nodes decide to jump. Essentially, the transitions feel scattered across the entire tree which has driven me crazy in the past)

So, I try to keep behavior trees smaller and more readable by keeping them as directed acyclic graphs. Basically, just a convenient way to form sequences of actions with a given flow, while HFSM handles the transitions.


If the desired behavior needs to more complex or emergent behaviors are desired, I agree that other frameworks like Utility AI or some kind of planner like GOAP or HTN can be nice. Really just comes down to what kind of behaviors you want from the AI and weighing the pros and cons, but I often like using the most simple frameworks first, and only delving into the more advanced frameworks for the specific AI states that need to be more complex.

drewvananne
Автор

AI Tree is pretty good, much close to unreals behavior trees. Behavior designer starts getting very cumbersome to work with after having a couple of deep branches. Also EQS is a really important point in that one, because without EQS, you need a lot of leg work on AI positioning.

themerpheus
Автор

I can always count on your channel for learning something new or even just clarifying some general concepts, even after years of gamedev.

brickchpel
Автор

I prefer the goap like structure. I have pseudo coded a structure similar to a goap-like structure for my simulation games and I think those kinds of structures make the most sense for complex behaviors. I just didn't realize the structure had a name. lol. Now it will be easier to find how others have implemented it. Thanks for the exposure to all this info!

brazenzebra
Автор

i find the goap cons funny, because when i started imaging ai for my game, its the first design i thought of, without ever hearing about it.

Trinimp
Автор

I use state machines all the time. The exponential number of transitions is only a theoretical possibility. The number of transitions actually needed is usually much much lower. Also, some transitions are so fast that they can be triggered from any state without issues.

DileepNow
Автор

I am using a combination of hierarchical state machines and behavior trees for my XCOM-style prototype. Basically I run a different tree in every state. I coded both (borrowing A LOT from existing literature), so no fancy UI, all in code, but still quite modular and I am very happy with the result. I recommend looking into this sinergy. Hierarchical SMs can really address a lot of the scalability problems of FSMs.

CharlieFleed
Автор

This is a great video with a really good overview of the different AI behavior models. It has enough detail to be very informative on each topic but not so much to be overwhelming with info, love it.

lukeloobey
Автор

I you look closely you will see that BT is state machine. Difference is transition rules fused with tasks and transitions go to next branch. That simplification of transitions sacrifice flexibility for better readability.

gendalfgray
Автор

Very good explanation. Can you make a tutorial on G.O.A.P?

obscure
Автор

Thank You for making this video 💯👍🏻.
So far I've been using my own solution based on FSM with some additions to address some special use cases, but I want to expand those functionalities, so I really have to choose a more developed, existing solution.

So I will rewatch your video in the future as I will have to choose an A.I. Framework for a Game with enemies and bosses functioning under a "more interesting" A.I. Behaviour.

It's very good to be able to count on you as a teacher for these "cool things" related to Unity, Game Dev, A.I., etc 😄

alec_almartson
Автор

The vast majority of AI enemies can simply use a state machine if all they need to do is pathfind and attack. Behavior Trees & GOAP are more for cases where your AI unit needs to interact with other systems.

panampace
Автор

GOAP actually sounds like the most "natural" of the solutions, closer to how we make choices as opposed to having some kinda tree in the mind.

zzzTyle
Автор

I would like to see some tutorials on trees or goap, in terms of some action or strategy game

GradoFun
Автор


In case you skipped the description, here you can find some free and paid solutions for State Machines, Behavior Trees, and GOAP!:

Some of these links may be affiliate links, which at no additional cost to you, gives me a small portion of the purchase.

LlamAcademy
Автор

GOAP can implemented in a behavior tree. Just add the concept of a Triage Sequence.
You can make a weighted sequence of goals, and update their importance over time.
the most important goal is run, and the dependency chain of actions are just behavior tree sequences.

RPG_Guy-fxns
Автор

if you want a video subject I think it could be interesting to do a series on the development of a hearthstone-style combat card system

Infamous
Автор

Wish I could give more, keep up the great work!

travis
Автор

Great video. Any thoughts on Utility AI or a GOAP/Utility hybrid?

jeffreyhersh