Behavior Trees, AI, UE4


#1

Continuing the discussion from 4.20 Update:

You could use :sk: to write some of the BT implementations, but you’d need to use :ue4: for all of the BT management, decorators etc.

Personally, I’ve had something of a foreboding feeling ever since BT’s were introduced in :ue4:. My personal opinion is that Behavior Trees in :ue4: have always felt bloated, both in terms of the number of assets you end up generating and in terms of the amount of effort you put in to get a result. Surprisingly, Tom Looman recently posted an article on BT’s that echo’d all of my personal feelings on them while at the same time introducing something new (to me) called Utility AI.

I am currently investigating Utility AI and how it might be implemented. Some further links for education:
http://intrinsicalgorithm.com/IAonAI/2013/02/both-my-gdc-lectures-on-utility-theory-free-on-gdc-vault/


http://intrinsicalgorithm.com/IAonAI/2015/10/building-a-better-centaur-ai-at-massive-scale-gdc-ai-summit-lecture/


#2

Thanks for your reply and the links, error454. I was about to create the topic when I saw the notification popping in the top bar.

My personal opinion is that Behavior Trees in :ue4: have always felt bloated, both in terms of the number of assets you end up generating and in terms of the amount of effort you put in to get a result.

I didn’t try yet to implement one in UE4, but after reading the docs on it more than once, I agree with you. It seems a bit weird. Also some names of the building blocks/main objects are not very friendly, not very easy to grab the concept. “Decorator” being the worst one. Why not call it “Conditionals” as the docs say they’re called in other implementations?
Blackboard is not too bad, but not very friendly for beginners also. Maybe “memory” or “data storage” would be better. “Task” and “Selector” are fine, though.

I’ll read the docs in the links. Thank you.


#3

I’m watching and reading the links.

I was thinking here about the Butterflies are Skookum demo - which I guess is Skookum demo I learned more from - and the way you implemented the butterfly’s behavior. Is very cool and easy to understand, those corroutines running along together for flapping, marking a spot to land etc.


#4

It will/would be very interesting to check this.
I have read and watched most of the links. Tom Looman’s implementation of Utility AI using blueprints seems very interesting. The player scoring objects to look at… This kind of thing adds a lot of life to a game.


#5

There was an old discussion about just using SkookumScript over behavior trees that you also might want to check out:


#6

There was an old discussion about just using SkookumScript over behavior trees that you also might want to check out:

While reading here I recalled I’ve read this thread when I first began browsing the forum.
I’m reading the docs on UE4’s behavior trees, Env. Query system etc and preparing to use them, but this thing keeps floating in my mind about a simpler way to script some NPC AI, as the guys mentioned in the thread, and in a way that make it easy to go adding actions, behaviors at will while prototyping, following only the fun factor, and without conflicts appearing between these actions.
The idea of coroutines that keep running and “race” for which is the most important and will take the priority / beat the others (ex: _breathe being scored higher than _escape_death which is being scored higher than _find_safe_spot > _look_for_enemy…).
Ok, _breathe may be overkill, but in a level where the player is mostly swimming, diving etc it makes sense.

Our actions in real life seems to be always motivated by needs - some urgent / instincts, some less urgent, then some other “tertiary” / “it would be nice if…”.
Edit: So it’s already like we have these coroutines running, ticking against the clock. Water being slowly wasted in your body and asking for replacement etc etc.
The ability to choose the ticking interval for each coroutine I think is great for this kind of thing. Don’t waste cycles unnecessarily.
So maybe an AI architecture structured around needs (and goals, which are needs we create) would be interesting. Unfortunately I’m not skilled enough at coding to make a robust prototype… Just thinking here.

From the links error454 posted above, one was an intro to AI architectures most used today. The Planner paradigm looked very interesting. Also Utility AI.

Edit: typos.


#7

I don’t think it has to be complicated. A needs system that calculates all needs every second as a value between 0-1 and then a coroutine that ticks every 5 seconds, chooses the most urgent need and performs the action related to that. That’s pretty simple to understand, the complexity here is more tedious as you tune values for your different needs.


#8

I don’t think it has to be complicated. A needs system that calculates all needs every second as a value between 0-1 and then a coroutine that ticks every 5 seconds, chooses the most urgent need and performs the action related to that. That’s pretty simple to understand, the complexity here is more tedious as you tune values for your different needs.

That’s encouraging to hear. I plan to have some NPC foes in my demo. Average thugs, a sub-boss and a boss. And horses with AI also. Hopefully I’ll put some very basic needs system in them to see, have some fun. At least I’ll try, in a very basic implementation initially - if my schedule allow it. Start simple.