#gameplay-ai
1 messages · Page 13 of 1
Would be nice to change the default
I will probably also spent some time adding some default tasks to it from C++
Like a "Debug Transform" tasks
Now with that said, where does one place "global state" though
I guess the Context Actor houses that now ?
The Blackboard felt like burden and was a bit confusing indeed
I believe they wanted to follow a general AI development practice but it didn't fit well in UE
Looks like the output variable category is Out, for Output it doesn't seem to appear in the StateTree under that task
Either way I'm happy I now know how to pass data 😄
Schema parameters
or additional UObject you add as schema parameters
But that's C++ then right, new Context variable or what?
no C++ needed, its only if you need to add something to schema by default or being able to promote its type
Schema's UPROPERTY's become schema parameters
Yeah okay, so the Parent of it?
yep
So a custom Parent would allow that?
not the statetreecomponentschema though - its not exported - use the base class
How do I access the variables in a Task then?
I think I mixed up this. You can do that fpr sub states and multiple tasks within single state (a bit confusing because the order of execution and finishing is not clear)
just by data binding system
Yeah figured
Ahhh, and that allows both read and write?
Makes sense, thanks!
I'm not sure about that yet, probably doesnt
thats why you might need an additional UObject
Fair enough
so you copy the uobject ptr instead of the value
Does anyone know what the StateTreeSendEvent node is for?
Also, how does one handle latent stuff in tasks? :<
Context param in node functions gives you access to events but looks like events are scoped
Context.ForEachEvent()
extra way of passing data by event/signal system probably - though it doesnt let you pass a payload like gameplay events
Oki
in BP you might be able to convert your function to event
by right clicking
EnterState has a return value though
ah right sorry
I already complained :D #gameplay-ai message
I remember 
tick 
ah sry wanted to reply to @pallid mica
Ah
Running as return for Enter will Exit and Reenter?
Ah you use tick too
I see the setup now
Yeah guess that will have to do
Is it needed to call Finished/Failed in Enter?
I assume Enter only calls once
Did this now
Looks good just tou don’t call the Custom event anywhere
Ah
Right
Also, if I want to constantly rotate the AI towards a Target, is that fine in a Task that just doesn't End in one of the Parent States or should I continue doing that in the Character itself?
BT Tick was shit for this
I ended to have many tasks just running forever
Constantly rotating to something would be one of them
Usually every task I use on states which have sub states runs forever because I use it for stuff like “keep doing this while the sub states are executing”. And you can not finish that one as you would interrupt your substates.
That Payload seems to be C++ only from the looks of it
USTRUCT(BlueprintType)
struct STATETREEMODULE_API FStateTreeEvent
{
GENERATED_BODY()
FStateTreeEvent() = default;
FStateTreeEvent(const FGameplayTag& InTag)
: Tag(InTag)
{
}
/** Tag describing the event */
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Default", meta=(Categories="StateTreeEvent"))
FGameplayTag Tag;
/** Optional payload for the event. */
UPROPERTY(EditAnywhere, Category = "Default")
FInstancedStruct Payload;
/** Optional info to describe who sent the event. */
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Default")
FName Origin;
};
ohh great, it lets you pass FInstancedStruct
though since its actually exposed to BP now, i dont know why its limited to C++
I guess something like this
Yeah nvm, that's James struct or?
That he PR'd?
Jambax on Discord
He did the BP API for 5.1 and replication in 5.2
With events you can make your state transitions event based instead of ticking
Every state which has substates has permanently Running tasks only. Imo this is a bit confusing on ST as the fact whether the task runs as Success/Fail or forever Running is implementation detail of individual task but you need to understand it for every task in order to understand the tree. Can be probably improved by naming forever running tasks as Keep <something> or so.
Do you have an older version?
Just asking, cause your Next Arrow is not pointing downwards
5.1
Probably because of ( ? ) in front of it
Only vis logger for now 😢
Oki
How are your "See vs no See" handled? I think we previously pushed Perception Info into the Blackboard.
I guess one option is to not use AIPerception
I wonder if there is anything debugging wise on 5.2already
Does someone have an example for an Evaluator? Sounds like I should place my Perception Code into that
Created one and added it to the Tree. Now I wonder what I'm supposed to modify from here. Bindings again?
I run EQS in an interval as evaluator. The EQS iterates results from perception component and filters only relevant things. When the result changes, it fires State Tree Event and See/No See is switching based on this event.
Something something custom StateTree Asset with VariableA and then binding VariableA in the Evaluator and in whatever Task I need?
But it is only hobby project/prototype, not a serious project, so take it with caution
It#s a prototype here anyway
@celest python I don't think I can create BP Version of Schemas, or?
There is a screenshot I posted some time ago which shows also evaluators and my early experiments. #gameplay-ai message
as in, a new parent for a State Tree?
Doesn't seem to show up in the Blueprint Class Dialog
nope
you must inherit from c++
Is the idea correct to move data between Eval and Task via custom Schema and Bindings?
Ah, so just put them into an Output Category ?
yes
Man, too much auto generated crap for beginners I swear
Would be nice if at least the Categories would be autopopulated
yeah, I also found out about categories randomly
This from @short aurora was helpful to find out https://github.com/redxdev/MAPlugins
Think of Schemes as of use cases / contexts in which you use your ST. You can now use ST for AI logic, elevator, weapon states, RTS order and so on. Iirc you can limit tasks, evaluators and everything only to certain scheme, so RTS order tasks will show only if you work in RTS order state tree. Same for other. You can also define custom context vars. In the case of AI logic it could be your character/AIControoler, in the case of RTS order it could be your selected ARTSUnit, in the case of elevator it could be maybe your AElevatorButton and AElevator.
This is a really cool improvement over BT. If you used BT in different contexts, designers always saw all nodes in the right click menu.. even ones which don't make sense for the given usage.
From what I saw, Mikko follows the concept also for the new World Conditions plugin which has some scheme stuff too.
New World Conditions plugin was added to ue5-main today. It looks like a system to check the state of world from other systems in a modular way. Could be potentially used by AI or systems like objectives. https://t.co/wGMaBt2Y0u
Thanks for sharing
I assume this won't work, or?
Or does it reevaluate the Condition if the Boolean changes?
World conditions are just fancy blackboards? 
I am afraid not. That is exactly why I mentioned in my feedback the exponential growth and Abort functionality of BT. You need to add transition from See Enemy to No see Enemy and from No See Enemy to See Enemy. I would be interested to know if there is a better way because otherwise it is just the common SM growing complexity problem again.
I did not investigate but I guess it is more function based than variable/value.
I see, at first glance reminded me of CryEngine's "game tokens" thing - but seems entirely different
Imo it sounds like something usable by objectives system
This could be related research
But they have my full trust :D the stuff they are doing for UE5 is wonderful
Isn't the Transition wrong here?
Shouldn't Move To Cover go to Next?
Yeah I'm a bit lost. Not sure how I get the tree to re-evaluate when a condition changes.
yeah, sry. Forgot to remove WIP stuff before the screenshot.
I am not sure if there is a better solution than check for that variable in all same level states as exit transitions.
Hm
That sounds strange yeah
The Decorators are missing I guess
Something that looks at a variable and notifies the tree or part of it that itneeds to change
Abort Self basically
Yeah, this is what I do now
my original plan was that every sensed actor change fires ST event StateTree.Event.Sense.SenseCategory
and that all main states like Hear Noise, See Corpse, Receive Damage will do (?) -> Root when the event StateTree.Event.Sense happens.
But in 5.1 there is an issue that ST Event tags are not using tag hierarchy, so you need to check for exact tags in event transitions
This is already fixed in 5.2
I added a Transition OnTick to the other option for now
Both way
That's at least how the Docs do it
.>
yeah, I guess it is fine too
but as you said, Abort stuff would be really handy but I am afraid ST intends to be general purpose state machine and abort probably has no place in the basic state machine concept. Unless Epic decided to alter it and diverge more from state machines. But It can totally be that I am just missing something. I guess we need to wait for more official examples.
Yeah it#s a bit strange. Like it doesn't help to bind to Evaluators if the values changing doesn't cause the tree to retrigger
Now it's basically trying 24/7 to transition to the other State which fails cause of the condition
It does cancel though I guess
Like, if the "Random Wait" is still active, it finishes it
If you look for posts from Mikko (author of ST), you can find more details:
Which means I need to be careful to handle tasks that are meant to end later and remove all still running logic
Yeah I'm being very careful right now not to overcommit
The missing debug visuals are quite the killer
It looks really nice ,but seems to be one or two iteration to early
For AI at least
at this point I plan to do core AI in BT and individual encapsulated AI behaviors as ST. That way I can reuse behavior ST for multiple enemies, assign them in details panel and pass different params for every enemy instance. But the main branch decisioning will be in BT, so I don't need to handle the aborting/root transitions in ST that much.
Yeah I might fall back to using the STs for non AI for now
E.g. Music State Management
Although our own StateMachine is in that regard more powerful
As there is some transition time to crossfade etc.
sad beep
maybe that's GateDelay
Who kows
yeah, we will see. It was mentioned before be Mieszko that the production ready state of ST means it is stable and not that it is feature complete. Might need a few more changes to make it easier to go full ST everything easily.
Makes sense
I wonder if it might be a future idea to allow defining Abort options in Bindings.
E.g. here
Some additional setting for "Abort Self on Change", which would be closer to Decorators
Just thinking out loud
Although pretty sure the Input Params are just handed in and there is no intend to keep track of where that came from and if it changes.
Which is fair, would allow to remove BT more though
Thinking loud I would expect no change there and the current structure to be more or less final as it is a complete state machine. Maybe the evaluation of transitions will be event based in future but having Abort would be a drastic change to how people use it. (For me it would change it to better but more experienced people can have different opinion).
I don't see that much of a problem to Abort a State and have that as an additional Trigger
No one needs to use it then
I personally don't but maybe Epic wants ST to be close to clean state machine implementation than a completely new paradigm. It was mentioned that BT v2 could happen but it is years away. As I mentioned before, ST could be a backend for it as BT is more or less a state machine just with some implicit transitions. #gameplay-ai message
Yeah I mean, if they just improve the looks and stuff of BTs, then I would also be happy
I just hate BTs
Yeah, me too. But going deeper I think I hate blackboard and not BT.
Hm, I think UX wise it could be a lot better
BTs that is
And that I don't have a proper Parallel and Tick in it
Is annoying me
yup. The concept is not bad but UX is dated.
Might be worth pinning this one until the documentation mentions so 🙂
I don't know if it's correct haha
Heyy, kinda landed on some struggles with my behaviour tree for a bossfight. I want to add the condition Dead-Boolean. But cant seem to wrap around how. What I've done is made a blackboard value by pool, and entered the isdead condition from my bosscharacterbp. However, it doesn't really update, or getting applied. Any good guides on how to add the event of death to a behaviourtree? Aswell as unpossessing/deleting it.
Best regards
Awww - ya'll were talkin' ST while I was sleeping 😭.
I plan on releasing a blog/written tutorial soon about these things with ST. For an abort condition, I would do a Exit Condition on Tick pretty much. You can think of Evaluators as services from BT @pallid mica. Currently, that is how I'm passing in Perception data. Through the ST event. My Root node has a transition for these kinds of things. (This is also part of what drove me to look into how to alter ST params at runtime, because I didn't want an evaluator specifically for that)
No. Navigation does nothing to collision. Setting the step height lower will limit terrain they can walk over. Increasing the step height will mean they can walk over taller rocks. You might also have a level design problem where even the player will have trouble moving through that.
For the move stuff, I am setting up the movement in the enter state function. Then in tick, I am checking if we have gotten there.
What is it that you are trying to do? Not the implementation, but what problem are you trying to solve? It's not a good idea to do death functionality in the BT.
Basically just play an animation upon death, and let the be looped afterwards in death. New to the BT, switched from BP based only. Just need to wrap my head around it
Hey guys, Perhaps anyone here can help me figure this out
I have a map where the ai can take a shortcut around a cave behind a waterfall, Now i wanted to make it so the AI gets telported to the other side of the waterfall and i have an overlapping trigger connecting both "cave" exits. Now the Nav mesh between those two is obviously disconnected and i though i would be able to connect them using a nav proxy link but the ai doesn't seem to take the path even though it's clearly cheaper than it's alternative
Is there any way for me to tell the AI hey if you take this path is shorter than the alternative because you will teleport? due to other tasks i can't tell the ai to use the shortcut by command, it has to be it's own decision.
Maybe through a task or a conditioncheck, with the distance from actor to the cave?
For death, it's better to just turn off the AI, play an animation via the character and set the lifespan of the character. AI is more for making decisions, but death is just a thing that happens once the health condition is met.
Meh. I like the editor tools, but like the smart objects they went clever instead of useable. I already have a condition system, so I might just repurpose the editor tools.
Nav areas are what you are looking for.
Is there an efficient way for AI to look for actors of class within a range around it? (More efficient than using Get All Actors of Class)
Perception system is a good start
Hmm, I'll try that, thanks
Also, is there some way to have a BT task that will run indefinitely until a specific event is called on the AI pawn?
A task the AI can't know the duration of until it's complete, basically
how can I make my ai give up after cant see a certain amount of time?
I'd put a timer that gets removed if the action is succesful, and triggers the give up behaviour if the timer finishes
Cant get this Death event to work at all. Tried it through macro, function, bt, animation, montage etc etc xD
Depends on what you mean by efficient and if it's actually a perf problem. The perception system isn't actually going to be cheaper for most cases.
I mean... I have situations such as when my AI is mining, it reaches a point where the mining completes and a piece of ore drops to the ground, I want them to be able to find that to pick it up. It just feels wrong to query all actors of type 'ore' in order to find the closest one
Uhhh - not cheaper than doing Get All Actors of Class? That's an interesting assertion
Yes. You don't return until your event has finished. I do recommend making sure it can abort.
So, what's the right way to handle that, am I just running a loop in that task to check for completion?
Distance checks are cheap. If it becomes an actual perf problem you can store things in a data structure that is better for spatial reasoning.
Hello, find path to actor synchronously is giving me a path that goes too close to walls. How do I increase the distance away from walls?
What is interesting about it? The perception system doesn't store source actors by class.
So you'd recommend just querying all actors of class every half second until I find one that's within the range I'm looking for?
You can get the class of the actor that triggers it.
Get All Actors of class iterates through all actors in the world
in that case you can also get the min distance one btw
Having a box collider around and tracking what enters and exits would probably still be better, depending on how many agents you plan to have.
How many actors can it be max?
There is no max
Yeah anything spatial
It could be a lot
You should have a max
Probably not thousands, but it's possible
Get all actors of class only iterates on all actors in the world if the editor is running. In a packaged project it uses the object tmap by class.
Else how do you know what you can sanely support
I'm not too worried about defining maximums at this point, until I encounter issues
A sweep collision every frame on moving objects isn't less expensive.
This is very early prototyping, I'm mainly just trying to determine the right approach to doing this
There's a lot of ways it can be done, but I'd like to at least start with a way that isn't terrible
Get All actors of class every half second is hardly the solution I'd go for. But w/e. I'm checking out.
I recommend doing the simplist solution unless it becomes a problem.
the right approach depends on your target. The way to get actors in radius can range from sphere casting to multithreaded spatial tree queries
Sphere cast might be a good approach for this
depends on how big the sphere is. Also, the ratio between gold pieces and miners
also if you need something really performant, TOctree2 is the fastest spatial data structure that I have found for now
for multiple queries
and TQuadtree for 2D, but queries are slower
Yeah I think sphere trace is going to work the best, there could be dozens of miners around the world doing their thing, but they never need to know about ore that's more than a couple of meters away from them
Not really something you want to do every half a second
No, it isn't
probably, and definitely not in the same time. Spread around frames could be relatively acceptable
Hence my search for a "better" way
Even spread around frames it's useless with the idea of having many agents.
I don't know a middle ground between the slow ways (actor looping) and the fast ways (dedicated data structures)
yeah that's why I was asking. With 100 agents the cost of the spheres is going tank FPS like crazy
It'd have to be in a subsystem.
With 100 agents, most of the standard solutions will tank FPS
Yeah it also doesn't need to be a half second, really, I'm still trying to determine how to make this task figure out when it's finished, heh
indeed
Perception, box collision, get all actors, etc...
It could, ideally, just fire when the task finishes to look for the piece of ore that should have fallen
Also BTW, if the gold is dropped by the direct action of a miner maybe that miner can pick the gold and you avoid all this hassle
👆
Well, it's dropped by the harvestable node when a certain progress point has been reached, the miner is simply applying progress to that node every few seconds
Like - I know having a bunch of moving trigger boxes is shit for performance at scale
But it is a solution depending on the context
Are you trying to make it where when an ore drop it shows the distance on the hud or something?
how likely it is that the miner that applied progress to the node is also the closest to the ore?
Very likely
I would not bother with distance checks or queries
just have that miner pick it, 0 performance cost
and probs same results 90% of the time
I mean, unless there is something important about having a different miner pick it, players won't notice/won't care
Actually I guess I could just make the node send the ref to the ore it spawned in the completion event
faster to code, faster to run
yeah ofc
Hey, I'm slow, give me time, lol
So this leaves me with the question of the task itself, can I use delays or timers in a task?
Yeah
Okay that should work then
There is a built in delay task already.
Depending on how you are structuring your BT, that may be a better thing to use
Just not enough information to accurately say
(Which is also why you were given so many different solutions to your question)
Since you guys are ballers on the AI, is anyone help me to kill off my AI? xd - nothing but bugs
couldve been that easy, huh
But nah, behaviourtree will go nuts in error log
i figured it out however
But now I just need to make my death animation stop loopin
and fixed that. lol
That entirely depends. Have you actually profiled it? I've never seen it be a problem in a shipping game.
how do i stop enemies from blocking other enemies' vision?
Is running an EQS alongside a simple parallel bad?
I'm trying to split movement of my character from it's aiming / firing.
Why not have a task at the top of the tree calling a custom BT Task like ShootAtEnemy that hooks into AI Controller to see if it has target, can see them, and has ammo (along with other rules you want) then fire weapon. Can have it loop the task every 5 seconds with a ±1 second deviation.
That way you can have the AI try to aim / fire at the player whenever possible across multiple child branches such as if they're running towards enemy, going to find more ammo, or wandering.
No. Mainly because I haven't ever reached for it as a solution. Lessons from all the others who have reported performance hits from using it and the documentation saying that it is slow.
You're honestly the first person I've ever heard defending using it every half a second for potentially thousands of actors
That's something similar to what I have now, except I don't have it trigger the 'shoot' mechanism from the AIC. But maybe I should? Make movement a BT thing and then have the triggers on the AIC.
This is why blindly following advice that includes absolutes, especially when it comes to performance, is bad and perpetuates naive information. Yes in some circumstances it's too slow and it's better to reach for a different data structure, but in many cases (especially for hobbyists) it's a perfectly fine tool. I've used it in several shipped games just fine.
In programming there aren't a lot of absolutes. Every decision that you make has pros and cons and it's more important to understand those instead of using absolutes. Sure the documentation says it's slow, but it doesn't give the context of why. If you actually dig into it, what it's doing in a non editor game is perfectly reasonable. Sure you shouldn't use it every tick, but you should be avoiding tick anyways.
I never said that it's fine for potentially thousands of actors. It is however better than the other solutions given depending on the context.
So where would I look to see what it does in a non-editor build? Because I don't see anything editor specific in this function or the TActorIterator. Everything that I've seen points to it still iterating through all actors in the world.
No, it won't matter much in small games.
And yes, a lot of things are context dependent. There is no denying that.
And I don't think anyone was ever talking in absolutes.
So - I'm pretty sure I traced it down to the hashtable you mentioned before. Inside FActorIteratorState, it calls GetObjectsOfClass() which inside of that calls ForEachObjectOfClass() which then gets the FUObjectHashTables singleton and calls ForEachObjectOfClasses_Implementation() And in there is where the actual finding of classes happens. So it seems like this table gets updated when a new object is created, and everything is derives from UObject.
class RAPTOR_API UREnvQueryFindEnemy : public UEnvQueryTest
{
GENERATED_BODY()
public:
virtual void RunTest(FEnvQueryInstance& QueryInstance) const override;
virtual FText GetDescriptionTitle() const override;
virtual FText GetDescriptionDetails() const override;
};
Sanity test - having an issue with getting this to compile at all.
It's a custom Environment Query Test. Really basic. But for some reason it's throwing that the RunTest has no overloaded member FEnvQueryInstance.
I thought maybe my header is cooked, but it's not.
fuck it. didn't include const in my .cpp
If anyone adds BP-created enum to their ST as parameter, be careful
I did it two times and cant open the ST graph anymore
hey there, what avoidance will be better for the enemy AI Detour Crowd or RVO, and will there be any performance hit by using any of these two? As right now my enemy AI are bumping into each other way too much
So, friends of Behavior Trees. You could maybe win me back if one could explain me how I get a ticking Service that ticks every frame.
It doesn't matter why, I just want it ;_;
they dont tick everytime
I knoow
I want them to
At least the option
After all this thing whole setup is actually using tick
create a base service class and inherit from FTickFunction, use it's tick -- you wont be able to access default parameters though since it only gives you DeltaTime
It's just that Services have extra code to only do it every x seconds
The problem is WrappedTickNode
ACTUALLY
if (NodeOb->bTickIntervals)
{
// Some annoying code
}
else
{
UE_VLOG(OwnerComp.GetOwner(), LogBehaviorTree, Verbose, TEXT("Ticking aux node: %s"), *UBehaviorTreeTypes::DescribeNodeHelper(this));
const_cast<UBTAuxiliaryNode*>(NodeOb)->TickNode(OwnerComp, NodeMemory, UseDeltaTime);
NextNeededDeltaTime = 0.0f;
return true;
}
This looks quite nice
So I just need a childclass, like the DefaultFocus one
And set the boolean to false
I have 2 decorators on my behavior tree for 2 of my character states, attacking and holding. I know that when sequences fail they start from scratch, i have another state called knocked down that i think breaks the loop. after it goes into knocked down state the behavior tree gets stuck in the holding branch. Im not sure why its getting stuck.
Wait you can just set the Interval to 0 and that ticks every frame?
Hm, I'm sure that didn't work before
Your tree suggests it's in Attacking Mode?
And arrow wise it seems to have returned to its parent
What's at the top of that tree?
i didnt know about intervals ill see if that does anything. theres nothing above the top sequence other than the entry thing
The interval stuff is not about your stuff
oop
Oh
Eh
I think you are using the wrong Composite node
Sequence stops if a Child fails
You want a Selector
Selector stops when a Child succeeds
The Sequence won't progress to the next node on the right cause the first one fails due to the AIState
i think thats right but it didnt fix my issue. I think it might be because i am reseting the state on a set timer by event thats throwing off the behavior tree or smthn.
ye thank you i think ur thing fixed it and switched up the timer ty
i think... prolly
Hi folks, I see you've been talking about StateTree, maybe you have the answer I'm looking for.
Do you know if there is a way to use statetree's Parameter like a blackboard ? It seems to be read only. There is a way to pass variable between tasks without using Parameters (by categorizing them as Input or Output), but its working only for tasks that share the same state, not between different states.
I've tried to set a float to Parameter category, bind it to a Parameter and increment it, but the end value is still 1 (coming from 0, the Parameter isn't set).
If the answer is no, how do you keep a short / medium term memory ? With a custom solution by settings variable directly in the Context class used by the StateTree (your derived class actor ?) ? Thanks !
So it's actually quite easy. Inherit from the BlueprintBase version of Serice in C++ and set bTickIntervals to false.
That's kinda it. Inheriting from that custom Service then makes the BP one tick every frame. So I can finally move my Rotate to Target stuff to a Service.
Not related to Alex's question, just saying.
@pallid mica So you eventually gave up on ST? 🙂
There was a ST Enum support fix in ue5-main last week, could be related

