#gameplay-ai

1 messages Β· Page 68 of 1

coral widget
#

which is the right channel?

misty wharf
#

Yeah that's what I thought

pallid mica
#

Yeah I can confirm that. He always sang "I'd catch a grenade for ya." whenever he died to his own creations.

slow bobcat
harsh storm
#

Is zonegraph even still actively developed?

pallid mica
# coral widget which is the right channel?

If you have problems with Lyra specifically, probably none, as we aren't really serving specific Example Projects.
There should be a Lyra specific Discord Server you can join, but I have no clue what the link is.

slow bobcat
pallid mica
#

Not sure it's actively being developed. Would need to check recent commits.
I coded a copied zone graph from scratch and mixed it with NavMesh for a Pedestrian Simulation with Mass.
The architecture of the ZoneGraph is pretty boring tbh. Most of the code is just to keep the arrays flat and draw the scene proxy.

coral widget
#

i have a fps bug!

pallid mica
coral widget
#

i have 1-3 fps on lyra? i have 16 gb ram and rtx 3050? i should have 60 fps without any alggs and problems

slow bobcat
# coral widget which is the right channel?

For the Nth time, #profiling is your best chance. That's where people savvy in performance gather. But not asking the shitty question you asked already.
Post a screenshot of your hardware setup, of the gsme running with visible fps and tell the you have 16gb of ram, so they can explain better what we already told you about cache memory constant swapping

coral widget
#

really no one know? waht i can do? the problem musst be some settings etc. my cpu nad gpu is on 10%

harsh storm
pallid mica
#

If you only have those issues on Lyra, then you need to go to the Lyra Discord Server as I said.

#

Rightclick -> Apps?

low stump
coral widget
#

i have this problem in any project

pallid mica
slow bobcat
pallid mica
harsh storm
#

I'm mad that my gif isn't showing

#

How can I report Tenor?

pallid mica
#

I mean the reason I'm here is cause they got reported.

harsh storm
#

Tenor is busted 😭

misty wharf
#

Oh yeah it is

#

could just be discord

harsh storm
#

It normally is

slow bobcat
misty wharf
#

It might not have been you lol

pallid mica
#

Ah all good, I was just curious cause silvers already has 2 strikes.

harsh storm
#

Don't apologize to a mod for them doing their volunteer job!

misty wharf
#

Epic should honestly pay mods here somehow, pretty sure they have the means to do so

#

This is like about as official as it gets at this point I think

harsh storm
#

I love Cedric - but I'd rather they put that money into 2D tooling 😠

misty wharf
#

just use Unity

slow bobcat
pallid mica
misty wharf
#

:D

pallid mica
#

Does that pay the mods? Absolutely not. Nick keeps that all for himself for paying the Bot hosting and I guess himself.

#

Β―_(ツ)_/Β―

pallid mica
#
  • reporting them fwiw
harsh storm
slow bobcat
near condor
#

Little state tree issue I was hoping some of you may be able to help me with. I tried watching videos and reading guides but I think this concept is still tripping me up! Help would be incredibly appreciated! Thanks in advance!

slow bobcat
silent hamlet
near condor
silent hamlet
#

Ah, but the enter condition is on the group

near condor
#

The intention would be when Engage is triggered, Execute LetAlliesKnowIAmEngagedWithTheTarget, then a 30% chance to enter the group for MoveAroundTarget, and if not entered, continue to PrepareToAttack. Am I missing how the EnterCondition Random works?

silent hamlet
#

You set it up on the group so that means that the group has a 30% chance of being entred. If you want that to apply to the child you need to move it to the child themselves

#

Or maybe as exit condition of the group

#

Sorry exit transitions

near condor
#

Ahhhhh Okay that makes a lot of sense actually

#

Thank you so much

coral widget
#

brunooooooo

#

why you people dont know after 10 years?

#

thta in window engine

#

you have change streaming pool size from 70 to 0

cyan sigil
#

Hello. Got kind of an advanced question: I'm working with a custom codebase and it looks like when I generate a path it's generating only the start and end points, but the Corridor has several polygons inside. Is it normal to have so few Points in the path?

slow bobcat
#

But the corridor holding your path will have the polygons from the nav data that your path crosses

last marlin
#

Has someone tried building a NavMesh for a USD stage actor?

misty gale
#

Is there some bug with BT's or AIC's in 5.5 ? Can't think of a reaon my BT's disappear at random times

#

might've just been my logic , having the tree's on a pawn or smth

misty gale
#

Same thing happens with it on the AIController πŸ€”

#

5 controllers, 5 active AI pawns, 4 BT's

near condor
#

Hey all, another question with State Trees: How are you all handling AI Move To nodes in your tasks? Honestly, with how they operate in states, I feel like that is a general enough of a way to ask, but if more details are needed, I can provide them.

misty wharf
#

Yeah more details would probably help because I'm not quite sure what the problem here is

near condor
#

Rats

misty wharf
#

Because f.ex. you have a MoveTo task and.. that's it?

near condor
#

So

#

AI Move To nodes has a Success and Failure Branch, and I feel like I keep tripping up on getting the state tree to not try to transition until the move is finished... Do I need to actively monitor the results of the AI Move To Node on the Enum Output?

misty wharf
#

Don't call finish on the task until the move finishes

#

That should really be the only thing you need

harsh storm
#

I just use the built-in move to task

#

But if you have a custom one, really should only call finish task when the move to is actually finished.

#

So you'd be binding to delegates or pulling off the succeeded/failed pins in BP for the node.

plain epoch
#

Hiyas,
If an AI steps off the navmesh, is there any function that gets the closest navmesh point so it can manually walk back on?

misty wharf
#

project point to navigation

plain epoch
#

I have an issue with AI constantly going off the navmesh and then basically being stuck forever

#

Ooo, thankyou

maiden sluice
#

Wondering if anyone tried to do Root motion walking for AI Pawn from Nav Mesh / Path Component. Or do unreal has sth similar. I am coding in C++

slow bobcat
# maiden sluice Wondering if anyone tried to do Root motion walking for AI Pawn from Nav Mesh / ...

I have. Long to explain but what I basically do:

  • root motion just moves they AI forward
  • I have my own move request object that can tell me with a flag if the AI moves with root motion or not
  • in the path following component I check that flag and, if true, I make sure that, when starting a new path segment, we set the focus to look at the end of the segment. That way the root motion will move the AI following that path segment.

Other people use Motion warping to directly force the root motion towards the path direction.

maiden sluice
slow bobcat
maiden sluice
harsh storm
#

I was about to have to correct Bruno. Glad for that edit. "There's no such thing as the path following component"

#

I was ready Bruno...I was ready.

cyan sigil
slow bobcat
cyan sigil
#

I'm wondering if there's some problem with the custom navigation code, or if having so few points is normal.

slow bobcat
cyan sigil
#

Can't post the screenshot due to NDA reasons. I'll try to describe it.

slow bobcat
#

In reality we just need to see the nav polys/corridor and your path. Nothing else matters

cyan sigil
#

Looks like this codebase doesn't have a Navigation category. 😠 I'll try to find the equivalent.

slow bobcat
cyan sigil
#

This is unreal 4.27 fork, if that matters

pastel moth
#

in order to use ai state tree components do they have to be a component on the AI controller?

slow bobcat
slow bobcat
cyan sigil
slow bobcat
#

Yeah

#

Then pause or stop, right click navigation category - > display only this and check what's going on selecting the markers

misty wharf
slow bobcat
misty wharf
#

Fwiw they have very little difference, I think the AI variant just allows you to get a ref to the AI controller from the state tree schema's context variables

cyan sigil
slow bobcat
cyan sigil
slow bobcat
cyan sigil
slow bobcat
cyan sigil
slow bobcat
vapid laurel
#

πŸ‘‹ Hi, I'm making a game that will require large crowds. I've just made a few test levels to get a baseline FPS for 32, 512, and 1024 enemies. Currently I'm using a quickly thrown together AI character that uses AIPerception and a simple chase-the-player behavior tree. This works fine for the 32 Ai character level, but on the 512 level the AI behavior simply stops functioning. Any idea why this might be the case? I've already increased the CrowdManager.MaxAgents to 1024 in project settings, to no effect.

Ultimately, I wont be sticking with this AI setup long-term but I'm just curious why this would be broken. Probably will be implementing the Mass system and then using Niagra to simulate even more characters in the distance

harsh storm
#

Define "stop functioning"

#

Because with 500 AI, you're entering mostly custom work territory.

#

So "stop functioning" could be that you are not longer playing a game, but instead watching a powerpoint.

misty wharf
#

At 512 it's potentially also perception timeslicing just slicing it pretty hard so there's enormous latency in the reactions

#

Since it's rather likely that a quickly configured perception system is gonna attempt to make 512 * 512 linetraces at that point :P

vapid laurel
#

Oh, FPS drops to 18 that's for sure haha. Definitely not performant. But by "stop functioning" I mean the AI characters will still play their idle animations, but wont perceive my player character or start to move. Its not like there's a delay, it just doesn't happen anymore

harsh storm
#

AI Perception & Crowd manager are two different things.

#

I'd explore the perception to see if there is any limiter like that. But you may also need to go a custom route with that as well.

vapid laurel
#

Ah okay. Probably wont bother investigating further, was just wondering if there was a simple answer.

When you say custom work, are you implying that the Mass system + Niagra wouldn't be capable of handling my needs?

harsh storm
#

Considering mass doesn't have perception - yes.

#

And Niagra also doesn't have perception

vapid laurel
#

So roll my own on perception for the stuff spawned by Mass is what you're saying. Got it

And yeah I was thinking niagra would be far-distance entities to just make things appear larger. No AI there. We'll see on that front, performance-wise it may make more sense to just essentially play a looping video

I've also been eyeing the new Instanced Actors feature (https://dev.epicgames.com/documentation/en-us/unreal-engine/unreal-engine-5.5-release-notes#instancedactors) though documentation seems pretty light there. But from what I understand this would allow for basically a pipe of

  • Outside playable area = Niagra/video, animations but no movement or only basic movement
  • Within playable area but far from player = Mass, simple AI
  • Near player = Instanced actors, full blown AI with perception
Epic Games Developer

Overview of new and updated features in Unreal Engine 5.5

slow bobcat
# vapid laurel Oh, FPS drops to 18 that's for sure haha. Definitely not performant. But by "sto...

Perception has a problem where all the actors are placed in an array, then processed based on frame budget and... Due to how things are ordered, when you have over 30/40 actors, some may never retrieve the update because they are always at the end of the collection. I had this problem in a game I released and I had to implement an LOD system to handle it. Perception is not in tented for large numbers

vapid laurel
languid meadow
#

After updating to Unreal Engine 5.5 my AI Controller wouldn't sense a target anymore. I spend an hour debugging and nothing turns up - I then try rotating it 90 degrees (yaw) to point directly at the target and it works! I counter-rotate it back (-90 degres yaw) and it still works 😡 😩

cyan sigil
#

@slow bobcat I've managed to recreate the setup in a fresh project and I am seeing the same problem. I have an AI pathing from the green sphere to the red sphere. THe pink line is me visualizing the points in the path, which do not obey the ground at all. What do I get instead if I want to see the actual route the character will follow?

#
{
    // Get the path somehow.

    const FNavPathSharedPtr PathInstance = GetPathFollowingComponent()->GetPath();
    if (PathInstance == nullptr)
    {
        return;
    }
    TArray<FNavPathPoint>& pathPoints = PathInstance->GetPathPoints();
    for (int i = 0; i < pathPoints.Num() - 1; i++)
    {
        FVector FirstPoint = pathPoints[i].Location;
        FVector SecondPoint = pathPoints[i+1].Location;
        DrawDebugLine(this->GetWorld(), FirstPoint, SecondPoint, Color, false, Time, 0, Thickness);
    }
}``` This is the code I am using.
slow bobcat
cyan sigil
stiff gale
#

How do you disable everything of an AI character? I spawned 200 AI characters. I disabled everything in EventBeginplay, but still running 22fps.

#

Maybe I'm doing it wrong

dense owl
cyan sigil
#

Apparently it's actually the MoveComponent that does most of the navigation stuff, not the Path Following Component. I've got more research to do.

vapid laurel
cyan sigil
#

So does anyone know how to preview a character's pathing when PathPoints only generate the start and end?

unreal kernel
dense owl
stiff gale
#

I disabled all of my AIPerceptions? Why I am still seeing Sight, Compute Visibility calls over 300?

slow bobcat
slow bobcat
cyan sigil
stiff gale
slow bobcat
#

don't know about the Deactivate part, but the second line is wrong.
You need to pass the class of the sense you are using, otherwise the function will not do anything

#
void UAIPerceptionComponent::SetSenseEnabled(TSubclassOf<UAISense> SenseClass, const bool bEnable)
{
    const FAISenseID SenseID = UAISense::GetSenseID(SenseClass);
    if (SenseID.IsValid())
    {
        UpdatePerceptionAllowList(SenseID, bEnable);
    }
}```
You will never get an ID passing UAISense::StaticClass().
If anything you need to call it like this (asuming you use the ones in the engine)

`AICtrl->GetAIPerceptionComponent()->SetSenseEnabled(UAISense_Sight::StaticClass(), false);`
#

and have a call per sense

stiff gale
#

per sense? i will try thanks

slow bobcat
#

Try with sight and check metrics again. The 300 calls should go away

stiff gale
slow bobcat
#

You can check what the BP does in code, maybe you are missing some function somewhere

#

@stiff gale since you are in ue4, can you check something for me please? Can you look in code for "move away from corners"? can you tell me if, like in ue5, it's just a flag or if there's a function for it? UE5 has the flag bUseBetterOffsetsFromCorners but I recall UE4 having a different thing that was quite bad. I want to check if that changed much since then.

stiff gale
#

ue5.5

slow bobcat
#

ah sorry! wrong tag!
@cyan sigil , can you check it for me please? Would save me from downloading UE4

cyan sigil
#

Sure. I will check in the morning.

slow bobcat
#

appreciated mate

low stump
#

Does anyone have any experience with exporting a navmesh to a file and then reading it from file for pathfinding?

#

https://forums.unrealengine.com/t/how-can-i-export-navmesh-data/1846323 I've seen multiple similar posts to this one, and though if maybe someone here has more information

uneven moss
#

hello, why does it create navigatable location under my mesh? i would like the whole area under my meshes to be non navigatable

silent hamlet
#

On the actor

uneven moss
#

i want it to affect the navigation. But i wont it to exclude all the area, even the area below the actor.

silent hamlet
#

Affect navigation yes that's it. That one should be on. If it is already maybe there is some gap in the collision? Might be worth to check that

uneven moss
#

found it, it had to do with the collision on the mesh

#

thank you

lament hemlock
#

Does anyone know of a tutorial on how to use DetourCrowd? I've been trying to get it working for days but can't seem to find a lot of information on it. It took a little to get it working and when I did I found OnMoveCompleted() doesn't work anymore and I've failed to find more docs/tutorials on it.
Can anyone point me to a tutorial or docs explaining it a bit better?

misty wharf
lament hemlock
misty wharf
#

look at the code for the detour controller, it should show you how to correctly do that

#

all it does is it just replaces the path follower, I think your approach would still end up creating the other one which might be the problem

lament hemlock
#

I have been looking through it's code a bit, which has helped. I was hoping for a idiots guide somewhere on the web!

misty wharf
#

Unfortunately I'm not sure if one exists :)

#

Setting the path follower comp to the correct one should be sufficient to get your AI's avoiding each other at the very least though

lament hemlock
#

They do, I can see the difference, which is why I really want to work all this out.

misty wharf
#

Ahh I see

#

Yeah information on how to tailor the functionality is pretty limited as far as I'm aware of

static flint
#

Theres no FinishLatentTask in StateTree?
How to use StateTree then?

There is a thing called UStateTreeTaskBlueprintBase::FinishTask but it literally checks a bool every tick which is what I'd like to avoid

narrow mason
#

To finish a task in State Tree, you return a "completed" status from your task EnterState, or Tick functions. A completed status is either Success, Failed, or Stopped. Stopped actually ends your tree

#

I don't really like blueprint tasks cause I think they can be done better and I work mostly in C++. But if I wanted to write my own implementation, its pretty easy to do tbh.

static flint
#

You can schedule tick when its needed (e.g. for a delay task)
But you don't always know the exact timing of a task

#

E.g. you don't know when montage ends

#

Thats how its done in BT:

void UBTTask_PlayMontage::OnMontageEnded(UAnimMontage* AnimMontage, bool bInterrupted, UBehaviorTreeComponent* BehaviorTreeComponent, uint8* NodeMemory)
{
    if(BehaviorTreeComponent)
    {
        FinishLatentTask(*BehaviorTreeComponent, EBTNodeResult::Succeeded);
    }
}
#

This one doesnt tick every frame

narrow mason
#

Yeah, I can see the issue. So, here's the thing. Mass State Trees don't tick every frame either and actually solves this problem you're having. Its a bit complicated to explain, but the gist of it is that OnMontageEnded would tell the state tree to tick. So the Tree's tick function isn't called until the Montage has ended. Then, inside the tick function, you check if a bool is set (you can set the bool from the OnMontageEnded function also), and return a completed status.

#

You're still checking a bool, but remember, the tick function is only called once rather than every frame.

static flint
narrow mason
#

To acheive something like this with UStateTreeComponent, you basically have to write your own component and modify the behaviour.

static flint
#

I'll take a look at 5.5, maybe theres some changes in that area

#

As theyve promised updated statetree runtime

narrow mason
#

Probably not for this particular thing. But hopefully some long needed improvements

static flint
#

At least thats a relief Im not alone to think this is a problem to tick every single frame in every single running task

narrow mason
#

For smaller scale games, its not really a problem. But its a bit annoying that you have to modify your logic to match the tick style of the tree. Which means you need to know how the tree ticks. Not a very good API imo.

#

Can't reuse the same tasks for different styles of ST tick

solid spire
#

I've got a state tree question:
I've got my own high level decision making layer to say what state I'd like the ai to be in. So I use linked state trees a lot (or I fire off a parallel tree and wait for the result), so I make use of state tree parameters to instruct those linked trees.

Now sometimes I'll have, say, an "attack target" state tree that takes a target and some attack data. If for some reason my ideal target changes I'd like to cancel out of that state and re-enter with a new target. By default this will end up being a 'sustain' transition at best. And while there's a lot of ugly things I can do to support that, I'm running into an issue:

the parameters of a state seem to be cached upon entry, and don't get updated if we sustain (try to 're-enter') a state we're already in.

Is anyone familiar with this situation? Any smart workarounds or better philosophical approaches to what I'm trying to do?

silent hamlet
cyan sigil
cyan sigil
#

Okay, I've determined that the difficulty I've been having with path re-use is simply that in my test scenarios the nav polygons are quite large and a unit has to reserve the entire polygon at a time. If there's only one on the surface, then all units will cross it with maximum efficiency (corner to corner), resulting in single-file pathing. What I need is some way to identify areas of the map to be broken up into more polygons.

stable plover
#

I have a question and I dont know why this isn’t in unreal engine yet. why can’t we bind to linked assets for state trees yet? if anyone can tell me why that would be awesome

solid spire
#

You mean the asset itself? I think parallel trees will open this up in 5.5 but I haven't tried them myself yet

#

LinkedIn trees are statically bound I guess is the reason

slow bobcat
restive loom
#

How would I make my npcs avoid objects and continue to their destination?

misty wharf
restive loom
#

I was thinking of a trace but that didn't really work

#

At least the way I did it

misty wharf
#

if it's other npc's, you might want to look into crowd avoidance or rvo avoidance

restive loom
#

Well what if I want to avoid objects in general

#

Like if a car goes in front of the npc

#

Line trace should work but the going around part is a bit harder

#

That's my issue

#

I tried to do some code but it definitely didn't work

misty wharf
#

More complex ones are kinda beyond me but maybe someone else can help. I know you can customize crowd avoidance, but I'm not sure how well it would work with something larger like cars

restive loom
#

Shouldn't this work for going around actors?

misty gale
#

That assumes the actor is directly in the crosshair. Theres 100q cases where it's not

near condor
#

I feel like I am missing something incredibly obvious here...

When State MoveAroundTarget is entered, it triggers a task that checks if the AI should decide to strafe or not (I stripped this down to a simple 50/50 int check for true or false)

As mentioned in the image, when the task is marked as failed, I would like it to transition to PrepareToAttack, but this transition is never triggered. It almost seems as though the task is reran until it gives back a true/Task Succeeded result.

Unreal Engine 5.4.3

Help would be greatly appreciated in understanding what I am doing wrong.

misty wharf
#

@near condor Hard to say, looks correct to me. I would check using Visual Logger what kind of transitions get triggered from it

#

You could also try using the ST debugger, it might show something useful about it, can't remember the specifics

near condor
#

Working with the ST Debugger right now (kinda wish it could show this information in a cleaner way... not sure how I would structure it though... Maybe Raw JSON honestly).

However, I added another check to the debug string in the blueprint, one to check the result of the bool within the task, and another to check the result of the bool on the ST_AIActor.

And even though I am setting the variable on the actor, it is switching sometimes?

wise sluice
#

WHy not structure it using enter condition instead?

near condor
#

Those were not working either when I attempted that.

#

That was the first way I tried it

wise sluice
#

You need to be careful about the transition that you make, if you use "Go to Next State" and you point to a state with condition, if it fails it will redirect you to Root

#

Due to an error similar to "Failed to execute transition"

near condor
#

Understood. I am not using any enter conditions

wise sluice
#

Ah that's an STE that drives your STT ?

Kind of hard to follow the logs

#

What about your StateTreeDebugger ?

#

You showed us your console logs

near condor
#

The STE is just toggling an enum for what overall state the enemy is in based on the facts the enemy knows.

#

Sure, getting StateTreeDebugger info

#

Part 1

#

Part 2

wise sluice
#

So all your tasks are instantaneous ?

#

In one frame, all your task got executed
From "MoveAround" to "PerformAttack"

#

And you did a full loop

near condor
#

I think the answer is yes, but not sure how else I would configure that? Whatcha thinkin?

wise sluice
#

Is there any move to, animation that should happen?

near condor
#

Oh yeah it does have one

wise sluice
#

So, you should keep the task running until it's finished

#

Don't call Finish task if the job is not done

#

You can do event based logic

#

or use the tick if you don't have any event to hook

near condor
wise sluice
#

Also if you want, you can do your game logic in one task and never call finish
And let other task such as "PlayMontageTask" or "Delay" or anything else finish the current state

wise sluice
# near condor

This one is ok, so you should see your AI move and the state should end when movement ended

near condor
#

Right, and that happens

wise sluice
#