Hello, I'm trying to put a "AI MoveTo" node in a ST task but because "ReceiveEnterState" can only be a function I can't, is there a way to make it work?
As a workaround, you can add a custom event in the event graph of the ST Task and call this event in ReceiveEnterState. Then you will need a way to tell your ReceiveTick if the task is running or succeeded (a boolean or enum perhaps ?). That doesn't seems the way to go, as it seems to there is no way to call a specific function to end a ST Task.
If anyone has a better idea, I'll be glad to know it.
Perhaps the StateTree Send Event function could be called after the AI Move To
While in the State Tree, there would be state transition upon this event
Maybe I'm wrong, but I think the question was about AIMoveTo that is a latent function, and can't be call in another function, but only in an event graph. But your solution seems pretty elegant and could be used with another not latent Move function I suppose.
It should be possible by creating custom blueprint base which returns running by default and true/dalse depending on if finish func was called. Just like BT bp base classes do. But it might be tricky to get them to display it in class picker. But it can be hacked with copy paste. #gameplay-ai message
A bit hacky but should do the trick, thanks for the tip !
At least for now. It's missing a few things for me to do what I need.
This is how it has worked for as long as I've sat down and taken an interest in AI in UE (so like 2 years).
Side note - why are your AI questions that I can answer quickly always asked when I am sleeping 😭
- Yes, it is by design that different states don't share data really. You can bind to any previous state in the list and parent states.
- Binding is a one-way direction.
- To alter the state tree params, you need to get the parameters from the ST itself. You should have access to this via the
FStateTreeExecutionContextthat gets passed into each of the 3 callbacks.
This is much easier in C++ honestly. Start the move to call and then in tick check the current status of it. That's how I do it (also how I saw Mikko recommend to do it)
Getting the path follow result isn't exposed to BP I believe.
Crowd following gives better results and causes less issues than RVO. Such as RVO can push agents off the nav mesh and doesn't work at all when 1 is not moving. Crowd following however is more perf heavy, which will only be a problem depending on how many agents you have running around.
Well in RVO i am getting this error where one AI is moving but another is just standing, and as you said it would work, and in cases where it pushes the AI out is navmesh, it will just mess up real bad .Looks like i need to go with the detour crowd, and for performance I'll have to check how many AI my scene can handle at once ...
Thank you for the explanation.
Keep in mind that there is a cap on how many agents you can have active at one time. Default is like 50 or something like that
Changeable in the project settings
Thanks for your answer !
1 / 2) I get it. Too bad we can't set back by an Output variable.
- I see that
FStateTreeExecutionContextisn't aBlueprintType, do you know if there a reason to hide it in blueprint ? Is it by design a wrong way of keeping medium term memory ?
By looking at UStateTree class, I see there is a method named GetDefaultParameters() const that return FInstancedPropertyBag, but the Parameter being private, I don't see a way to set it back, is this even possible ?
While waiting for an answer, I ended up making a very naive Blackboard-like component attached to the actor, it does the trick but I'm not sure if I want to know how unoptimized it is.
Don't know why it would be hidden in BP, maybe it was just forgotten to be exposed or maybe it just can't be exposed. It might be an instanced struct thing, in which case, BP support was only added for those at the very last minute for 5.1 release. In which case it may have just been forgotten.
When you have the FInstancedPropertyBag, you should have access to functions like SetValueFloat(PropertyNameAsFName, Value);
Oh, I was thinking the struct was passed by copy, thanks I'll give it a try !
That's a real weird thing to tie to using a battle tested architecture. There is very little in AI that actually needs to tick every frame. 0.2 seconds actually give good and more natural results, because that's the average human reaction time.
Rotating your AI towards a Target sounds pretty important to me tbh
And I disliked that I had to do this outside the BT, cause doing it every 0.2 seconds looks really shitty
But I already got that working now. Services are just not nicely exposed in that regard to BPs
In C++ Epic even sets Interval to 0.f on some of their Services
Which causes them to tick every frame
You just can't in BPs cause the UI clamps it to 0.001 or so
I said that RVO doesn't work if 1 is non moving. There's also a project setting that limits the crowd agents to 25. How much the cost will affect your project is based on what else is going on. You can also toggle it off for less significant agents to help with the cost.
how can I make a camera shake that only plays when being chased by an enemy and disappears when enemy stop chasing?
The movement component does rotation really well, especially with replication, and reinventing the wheel generally leads to disaster. It does make more sense for the AI to decide what to focus on and the character decides how to actually rotate.
Sounds more like your problem is more the restrictions on BP than how BTs function.
The FocusActor stuff didn't look like it was made for rotation towards target the way I needed it
Also not enough control for me
If BPs of BTs are exposed with restrictions, then it's kinda both
But I get what you mean, don't worry
You override FaceRotation on pawn for that
Disappointing that it's less event based than BTs.
Service -> AIController Focus -> Pawn FaceRotation
Yeah but that's the thing. I don't want to have some of the stuff in Controller, some in Pawn, some in the BT
At least for this specific topic
yeah thats the issue with BTs
legacy from UT times
also see #gameplay-ai message
For given context its exactly same as BTs though
Why? It makes a lot of sense when you separate the brain from the body.
You can 1:1 replicate MoveTo BTTask to a StateTree task
and code would be the same
Problem is, ST's BlueprintBase classes dont cover required BP helper stuff like BT's BlueprintBase classes
To be fair - Eren does have a bias against AIController 😅
Maybe it's a bad example. Restricting Tick Interval to "not every frame" just for BP users of BT Services is bad imo
That's the overall annoyance for me
Ah. I've only briefly looked at state trees as they don't fit my current games need. Disappointing then it was recommended to use tick instead.
Dont you end up having design problems when you want to modularize your AI because of how pathfollowing composite and other AIController components composed?
You only use tick to check if they've arrived at the goal or not
especially when you want to go data oriented
PathFollowingComp should do that if its not disregarded completely
Yes - it does.
BTTask_MoveTo just calls RequestMove on PathFollowing with some additional wrapper stuff
But you need some way to exit the state
There is no "Force Exit State" function to call when you get to the destination
Not at all. I use a lot of AI tasks so functionality can be used in the BT, scripted functionality and sequencer.
That and not being able to abort was what drove me away from ST as a replacement for BT for now
I had some problems when I want to pool my AIs - since some archetypes required different type of AIController and some other required different pathfollowing comp
if data would be collected in single place it'd be better for me - though I understand if your system get alongs well with OOP rather than data it still works
Not saying it should be a replacement, but it could have been
Hope they update BT's visuals at some point. ST looks so pretty :D
I still like the BT visuals 😢
Btw eXi, not to advertise a paid 3rd party plugin but I recently saw this and I'd buy this if I would continuing with BTs. https://www.unrealengine.com/marketplace/en-US/product/behavior-tree-extension?sessionInvalidated=true
fixes some of the UX issues
specifically the parameter groups thing
What I like about it is it is super simple and straightforward 😅
I use a more data driven design instead of a significant amount of OOP. So we only need the 1 AI controller.
It isn't trying to do anything crazy, lol
Only thing I dont know specific about BTs it encapsulates behaviors into tasks instead of going more node-oriented - but it what keeps it simple i guess
but then I realized at least %75 of UE game AI dont require much modularization in the tree
Interesting. Not sure I get the parameter one
Make reusable behavior trees more or less
It lets you bind data to subtrees via details panel so you dont end up creating tons of BB keys
Ah
That is indeed nice
So I can make an Attack Tree, expose variables and control them from the RunBT Node?
Yeah
The only other thing I wonder if I just never understood it correctly (or I'm the only one needing it) is proper Parallel Trees.
I don't know if it helps reduce the creation of BB keys, unless you can't link to a BB key
Simple Parallel as generally worked fine for me personally.
But I also only use it for move & attack stuff
I heard compared to other engine's BTs UE's parallel composite is very limited
Yeah there was something with SimpleParallel and RunBT iirc
based on zoombapup
Can't recall but I think there was even a "bug" in the form of the SimpleParallel not supporting using a RunBT for the MainTask or so
it's been too long that I tried that
There is a bug abouts its serialization to the graph
sometimes it doesnt get deleted 😄
Na it was more about not really finishing
Cause the RunBT Task being slightly different in that regard than a normal Task
That plugin also provides a simple utility ai thing and a random selector, which is honestly....also kind of nice.
Yeah but that's stuff I wouldn't purchase for. I can create these things if needed
Like, me personally
Still nice if you aren't able to do that
Definitely. But it's a nice little bonus. The main selling point is the better RunBT nodes
A lot of reflection in that node 😅
utility score rings a bell
That one might even be a bit more interesting than the random one
Yeah. It's nice & simple & straight forward.
Ah yeah stuff like this was in some GDD of some client a while ago
Hugely complex scoring system for AIs to select an Ability
Based on what the Player has done so far
A non programmer client knows what utility score is 
Could be useful in the BT to just plug into tasks
Fear popularized utility AI if I recall correctly
wasnt it GOAP?
Create a Behavior Tree Instance object for modifying parameters similar to Material Instances.
This is an interesting bullet point
Yeah it was some round based, sort of JRPG for that Client
Ahh - yeah, they used GOAP. My mistake.
same picture anyway
Wasn't the Run Instanced thing what we just discussed about having parameters exposed?
Expose Behavior Tree parameters by using Run Behavior with Parameters task.
Well this is also a bullet point
So they're saying the same thing twice? 🤔
this is wild
why its not even on images? 
no
this one means custom BTTask
Yeah - I was replying to Cedric
oh sorry - i cant read
But what do they mean about doing an instance object?
@verbal shore 
can you explain? 😄
It was the Sims that popularized Utility
The BT already has params exposed, no?
There is
@uneven cloud btw - thanks for challenging me (I mean that in a friendly way btw) last night. Caused me to learn more about how objects are actually created in UE.
Yeah - that's what I'm trying to ask really. What the actual difference is. Because I could just throw in the RunBT param node.
Unless there is a BTInstanced Asset you can create
They likened it to material instances - which is a whole new asset
Actually
because many AI singletons rely on that specific asset
The Screenshot of the Node gives away that it's another asset
BTI
So I assume the idea is to have a "child" of the BT with fixed new values
Where RunBTWithParams needs you to type the params multiple times
E.g. if you have a BT that you use in 2 different ways, but in 10 places
You don't wan to fix that one variable in those x places
But just on the BTI
It's like having a Enemy with a Health Variable. You don't want to type that in manually whenever you spawn the Enemy, but rather have Enemy_SomeCoolDude with Health already set that you can reuse, as well as Enemy_SomeFunkyGirl.
You're welcome. There are so many hidden depths of the engine.
That's what I thought as well to be honest. Specifically because they mentioned Material Instances.
Yeah it's probably that then
I'm just not sure I'm sold on the use case to be honest.
Sadly, that stuff should really be default in the Engine ;_;
Yeah me neither yet
Most of the values that are different are usually originating from the AI itself
They have some examples. But I feel like a lot of those are just AI params
Yeah - those are the values from the RunBT param
Like, if these values are in the TIGER BT
Then why does the TIGER not provide them
That's basically where it would fall apart for me
That's how I parameterize my BT stuff as well
This also causes issues if you need that value outside the BT
What if I want to show that Sneak Distance to the Player somehow
And it doesn't look like you can just select a BB key
I mean, maybe for stuff like a reusable tree that has some non-AI Specific settings
Maybe you want a tree somewhere to have a higher WaitDelay that doesn't matter to the AI itself
Then I can kinda understand it, but that seems like an edge case
I like by Data in my DataAssets
I mostly just like the RunBT being a proper RunBT 😅
But that's kinda good, makes me more or less realize that I only need to code their Utility and Random Selector stuff for our Internal Plugin lol
thats.. like the most easy thing though 😄
Yeah exactly, don't need to buy for that
Automatically binding to a Key based on name would be cool
yeah
Just to skip some bugs
It might be planned for the BT 2.0 that Mieszko is thinking about.
But who knows if he'll ever get to work on it
Mieszko said anything about 2.0?
Not much.
But I recall him talking about it around the time he was talkin' about EQS 2
The problem with these things are that if they ever release, it will still be a year or so before they will be usable to the full extend
So it's really unlikely that we touch BT2 any time soon I guess
Fornite just needs to be more AI driven. It'll be finalized real quick 👌
I'm kinda hurt by the PredictionPlugin, if one can tell ;_;

dont remind
but hey - they said they will continue on it
just.. probably years later
You? Nahhhh
The Salty part does indeed come from my side
As someone who is not a fan of the new AI systems, I hope they don't modify EQS an BT too much.
Whatever happens, it should end up better than this: #gameplay-ai message
😂
I'm kind of meh about ST after playing with it for a week or so. But I do like creating a new task/condition/evaluator more in ST than the BT counterparts
Really low bar.
😄
Well it's kinda open world , so i am a little tight with performance. Will see what will be the performance issue while using crowd and how many the system can handle at once.
Hey I guess I missed something, what's going on 😄
What is the Instanced BT you talk about in the BTE plugin?
How does it differ from just doing the RunBT with params?
There are two ways to expose behavior tree parameters, one this directly happening through the node, another one is like creating a data asset and modifying them from there
It's especially useful when you want to use same configuration in multiple AIs. In "Run Behavior Instanced" you pick the Behavior Tree Instance object
The naming might be confusing but I couldn't come up with something better. It's inspired from material instances
@pallid mica 👆
@pallid mica
I win
Haha congrats 😄
respect the server authority 😄
That's one thing I know
So it's pretty much making a DA for a behavior tree more or less
Yep, exactly
Is the Instance a "child" of the original BT?
STs, like a lot of the other new systems, are focused more on being clever than user friendly. The EQS can get really complicated, but that's hidden unless you are trying to do interesting things.
No it's just an object. I do the same stuff I did in node version
I can see why you'd describe it like a MI, but it isn't 😅. Because MI's are reflective of their parent assets
Tough call.
But alrighty. I get it now.
How does interacting with the BB work when dealing with the sub trees?
Subtrees can have their own unique blackboards, this is also not provided by the engine. So it enables using different blackboards as well
You can't bind BB keys to exposed parameters, my goal was just exposing them. I didn't want to use blackboards much so I didn't need it back then.
If parent tree has a service that ticking and modifying a variable called "TargetActor" and the subtree also has the same variable, it will modify the value in subtree
But when you go back to the main tree, those changes will not be carried back
one crazy idea I have right now buying the plugin and going through some existential crises with slate and creating a fake data binding system based on Blackboard and FProperty's exposed to parameter groups but I dont have enough time 😔
Haha, you're spending huge time with different AI solutions. Might not be the best idea to add another one. 😄 Though I would lose a sale haha
You can't bind BB keys to exposed parameters
😭
new ST thing also really cached my interest but I wouldn't even be able to get started implementing it from at this point (to my own game project)
ST just keeps my attention because of state machines and data binding
and of course.. replacing AIControllers i.e. data bindings
Or because "oh shiny"
nope
spending some time with erlang
i think verse could achieve what ST is doing in code 😂
Eh - verse ain't going to be a thing for us for a lonnnnnng while
It feels like it can offer a great modularity, which is I always appreciated. But I didn't have a chance to test it out by myself so I don't really know, maybe a wrong impression. But data binding thing looks really cool
tl;dr its bottom-up version of BTs - current node determines which state to transit instead of a top level node
rest of the stuff is pretty much solving the data binding system and its rules
@harsh storm @verbal shore Thanks.
Do you have an example for the usage of both RunBT Versions, especially when there is the option to store those different params in the AI itself?
E.g. an Attack Range would live in an AI DataAsset for me
From what I've seen in the Marketplace Screenshot, almost all (I don't know what all of them do) of those variables seem like things that could just be stored in a Tiger DA for the AI itself
I think the idea is that your AI DA would now be in the BT DA more or less.
So no more AI DA per se
Same
So that should be the initial point for everything creation of AI for me
DA for data
Actor for functionality
Our game is even setup to not have preplaced AIs
Only AI spawners
Makes load time really quick :D
Saaammmmeee
That's fair haha. I have data assets that define my AI characters as well, but they mostly define the very basic things. For example, Tiger hunts deers, silkworm hunts butterflies etc. So core stuff is handled in data assets. (I could do that within BT but I also need to let other AIs know about each other so it's unavoidable). How I use Run Behaviors with Parameters is that I use them for things like combat, neutral behaviors etc. I like using behavior trees, and if I start handling everything through data assets it would greatly limit my capabilities, especially when I have this many AIs
I created different behavior trees for different combats, so they are like templates and I just modify their value
I typically have something like Attack range in my DA as well. Then I have a BB key for attack range. My controller sets that attack range BB value from the controlled pawn's DA
Ah, so this is the equivalent of me trying to rotate my character via a Service
We have that too, I'm still debating if I should just access it directly instead of littering vars into the BB
Wherever I can link to a BBKey, I probably have access to the ControlledPawn.
I guess it just kind of depends honestly. Because you can set the value in the task or w/e upon entering the task.
I see what you're saying.
In my solution if I need to get something directly through AI data asset I can design my task & service & decorator around that idea, but I very rarely need that
out of the context but, last two day's conversation quite proves devs mostly spend time to design how their data will be used on AI
rather than adding functionalities
Data is the most important thing if you are working with designers.
Yeah, it can be really dangerous as well. 😄 If you design something bad (did this countless of times) it takes more time to create stuff. If you put too much time on designing your systems then you forget developing the game (also did this countless of times)
I do like BT's and BB's - but I do understand that it can be a bit cumbersome getting external data to the BB correctly
Relying on strings (I know they're FNames) is also a 😭 moment
Yeah I love BTs as well, would love to see they get more love from Epic. They recently added gameplay tag support for BBs I guess, but it would be super cool to see more BT features. I think they are really powerful and super fun to design AIs with them
Are you suggesting I haven't actually coded any behavior for my AIs since Monday?
Because if so, you are god damn right
Mostly just reading up on stuff cause AI is def not my thing usually.
Bloody typical, I spend weeks making this NLP based voice control system and then find that Meta has released a voice SDK to do the same on the 12th of this month
Mind you, theirs doesn't do continual transcription and whatnot
Guess its nice to see other people's version of stuff at least
If it makes you feel better, Epic keeps releasing new systems I've already written.
Hahaha.. guess its an occupational hazard 🙂
I enabled a bunch of random plugins today.. man there are a lot in 5.1
Of course the build then failed, so I disabled them all again
Think tomorrow I'm going to add Amazon Polly based text to speech.. the Meta version isn't great, the Epic version is worse (but quite like Steven Hawking voice, so kind of fun)
Polly can drive face blendshapes at least..
When creating BehaviorTrees, are there downsides to cutting them into multiple subtrees, even if there are no plans to reuse the subtrees elsewhere?
E.g. a Main Tree and then 2 SubTrees for "Sees Enemy" and "Doesn't See Enemy"?
Mainly for the sake of keeping logic in BTs smaller and easier to read, but losing the overall "everything visible in one picture (BT)"
If I add a Delay Task with "run forever" checked into a StateTree state, the execution should never leave that state, correct? (no transitions present)
Gosh this is frustrating
Seems like the execution jumps between states no matter transition conditions
Anyone willing to share their whole StateTree MoveTo task? Pretty please
There is a warning about this when doing a too small subtree. I forgot what it said though. Something like a decorator or service might not work if the subtree has it on the root node.
But I think the main downside is that you can't parameterize it. Not sure if they end up sharing BB though.
Are you using BP or C++
BP preferred but I'm happy for anything I guess
In Enter State, get your binded actor, get the AI controller, then call the Move To node (actor or location, up to you, or support both). Then make a switch from the Return Value and if they are already at goal, return that the state succeeded
EnterState is a function and the AI MoveTo node is latent, it won't let me
Don't use that node.
Use Move to *
Not AI MoveTo
That's how I did my BP version if I recall correctly, before switching to native
return InProgress
have a boolean bIsFinished
create a custom event that calls AI Move To
and set bIsFinished to true when its done
and if bIsFinished is true return from tick
one of other 1324242352 options
@celest python I tried that originally, thank you
And what @harsh storm suggested doesn't work either but says that there's no instance of AiController
I guess I need to instantiate it manually 😅
No. Just bind to the actor context variable
Then get that actor in your task
Pull off that and get the AI controller
If your AI is not pawn based, then yes, you won't have an AI controller
Instead, you would just end up moving them in tick or something like that
Like this?
My Unit is Character-based, but still I get "Accessed None trying to read property CallFunc_GetAIController_ReturnValue"
I'd investigate around why that is happening then.
ok, here was the catch
@harsh storm @celest python Thanks for your help, appreciated 🙂
I always select the bottom one. I feel like that should be the default
Hiya all, i'm trying to figure out how to get enemy AI to aim accurately at the player
Basically, how do you get a humanoid mesh to accurately point their weapon at a player
I've tried using some spine deformation stuff, as well as Aim Offsets, and both seem to have accuracy issues
but that might be more down to my calculation logic too
has anyone had success with this sort of thing in the past?
What we did was solve for the weapon line.. so basically move the arms to match where the weapon should be if it were pointing at something. IK the hands to the weapon rather than attach the weapon to the hands. Weapon was procedurally animated and could do things like block against geometry and the like. Probably overkill for most games that aren't FPS focus
Have a look at the FK/IK switching, basically you can use the aim offset to get in the ballpark and then IK for the final angles to ensure its correct
Just remember to make sure you handle the physics of the weapon hitting walls and stuff
@ocean wren
This is kinda random but I remember like years ago you tweeted/retweeted an AI agent emotion topology/graph that boiled down like 16 or 32 emotional states with like leaf end nodes like “apprechiation for self” vs “Apprechiation for other”. with qualitative labels for it like “proud” etc..
I’ve been trying to find it but google has been completely useless due to all the recent clickbait articles spam. Tried to see if it was a GDC thing but had no luck.
Working on a sims/rune factory mashup so was trying to find that article again. If you don’t remember/doesn’t sound familiar disregard but I thought there might be a chance
can I switch from nav generation static to nav generation dynamic during runtime 🤔
how can I prevent ai from detecting itself? I have AIPerceptionStimuliSource added to player controller, and AIPerception added to EnemyAIController. My understanding is that this arrangement should prevent ai from sensing each other, because ai is never a source/does not have the source component.
I have them set to move to me as soon as they see me but they are seeing each other too and Im not doing any check to make sure that they dont move to other ai.
Somehow they are just moving to me even though visually we can see that they are register sight sense with other ai.
How to allow my character to push ai out of the way?
It does sound familiar.. there's been a bunch of architectures for that.. based on the sims work on edith: https://www.qrg.northwestern.edu/papers/Files/Programming_Objects_in_The_Sims.pdf
It might well be something from Richard Evan's work on the sims.. have a look at his stuff from GDC
Rich mostly used rule based systems though..
Oh wait, was it something like Prom Week?
Actually, I think I know what you mean.. its the standard model for cognitive modelling of emotions.. or rather an early version of it
Was it something like this? or more of a flowchart?
I think you probably mean the OCC model of Ortony, Chlore and Collins?
ORTONY, A., Clore, G. L. & Collins, A. (1988). The Cognitive Structure of Emotions. New York: Cambridge University Press.
Man, feels like a lifetime ago I was looking at this stuff
Relevant paper from a while back:
You have to disable the auto register
In the DefaultGame.ini ⬇️
[/Script/AIModule.AISense_Sight]
bAutoRegisterAllPawnsAsSources=false
bAutoRegisterNewPawnsAsSources=false
[/Script/AIModule.AISense_Hearing]
bAutoRegisterAllPawnsAsSources=false
bAutoRegisterNewPawnsAsSources=false
Even in 5.1?
I cannot do this from within engine?
I pasted your text exactly as is and same results. AI still sensing other ai pawns
Did you restart the engine?
ok let me try that. I followed this and remember having to put that text into DefaultGame, and did not have to restart then. That was for 4.25 though.
In this presentation, Epic's Paulo Souza uses Unreal Engine's built-in AI features to build smart enemy behaviors for a game with stealth-like mechanics.
By relying on the Gameplay Framework in Unreal, we're able to quickly create convincing AI using Behavior Trees. Behavior Trees are great for creating complex AI that can be presented in a way...
amazing
youre my hero. pm me a venmo. will pay
I think you need to restart the editor each time you make a change in one of the .ini files (except for settings like collisions)
interesting. did not know that for certain.
To answer your question.. easy mode is to handle on collision with capsule and just issue a move request in a direction away from the collision point.. slightly better and harder, is to disable the rigid body for the capsule of the actors, add a detourcrowdfollowingcomponent and then find the function where it calculates forces (something with avoidance in the name if I recall) and write your own to add a force away from the nearby entities in the force calculations.
The former would technically work, but will look weird.. the latter definitely works and feels smoother, but you'll need to hit the C++ code for it
The detour controller already has the force calculations in there, so its just modifying things really.. but it does run a lot nicer and you then don't have to deal with absolutely stuck collision capsules.
I do like the force calculation option. What part is limited to c++?
The only real downside to the detour version that I saw, was that smoothly shifting the characters needed better animation support
Well, adding the detour controller is C++ only if I recall.. and the force calculation is only available to C++ too
It just was never exposed as far as I can tell
I mean I doubt anyone other than me ever used it 🙂
alright so limited to a simple.. on collide, nudge away basically.
yeah, you could get a LITTLE bit trickier and do an EQS test to see where to move away to that doesn't have another collision object in it
i.e. "nudge towards somewhere without an obstacle and generally in the right direction"
ah nice... I do like that thought
Would prevent ai from getting shoved through world geometries
I generally don't like the idea of rigid bodies for AI entities.. almost more hassle than its worth imho
I don't mean for collsion.. I mean for collision response
isnt rigid body for physics? like.. specifically for falling/jumping?
Yeah, but every character has a capsule as well as the rigid bodies associated with the physics skeleton
and it uses the capsule for collision testing for movement and the like
makes sense
I like to keep the capsule, but disable capsule->capsule collisions for the AI and player, so basically all characters can pass through each other
I then use forces to keep them apart (which is what the detourcrowdcontroller is for)
that sounds really clean actually.
Works pretty much exactly like Team Fortress 2 if you want to see what it feels like
It helps when you've got to get a squad of soldiers through a narrow doorway 🙂
its undecided atm how Ill handle player moving through ai. I have 3 of various sizes and I want the player to feel that difference
And worst case, you can literally swap positions of overlapping capsules to allow them to pass in different directions
is that replicated too?
It does depend on your circumstances in your game to be fair.. but if you've got a lot of agents going about doing things having this stuff helps a lot
Yea I can see that
its replicated yeah
bravo
Well, I mean the AI runs on the server, so the positions are server authoritative anyway
Maybe anything multiplayer is just admirable to me for both that I dont understand it well enough and replication in general gets tricky quick compared to single player games.
You've got me wondering if the new MassAI has some of this built in now too 🙂
Try the matrix awakens example.. might have some of this.. I honestly didn't even look at the character side of that 🙂
And with movement responding to collision, and replicating that... Cant imagine how youd make up for packet losses or lag, predictions etc
I know those are things you might have to worry about
The only loss or lag would come from the player.. from the AI with it running on the server, you can't really get any
So if anything, the player would be the only thing that went wonky and in my setup, that wasn't an issue because they weren't doing rigid collisions.. so you'd not see any significant difference in response
The forces were all smoothed anyway, so it would resolve any player->AI differences in a smooth way relatively quickly
nice
I mean sure, you'd still have issues with hitreg and all that for FPS to deal with.. but for general movement amongst multiple agents, it works out fine
Dammit, going to have to look at the matrix sample again now 🙂 add it to the todo list
sounds logical. if you got a vid of what youre working on would like to see it
You can see my stuff at www.youtube.com/zoombapup
Will be posting a vid for my current voice control stuff once we agree with company that they're OK with it
Hopefully a few weeks.. working on the demo now (part of the funding contract we have to demo it at two events)
any vid specific to this movement stuff we are talking about?
lots of stuff here lol
Going to be a fun one.. trying to think of the most impressive demo..
I thought I'd recorded one on the movement, but looking at the list last week apparently not
I thought I'd done one on the smart object stuff I did too.. turns out nope 🙂
dang. oh well lol. Thanks for all the food for thought.
No problem.. at some point I really should do some demo videos of just general AI stuff I guess
Its been a while since I just sat and noodled with AI stuff in C++ though, having to do Python has broken me a bit 🙂
Would be nice to do a voice control demo with a huge army or something.. but isn't really in keeping with the company I'm working with
I have been in ue4-5 since 2016 with a year in there in unity and c#. Dont think ill ever step outside of unreal again. Dont have the guts haha.
Well, This AI thing I am working on does happen to be in line with my job, since I am working on ai for them in unreal also.
But its drone warfare and collision is disabled. exploring how to have multiple ai, different behaviors/trees.. levels of aggression etc
I'm working with a lot of non-game stuff right now.. mostly visualization, language, simulation things.. data visualization and voice control (natural language understanding)
And some military ISR stuff
Digital Twins and the like
But right now, its about sparkly demos for voice control 🙂
yea maybe you could do voice controlled ai, 2d ai to create charts lol.. maybe demonstrating some sort of collision stuff as they cross paths through each other lol
combines voice controlled data visualization with ai and crowd control maybe lol
This video of yours mentions crowd control but does not point to the 2nd in the series like most usually do..
Part one of a four part tutorial series on Unreal Engine crowd technology
Theres a playlist for that.. if you look at my playlists
Its quite old that one though.. so likely nodes are out of date etc..
Part of the reason I don't do tutorials much anymore except for if someone asks me for a specific thing
haha dang. Saw RTS stuff got excited, then says c++ haha
not gonna link here since its not ai lol
If you're doing an RTS, you're going to have to use C++ really.. highly un-recommended to attempt it in BP
haha i am not. Just a fan of the genre. Have tried though. had multplayer set up, joinable lobbies.. race selection.. resource gathering and attacking
but.. movement desync.. killed it and ha dno idea where to look to solve that
This playlist is awesome
https://youtube.com/playlist?list=PL4C3D55CA4EF8578B
Some examples of different crowd papers from years ago 🙂
Im making something heavily inspired by The Siege Breaker. There is lots of crowd stuff involved since it is a tower defense or base defense. Im using this project to make something that is manageable within my skills. small scope. 3 enemies, 3 towers. 1 player, 3 buildings.
the only thing not using ai in this are the buildings. walls and harvesters, blocks pathing and generates resources respectively.
You really went deep on this ai stuff, and have been for 13 years! good job!
I've been doing AI for longer than that 🙂
I just have this video as a time stamp from 13 years ago. Cannot imagine how some of these demonstrations improve with tech and your understanding.
A lot, and yet.. sometimes not so much
Game AI is a weird field to be in
On the one hand, we're doing stuff like natural language understanding, voice based image generation, on the other, we can't seem to create a decent movement system API 😉
haha Starcraft 2 wasn't decent?
It was very specific to SC2 though, and was proprietary
yea
hi guys, im playing around with character movement component and ai move to
Cant understand why this happens:
When i tell char to move on area where it cant step up, char going to wall and not stop right before but just trying go through it
When i tell char go to near the wall all works fine
Anyone knows how to fix it?
Its likely you're trying to a navmesh "island" that isn't connected to your current one and doesn't have a navmeshlink to join it
trying to move to..
makes sense
So build a ramp up to that island, or add a navmesh blocker to remove the navmesh in that area
press p i htink to render pathing
You can also adjust your pawns movement step height i think
but youll want to confirm your nav mesh is building pathing on those steps
oh where i can turn it on?
There’s a class of gameplay bugs that are hard to track down just via user reports. These types of bugs typically involve complicated steps where the AI has made a decision based upon the state of the game at the time. UE4 has a tool to help in this regard; we call it Visual Logger, and here's how to use it.
Also the gameplay debugger might help: https://docs.unrealengine.com/4.27/en-US/ProgrammingAndScripting/GameplayDebugger/
But this behavior not always happen, sometimes it just stop properly like if i click on place near the wall, that why im asking about that
Its probably that the click position is slightly nearer the main navmesh than the island navmesh
basically, from what I am seeing, I'd suspect that its actually finding the navmesh poly closest to the click and trying to move to that, so if you click in different positions the nearest poly might be on the island or on the main navmesh
Just a guess though, you'll need to debug to check that's the case
ty, will try to check it out
morning all. so i get this is prob a stupid way to learn, but i know nothing of code and im really struggling with learning blender and python. this morning i decided to use that OpenAI site to spit out some basic code and then try and back track any errors blender gives back and learn what those mean (ya, assabouttit way of doing it i know but tutorials dont seem to be sinking in) with this in mind can someone help me understand what this error means please?
Python: Traceback (most recent call last):
File "\Start with a cube as the base for the cabin", line 49, in <module>
KeyError: 'bpy_prop_collection[key]: key "Camera" not found'
You might want to ask on the blender forums or some such.. this isn't really the right place for this kind of question
And yeah, not a good way to learn 🙂
Yes this was it!! Thank you! I’ve been looking all over for this. Very much apprechiated
And yeah, I first started following your early UE4 stuff in 2015 right after I graduated university. So it was quite awhile back lol
Crazy how things have changed.. all of the latest ML shenanigans has blown up a bit, but still people struggle with BT's and the like.
Its weird, all of the issues you have balancing things like utility scores for utility reasoners and now we've got the same issues for stuff like reinforcement values for RL algorithms (or the NLP stuff I'm doing right now)
Why does it just get more powerful and not easier and more natural?
ai generated music anyone?
using an image to generate a text prompt that then generates the audio
I'd add to my playlist, tbh 😄
Yeah. The new Mass stuff has pretty decent obstacle avoidance already.
Yeah, forgot 🙂
In 5.1 are there any tools to see where in the state tree it is currently executing?
Its logged to vlog
thank you!
Do you mean this here
Anyone know what we have access to in BPs with Detour Crowd AI Controller vs AI Controller? I am aware of settings in the Project Settings, and the rvo in the movement component, thanks to @ocean wren s vids on youtube (https://youtube.com/playlist?list=PLaIL7QdE_Vqi8MIo2vghzW_Jj0Jz_grFH). Concerned about changing the parent for my aicontroller to the DetourCrowdAIController. Anything changes I should be aware of?
Can you set the enums default value in a blackboard, without forcing the behavior tree to do it, and without changing the order of the indexes in the enum? I imagine the blackboard enum is simply using the first one, but wondering if im blind or missing something in the blackboard.
Hello ! I would like to change the AI perception shape of UE. Is it possible ?
Currently, my AI can see with a Cone shaped AI Perception, but I would like it to be more of what TLOU used (which is basically the cone plus a circle around the AI).
Thanks !! 😉
You need to use the DetourCrowdController, but don't use RVO as it is a different avoidance system and will fight against the detour version.
You also need a DetourPathFollowingComponent if I recall correctly
Yeah, you can modify the source code to do that.. thats what I did. Had falloff curves and such. Basically treated the perception as a utility function
I know I should use that detour ai controller but any knowledge about what options become available or removed if I reparent my ai controller to the detour crowd ai controller?
I did not see detourpathfollowing component in your vids.
Maybe I missed it
Basically, should I expect anything to break from reparenting the ai controller to detour crowd ai controller?
You can either modify the source code or make your own sense. Making your own sense is a bit more stable as you don't have to worry about engine merges down the line.
No. Nothing should break down, unless you made changes to the path following component.
any tips for getting ai to see me when I am visible at the top of this platform? Not sure why they cannot see me..
seems like theyre all trying to hop up the jump proxy for some reason
Looks like a line of sight problem.
I went to the edge and nothing changed. Deleted the proxy and now they go around
I either put time into making the proxy work both ways, 1 way, or remove it lol. Maybe I can get the proxy to work later kinda lame that its in the template and breaks things to start with.
Its part of the controlled actor, not the AI controller. Problem is I'm not sure you can do it in BP. I did it as a subcomponent switch in the C++ class.
I did it and it is working 😄
Make sure your objects aren't blocking line of sight from each other.. same with navlink proxies and the like.. none of them should block visibility
Does the navmesh use the lowest LOD of each mesh by default to generate on?
I changed my LOD group reduction settings and have noticed a large speed up in navmesh generation
Hello guys. How I can get what location, which be received from hearing sense path exists?
sigh - my ST keeps crashing on the client 😭
@celest python Has your ST been crashing on client? I'm thinkin' about just putting the ST on the controller 😅
If you're putting the ST Comp on your AI Pawn, how are you making sure it is only ran on server?
@celest python Notice me senpai
I have a different way of initting characters in my project
Since they are pooled its dynamically created comps
On specific net roles
Now that you mention it, I guess I could add the component on possession. That only happens on server.
Memory access error in my moving task. Only happens on client. So I'm guessing there is some client specific shenanigans that are happening due to competing stuff.
Hmm, i think... The move to stuff is relevant
Rather than ST
Otherwise i guess ST memory thingy is cursed
Btw Client shouldnt run ST i guess? 😄
Especially a moveto
Its a pathfolloeing comp thing
Nah - it shouldn't. ST uses a brain component. Traditionally, BC is on the controller.
Controller doesn't exist on clients
I'm thinkin' the memory error is because of that reason btw.
Probably something deeper in the framework that has this affect. I didn't dig too much to be honest.
(i might go offline and answer back tomorrow)
But I know the MoveTo stuff is reliant on the AI controller.
ST is meant to used on actors and used actors on citysample afaik
Where st comp lives currently
I've been putting it in the Pawn. Seemed to make the most sense because of the data binding
Try checking the role on beginplay and init comp there
Yeah - that's what I'm going to end up doing. Except doing it on possession.
Possess also works but i thought pawns could get possessed or multiple times
If thats not the case
Possession only happens on server.
AIController only exists on server.
Win-win in my eyes 😅
Still pawns can get unpossessed and possessed by Ai controllers multiple times
But probably you dont do that
Because... Why would you xD
Exactly 😅
So yeah win win
Maybe my zombie can get in a car 🤣
Would be a nice game design
car driving zombies? whatever next
mind you, after four hours in a traffic jam I'm probably not far off 🙂
goddam it, just spent a day debugging and it turns out it was a trailing slash in a connection url string.. fml 😦
Uggghhh - and now, for w/e reason, I can't bind to previous tasks
Is it normal that move to does stop as soon as target is unreachable? shouldn't it still get the nearest it can to it?i even have allow partial path checked
Hello ! I am trying to make my AI hear sounds (in this case, a grenade).
The issue is that my Blackboard key for the location of the impact of the grenade is always set to "Invalid". It never takes the location of my Grenade.
You can see images of what I have done in AI_Controller (Image 1) and in the Grenade BP, after it detonates (Image 2)
Thanks a lot !! 😉
How do I automatically list enemies in my combat manager when they spawn?
when you spawn them you can pull off a reference to them and add them to your "list" somewhat like this
Thanks
er just checking - EQS shouldn't be to find an actor, right?
You can use EQS to find an actor or a location. If you know enough C++, it can find whatever you want.
I would first check that the sound event gets correctly registered using the gameplay debugger.
How do I solve this error? I tried setting it as a parent
But it's not working
I need to replace it
I don't suppose anyone knows where the interfaces section of the details panel went in 5.1 do they?
ahh, class settings
Thats a widget node (seen by the text Target is Widget)
Hmm, so adding an interface seems to not return a "does implement interface" of true.. curious
BP interface or C++?
Does it require an actual implementation for it to return true ?
it just checks if reflection data has given interface type in the class info
That should be a no then
Ha, first crash of the day.. seems like interfaces went a bit awry in 5.1 🙂
they didnt change
So adding a blueprint interface to one actor shows it in the editor to override, on another, which already had a function called something with a function name of the interface its adding.. doesn't show the interface 🙂
and then it crashes 🙂
haha.. what a numpty, I was implementing the wrong bloody interface!
guys need some help
i am trying to integrate chatgpt in unreal 5 can you help all help with a headstart
apprarently it does
httprequest is the way to go
If you can find a schema for the API, UE 5.1 introduced a new plugin where you can convert the schema to code and blueprints by dragging the schema into the content browser (schema comes from openapi api description in the demo I saw)
do you know how to integrate it ?
Well, yes I do.. I mean its an API right, you implement the API calls like they want and you get some return values in JSON that you parse.. search online for http and json in unreal engine
How can programmers create environments where designers, artists, and game logic work as one? Through intuitive data systems. Learn the art of storing data in Unreal Engine, as we analyze how different methods impact designers and/or help teams scale.
We’re excited to bring you sessions from Unreal Fest 2022, available to watch on demand: https...
Watch that video.. got most of the methods they have for manipulating data
specifically this for BP only stuff.. https://youtu.be/HOpyZ8552oA?t=1024
How can programmers create environments where designers, artists, and game logic work as one? Through intuitive data systems. Learn the art of storing data in Unreal Engine, as we analyze how different methods impact designers and/or help teams scale.
We’re excited to bring you sessions from Unreal Fest 2022, available to watch on demand: https...
Data tables are very useful, especially if you work with designers.
Hello !
I followed this tutorial to make only ONE of my enemies move to a sound location : https://www.youtube.com/watch?v=xWBawODyxC8
The issue is that I don't manage to make it work. I've done the same as him, except that I do not have a "Team ID". I am using Lyra Starter Sample so instead I am checking the Team ID of Lyra.
What do you think could be the issue please ?
Or, do you have any other ideas on how can I make it ??
Thanks a lot !! 😉
Project Files: https://www.patreon.com/posts/63395392 .
This is episode 42 of the third-person shooter series based on Unreal Advanced Locomotion System. Today, we are going to get started with how to make AI-controlled NPC characters work as a team. For example, when the player throws a rock near a set of enemies and they hear the noise. Acc...
if you followed the tutorial exactly except the teamID then that's the first place I would start looking
Yes but I don't understand what is the point of it, and how to convert it to my Lyra project :/
it ties the squads together that way when I ai gets the move to sound location they all do
And is it also what the Team system in Lyra does ? (because I have a Team ID in Lyra)
The only thing I have changed from him is that :
On the first image, it's his Blueprint (in his NPC_Character) :
- Before the "Is Valid" node, he got the NPCManager BP Actor, and after the Branch node, he Set it.
The Second image is my BP, with the Lyra tweaks.
Do you think it's the reason why it does not work ?
Thanks !! 😉
Inside a ai controller
I tried, and it is exactly the same problem :/
Instead of asking us to watch a tutorial and then try to figure out what you might have done wrong, it's better to explain what you are trying to do and how you did it.
What is the purpose of the code you posted?
My AI is able to hear noise, and to go to the noise location. The issue is that every enemies (that heard the sound) are going to the location.
What I want is that only ONE of them move to the noise location, while stop moving.
The code I posted previously is just a part of the tutorial. Basically, he created an actor to "manage" AI characters. And this code apply the AIManager BP to the AI enemies who belong to a specific team.
That's what I want to achieve, but this tutorial is the only one I've found on the Internet to do so. I also did not find any posts about this on the unreal forum.
Thanks ! 😉
hello, i have a question regarding stop on overlap option in behavior tree how can i make this checkbox clickable? thank you in advance
Thanks for the context. From what I can tell from the code you posted is that the tutorial is finding the AI manager for a specific AI team, but you are trying to find an AI manager for the PLAYERS team. I think what you might want is get pawn instead of get player pawn in the 2nd Find Team From Object
You have to uncheck Reach Test Includes Agent Radius
Try the other reach test as well.
same thing
You have them both unchecked?
yup
I'd have to look at the source again, but I'm not 100% sure that's even used anymore. The reach tests is how you control how it stops on overlap.
Actually what I am trying to do, is to get the player team, and then to apply to the AIManager "TeamID", the other team (if player is in team 1, then AI is in team 2, then TeamID should be = 2 ; if player is in team 2, then AI is in team 1, then TeamID should be = 1)
But actually, I remembered that I set my AI to be always in Team 1, so I force Team 1 on the Team ID variables, and it's still the same, my AI go to the same location :/
thanks, kindly let me know if you found something. it works with the "move to actor node" but i wanted stuffs like this to be on behavior tree as much as possible.
Any idea on how to prevent findpathtolocation from being too close to wall?
Do we know if movable smart objects are planned for 5.2?
I've been watching a few Behavior treee videos, it seems all the logic is used in Tasks, and AI controller. I wonder what AIBlueprint is supposed to do at that point. Mostly Animation?
Animation is usually done in Animation Blueprint
Which again leads to be question besides displaying the meshes and components, what does actor/pawn blueprint supposed to do?
If the pawn/character is controlled by a player, you can put the controls logic in there. That way if you have multiple pawns with different controls in a game that the player (controller) can possess, it's easy to switch them including controls.
I also put health points there, death effects and events, etc. Which applies for AI as well.
Hello, does anyone have an issue with navigation not working in a packaged game?
Heya folks - I've traditionally used custom AI systems, even with my unreal work, but I'm looking to learn the stock unreal implementations a bit better. I prefer working in C++. Anyone have any tips on guides or videos about best practices to help me ramp up properly?
As an example, it looks like you would define your blackboard and keys in blueprint and use a blackboard component to manage the values in C++ on your custom controller. For creating behavior nodes it looks like you can do custom C++ implementations, but it almost seems just as easy to expose C++ functions to blueprints and have the behavior tree execute a blueprint call that shells out to your C++ implementation. Overall just trying to get the feel on how someone with more experience would approach building things in these systems vs. the standard intro tutorials I'm finding.
Maybe as one other example - I could run a LOS check as part of my actor tick and write the result to the blackboard and check it in a decorator, but maybe it's preferable to just write a custom "HasLOS" decorator so that the actor tick doesn't need to be enabled and the behavior tree can manage how often it needs to run that check?