Okay so what about an other one (any, don't leak everything if you care) ?

near condor
#

but the one I posted earlier is the problem

#

The one in this:

wise sluice
#

I think it's ok, it's instantaeous

#

And it redirect to another state that has a task that is also instantaneous no ?

#

PerformAttack seems instantaneous from the StateTreeDebugger

#

PrepareAttack is only checking if the AI should reload
If not, it goes to the PerformAttack but if this one finish the same frame it got started, that's a problem

near condor
#

Prepare to attack can be instantaneous if the enemy doesn't need to reload, then it executes Perform Attack, then back to Root, and since Evaluator I am using still says "The ST AIActor is in the Engage State since the Player is in sight, then I should go from Root, and only enter the Engage State in the tree"

So from Root, it enters Engage again, and in theory, if the MoveAroundTarget were to fail in the way I want it to, I want it to sometimes fire another shot. It should be a 50% chance for it to fire another shot or move to another position. Right now it is is acting like Fire, move, fire, move, on repeat. And sometimes that task in MoveAroundTarget seems to be executed rapidly multiple times in a row.

near condor
wise sluice
#

And do you wait the ability to end?

near condor
#

I suppose not huh

wise sluice
#

No, it's finishing the task as soon as you started the ability

#

Don't call Finish Task true

#

You could call "Finish" with by adding an event that wait for the ability to end

#

Not sure about the native solution that you could use there cause i did a lot of changes to expose ability functions

near condor
#

I do not mind adding native functions, I already have a blueprint library that I created in C++ if you have any tips you would be willing to share

solid spire
wise sluice
wise sluice
near condor
wise sluice
#

Another solution is to send a statetree event once the ability called "EndAbility"

near condor
#

Ohhhhhh very good idea.

#

that can be done easily. AI abilities in my setup are abilities the player can use as well, just toggled via a bool to use the AI logic vs the player logic haha

wise sluice
#

You're welcome πŸ˜„ !

near condor
#

ugh I can finally move on, I know I just said thank you but seriously this is great

stable plover
#

This is what I mean for more clarity

#

Its just static

midnight scroll
#

Working in a state tree task, that is ran by an StateTreeAI component, how can I access the AIController in the task?

solid spire
# stable plover yea the state tree asset itself, its just static, it shouldnt be hard to have a ...

I'm not sure how unreal is handling things behind the scene but I imagine they can optimize their memory usage by assuming that the linked state tree will be the same for everyone who uses that state tree asset. If it was a binding it would imply an instance that could be different for everyone.

Parallel trees will allow you to do what you want in 5.5. I made my own task to do that in 5.3 but their implementation is looking more robust.

fiery hemlock
#

I have made a custom nav modifier volume and try to use it in an EQS Test. Things look nice when playing with my EQS Test Pawn, first image. But as soon as doing this Test in a BT, it fails:

#

It is related to the Do Complex Volume Test, but that is what I need to follow the shape of the volume. How can it be, that Testpawn and PIE delivers different results? I have made some Blueprint code using Projection etc.. and can achieve working results, but really would like to do it with EQS, because I believe, that's a much more elegant way. Writing my own EQS Test could be some option, but needs C++ AFAIK. Should be no problem, but I would like to keep the project blueprint only, as it is a simple and small one.

stable plover
stable plover
#

in your task create a variable of that type

#

also put it in a category called context so it binds automatically

#

then viewing your task in the state tree you should see that the variable in your task is bound

silent hamlet
solid spire
silk fulcrum
#

Does 5.5 let a sub tree you run in a state tree (linked asset) be dynamic? i.e. passed in at runtime?

solid spire
#

I think I misunderstood something. I was under the impression that parameters were cached when entering a state, but you're right they're not.

I'm gonna re-evaluate my design

stable plover
#

but ima have to look at 5.5

#

Also would anyone be available for a discord channel call about state trees? I have questions about events, practices and modularity that writing about wouldn’t solve. If anyone can that would be appreciated, thank you

slow bobcat
cinder crag
#

Can I make hybrid system for pawn.
Say like I want to drive my vehicle and also should work like companion AI

slow bobcat
cinder crag
#

For example Batmobile in games follows player as well as controllable

slow bobcat
#

Aah... Yeah should be doable. I'm pretty sure there's a talk about this from an unreal fest but can't remember which one or what was about.

slow bobcat
cinder crag
#

I found this. Have to give it a try https://www.youtube.com/watch?v=mNtm2fAHObg

Done on UE4 4.24
Got a question about being able to iterate through the various sets of pawns that are assigned to a player controller and a way to get AI to possess and follow the player.
I also wanted to extend upon the last video I did with some more information that hopefully will help give some ideas to branch out on for both AI control and...

β–Ά Play video
pastel star
#

Is there a way to have nav mesh use complex collision instead of simple? I'm having issues with AI seeing tunnels as walls because of this, when i change the simple collision of a tunnel to have a hole in the middle it works just fine but i don't want to do that for every single object that AI needs to get close to.

cinder crag
#

NavLink Proxy And Smart Links would be helpful !?
But I am not sure

pastel star
solid spire
ocean delta
#

does anyone know where i can find more information on state trees? in particular i'm wondering if i can get them to appear on the gameplay debugger overlay and i'm wondering simple things like should they belong on the controller vs. the pawn, and why the debugger is not working, etc.

silent hamlet
ocean delta
#

the only way i can get the state tree to work is if i attach it to a behavior tree on the controller and then run the tree using a BTTask

#

this works in the state tree debugger

#

but then the issue is i don't know how to access the state tree. i guess i have to do it with evaluators

#

ah, instead of setting this as a parameter, i could potentially just reach into a variable in the actor itself i guess

silent hamlet
#

You can run them from anywhere. Running a state tree from a bt is a very weird setup. Why can't you just run it in whoever is the owner?

ocean delta
#

i can, but it's not appearing in the debugger

silent hamlet
#

Oh boy, ok. I have never done deep state tree debugging. I know there was an article from epic that showed how to debug state trees using the visual logger but I'm not familiar with this, which i think they added in recent versions

#

Anyway im pretty sure the intention was not to make it debuggable only if ran via bt task

ocean delta
#

that's okay, i got what i wanted with evaluators

slow bobcat
#

And no, your only debug is the st debugger. If you want more options, you need to grab the state tree debugger object in code and print the events. There 0 documentation about it, but you can follow the code. It's not straightforward but... It's soemthing

slow bobcat
ocean delta
stable plover
ocean delta
#

why does my state machine always want to go back to root? is there any way i can make it stay in the attacking state?

#

it's one of the things that drive me crazy about behavior trees. it looks like the same thing is happening in state trees. i want it to stay put!

#

so turns out i can delay it forever, and that does the trick

#

interesting, but then on tick i have to specify the transition

ocean delta
#

it'd be really nice if i could get the state tree debugger to work without a behavior tree... i'm running into a use case now where i want multiple state machines running at once

#

ah, interesting. the reason the debugger doesn't work is because the state tree itself is actually not running even if i start its logic

#

the code never lies

ocean delta
#

wow i'm in love with state trees

#

this is exactly what i've been looking for

#

this is one of their better designed systems

slow bobcat
slow bobcat
slow bobcat
slow bobcat
slow bobcat
ocean delta
#

seems kinda weird that the MoveTo task works fine for moving twoards my character but if you bind a vector it doesn't work... πŸ™„

restive loom
#

How can I stop ai move to?

fiery hemlock
# slow bobcat I'm a bit confused. You are spawning a nav modifier volume in an eqs test?

I simply want to have an arbitrary shaped volume to use in an EQS Volume Test. I created this in Brush Editing Mode and converted to a NavModifier volume, nothing gets spawned. The NavArea assigned to it is simply derived from NavArea only changing color, nothing changed in cost. Using the EQS Testpawn shows, that it detects the shape and delivers correct results, isn't that the use case for volume tests? I do not understand, why the same EQS Query run in the BT on an NPC does not return any results? All Points fail, with that physics error message. But I did some other test, inspired by that keyword "Physics" - so converted another volume to a Physics Volume now and doing the same EQS Test just with that. And this seems to work. Need to verify everything, but it looks like this solved the problem. Still the question remains, why other volume classes like NavModifier are available in the dropdown for Volume Class in the Test Details, if a physics one is required for a Complex Test. Looks like I did simply not read the hover help carefully enough, stating that it does a Physics test - better, the option should not be shown at all in that case. And, the question remains, why does the EQS test pawn handle this correctly?

misty wharf
#

It checks whether the generated items are inside a particular type of AVolume, from the volumes which exist in the level

fiery hemlock
#

Just did more tests: Removing collisions from the physics volume makes the test fail for this as well. So Doing Overlap All Dynamic on the NavModifier volume - and it seems to work. And I prefer this one, because it allows to have a color to show the shape.

misty wharf
#

As long as the volume exists in the world before you run the test it seems like it shoul work regardless of volume type

#

It just calls IsPointInsideBoundingBox and EncompassessPoint if complex checks are enabled

#

These are checks done in just maths as far as I know, so any kind of collision etc. settings should have no impact

fiery hemlock
#

My tests show, that the collision settings on the Volume definitely influence the result when being in PIE with the EQS Query run in my BT, while the volume type (navmod or physics) - both work as you say. The EQS Test pawn in Editor is indeed not affected. For now, I observe the desired behavior for my NPCs with that collision setting. I definitely need to recheck this, thank you for the replies.

misty wharf
#

You can check EnvQueryTest_Volume.cpp maybe that'll help, it does seem like something else might be going on here that isn't caused by the EQS test itself

fiery hemlock
#

I already had a quick look into this, just found the checks for the different flags, doing list of volumes for the complex tests. Will have to go more deeply into the source code, it's always a good source for learning. For now, I'm happy that this works, so I can drop quite some Blueprint Code doing GetRandomPoint... and ProjectPoint stuff - which works, but EQS seems to be the more Unreal way of doing it πŸ™‚

ocean delta
restive loom
#

Anyone know how I could create a mechanic for my npcs to go around dynamic obstacles?

restive loom
#

Should this work for it?

#

Kinda already tried that

#

Yes ChatGPT works sometimes

ocean delta
misty wharf
#

If it goes into another state you need to figure out why that occurs, if the movement fails to reach the player, the visual logger most likely would have some indications of why that happens

ocean delta
#

they're turning around and not going to the start position

#

move to is failing

misty wharf
#

Ok, if the moveto fails check in visual logger for starters

ocean delta
#

AITask_MoveTo_25 is invalid lol

#

but why

misty wharf
#

πŸ€”

#

Is it possible the state tree transitioned away from the state which triggers the move?

#

This would be likely to invalidate the moveto

ocean delta
#

i will check

#

yeah this is interesting so the character turns around, which the move must have started

#

so maybe there's a transition

#

i actually don't see the transition at all

#

and i don't know why there's two executions

misty wharf
#

Hm.. Usually it would say why the moveto is invalid so I wonder if this is failing immediately because the move request is invalid

#

Maybe check that the location it's trying to move to is actually a valid location to move into

ocean delta
#

seems like a valid location to me...

#

im gonna download 5.4...

ocean delta
#

11>BastionAIController.cpp.obj: Error LNK2019 : unresolved external symbol "private: static class UClass * __cdecl UStateTreeAIComponent::GetPrivateStaticClass(void)" (?GetPrivateStaticClass@UStateTreeAIComponent@@CAPEAVUClass@@XZ) referenced in function "public: __cdecl ABastionAIController::ABastionAIController(void)" (??0ABastionAIController@@QEAA@XZ)

is UStateTreeAIComponent not available in 5.4...?

misty wharf
#

It should be. You are probably missing a dependency in your build.cs

ocean delta
#

        PublicDependencyModuleNames.AddRange(new string[]
            { "Core", "CoreUObject", "Engine", "InputCore", "ElectronicNodes" });

        PrivateDependencyModuleNames.AddRange
        (
            new string[]
            {
                "GameplayAbilities", "GameplayTags", "GameplayTasks", "UMG", "AIModule",
                "DeveloperSettings", "EnhancedInput", "StateTreeModule", "GameplayStateTreeModule", "StateTreeEditorModule"
            }
        );
#

i'm deleting intermediate and trying again

misty wharf
#

It might be in a different module than it was in whatever version you were using previously

ocean delta
#

it's in GameplayStateTreeModule

#

i guess i spoke too soon with state trees

ocean delta
#

so i guess one thing i'm not understanding is why my state tree has two executions

#

shouldn't it be in one state?

#

i think this is the root of the problem. for some reason my controller is both idle and disengaging

cinder crag
ocean delta
#

as an alternative i'm going to spawn an empty scene at the location and bind the move to the actor... what a mess

ocean delta
#

i figured it out. apparently having a transition on tick on the root isn't the best idea. it looks like it was killing the task immediately or something

misty wharf
#

Oh.. Yeah that sounds like it would just transition elsewhere every single tick

near condor
#

@wise sluice sorry for the ping, but I was curious, do you use events in your move nodes too? Like are you sending an event when they successfully reach a destination?

ocean delta
#

hey yall, how do i get my AI to stop rotating on the X and Y axis and only rotate on Z when using MoveTo commands? i can set something up on Tick to override the rotation but it feels wrong

#

also it's so confusing that unreal does not put labels on these rotations

stable plover
#

if so then just do it in there

#

disable the axis to rotate in, in the movement component I think

#

Also I have a question. In relation to state tree On Event trigger for states. lets say I have a death state, do i have to add that trigger on every state, or can i add it to the group that contains the states?

ocean delta
#

they are not my own move to commands, no. they are in StateTreeMoveTo

stable plover
#

for whatever it is I think creating a custom Move To would be a better work around

ocean delta
stable plover
ocean delta
#

set pitch and roll to 0 in my own look at call

stable plover
#

oh why didnt i think of that, i was just doing that with a actor a couple hours ago

#

πŸ˜”

ocean delta
#

XD all good but i was quick to blame the engine instead of my own code

dense owl
#

99/100 times it’s you, not the engine

#

Which is a good thing because it means you can fix it

silent hamlet
silent hamlet
#

destroy player character on death is probably the easiest. else you can notify the ai (controller) that target is dead with an event it can bind to

#

or there is an interface you can give to your characters where you can customize the logic ai uses to sense other actors and return true/false for sensed/not sensed. there you can return false if the player is dead

#

IAISightTargetInterface

#

i think you can only add it via c++ tho

#

to start out you can look into dispatchers. have the player dispatch a "Dead" event and the AIcontroller binds to it when it acquires the target

#

requires casting and it is not a general solution but if you are just starting out it's the easiest thing that comes to mind

fiery hemlock
#

Trying to go into Random EQS Generators using Blueprint only: having a simple generator to produce random points. The debug draws show, that points are found correctly. But no points are actually added to the results and log shows why this is the case:
LogEQS: Error: Trying to generate a Vector item while generator EQG_Random_C_1 is configured to produce Actor items
Looking into Source (5.4.4) code shows:

void UEnvQueryGenerator_BlueprintBase::AddGeneratedVector(FVector Vector) const
{
    check(CachedQueryInstance);
    if (ensure(ItemType->IsChildOf<UEnvQueryItemType_ActorBase>() == false))
    {
        CachedQueryInstance->AddItemData<UEnvQueryItemType_Point>(Vector);
    }
    else
    {
        UE_LOG(LogEQS, Error, TEXT("Trying to generate a Vector item while generator %s is configured to produce Actor items")
            , *GetName());
    }
}```
My ***ItemType is set to Point***, so the IsChildOf check should actually fail, because Point derives from VectorBase and not from ActorBase (which is parallel to the Point in the hierarchy under VectorBase). Looks like there's a bug here or did I miss something?
restive loom
#

Anyone got any idea how could I stop ai move to?

misty wharf
#

What's the scam?

silent hamlet
#

The scam I'm not sure but the sPam it's all over

misty wharf
#

Surely he isn't dumb enough to think this is a good way to find collaborators

dense owl
#

Go read the #rules and bear in mind this is an Unreal Engine server. Those skills are irrelevant here.

stable plover
#

Don’t know why you are advertising here in a unreal engine server

pure cradle
#

Hi I got a question I have create a goap based ai for my game and I would like to incorporate reinforcement learning by learning agent but I'm having a hard time to figure out how to combine the goap gameplay action into the learning agent manager action ? How should I approach it?

fiery hemlock
#

Does anyone have an idea how I could access the Array of Navigation Area Classes for a given Navigation Query Filter class at runtime? In Blueprint only? Or is it impossible at all?

slow bobcat
fiery hemlock
slow bobcat
#

@pallid micanew account created to circunvent the ban. Silvers is now MonkeyRufffy

slow bobcat
pallid mica
#

@slow bobcat please use the report function next time

#

Right-click the message, click on Apps, and report the message

#

Then other mods can also act

fiery hemlock
fiery hemlock
# slow bobcat let us know if anything changed, but looking at how the filters work and how the...

I'm experimenting to use NavAreas and NavFilters along with custom shaped Modifier Volumes created using brush editor - so that I can simply define custom shaped areas and have function like "GetRandomPointsWithinNavFilter"... this basically works, but I need to have NavFilters and NavAreas to be defined correctly. So it would be nice to pass in a Filter only and get the Areas automatically. The Areas are used to filter my nav modifier volumes before processing.

misty wharf
slow bobcat
misty wharf
#

Ugh, he needs some kind of help that isn't programming related it seems :P

slow bobcat
# pure cradle Anyone?

Not sure this is the right channel. For the GOAP questions sure, for the Machine Learning Reinforcement part... maybe #mass ?

#

not sure where does people anser better those questions

pure cradle
slow bobcat
pure cradle
#

But the learning agent in ue is specifically for c++ it have blueprint support

slow bobcat
#

yeah... I don't have a better answer honestly. I'm as confused with the topic as you are now

misty wharf
#

I find that folks on #cpp are generally some of the more experienced ones so it's easy to just dump random Qs there with the highest likelihood of getting a useful answer lol

#

Difficult questions on most other channels usually get ignored or get some "I don't know but maybe try this" answer which at least is someone making an attempt but ultimately doesn't solve it

#

At least this has been my experience :D

slow bobcat
#

A new channel for it would help a lot with the situation

low stump
#

Can someone explain to me why he isn't moving?

#

I have a valid navmesh, the npc is able to find a valid path but simply doesn't move...

#

This started happening after updating the project from 5.4.4 to 5.5

#

All I did after updating the project from 5.4.4 to 5.5 was:

  • Fix all redirectors
  • Resave the entire project
slow bobcat
#

What does visual logger say? Any info within the Navigation category?

low stump
slow bobcat
# low stump What is visual logger?

Your best friend. There's a pin post about it, if not Google will explain it way better than me, but pretty much a debug tool with visual information

low stump
cyan ivy
#

just saw this, thanks bruno!

wise sluice
hoary peak
#

I'm trying to figure out how to make a pawn follow a spline and not just walk from point to point(or make a character walk in a circle around a point without "strafe". I want the pawn to walk forward but in a circle) So far what I've found is a video where I would be able to tweak his implementation to make the pawn walk to the location of the spline and then the actor with the spline would set the relative location of that pawn. Is there a cleaner way?

misty wharf
#

You mean something like Character->FollowSpline() ?

#

If so - no. You would have to build it yourself, using something like what you described.

vale sierra
#

Hello, I have a question. I have an AI that chases my player in narrow corridors, but it seems to hesitate at turns and shakes. I was able to get better results by basing its rotation on its movement and setting the Z rotation rate to 180, and it's much better. However, I would like to keep a rotation speed between 360 and 540 while ensuring the AI follows the player smoothly in the corridors without hesitation at turns. I'm using a Behavior Tree with an AI Move To set up like this.

Does anyone know how I can achieve smooth movement in narrow corridors? I've also increased the navigation area in the corridors. Thanks in advance!

silent hamlet
vale sierra
#

Yes, the NavMesh is equivalent to that.

I tried reducing the cell size from 10 to 3, and it works better, but it's resource-intensive. Are there other methods I could use?

slow bobcat
slow bobcat
nimble smelt
#

How do I stop my AI from hearing just as well through walls?
It's a pretty simple AI using your classic AIPerception component, and my player pawn that registers sound events when moving.

#

I know how I'd hack it, have the controller figure out when it's looking at stimulus from hearing and do some line-traces, but I wanted to know if there's a "right way"

harsh storm
#

You don't really. The AI sound stuff is very primitive to my knowledge. I would hear the sound and then then do a line trace and do logic based off that

#

Might be a smarter way, but meh

nimble smelt
#

It's weird that there's a CanBeSeenFrom interface but not CanBeHeardFrom

stiff gale
#

In AI Stats, i'm not seeing hearing senses.

vagrant badge
#

Well it took me a while but finally debugged this. Turns out in the IsTraceConsideredVisible part of AISense_Sight, it was hitting my player's weapon actor which I had not correctly set to be owned by the player's character actor. So it was failing here.

#

Figured I would update you even though you probably forgot about this!

stable plover
#

I have a question, im using state trees and a common task that im using is the MoveTo task provided by default. the problem is that im trying to terminate that task when an event happens but i cant get it to work for some reason. For example, the ai wandering to a location, while its wandering it hears a sound, it should immediately stop but its going to the heard sound then stopping. If anyone can just provide clarification what would be appreciated, thank you, Im using the Trigger Events to try to get out of the state

#

nvm I got it

#

there is a Stop Movement node for the controller

#

but i have to do it on tick 😦

slow bobcat
silent hamlet
silent hamlet
#

And maybe its worth playing also with the collision shape on your character

slow bobcat
#

yeah that's a good point. We don't know if the character capsule radius is <= the nav agent radius used to generate the nav data

low stump
#

Yesterday I asked about a problem I have with my npc's not walking even though there is a navmesh present and it finds where to go

#

This all started when updating to 5.5

#

Another discovery I made is that this is only a problem on this specific level

#

I made:
A new non world partitioned level
A new world partitioned level

And in these levels it works no problem using the same setup for the navmesh as in that level

low stump
low stump
slow bobcat
slow bobcat
low stump
#

It's the same on this world partitioned level but here it walks

low stump
slow bobcat
#

Yeah, I see. Let's start with the basics:

  • check if your nav exists in runtime (my previous comment)
  • tell us what's your setup in non-WP (static/dynamic modifiers only/dynamic), where are your nav volumes placed (if any) etc
low stump
low stump
#

Heading to the meeting now o7 ttyl

slow bobcat
#

yeah no worries, I'm working too so I might take long to reply until my next compilation time

bitter fossil
#

Hello! Has anyone got experience using learning agents outside of the sorts of projects shown in the epic example? I'm considering using them for my AI I wondered how practical it would be - the reason they're of interest is that not only could they be used in game but also for regression testing and making sure gameplay is balanced by allowing the bots to get extremely good against each other and checking the results. I like this idea because it'll likely reduce the number of times I'd make something, deploy it and then have to patch to balance it out when some crazy good kid finds a way to make it OP.

low stump
#

I also made a new discovery, it seems that this issue only affects npc placed before updating to 5.5

If I place a new one with the same configuration they can path find (The black npc (new) in the above picture moved while the white npc (old) didn't move, both of them were supposed to move to the same spot)

#

Also, if I duplicate the old npc it still doesn't work. I actually need to drag a new one from the content drawer and configure it

slow bobcat
#

Then I suggest you debug the code to see where the difference lies. VisLog mentions the path being aborted. Maybe you can put a breakpoint there and see who/why is it being aborted

bitter fossil
# low stump Here's a confirmation of an existing navmesh at runtime

If the same NPC works when you redrag it, it just sounds like some of your components have lost references etc when you upgraded, have you tried clean/rebuild from the menu? might not work, but worth a try as updates to the engine will often shift things around source code wise.

undone rune
#

for nav invoker it is better for each character to be on its own (Individual ) or just one added to the player

low stump
bitter fossil
#

If they're exactly the same and the only difference is you've already dragged it into the world, then I don't understand why wouldn't just redrag them and be done with it?

#

I'm late to this conversation though so ignore me if I'm misunderstanding πŸ™‚

low stump
bitter fossil
#

Ahh gotcha, and you've tried initially doing CLEAN from the build menu?

low stump
bitter fossil
#

Ahh you're in blueprint only, oof yeah as Bruno said above you're probably going to have to debug then.

#

Although if you check the NPC's in the editor, see if any references or attributes have gotten reset during the update you might be able to find something.

low stump
low stump
#

I basically called the movetolocation continously, but it was the same location every time

#

I have now fixed it and the visual logger looks like this

#

But it still doesn't move

slow bobcat
# low stump This is the issue, I currently have over 30 npcs in the world. All of them are t...

Yeah... This is why is better to use a Spawner object approach. An object you place in the world where you specify what kind of actor fo you want to spawn. You can create children for npc's, enemies etc where the BP has a preset class. Right now you would have 30 of those placed and they would call the spam function, making it easier handling this kind of issues. It also will help in the long run with ootimizations (do not spam the npc unless the player is in Xm distance etc)

slow bobcat
low stump
slow bobcat
#

Looks like your movement is immediately aborted

low stump
# slow bobcat Looks like your movement is immediately aborted

It's not that the movement is immediately aborted because using the asterisk button it says "path following: moving (path:0, visited:0)" but rather that it simple doesn't move

The right image shows me tracking the black npc, it shows the same thing but actually move (which in turn updates how many tiles it has visited)

#

I'm so sorry if I sound annoying btw...

slow bobcat
#

No worries mate

#

Umm not sure what could be happening. If you debug the path following component you might get some clues

low stump
#

Here's a visual logger comparison between black and white npc

Left image shows info about the black npc's movement
Right image shows info about the white npc's movement

Notice how the black npc's controller has more blue lines

#

Those extra blue lines just notify that it has moved to another tile

With the last one notifying that the move request succeeded

low stump
#

But it depends on what you want. If you only need npcs to move when you see them, you might be good just putting a nav invoker on the player

low stump
#

If you player doesn't need to use the navmesh in any way, I guess it would be better to put nav invokers on npcs.

undone rune
low stump
undone rune
low stump
#

Because you might experience lowered frames due to the player moving thus updating the navmesh

undone rune
low stump
undone rune
low stump
#

Here are the settings I use for example, you can try copying my settings and see if your performance gets any better

low stump
low stump
undone rune
low stump
rapid birch
#

Hi. What would you do for having a Dynamic Navigation mesh for big open world area? Now I have one set up but it is just limited area of space. The nav bound box is very big but the actual recast nav area is much smaller. Is there a way to dynamically move the nav bounds? Also the dynamically generated stuff with invokers is limited to the same area I get in first place.

near condor
vale sierra
#

However, I don’t understand some things:

What is the difference between the agent radius in:

Navigation Mesh in project settings
Navigation System with a profile
Recast navigation (details)
Because if I don’t create a profile and decrease the agent radius in recast navigation, it doesn’t save. But if I create a profile, assign it to the navbounds volume, and modify the recast agent radius, the value is saved. However, my AI is blocked unless I set this value in the Navigation Mesh of the project settings. I don’t quite understand what the differences are.

Another question: For the cell resolution of the navmesh, there are 3 values: low, default, and high. How are they used? It seems like "default" is always used by default, and I don’t understand why we have both a high and low parameter. Are these like profiles we can choose instead of redefining the default every time we want to change the resolution? If so, where can we change them? Thank you in advance! πŸ™‚

misty wharf
#

Has anyone figured out why there's "State" and "Group" types for states in the state tree?

#

As far as I can tell, they are functionally identical. The only difference is that it just doesn't let you put tasks directly into Groups - so you could achieve the exact same result by just using a state and... not putting any tasks into it, and using it only for childstates?

#

It appears the only place in UE's code that references the Group type is a PostEdit function, which just... removes all tasks from the state that got changed into a group so it seems to make absolutely no difference

silent hamlet
# vale sierra However, I don’t understand some things: What is the difference between the age...

Uff i wouldn't be able to give you an answer. I'm aware of the problems you mention in 1. Sometimes a manual rebuild of the navmesh sorts it but I have never really figured out what's going on there

For 2 I don't know. But, i know a good series on nav mesh and maybe the answer is there. Maybe! But it's well made and could answer other questions too

https://youtube.com/playlist?list=PLJULvNgY9N0iILweygTfkhfNl2x0i_71_&si=TV8t0JvkK_DcYPZZ

vale sierra
median socket
#

This isn't really AI, but navmesh -- I was wondering if there's a way to query whether or not an actor is presently on or near the navmesh?

#

My goal is to have a way to detect whether or not important quest items have fallen out-of-bounds, and the navmesh seems like a pretty good starting point for checking what's "reachable".

#

ProjectPointToNavigation looks like what I was looking for, sorry -- should have done more googling before asking for help :)

restive loom
#

Anyone got any idea how I could make my npc dodge / go around things? Like if there was a car coming at the npc or in front it would dodge or go around it

slow bobcat
# restive loom Anyone got any idea how I could make my npc dodge / go around things? Like if th...

If it's a static object (it doesn't move), you could simply affect the nav with a nav area with a high cost. If the npc paths throught that, it will try to go around due to the high cost (except if it's the only way. The the path will go through). To ensure 100% npc's going around, you either need to set nav area null (no nav) or use a nav filter that discard the nav area of your object.

For moving objects gets trickier. One easy way is for moving objects to trace forward a ray deveral meters ahead and, if an npc is hit by it, then alert the npc so it plays an anim or something. It's always easier to make moving objects alert static objects than the other way around because you only need to do it while something moves.
If we are talking about very fast objects (like a projectile), you can simply project the trajectory and see if it goes through any npc.
There are a ton of small cases and situations depending on what your game needs/wants

#

Btw, in the case of the car, if its following a path, you can do the check in path following component. There's a function called every time a new segment is about yo be followed

#

You can do a trace the length of the trace and check

#

Then re-check every X frames

#

The bigger problem will be when 2 moving objects need to dodge each other.
Have you tried crowd control? See if the results are good enough?

restive loom
restive loom
slow bobcat
#

Well... On hit, grab the hit actor, then call some function for it. Soemthing that plays a montage with root motion left/right. Something like that

near condor
#

Like declaring intent

misty wharf
#

Yeah that's kinda what it looks like

analog mural
#

About this, I inherited from the cooldown decorator but I'm not sure how to access the cooldown value in my character class to change the decorator's cooldown time

#

Any tips? I'm using C++

misty wharf
analog mural
#

It's used for a temporary attack speed buff so the cooldown time of the decorator will be changed as the buff gets triggered on the character

misty wharf
analog mural
misty wharf
#

That could work yeah

halcyon briar
#

If I put a breakpoint on a behavior tree node, does it break whenever any controller enters this node ?
Or, does it break only for the selected controller ?

silent hamlet
halcyon briar
slow bobcat
#

Eeemm not sure tbh

mossy vale
#

Hi, does anyone have experience with world paritioned navmesh generation? I'm currently building navigation according to official tutorial of this experimental feature and it takes 8 hours already.. The runner processes all 4096^2 WP chunks, is there a way to optimize it? How do big titles handle it?

lavish heart
#

Is there any way to build a nav mesh once and save/bake that data into a sublevel so I never have to rebuild the nav mesh again.

#

Everytime my sublevel is streamed from my persistent level the NavMesh no longer works, this doesn't happen if I directly open the sub level

slow bobcat
slow bobcat
# lavish heart Is there any way to build a nav mesh once and save/bake that data into a subleve...
  • make sure you always have a nav mesh volume in the persistent level. A small one at (0,0,0) coordinates for example. That guarantees the recast object will always be in the persistent level, so your nav data is always available
  • then place nav generation volumes in sub levels.
  • to build the nav, doesn't matter if you use Static or Dynamic With Modifiers Only (which is another form of static nav mesh), you need to load the entire world. That will be a problem if you have a very big world or very populated levels because you will need lots of ram. If your reach a point where you can't load everything, you can build the nav with a commandlet. It's a bit tricky but it saves lots of ram because you don't load the editor and nothing is rendered.
#
  • there will be another problem: when 2 sub levels nav chuck data share a tile, only the data form the last will be shown. We had to mdofiy the engine to make sure the overlap is resolved in an additive way (both data's for the tile are added to the world) rather than substractive. I have a small github example but I never updated it. There's a bunch of code we had to add in the following months, but it's a good start. https://github.com/mbrpistoni/UnrealHowTo/tree/main/FixForOverlappingStreamingVolumes
GitHub

A compilation of self-produced documentation about how key features of unreal work - mbrpistoni/UnrealHowTo

keen grotto
#

In Behavior Trees, what's the simplest way of saying "please wait as long as it takes for the character to reach location x, don't do anything else until you reach it" at which point I'll call a stop.

I have a floating movement component, I have a location I want the pawn to float to, I set velocity for it, now I just need to wait until it reaches the location. But wait by default returns success, so it always resets the selector back.

I wonder if I made the problem more cursed than it needs to be my disabling friction on the movement component and making velocity permanent rather than perhaps adding movement input on every tick.

slow bobcat
# keen grotto In Behavior Trees, what's the simplest way of saying "please wait as long as it ...

To me it look like the problem is that you are using a selector.
The whole thing sounds like a sequence to me:

  • get a location
  • start moving
  • wait for the Movement to finish
  • do whatever

One thing you can consider is to make your own movement task and return Success on arrival, Failure if something went wrong and, while the movement happens and until it has arrived, return Running. Then conjoin the functionality of SetVelocityTowardsLocation and Wait.

The main problem is how you are handling the wait: using a 0.1s wait and re-evaluating constantly the tree to know if it has arrived, rather than have a task waiting until is done (so the tree stays in that task)

keen grotto
slow bobcat
# keen grotto I thnk you're spot on with these observations, thanks so much! This new version ...

If you hover that time limit decorator you will see a tool tip saying it will not run and why. Decorators in root nodes do not run UNLESS your tree is a sub tree (that's why it's "greyed" out). Your main problem is the wait node still. You can do a simple task that, within the tick function, checks if your character has arrived to the destination. If it hasn't return Running (don't return anything), if it has arrived, return Success

#

Instead of using that wait. That way you will not need to use that conditional loop, the service etc

#

That approach is pretty much what the a MoveTo task does

keen grotto
# slow bobcat That approach is pretty much what the a MoveTo task does

I attempted to use that one but I wasn't sure how well it did with a floating pawn movement component that's hovering in the air rather than expecting a nav mesh. Wasn't clear if that was an usupported scenario and the task was meant more for the traditional ACharacter and running on terrain with nav mesh.

keen grotto
slow bobcat
slow bobcat
keen grotto
#

Ok, this works, thanks so much. Having to have the extra Selector just to get TimeLimit to work seems odd, but if that's what it takes.

mossy vale
slow bobcat
# mossy vale unfortunately I'm not interested in dynamic generation, but in navmesh streaming...

Yeah sorry I can't help you much unfortunately. I haven't worked yet with WP. I know you can bake data and that WP-Tiles use Nav Chunks exactly the same as streaming sub levels did before, but nothing else aside that. I would assume that you add nav mesh volumes to the WPTiles and build the nav as static/dynamic with modifiers only. But I have no idea how you make a nav volume be owned by WPTile so it streams in/out its nav chuck data. Also, as I mentioned above for other person, when using this approach with sub levels, you need to load the entire world to build the nav. I have no idea if that's the case for WP or if you can do something that loads one tile at a time to build just that. Also: is there a persistent level concept in WP? That's where I would imagine you need to keep your recast object

slow bobcat
slow bobcat
# keen grotto Roger, appreciate the tip.

In general is a good practice to name your composite nodes (selectors, sequences or custom). That way, when you debug with Visual Logger you can see the actual name rather than Selector_57 and break your head trying to figure out which one is 57 in your tree logic

keen grotto
mossy vale
#

Yeah basically all the stuff you mentioned should be handled by existing tools πŸ˜„ There's a UWorldPartitionNavigationDataBuilder class that takes care of all these steps and creates streamable actors tied with WPCells as a result. I tried to run it yesterday in our game with quite a big level and apparently this runner is totally ignoring NavMeshBoundsVolumes location, its processing the whole grid which is 4096^2 in our case, so I canceled it after 18 hours (got ~60% status). I'll keep diging and try to optimize UWorldPartitionNavigationDataBuilder::RunInternal πŸ™‚

slow bobcat
lavish heart
slow bobcat
#

Let me open the editor and se what's the real name

slow bobcat
#

I'm mentioning that because I'm unsure now if your problem is that you are missing nav in runtime (PIE or build), for which my first answer was directed, or if your problem is that, every time you move something or do anything in editor, the nav re-builds (which is what I also see from your last reply)

misty wharf
#

Hmm... I wonder what even is the point of the StateTreeAIComponent πŸ€”

#

Because looking at it a bit more... all it really does is add the AIController context variable... but the regular Actor context variable already is assigned to the same value

#

Oh wait - I think if you set the Actor's class to the class of the pawn, then it actually gets filled with the pawn. That's not super obvious at a glance, but I guess that must be it

slow bobcat
#

yep. It gives you both: AI Controller through the context as default, the pawn as the Actor. And that's about it

misty wharf
#

Yeah. Looks like you can get either of them with the regular ST comp, depending on which class you set, but you can't get both at the same time

slow bobcat
misty wharf
#

Yeah. It doesn't seem you can pull the pawn from the AI controller in the binding menu, so it makes sense it would allow this

analog mural
misty wharf
#

the owner comp is also in FBehaviorTreeSearchData

#

so you go owner comp -> get owner -> cast to controller -> get pawn

oblique drum
#

Why does my BT never go into IsDead, is my logic off in the BT?

slow bobcat
#

Ufff difficult to say. If you set breakpoints and observe the BT while it's running, you should see what's going on

silent hamlet
#

Then as to why you need to do some digging

fathom sun
#

Hello, does anyone have experience with paper 2D and navmesh? I'm trying to spawn a nav mesh on a map that has tileset, but no green area appears when I hit P. If I add some regular geometry, it does get the navmesh on it. It seems like navmesh treats the tileset as a wall

slow bobcat
#

Ummm nav mesh only generates on top of the Z plane (the plane defined by a normal following the Z axis). I never have done 2d with unreal but in very curious

sacred stone
#

what is the general consensus regarding bCreateNodeInstance = true; performance wise? Is it the only way to assure multiple enemy instances using the same BT (but different instances of it) actually use different task nodes?

harsh storm
#

It is generally worse for performance

#

When the BT is created, everyone that uses that BT will get an instance of w/e node that is.

#

So, if you have 10 enemies and 1 node that does instanced nodes, that is a new UObject for each enemy

#

If it isn't an instanced node, then all 10 enemies use the same node

#

Use AITasks (look at MoveTo as an example) to do more of a lazy instantiation

#

So, it'll only create the task if that task is going to be executed

#

You can also use the node memory for some more simple stuff

#

Like, storing some values for example

fathom sun
slow bobcat
# harsh storm When the BT is created, everyone that uses that BT will get an instance of w/e n...

Umm I have to add soemthing:

  • trees run in loop mode (default in unreal) always create instances. The instance is cleared when the tree stops. If you have a main tree (treeA) with 3 branches and 2 of them run a subtree (treeB), each of those branches create a TreeB instance that is kept alive until either treeA or each treeB calls stop. For. Unreal, treeB runs 2 instances due to it coming form a different parent branch.
  • if you, on top, instance nodes (like a decorator), you keep the instance of said nodes. Imagine your treeB has 2 of the same decorator (2 per treeB) . You now have 4 instances of the same decorator. In my previous project we actually hit the tree instance limit (256) due to the sheer amount of options we had.

Best thing to do is to never instance and store things in the mode memory every time as Duroxxigar mentioned

harsh storm
#

Yeah, I didn't bother even going into subtree shenanigans.

#

Overall - use instanced nodes only when you really need to, or just live in BP land πŸ˜…

slow bobcat
harsh storm
#

Yeah, they do. That's why I said "live in BP land"

#

I probably could've worded it better

slow bobcat
#

Aaah OK om I get you now

copper grotto
#

I'm having an issue with my Behavior Tree's MoveTo returning a movement result of "Aborted". I can't seem to figure out why. My TargetPosition seems to be valid, my nav mesh is working for other characters, I'm ot sure what the issue could be.

#

Maybe I should mention that this character is the player character, and I am switching to UI input and having this Ai Controller possess the player character. Could this cause issues somehow?

copper grotto
#

Holy fuck I got it. For some reason I needed to use Project Point To Navigation. The MoveTo node for whatever reason wasn't working, so I created a custom one and added that in there and it worked.

silent hamlet
#

Using AIPerception, if I have 2 (or more) senses configured -all with MaxAge set- the OnTargetPerceptionForgotten is called only once for whatever sense is forgotten first. What's the use case of this? Thinking as I am thinking, I would find it more useful if any stimulus that is beyond maxage would fire this event. I might want to do things when Sight is forgotten but not when Hearing is, for example. Am I thinking this the wrong way?

slow bobcat
silent hamlet
#

i think i can implement my own stimuli-sorting and forgetting logic on tick, but still don't really understand the idea behind this event

slow bobcat
#

Umm maybe you can check in code if there're any other events more suitable for what you need. Can't remember how I handle it and I OOO

silent hamlet
#

ah yea a dive into the source is probably the best way to go about this. wanted to save me the pain if possible with a question here first πŸ˜„ juust in case someone has better insights already

sacred stone
#

Also, are state trees having the same problem where they are shared by all agent instances using them and you need to instance their nodes/actions as well?

slow bobcat
slow bobcat
#

Bt system use bt instances per tree execution and st's handle state tree instanced data per tree execution (state tree execution context)

slow bobcat
#

They are 100% independent

#

Instanced nodes are a simplified way to use node memory: you don't nerd to use the memory pointer (uint8*), because you get a uobject instance, which can hold members like any other object instance in unreal (with the cost of extra memory usage + creation/destruction)

sacred stone
# slow bobcat Instanced nodes are a simplified way to use node memory: you don't nerd to use t...

So maybe the Execution Context/ BT Instances retain the separate states of the BTs even if using the same uasset instance in memory but the nodes may also be the same if not instanced.
So for a BT with 3 branches: one can be at the 2rd branch executing it.
And agent with the same BT spawns and it starts from the beginning.
So first agent is at the first branch, second agent is at the 3rd branch, but if the nodes are not instanced they will use the same node if they happen to execute it in their current BT progress. So if the same node is in both 1st branch and 3rd branch and they both get to it at the same time, one of them may finish it before the other? So for a node that returns InProgress until an event triggers, one agent will finish it and the other will still wait being stuck in InProgress?

#

I have also DM'd you to talk more about this, if you don't mind. Otherwise we can continue the conversation here.

#

So there is a clear difference between the BT asset in memory which defines the behavior vs the BT Execution Contexts. Agents may share the same BT definition, but under the hood the contexts are separate (the progress of the execution in the BT), however non-instanced nodes will be the same instances in memory for all BT contexts.

slow bobcat
slow bobcat
# sacred stone So there is a clear difference between the BT asset in memory which defines the ...

No. Nodes instances are not kept in memory when not instanced. It's confusing. Let's use the decorator example:

  • you have a custom decorator
  • that decorator is in 3 places within your tree.
  • each of those 3 decorator nodes use their own memory allocation where you store values you need.
  • when the BT runs one of the decorators, creates a temp instance (a ref really) and passes the corresponding memory (basically using the node index within the BT instance to look for the memory uint8* needed)
hollow osprey
#

How can I tell if a Stimulus (FAIStimulus) is still in the system, which is still inactive but exists, but not expired yet?

copper grotto
#

I'm having a difficult time getting my character to follow the object I need it to look at. I think it might have to do with some of the settings on the movement component. This is the player character and in certain situations, I swap out the player controller for an ai controller and move it around using the ai. The settings I'm having issues with seem to be the Use Controller Rotation Yaw (set to false normally, needs to be set to true to get the look at working right for AI), and the Orient Rotation to Movement (set to true normally, needs set to false for AI). Is it normal for these values to be problematic in a situation like this, or am I possibly doing something wrong either with the AI or with the normal input setup, that's causing unusual issues?

sacred stone
slow bobcat
# sacred stone I am not sure what you mean exactly by that because if a task node does not set ...

Might have the same memory address but the memory of the node is unique to that node. That's why they all behave differently. To follow my example: each of the 3 decorator usages use the same pointer but the memory pointer passed into it's functions is different for each usage of the decorator. That's why the code is filled of comments saying you can't manipulate class member variables in the functions unless you instance the node. If you don't instance it, you need to save your data in the memory of the node

slow bobcat
#

If you check CalculateRawCondition, each usage is retrieving a different uin8* memory. A BT instance has a big uint8* with all the memories of all the nodes. To calculate the specific memory of a node, the system uses the node index + the memory size + some other stuff that takes the pointer to the right place in that array (can't be more specific than that without looking at the code)

slow bobcat
#

For anyone else reading, try this example

You can do a test to understand a this:

  • write a decorator that generates a random number and stores it in a local member then returns true. Set the initial value to -1. Make sure the decorator is Non-Instanced
  • create a BT with a sequence. Add 2 wait nodes to the sequence and, on each, place your decorator.
  • run the BT and put a breakpoint just before saving the rnd number and observe. The first time you run, your value will be -1 before saving (first child of the sequence). The second time you will expect your value to be - 1 again (it's the second child of the sequence, a different decorator), but it will not be -1.

Now do the same but store the value within the memory. It will behave as expected.
You can run the same test with a task

#

This only applies to c++ BTW. Bt nodes made in BP's are always instanced I believe

copper grotto
#

Is it possible to get the blackboard in the AI Controller?

harsh storm
#

Get the controller, get the blackboard

copper grotto
harsh storm
#

Typically you only have one blackboard - otherwise, you need to work out a way to differentiate it.

copper grotto
harsh storm
#

The BT has the BB. When you do Run BT in the controller - it automatically adds it

copper grotto
#

Ooooh ok cool, thank you.

grizzled cave
#

Is there any reason why the "Enemy" object key isn't visible in the dropdown? It's the same for the Rotate to face task as well. When restarting editor the deleted SelfActor key comes back as well and that seems to show up in dropdown fine. This is happening on 5.3 and 5.0 (as a test). In 5.4 not the same but can't see more than one object in the dropdown instead

misty wharf
#

(expand the key type property from the little arrow to see the field to set the object's class)

#

Makes me wonder why they hide the class because this is such a common problem

grizzled cave
nova tapir
#

Hey there! Can someone help me understand how Controllers (Player & AI) and BlackBoards / BehaviorTrees work together?

I would like to make RTS units (think starcraft zergling).

What i have trouble is that their behavior can be controlled by both the player and their AI, the player can tell them to move somewhere, but their AI will attack an enemy that comes near them (unless they are put on hold position / stop command).

How should i approach this? What controller controls what? Should the player set variables for the AIController and let it handle the rest?

Any ideas or advice would be awesome, thanks!

misty wharf
#

I don't think it would make sense for the PC to possess individual units in an RTS type deal

#

unless you have some kind of direct control mechanics, like in some RTS games where you can take control of an individual unit from a sort of FPS POV

nova tapir
#

it just feels a little weird because it would go: PC -> UnitPawn -> AIC, feels a little weird writing either 3 set functions or having PC access a units AIC.

misty gale
#

I would think the pc only talks to Unitpawn while AIC is actually in control of UnitPawn, and acts on its state?

#

Id also prob swap an aic setup with a single batched unitController

frosty token
#

Are state tree states meant to have the tasks run parallel? is there a way to make them run sequential instead?

harsh storm
#

They're meant to run in parallel, yes.

slow bobcat
# frosty token Are state tree states meant to have the tasks run parallel? is there a way to ma...

State1 runs task1. Transition on Complete, run State1.1
State 1.1 runs task2. Transition on complete runsl state 1.1.1 etc.
Each state is a sub state of the previous one.

Either that or you have states form the same root and each task in each state sets an output value that is read in the next state enter condition

State1 runs task1. Sets bTaskTwo to true.
Enter condition "if bTaskTwo is true" in State2, run task2
Then reset those variables somewhere else

#

It's too bad that implementing a state that runs things in sequence is difficult, since the task running happens in the execution context. I guess you can write your own, but doesn't seem a trivial thing to do

misty wharf
#

The biggest problems with that seems to be that you can't access data from sibling states

#

So you have to put that data somewhere else to bind it

pastel moth
harsh storm
#

@slow bobcat πŸ‘† might be interested. Remember when I was talking about trying to do something like this a few weeks ago?

#

Interesting.

misty wharf
#

It's nice they're actually working on improving it

#

It does seem to become more useful each release

#

The real question is - why have they still not made it possible to replace state trees at runtime

#

:P

#

You can't even do basic stuff like a data asset which is used to configure a particular actor type because you can't inject a state tree into the component at runtime

harsh storm
#

Maybe with how some of the bindings are done? Idk

slow bobcat
# misty wharf The real question is - why have they still not made it possible to replace state...

You can in code. You simply replace the StatetreeRef variable. Then the next tick the Execution Context will be created for that tree. You also need to care about the Instanced Data variable. If you want to keep it from previous trees (in case you want continuity for when you run the same tree again after a while) you will have to keep them. We run several trees in parallel in one single componente with a tmap of statetree*, instancedata to generate the context right

EDIT: I'm replying with what I know and see from 5.4. I can see how this changed quite substantially in 5.5

slow bobcat
slow bobcat
#

The transitions with custom delegates are a thing I needed last week XD... It's going to be painful and nice when we change from 5.4 to 5.5...

misty wharf
slow bobcat
#

nah they are just protected variables accesible from your how child component implementation

misty wharf
#

Ah good to know, I never tried to subclass it

#

Oh that screenshot reminds me of another bug/feature - the start logic automatically thing doesn't seem to work lol

#

And manually calling StartLogic is janky because if you call it in BeginPlay, it doesn't work for spawned, but if you call it in OnPossess, it doesn't work in level-placed (or maybe the other way around)

wanton stag
#

Behavior tree have known bugs? Even with all of my checks passing, my game get stuck "waiting" and then wont commit to "move to"? Is this a known bug?

slow bobcat
#

Move to is executing and failing. Open Visual logger and check the navigation section to see why. Might be the nav or something else.

slow bobcat
#

Do you have Navmesh at runtime?

restive loom
#

Time to ask a question for the 100th time

#

Anyone got any idea how I could make my npc avoid dynamic obstacles?

#

Idk if the crowd plugin or whatever would work because I want the npc to be able to dodge cars too

slow bobcat
#

The npc's will dodge each other with crowd control (as in avoid, they will not do cool jumps over each other etc, just push each other out of the way). With the car... It's more complicated. I think you can add the car as soemthing to be avoided in the Crowd Control (sorry I'm not more specific, haven't use it in 4 years) but the car will never avoid them. The main problem I see is how will the npc's resolve the collision. For other npc's it's easy since they all use capsules but a car... No idea

#

Sounds like you will need to do something custom

#

I think there are flocking behavior plugins you can check and see if you can do something similar

restive loom
#

I tried line trace but it doesn't work and now I'm absolutely clueless on how to get the npc to actually move around then continue to the destinatiobn

slow bobcat
#

Ummm you could try soemthing like:

  • have a collide around the car for queries only (no physics)
  • the collider detects overlaps with npc's. When one overlaps, call a function called dodge in the npc
  • the dodge function passes points around the car (this can be fixed scene component locations in the car, like 6 of them around) and the overlap location
  • in dodge, using those points and the npc location of the npc running Dodge, calculate the best point to run to (or jump or whatever).
    Since the car moved forward/backwards only, you can just have couple long colliders in front and back
#

Then they will:

  • stop movement
  • jump away form the car trayectory (to the best side of the car)
  • calculate new path to the destination from where the npc is.

If a car is stopped (like a parked car or in a red light, a moment where you know it will be stopped for several seconds, make a nav modifier flag the nav as null ptr, so nobody path through the car. As soon as it starts, switch off the nav modifier in the car so the nav is navivatable again

#

You can try all that and adjust from there

restive loom
#

I'm trying to do this but it doesn't finish execute

#

I have a blackboard which has a sequence and the other task is to go around but it never gets triggered

mint terrace
#

because i just ran into that a minute ago-- i was using tick to determine when to end the task, but it would not end even though it was hitting finish execute -- but this was because the task was in the process of being aborted -- i think that if you implement the abort event you have to call finish abort, and finish execute does not finish aborting, it just gets ignored

restive loom
#

Finish abort doesn't work either

mint terrace
#

so to be clear though, the behavior tree never advances from patrol even though youve said its done (finish execute or whatever) in the task?

restive loom
mint terrace
#

do you have the Receive Abort AI event implemented on that graph by chance?

mint terrace
#

hmm could be something else i guess -- though im not sure if it needs to be there for this to happen

#

ig to rule it out you could check Is Aborting before Finish Execute

#

and maybe have a breakpoint or something

restive loom
mint terrace
#

ah, so it is aborting then or its not

restive loom
#

It at least calls it

#

Receive abort ai doesn't get triggered tho

mint terrace
#

yeah must be something else then

restive loom
#

Here's the full code for my patrol task

#

This is my behavior tree

mint terrace
restive loom
#

If I call finish execute after reaching the second patrol point it loops the whole thing

#

Shit

mint terrace
#

the link works fine

restive loom
#

What that exists?

mint terrace
#

ohhhh i see

#

Nvm, I thought you were calling Finish Execute before doing additional patrol points but nope thats fine

restive loom
#

I don't get what's going on

#

If I call finish execute after it reaches the second patrol point it just keeps on going

mint terrace
#

keeps on going? oh you mean the character keeps walking in the direction they were already going?

restive loom
#

Oh nvm

#

So finish execute works if I call it after reaching the second patrol point but doesn't work on tick

mint terrace
#

finish execute can work from the tick event if you need it to

#

seems like your tick is trying to detect when there's an obstacle in the way i guess?

#

and then... oh try to move to the next patrol point? is that the intent?

#

this is the one i was working on: basically saying the task is in progress as long as a gameplay ability is still active, and if something tries to abort it, it will just wait until it wouldve finished to finish aborting: https://blueprintue.com/blueprint/d5jeijuq/

#

so that explicitly uses finish abort in the tick event

halcyon briar
#

Hello.
I am trying to optimise my game's behaviour tree nodes.
Some of my behaviour tree tasks and decorators show rare occurrences of spikes in CPU time in the profiler data, ranging from 0.5 to 1 ms.
Although, for the most part, they barely go above a few microseconds.
Take this task node, for example. (in the attached screenshot)
It barely makes a bump in the trace 99% of the time. However, it occasionally creates spikes of 1.4 ms in length.
But all it's doing is fetching a value from the blackboard.
I know my question sounds a little vague, but all I am looking for here is some advice about how I can dig deeper to find out what's going on with such simple blueprint behaviour tree nodes and what I can try to optimize them?

restive loom
#

Then continue with the first task which is to go trough patrol points

mint terrace
#

ah ok, well you should probably use finish execute with false for success so that selectors and sequences work as expected in that scenario

restive loom
#

Huh?

mint terrace
#

(which is what you were doing i think)

restive loom
#

I used finish execute with false

mint terrace
#

yeah this

mint terrace
#

weird that it isnt finishing though when you do that (and there's no abort happening)

restive loom
#

Yeah ik

slow bobcat
halcyon briar
mint terrace
#

i dont think behavior tree runs on every frame

#

sounds like you are just seeing behavior tree existing

slow bobcat
halcyon briar
slow bobcat
halcyon briar
# slow bobcat you can always cover names too sensitive to show or something. Side question: ar...

UE 5.4.
Here's a trace of a different example, as I couldn't find the trace file of the first example.
Unlike the task node shown in my first post, this is a decorator node. But, the problem is the same in both cases. Seemingly simple node, causing spikes of 1 ms in duration.
This node simply casts the player controller into a custom controller and fetches a reference of a specific component.
Then, it fetches a boolean value from the component's reference. The component itself is written in C++ and barely makes any noise in the profiler. It is quite efficient.

slow bobcat
#

And The fetching of the component is just grabbing the pointer from the controller. If you had some custom getter doing something like "find component"... But not the case

#

And the IsStuck function call is simply returning a bool? No extra logic inside?

halcyon briar
slow bobcat
#

Then the only thing that I can see causing such problem is the cast to your BP Controller. Try the cast to the C++ and see if that changes anything. In general, it's a good practice to cast to c++ versions since casts are hard references to the BP casted, meaning you are loading a shit ton of stuff in memory you don't want to

halcyon briar
halcyon briar
slow bobcat
#

ah ok. Then I have no idea what could possibly be going on.
You could try something: write a function that does nothing but this

void Foo(const FString& someText)
{
  TRACE_CPUPROFILER_EVENT_SCOPE_TEXT(*FString::Printf(TEXT("%s : %s"), *FString(__FUNCTION__), *someText));
}

And add it several times within your BP decorator, in between each node.
That way you will get traces below the last line of the decorator in Insights and see which node is taking the longest

#

When I was asking about 5.5 is because you can now add CPU traces in BP's too

#

You will get traces saying "Foo : Before Cast", "Foo : Before Is Stuck" etc (passing your own strings for Before Cast and so on)

wanton stag
# slow bobcat Do you have Navmesh at runtime?

Yeah I plopped a nav mesh down which is why it does work sometimes. Others it gets stuck like that in the video. I'll try the debugger. Didn't know about the visual debugger 😦

restive loom
mint terrace
#

nah

mint terrace
#

so regarding the run behavior node of behavior tree-- does it act effectively the same as substituting the subtree directly into the parent tree? any gotchas?

slow bobcat
mint terrace
#

ok good to know, but no gotchas then?

#

for instance aborts-- do abort settings carry through?

slow bobcat
#

Yeah, if the main tree aborts the branch with the subtree, the subtree aborts. Sub tree aborts (local) work the same

#

The gotcha is performance (keep an eye just in case) and that, for subtrees, decorators in the root node work (not the node that says Root, but the real root, which is your initial composite node). It will show greyed out (blued out?) but because unreal thinks you will run it as is. But as a subtree, it's a working decorator

#

Other than that... Maybe the limit in tree instances. You can have up to 255 per ai. The same tree run in two places (even if they are different 2 branches within the same main tree) generate different instances

misty wharf
#

"No one will ever need more than 255 behavior trees" -Bill Gates

#

That's the famous quote right?

slow bobcat
halcyon briar
misty wharf
#

Ah yeah the magic bullet to solving random BT (or ST) performance oddities :D

slow bobcat
halcyon briar
slow bobcat
#

Be this a reminder for when anyone gets mad at the usual random comment "hurdur... Devs don't know how to optimize unreal"... They are actually right XD

heady silo
#

Hello. I'm relatively new to behavior trees but I've been doing a lot of studying to figure out execution flow. I managed to get this set of trees working: basically this is called when the agent sees the player for the first time. Is At Location decorators specify which reaction to utilize when the agent detects the player based on the distance to the percieved target. At longer distance it plays a dialog line and a hand signal animation. At medium distance we skip the hand signal and play the normal contact line. At super close distance the AI plays panicked dialog instead. This works, but the agents in the level seem to all react at once despite the selector calling only one of these and going on a 20 second cooldown, leading to an avalanche of repeated voiceover dialog. Is there a way to force only one unit to call this out instead of allowing any agent using the tree to do this? I was originally going to handle dialog in the units proper but my implementation from CodeLikeMe wasn't working correctly so I brute forced it in the tree.

#

Additionally, the cooldown also doesn't stop the melee animation from playing again

#

...I figured it out. It's because I had a bark node in my attack tree, and I assumed that the bark was not working and didn't think about it. Apparently it now works

heady silo
#

that said, there is a rather odd bug with playing animations from the BT, it will T pose for a frame on the end for some reason

slow bobcat
#

That's the blending probably. And how long are you taking to play the next one

wanton stag
#

Anyone look at Ali Elzoheiry's Smart Enemy AI series? Or recommendations? Working on a boss fight πŸ™‚

signal pier
#

oo behavior trees πŸ™‚

heady silo
#

it could be a skill issue but it just drove me nuts

keen crow
#

Is it ok to call SetNextTickTime(NodeMemory, FLT_MAX) in uninstanced BT nodes if I conditionally don't want them to tick for some indefinite time? (for example, until blackboard key changes and observes "restarts" ticking for the node). Is there a better way to "pause" ticking BT nodes?

slow bobcat
keen crow
slow bobcat
#

Then stick to that rather than suddenly get your node ticking after FTL_MAX (btw, also use TNumericLimit rather than that, you might get problems in certain platforms)

restive loom
#

Why it gotta be so damn hard to just reroute my npc

restive loom
#

Any idea why the AI move to fails?

heady silo
#

He does respond to comments a lot, maybe you'll have better luck idk, but the monetization gives me the ick

heady silo
#

I couldn't figure out how to get raycasts to time with animation notifies so I threw three individual attacks into the tree timed to a rough three round burst πŸ’€ I'm sure that's bad for perf

slow bobcat
# restive loom Any idea why the AI move to fails?

Difficult to say but you are getting a location from an actor, which is already "far" from the floor, since it's the capsule center. Then you mutiply the vector by a scalar, which also multiples the Z axis, moving the point even further from the floor. My best guess is that your point is nowhere near the nav and the movement can't get there because of it. Try this:

  • only multiply X and Y (keep Z original Z from the actor location)
  • project the point onto the nav
  • use the projected point into your MoveTo node
#

This you could also check with Visual logger

restive loom
slow bobcat
#

Do you have nav at 0?

#

If you use a point that is not on the nav (within your extension parameters for nav projection), it will fail

#

Use Visual logger and check the navigation category or, at least, debug draw a small sphere at the point location before moving

slow bobcat
restive loom
#

It works on a location on the map that is accessible

#

I tried this

slow bobcat
#

your extent needs to be, at least, as big as the capsule of the character you are getting the location from. Get the capsule size and multiply it by 2

#

As you have things now, that bool it returns is gonna be false for sure (you should handle the cases of success and failure toward repeating with a different point or finish the task, otherwise... infinite task and stuck tree)

slow bobcat
#

Green line: nav (bottom)
Circle: your point
Box: your extension for the projection

IF your extension doesn't reach the nav, the projection will never work because it can't find it.
Since you point Z == CapsuleSize.Z, you need to make the extension at least that big.
The *2 is just some extra added to ensure things are ok but not too big to do crazy projections

#

your node right now doesn't have the Yellow Box, there's an extent of 0 0 0, so it will try to find nav at the point location, but we already know the point is Zm over the floor

#

Better drawing (programmer's art incomming)
That's your character. You are getting the character location, which is the centre of its capsule (the blue point).
The extension in the projection is "this is how far you need to look for the nav mesh to project the point".
If you use a box as big as the capsule, it might fail due to it being just by the nav in the bottom part (which is what happens with the yellow box). To ensure a better result, use the double of the capsule (the red box). That way the projection will definitely find the nav and project the point the closest posible (by the feet of the character)

static flint
#

How to subscribe to dynamic delegates from inside StateTree task (which is USTRUCT so doesnt allow having UFUNCTION so AddUniqueDynamic won't work)?
There's 2 types of delegates:

  • non-dynamic
    (from builtin EQS task)
    InstanceData.RequestId = Request.Execute(InstanceData.RunMode,
        FQueryFinishedSignature::CreateLambda([InstanceDataRef = Context.GetInstanceDataStructRef(*this)](TSharedPtr<FEnvQueryResult> QueryResult) mutable
            {
                if (FInstanceDataType* InstanceData = InstanceDataRef.GetPtr())
                {
                    InstanceData->QueryResult = QueryResult;
                    InstanceData->RequestId = INDEX_NONE;
                }
            }));
  • dynamic
    Which I have no idea how to bind to
static flint
misty wharf
#

Yeah I think that's undocumented, I randomly found out by poking in the engine code

static flint
#

StateTree API is so obscure as for today, builtin tasks is the only thing helps understanding this mess lol

misty wharf
#

Yeah pretty much

slow bobcat
misty wharf
#

Another 3 hours stream to pick 15 minutes of useful bits from? :D

slow bobcat
#

Hahah no no, it's quite short. He talked for about 40min. It's in the pinned messages I think

misty wharf
#

I'll have to check, maybe it's useful if it has info like that in it :)

static flint
slow bobcat
#

It's a very good introduction + some insight into the future of state trees. I used the chance to sit down with Mikko for over 1h to ask lots of things about St's. Too bad he's not at epic anymore

static flint
#

@misty wharf what's FStateTreeTask_PlayContextualAnim ? Doesnt exist in engine code
Maybe a part of some plugin?

#

Or maybe removed in 5.5?

misty wharf
#

Hm maybe it was renamed lemme check where it was if I can find it

#

Plugins/Runtime/GameplayInteractions/Source/GameplayInteractionsModule/Private/StateTree/StateTreeTask_PlayContextualAnim.h

#

5.4 still has it there

static flint
#

Oh maybe GameplayInteractions isn't enabled, holdon

misty wharf
#

Rider should still find it at least if you have the engine indexed

static flint
#

Now I see it, thanks

misty wharf
#

Weird, I don't think I have it enabled and it found it :)

static flint
#

Are there any other AI-related unknown plugins I should be aware of?

slow knoll
#

hey all

#

for some reason theres like a 50/50 cahnce of this failing

#

like it runs for 50% of my NPCs

#

(theyre meant to walk to the rocks)

#

sometimes the getreachable radius comes back as false

#

sometimes it comes back as true, but still dont walk

#

the ai move to comes back as "aborted"

slow bobcat
#

Any useful info from visual logger?

heady silo
#

Try passing speed through an interface and set up an enum for speed values

stable plover
#

I have a weird problem thats occuring, I have using the Default Move to task in state trees to move to an actor which is valid but its being haulted kind of, it seems that the AI wants to move to the actor but cant for some reason, if anyone can help that would be appreciated thanks

#

this is my state tree and the debugger

#

the ai should move to the player if he is to far from him but sometimes he doesnt for some unknown reason

slow bobcat
#

Have you checked visual logger to see if there's something off with the movement? Is the target actor valid?

stable plover
#

so its not executing the move to state

late grotto
#

Would anyone happen to know why my enemy character's move completed delegate is sometimes not being triggered by AIController->Receivemovecompleted? It causes the enemy to just stand there after it stops moving until I get out of and back into range

#

But only sometimes

dense owl
dusty fox
#

Hi guys, just wondering what should I look into if I wanted to make an AI similar to this video's "advanced enemy AI' on 5 minutes using statetree?
https://www.youtube.com/watch?v=XeNP0qf5jc0&ab_channel=LemonMaster66

Ancient Sins is a Biblical Horror Game where you have to Take pictures of Artefacts in Jesus' Tomb
Along the way, youll inevitably end up running into: judas-
who after betraying jesus, was cursed by god to eternal life but not eternal youth
he was also turned into a sort of weeping angel, Unable to move while in direct eyeline

Happy Halloween!...

β–Ά Play video
misty wharf
#

With ST, you could for example have a state which has a task that checks the conditions and sets some values, and continues into the next state only if it succeeds or something like this, and just repeat this kind of step based system until you get what you want

coarse arch
#

i have a wolf that will chase any pawns or characters when it sees. I have a rabbit that will get chased by said wolf but, when the rabbit runs, it goes and hides in its hole, and i disabled its visibility. The problem is, the wolf still senses the rabbit even after its invisible, so he just stands there waiting for it

slow bobcat
coarse arch
#

sorry, im new to ue, how would i do that?

silent hamlet
# coarse arch i have a wolf that will chase any pawns or characters when it sees. I have a rab...

I think a good way to go about this would be to use the sightinterface. Was googling it to give you some starting point and found this website with a name I've already seen somewhere around here πŸ€”

Anyway, this!
https://zomgmoz.tv/unreal/AI-Perception/IAISightTargetInterface

coarse arch
#

okay thanks, ill look into it

misty wharf
#

Another thing that could be affecting is that just making it invisible might not really remove it from the perception, and you might want to instead manually unregister it from the perception system... but there's many ways to do this so I don't know if this is necessarily the right way

ocean delta
#

hey all, in an FStateTreeTask, is there any way to set up a callback for a delegate? it seems like there are no straightforward ways of doing this, but maybe i'm missing something

#

in particular i want to add a callback to the ASC->OnAbilityEnded delegate

#

i'm currently doing analysis on Tick to figure out if the current ability ended but it's convoluted and unreliable

ocean delta
#

absolutely huge, thank you

#

i asked this same question in CPP and they tried very valiantly to help. it mostly consisted of trying to bind a lambda delegate but that was super buggy

misty wharf
#

I guess there might be some other way of doing it but this is the method the engine code uses at least

ocean delta
#

this is definitely the right way, will report back thank you!

silent hamlet
#

Digging for the first time my feet into state tree overrides. I setup an override on the STAIComponent on my controller. I have a corresponding LinkedAsset state in the main tree. The tag correspond. The schema is the same. Yet, the override is not replaced and the default runs. Im a bit at a loss. There is no useful log that I can find anywhere. Anyone has a clue what I might be missing?

#

overview of the base tree

slow bobcat
silent hamlet
#

it is, i checked with debugger but also at the root of both trees i have a debug text task with an infinite delay that reports "Normal" or "Override". The override is never ran

#

i tried to see if vislog has more info but nope. I tried look into the source but the only reason i saw for it to ignore the linked tree are 2:

  • schema differs (which doesn't)
  • tag is invalid or does not match (but they are set and matching)
#

i evidently am missing something...but have no clue what. Did you ever use this feature?

#

I tried reproducing it on a separate test case with only 1 linked asset state and still cant make it work. I think im ignoring something obvious but for the love of me i cant see it

slow bobcat
#

Unfortunately I have never used linked trees. But the debugger will show what happened with the state in question, if entered it will show the conditions pass and the running state (running, failed/success)

#

What is it the debugger saying for your state?

silent hamlet
#

it is entering the Engaged state on the default tree

#

everything works fine, except the asset is not the one i am trying to override

#

this is a session i just ran

#

3rd execution

#

im expecting it to enter on ST_Engaged_Override as defined in the STAIComp. But it goes into ST_Engaged which is the default one set in the state

slow bobcat
#

You have linked the regular one rather than the override

#

Look at the linked asset there. Worth trying

silent hamlet
#

Wait so i need to put the override directly on the linked asset? But no then you'd have the same situation in reverse. What i understand is that in the linked asset state you add a default tree to run. Then in the state tree component you can override that one.

#

If I put the override directly there it "works". As in, it will run the override. But the actual override functionality is still not working. Not sure if im making myself clear πŸ™ƒ

slow bobcat
#

Not sure tbh. You will have to debug the code I guess to see why it faiks

silent hamlet
#

No worries. One day I'll bite the bullet and compile this monster from source. Hm actually, do you know if the debug symbols include state tree stuff?

#

That would be a less painful way

misty wharf
#

Debug symbols include all engine code

silent hamlet
#

Oh cool so maybe I can do that and breakpoint my way through it

misty wharf
#

Maybe, there are still optimizations applied to the engine which may get in the way, but it should at least give something useful

silent hamlet
#

Did you ever use this state tree override feature?

misty wharf
#

Nah, I'm not even sure where this UI is so it might be a 5.5 feature?

silent hamlet
#

5.4 or 5.5 yea

#

Maybe I'm playing with stuff that is too new

gleaming hemlock
#

Im making a strategy game similar to risk.
One thing that boggles my mind.

When AI is attacking another empire.
Should it:
1- split its armies and attack the weaker poorly defended regions.
2- Or should it concentrate armies press on for a big battle against a strong army thats on the way?
It seems both are viable strategies. One overwhelms a player, and you have to try to go after all the little armies the AI is creating to cut through your empire.
The other concentrates power in one army, can crush your main army and then conquer the empire.

#

although i can implement these 2 different AIs, i have no idea what conditions will make the AI go for strategy 1 , or strategy 2

misty wharf
#

I guess you could think of it from the perspective of what considerations a human player might do

#

It's been a decade or more since I played Risk so can't really say what those considerations might be

ocean delta
#

How do I stop AI sight perception from going through walls? Once they have the sight, the sight does not go away sight is going thru all walls