#gameplay-ai
1 messages Β· Page 68 of 1
Yeah that's what I thought
Yeah I can confirm that. He always sang "I'd catch a grenade for ya." whenever he died to his own creations.
This!
I think this is the kind of approach you want to check
https://dev.epicgames.com/community/learning/tutorials/qz6r/unreal-engine-zonegraph-quick-start-guide
Is zonegraph even still actively developed?
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.
No idea, but seeing eqs is still marked as experimental....
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.
i have a fps bug!
FPS related problems would be in #profiling
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
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
really no one know? waht i can do? the problem musst be some settings etc. my cpu nad gpu is on 10%
It has been days of this. I would've reported them to quinn already if I knew how.
If you only have those issues on Lyra, then you need to go to the Lyra Discord Server as I said.
Rightclick -> Apps?
I'll take a look at it, thank you :)
i have this problem in any project
Been flaggin the messages as spam myself, some as harassment when he dismisses people's feedback treating them as idiots or soemthing
Not #gameplay-ai , that's for sure.
I mean the reason I'm here is cause they got reported.
Tenor is busted π
It normally is
Sorry dude. Didn't know my reporting implied you checkign. Will use it better next time
It might not have been you lol
Ah all good, I was just curious cause silvers already has 2 strikes.
Don't apologize to a mod for them doing their volunteer job!
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
I love Cedric - but I'd rather they put that money into 2D tooling π
just use Unity
Summary is:
- asks a question
- gets replies with suggestions
- puts 0min in checking the suggestions or studying the engine/tutorials/code
- keeps asking the same question again and again
- starts being an asshole with people trying to help out of frustration with his/her own ignorance
- then started doing that with non-ai related stuff
Epic did a dev grant once for Unreal Slackers iirc.
And Nick has that website with the subscribtion stuff
:D
Does that pay the mods? Absolutely not. Nick keeps that all for himself for paying the Bot hosting and I guess himself.
Β―_(γ)_/Β―
Yeah I've seen the previous reports on them. Pretty sure they catch their 3rd strike soon. Best to just ignore them if you think they aren't worth the time.
- reporting them fwiw
Yeah, but we know why EQS is still marked as experimental. And hundreds, even thousands, of games have actually shipped using it. So not the same.
True. I think it's still worth checking, if anything to get a sense how epic handles things for large distance pathing
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!
Does the debugger throw any clues about it?
Can you share a bit more of the tree? The whole conditions and group setup mainly
Here they are in order
I am digging through it but nothing immediate to me is jumping out
Ah, but the enter condition is on the group
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?
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
brunooooooo
why you people dont know after 10 years?
thta in window engine
you have change streaming pool size from 70 to 0
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?
There's a step in path generation called string pulling (unreal uses the Funnel approach) where the original path is adjusted to the corners of your "road to walk" and strip the path from any unnecessary points. If your path is a straight line, you will only get 2 points (start and end)
But the corridor holding your path will have the polygons from the nav data that your path crosses
Has someone tried building a NavMesh for a USD stage actor?
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
Same thing happens with it on the AIController π€
5 controllers, 5 active AI pawns, 4 BT's
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.
Yeah more details would probably help because I'm not quite sure what the problem here is
Rats
Because f.ex. you have a MoveTo task and.. that's it?
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?
Don't call finish on the task until the move finishes
That should really be the only thing you need
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.
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?
project point to navigation
I have an issue with AI constantly going off the navmesh and then basically being stuck forever
Ooo, thankyou
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++
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.
Motion Warping , never thought of that.
so u just keep checking if the AI has reached each segment?
I am wonder how people handle overshooting cases. E.g the AI moved too fast etc.
There's no such thing as overshooting in the Path following component. The function used is from the engine, called every time a new path segment is taken by the AI. You can check if it's the last segment or not in cae you want to do different things based on that
thanks, will start playing around with that
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.
That's interesting. The path I am testing with is not a straight line, however. It's an S bend that has two corners.
I'm confused. Os your terrain an S bend but you are obtaining a path with 2 points (straight line) or is the path you obtained an S bend but, somehow, the points array only gives you 2 points?
The terrain is an S-bend, but the navigation is generating a path with two points.
I'm wondering if there's some problem with the custom navigation code, or if having so few points is normal.
If you show the navigation category with the path in visual logger, what does it show? Can't recall if you already posted it
Can't post the screenshot due to NDA reasons. I'll try to describe it.
Yeah I get that. Any chance you can take a screenshot and do a paint over other layer in photoshop or paint.net?
In reality we just need to see the nav polys/corridor and your path. Nothing else matters
Looks like this codebase doesn't have a Navigation category. π I'll try to find the equivalent.
That can't be. It's an engine one. If you record with visual logger it's always there in the upper row. You would need to hack the engine to get rid of it I think
They definitely added some categories for their custom navmesh system. I'm guessing they might have removed one or two.
This is unreal 4.27 fork, if that matters
in order to use ai state tree components do they have to be a component on the AI controller?
Ah no no, that's the gameplay debugger. I'm talking about Visual logger, different tool
Nope. You can put them wherever (they don't even need to be used for AI stuff even). It's convenient in the controller to handle things on posses and what not, but not mandatory AFAIK
Ah okay. I found Visual Logger. Do I just hit Record while a character is trying to path?
Yeah
Then pause or stop, right click navigation category - > display only this and check what's going on selecting the markers
The StateTreeAIComponent must be in an AI Controller, the regular StateTreeComponent no
Aaah true true. Sorry for the bad reply. Zomg is right
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
Done so. Looks like no logs are generated for the Navigation category.
What? Ummm that's incredibly strange. Hit record in visual logger before hitting play in editor so it records from the very beginning. Just in case
Yeah, none at all. The AI setup is pretty custom so I'm not surprised. I'll try making a fresh project to compare the two.
But even with that... Check if they are disabling nav logs through the verbose levels or something. Do you get recordings of any other category? Even more: do you see the navigation category in VisLog when you record?
I'm seeing logging for other categories like Behavior Tree. Where can I check verbosity levels?
Uff this I can't recall. I'm not at the pc now but, when you calculate a path, do you go trough the Nav System functionality? If you look in the nav system class, you will see the prints to the visual logger there. Maybe it's worth setting a breakpoint there just in case you are not even using it
Yeah, it's using a custom navigation system. Let me re-create my testing scenario in default Unreal and get back to you, because it sounds like a big mistake.
Ufff sounds painful yeah. Very curious why they needed a full custom solution. If you can share, I'm all ears. All I can recommend is to add debug to VisLog somehow. Paint the corridor etc
π 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
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.
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
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
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.
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?
Considering mass doesn't have perception - yes.
And Niagra also doesn't have perception
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
Overview of new and updated features in Unreal Engine 5.5
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
Ah okay, good to know. I can see why that wouldn't scale well :)
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 π΅ π©
@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.
When your character walks, does it move correctly? Or it also tried to follow that straight line your draw? Asking because your question seems to imply that the character moves just differently
It is navigating correctly, following the curves of the terrain. I'm just trying to figure how to get the path the character is actually going to walk, because PathInstance.GetPathPoints is not giving anything useful.
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
Yes, you need to profile to see exactly what is slowing you down
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.
my understanding is its the animation rendering that's expensive there, not the behavior logic
So does anyone know how to preview a character's pathing when PathPoints only generate the start and end?
Has anyone used repo recently? https://github.com/DaedalicEntertainment/ue4-orders-abilities Just implementing it now but still trying to figure out how a BehaviorTreeEnded call is supposed to be done
Could also be the CMC, hence why profiling is important
I disabled all of my AIPerceptions? Why I am still seeing Sight, Compute Visibility calls over 300?
Since you use full custom path calculation (you mentioned the engine version you use is heavily modified to the point it doesn't use the Navigation System Component functions) you will first need to see where how you calculate a path. There must be a function that ends up calling the API in the detour library. Let's find that first and from there we might be able to help
How did you disable it? Because that look like your perception component is active in every AI
I'm looking into a fresh 4.27 project right now, trying to understand how the default pathing works. I saw the Detour library but didn't dig too deep. I'm seeing that CrowdManager is what's actually pushing the velocity to the CMC each frame.
AICtrl->GetAIPerceptionComponent()->Deactivate();
AICtrl->GetAIPerceptionComponent()->SetSenseEnabled(UAISense::StaticClass(), false);```
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
per sense? i will try thanks
Try with sight and check metrics again. The 300 calls should go away
It works if I do it from BP but not from c++. Maybe my implementation of senses are wrong somewhere
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.
ue5.5
ah sorry! wrong tag!
@cyan sigil , can you check it for me please? Would save me from downloading UE4
Sure. I will check in the morning.
appreciated mate
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
Iβm having trouble exporting data from NavMesh. I want to extract the triangle data (v and f) from the green area (navigation) that is displayed in the Unreal Engine Editor. So in the NavMesh settings, I set the Runtime Generation option to Dynamic and wrote the following code. However, the obj file output via ExportNavigationData() con...
hello, why does it create navigatable location under my mesh? i would like the whole area under my meshes to be non navigatable
There is a checkbox called CanGenerateNavMesh or similar you can tick/untick
On the actor
i want it to affect the navigation. But i wont it to exclude all the area, even the area below the actor.
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
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?
Kinda depends on what your problem with it is. I'm not super familiar with how it works under the hood, but in my project to make it work all I needed to do was to use the DetourCrowdAIController or whatever it was called as it implements the necessary things for it to work
My project is C++ and so in my AIController I have
SetPathFollowingComponent(CreateDefaultSubobject<UCrowdFollowingComponent>(TEXT("CrowdFollowingComponent")));
which turns it on, but now things like OnMoveCompleted() don't work.
I guess first problem would be knowing when the path is completed.
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
I have been looking through it's code a bit, which has helped. I was hoping for a idiots guide somewhere on the web!
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
If you want them to also avoid the player, here's some info on that: https://zomgmoz.tv/unreal/Crowd-Avoidance/How-to-make-crowd-avoidance-avoid-the-player-or-other-types-of-actors
They do, I can see the difference, which is why I really want to work all this out.
Ahh I see
Yeah information on how to tailor the functionality is pretty limited as far as I'm aware of
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
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.
Yeah now compare with UBehaviorTreeComponent::OnTaskFinished which is called by FinishLatentTask in BT
Which doesnt check a bool in every single frame
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
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.
I see its completely similar to BT approach
To acheive something like this with UStateTreeComponent, you basically have to write your own component and modify the behaviour.
I'll take a look at 5.5, maybe theres some changes in that area
As theyve promised updated statetree runtime
Probably not for this particular thing. But hopefully some long needed improvements
At least thats a relief Im not alone to think this is a problem to tick every single frame in every single running task
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
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?
I think you should be able to store your target in an evaluator (or even in the aicontroller) and reference it from there. As soon as the target changes you should be able to read the new value in the tree without problems
Following up on this, there's no function that matches "Move away from corners" or "move corners". There is a function "OffsetFromCorners", however. You want me to parse it for you?
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.
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
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
If you tell me in which file it is, I can just check it in github. Thanks!
How would I make my npcs avoid objects and continue to their destination?
Depends on how those objects behave. Easiest way to do it is to make your objects affect the navmesh, but this also somewhat depends on their mobility where you would then need to use one of the dynamic navmesh modes
I mean I would want to just have the npc go around another npc
I was thinking of a trace but that didn't really work
At least the way I did it
if it's other npc's, you might want to look into crowd avoidance or rvo avoidance
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
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
Shouldn't this work for going around actors?
That assumes the actor is directly in the crosshair. Theres 100q cases where it's not
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.
@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
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?
WHy not structure it using enter condition instead?
Those were not working either when I attempted that.
That was the first way I tried it
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"
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
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
So all your tasks are instantaneous ?
In one frame, all your task got executed
From "MoveAround" to "PerformAttack"
And you did a full loop
I think the answer is yes, but not sure how else I would configure that? Whatcha thinkin?
Is there any move to, animation that should happen?
Oh yeah it does have one
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
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
This one is ok, so you should see your AI move and the state should end when movement ended
Right, and that happens
Okay so what about an other one (any, don't leak everything if you care) ?
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
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.
This one triggers the Ability System Component to activate an ability.
And do you wait the ability to end?
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
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
So the implication being that a trees parameters cannot be changed once entered, even if the desire is to re-enter the tree?
Feels a bit limiting. I'm finding myself moving away from state tree altogether, and wanting to use it to just perform discrete behaviors rather than using it as the main brain of my ai
Let me check if there is something native
You could create an async task node that is hook to "OnAbilityEnded" from the AbilitySystemComponent
I didn't find one
I will check on that, and if not create something myself. I just ran a hacky quick test using the "Task Delay" node in the attack task, and it worked perfectly. You were right on the ball with this. Thank you so much Loris. Been a few days trying to figure that one out, but I will be very mindful of delays vs instantaneous when needed going forward.
Another solution is to send a statetree event once the ability called "EndAbility"
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
You're welcome π !
NavMeshPath.cpp line 283
ugh I can finally move on, I know I just said thank you but seriously this is great
yea the state tree asset itself, its just static, it shouldnt be hard to have a binding because im assuming it reads from that linked asset at runtime anyways if it is at that state
This is what I mean for more clarity
Its just static
Working in a state tree task, that is ran by an StateTreeAI component, how can I access the AIController in the task?
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.
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.
so parallel tasks allow me to bind linked assets? basically Im trying to use one state tree for zombie ai but i have different types and instead of making different trees I just want to use different linked assets
in your state tree you have these filled out right?
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
Hm no, I mean you can reference variables that change, at any time. Having an evaluator does not work for your case?
Yeah exactly. It's basically launching another instance of another tree and you can even react to if that sub tree fails or succeeds
Does 5.5 let a sub tree you run in a state tree (linked asset) be dynamic? i.e. passed in at runtime?
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
that was basically my question @solid spire aka the binding issue
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
I'm a bit confused. You are spawning a nav modifier volume in an eqs test?
Can I make hybrid system for pawn.
Say like I want to drive my vehicle and also should work like companion AI
As in the vehicle is the companion?
Yes, Driveable and companion !
For example Batmobile in games follows player as well as controllable
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.
I will look into this. Thx
I think it was one about gameplay features. About this
https://dev.epicgames.com/documentation/en-us/unreal-engine/game-features-and-modular-gameplay-in-unreal-engine
I recall. Soemthing about a feature that would enable enhance input for the AI
Build standalone features that you can quickly activate or deactivate.
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...
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.
NavLink Proxy And Smart Links would be helpful !?
But I am not sure
Ok, i'll try to use those, thx
Yeah sorry for any confusion but the short answer is no.
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.
The docs are not bad. There's also a few nice videos on yt. They belong to whoever you want, they are not tied to controllers like behavior trees
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
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?
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
that's okay, i got what i wanted with evaluators
Check the pinned messages in the channel
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
This is weird. You should be able to Initialize them. I had to do it manually on posses within the AI Controller
yeah none of that is working unfortunately. i guess i'll just stick to the BTTree starting the state tree for now.
ok thank you for the feedback, appreciate it
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
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
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
Have you tried using and AI state tree component and place it in the AI Controller? That's what I do
If you want to stay in a state, none of the state task can finish. They should return running. As soon as any task calls finish, the state transitions will be processed
Same thing with Bt's. If you call finish task and return anything but Running, the task finishes and the parent composite will continue its logic
I don't remember now (not in front of my pc) but I'm pretty sure you need to call the initialization function in the component so the state tree ref is processed
Hahaha nope. This is the most promising but is a very much WIP
anyone have any idea why MoveTo would be failing here? kind of at my wit's end https://streamable.com/yzlxdz
seems kinda weird that the MoveTo task works fine for moving twoards my character but if you bind a vector it doesn't work... π
How can I stop ai move to?
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?
You should probably read the descriptions of the properties in that test. Class will be used to populate a list of AVolume to test against
It checks whether the generated items are inside a particular type of AVolume, from the volumes which exist in the level
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.
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
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.
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
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 π
Anyone run into this bug before?
Anyone know how I could create a mechanic for my npcs to go around dynamic obstacles?
bumping again, really need help with this. does anyone know why the move would fail here? all i'm doing is going to the original start location
The video with waving a cursor around isn't very descriptive. I'm assuming what you're trying to say is that what I guess is an NPC is supposed to walk up to the player but isn't. You would need to start by identifying what is happening - if it stops moving because it goes into another state, or if it stops moving because of an issue with moving to the player.
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
the character is not returning to their start position
they're turning around and not going to the start position
move to is failing
Ok, if the moveto fails check in visual logger for starters
π€
Is it possible the state tree transitioned away from the state which triggers the move?
This would be likely to invalidate the moveto
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
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
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...?
It should be. You are probably missing a dependency in your build.cs
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
It might be in a different module than it was in whatever version you were using previously
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
It's not relatable for my query
i made a new state machine without the weird double execution and unfortunately it's starting to look like a bug in the engine... for some reason the goal location simply doesn't get updated
as an alternative i'm going to spawn an empty scene at the location and bind the move to the actor... what a mess
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
Oh.. Yeah that sounds like it would just transition elsewhere every single tick
@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?
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
are they your own move to commands?
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?
they are not my own move to commands, no. they are in StateTreeMoveTo
why do you want to disable rotation in certain axis?
for whatever it is I think creating a custom Move To would be a better work around
nvm it does work in groups
it was my own rotation π€¦ββοΈ i found it
what was the solution?
set pitch and roll to 0 in my own look at call
oh why didnt i think of that, i was just doing that with a actor a couple hours ago
π
XD all good but i was quick to blame the engine instead of my own code
99/100 times itβs you, not the engine
Which is a good thing because it means you can fix it
This goes for coding in general. So much wasted time blaming the tools π
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
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?
Anyone got any idea how could I stop ai move to?
What's the scam?
The scam I'm not sure but the sPam it's all over
Surely he isn't dumb enough to think this is a good way to find collaborators
Go read the #rules and bear in mind this is an Unreal Engine server. Those skills are irrelevant here.
Donβt know why you are advertising here in a unreal engine server
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?
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?
unless it changed in 5.5, nothing is exposed to BP's (generally speaking for Nav, very little things are available in BP's)
Ok, so seems I did not overlook something... will have a look into 5.5. Thank you
@pallid micanew account created to circunvent the ban. Silvers is now MonkeyRufffy
let us know if anything changed, but looking at how the filters work and how they are coded, I doubt much has been exposed.
That said: what exactly are you trying to achieve? maybe there's some other way
@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
I do not have 5.5 installed yet, but when I find some news, I'll let you know.
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.
Did he instantly start hassling you again or how did you figure that out? lol
Intantly. Literally the second sentence he wrote.
And same pattern: nonsense, one word sentences one after the other, repeating the same things over and over, dismissing the help already retrieved before as if helpers were idiots... He got banned (3rd strike) in the performance channel exactly because of that. Took him 3s to do the same here, again
Ugh, he needs some kind of help that isn't programming related it seems :P
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
Shouldn't learning agent and goap be under the ai channel ?
it should, but estrangely enough it's not. Most Reinforced learning questions are being answered in cpp I believe. Not sure why. There was a petition a while ago to give it its own channel
But the learning agent in ue is specifically for c++ it have blueprint support
yeah... I don't have a better answer honestly. I'm as confused with the topic as you are now
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
A new channel for it would help a lot with the situation
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
What does visual logger say? Any info within the Navigation category?
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
Thank you very much, hopefully I'll be able to solve this issue using that :)
just saw this, thanks bruno!
Hello ! No just a "Finish Task"
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?
You mean something like Character->FollowSpline() ?
If so - no. You would have to build it yourself, using something like what you described.
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!
Sounds like a nav mesh/agent radius problem. Can you share your corridor with the navmesh toggled on?
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?
Check the AI path following component. Create your own child and mess with OnSegment (writing from memory, might be in next segment) functions. You can build a path using the spline points, then calculate the spline curve in path following tick etc.
Move to location is kind of trash because it doesn't update the path without stopping the movement. If you want smoother movement try move to actor. Move to actor updates the path when the destination (actor) moves and updates it without stopping
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"
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
It's weird that there's a CanBeSeenFrom interface but not CanBeHeardFrom
In AI Stats, i'm not seeing hearing senses.
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!
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 π¦
Nice one
What you described basically. If heard, check traces etc. You can do your own sense in code with its own debug and deal with that in the update call (CanBeSeenFrom is called within the update of the sense)
Hmm maybe it's just a collision issue on your character, getting stuck on corners. The generated path is the shortest one between points so it tends to cut corners. You could try playing with the agent radius (make sure it matches both on character and navmesh, else you break navigation)
That should push the path away from corners a bit
And maybe its worth playing also with the collision shape on your character
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
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
(This level is world partitioned)
I tried duplicating this level and hoped that it worked but nope, nothing π
It says the path movement was aborted
Can you post a picture at runtime showing the nav? Just to ensure the nav is there. Either eject (f8) and press P or run the command Show Navigation
It's the same on this world partitioned level but here it walks
Yeah I'm heading to a meeting, it'll probably take a few minutes, I'll ping you with a video when I'm back π
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
Another image using direct movement instead of pathfinding (To match this one)
It's dynamic, a single nav volume that covers the entire map, I only generate navmesh around nav invokers (All npcs have nav invokers)
Heading to the meeting now o7 ttyl
yeah no worries, I'm working too so I might take long to reply until my next compilation time
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.
Here's a confirmation of an existing navmesh at runtime
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
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
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.
for nav invoker it is better for each character to be on its own (Individual ) or just one added to the player
The white npc and the black one are both the same blueprint actor, it's called "BP_BaseNPC". When dragging one out you can edit that instance in the world (change it's behavior tree, visuals and more).
So if I understand you correctly, that specific instance (the white one) has become corrupted?
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 π
Nono it's fine :)
This is the issue, I currently have over 30 npcs in the world. All of them are the "base npc" blueprint so I can't just "redrag them".
They existing ones aren't a part of the content drawer. They are all configured after placing that "base npc" blueprint.
Meaning I would have to redo all 30 npcs and also fix the other things that references those npcs
Ahh gotcha, and you've tried initially doing CLEAN from the build menu?
I cannot find the clean option from the build menu but maybe I'm just confused
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.
Huh.. But I have a lot of c++ code
I found the abort thing, it was a skill issue
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
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)
Start placing a breakpoint in the abort function of the path movement (the one VisLog is alerting about) and try to figure out why is it being aborted. It's a good start
(Difference now is that the controller doesn't spam with move to updates) ((Left image only has one blue line while the right one has blue lines over and over again)
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...
No worries mate
Umm not sure what could be happening. If you debug the path following component you might get some clues
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
does anyone know?
In the game I'm working on, both the player and all npcs have nav invokers
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
Which one is more optimal?
I'm not sure. Does your player need to use the navmesh?
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.
I tested both and got strange results :
On one player : 30 FPS
On 10 npcs (Individual ) : 40 FPS
Are your npcs/individuals moving or are they stationary?
no AI use nav invoker around player
Because you might experience lowered frames due to the player moving thus updating the navmesh
individuals moving
Oh, interesting...
so i have to add invoker on all enemy Individual for more optimization
Maybe, try it and see :)
As for other optimization regarding navigation, look at your navmesh settings the default settings for navmesh generation set by unreal is very heavy for complex scenes
Here are the settings I use for example, you can try copying my settings and see if your performance gets any better
thats good thanks
Please do tell me what fps you have before and after ^^
ok sure
I debugged loads of code in c++ but all I see is both npcs entering the same lines of code...
At least I have source control so I'm just gonna go back to when it worked... Thanks for trying to help me though <3
Really appreciate it! I hope no one has to experience the same issue I'm having π
your runtime generation is dynamic?
Yes
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.
Thank you so much again Loris.
Thank you very much, I was able to solve my problem with the agent radius π
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! π
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
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
Great, thank you so much ! I'll watch the entire series, it will help me understand a lot of things better
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 :)
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
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?
I don't think it works for cars too
I have a trace but the problem is that how will I move the npc
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
I suspected that it was just for keeping it sorted is all
Like declaring intent
Yeah that's kinda what it looks like
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++
iirc you can get the owning component, so you can get the owning ai controller through that, and get its pawn through it and so on
Thank you. Would it make more sense to do it this way or to somehow get the cooldown decorator class from my character or controller?
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
It makes more sense for the decorator to know about the character than the character to know about the decorator yes
And then have some delegate which gets triggered when the character enters the buff state to set the new cooldown time on the decorator?
That could work yeah
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 ?
One way I found nice to go about stuff like this is to use gameplay tags. You can tag the actor when it enters a specific state and then basically knowing that is just one tag query on the character, from whatever system you need that info from
Only for the selected one
does that work when we select a controller using the ' apostrophe key in the debug display ?
Eeemm not sure tbh
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?
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
Dynamic nav generation around invokers I believe
- 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
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.
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)
I thnk you're spot on with these observations, thanks so much! This new version seems closer to what you mentioned? The one bit that's unfortunately not working as I hoped is that TimeLimit at the very top is no longer running.
(And +1 to what you said about having a dedicated task for this, I'll look into that bit deeper)
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
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.
Also wow I didn't realize you could return nothing from a Task, mind blown.
I'm not sure either. I didn't meant that your should use MoveAI, just meant that it uses that kind of approach: while waiting return running (which in Bp's I believe is achieved by not calling FinishTask), once done return success/failure
Haha yeah. Most people discover this the hard way and fall into the classic bug "why is my tree stuck in X task?"
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.
unfortunately I'm not interested in dynamic generation, but in navmesh streaming which is new from 5.1 experimental feature - https://dev.epicgames.com/documentation/en-us/unreal-engine/world-partitioned-navigation-mesh
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
Yep... If you look for tutorials online from Epic in YouTube where Miesztko (bt creator at epic) shows how to do stuff, he adds a node just like you. I have released 3 games in unreal and all our Bt's have that. We always rename it to FakeRoot, which, funny enough, is actually the real root. The root node you see in the editor is just a visual queue to know where to start adding stuff
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
Fair enough, that makes sense. I haven't had to use Visual Logger for this yet, but it seems like something I should figure out soon.
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 π
Keep us posted please. Next project we will probably move to WP and these things are very interesting to me
Nav mesh is the most stupid thing ever like why does it insist on needing to be redrawn all the time
Really there should just be a way to bake drawn data
You can bake it. That's what Build Paths does (or the command to build navigation if you do it from a commandlet). I think you might have the build nav on boot option enabled in the editor settings
Let me open the editor and se what's the real name
try disabling that option
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)
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
yep. It gives you both: AI Controller through the context as default, the pawn as the Actor. And that's about it
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
I think it's just for convenience when binding stuff in the conditions/tasks
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
I can't seem to figure out how to get the pawn. GetOuter gives me the BehaviorTreeManager which is a dead end. There is GetGameplayTaskOwner but it requires a UGameplayTask as a param so I don't think that'll work
Many of the functions have the owner comp as a parameter, like CalculateRawConditionValue
the owner comp is also in FBehaviorTreeSearchData
so you go owner comp -> get owner -> cast to controller -> get pawn
Why does my BT never go into IsDead, is my logic off in the BT?
Ufff difficult to say. If you set breakpoints and observe the BT while it's running, you should see what's going on
Because one of the selectors before it succeeds
Then as to why you need to do some digging
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
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
Maybe this thread can help
https://forums.unrealengine.com/t/generating-navmesh-for-2d-sidscroller-using-tilemap/378935/9
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?
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
Yeap, that was it, thank you very much
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
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 π
Bp's instance nodes I think. There's no reason to instance them if you can do code and your own memory structs. Hidden knowledge again
Yeah, they do. That's why I said "live in BP land"
I probably could've worded it better
Aaah OK om I get you now
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?
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.
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?
Ummm that's sounds counter intuitive indeed. Could it be you are setting the max age to the same value in both senses? 100% sure it's the first one forgetting and not the last one? Just to double check
i think its the first one forgotten yes. i tried with 1s vs 10s just to make it obvious. but that's not really the problem.
What I find counterintuitive is that:
- this event is called only for one of the senses (first or last does not really matter)
- im given only the forgotten actor, not the stimulus that was forgotten, so i cannot check which one it was
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
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
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
Store them in node memory via AI Tasks? Or what other options are there?
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?
All nodes in a bt (whether they are composite like sequences/selectors or decorators/tasks) have functions thet retrieve the memory of the node. You can store whatever you want in the memory (you make your own and override the unit memory and get memory size functions so they use your struct)
Bt's are not shared by instances, neither are state trees. They are not static (although you can make bbk's static so they are shared in between tree instances).
Bt system use bt instances per tree execution and st's handle state tree instanced data per tree execution (state tree execution context)
That's how it behaves by default (each ai has it's own bt instance that holds its own bt memory, which holds all the "memories" for all it's nodes)
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)
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.
Yes, they are independent. They are non Instanced nodes with their own memory allocated within the memory of separated bt instanced of the same bt asset
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)
How can I tell if a Stimulus (FAIStimulus) is still in the system, which is still inactive but exists, but not expired yet?
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?
I am not sure what you mean exactly by that because if a task node does not set bCreateNodeInstance to true, all agents executing the node will execute the same node in memory, it has the same memory address. So how are they "non instanced nodes with their own memory allocated within their separate bt instances"?
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
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)
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
Is it possible to get the blackboard in the AI Controller?
Get the controller, get the blackboard
How does it know which blackboard it's getting?
Typically you only have one blackboard - otherwise, you need to work out a way to differentiate it.
No I mean out of all blackboards for the entire game. How does it know it's not one for say a car ai vs the enemy ai? I don't remember ever linking my AI controller to a blackboard.
The BT has the BB. When you do Run BT in the controller - it automatically adds it
Ooooh ok cool, thank you.
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
You need to set the object key's type to Actor if you want it to show up. SelfActor is a default which you can't get rid of
(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
Thank you! That did it, yeah I didn't think that needed to be done for it. Appreciate the help
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!
It definitely sounds like the player sets variables for the AIC yes
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
i see i see, thanks for the confirmation,i reckon i'll just try to work with a blackboard bool to check whether the unit should listen to a character command or should figure something out itself
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.
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
Are state tree states meant to have the tasks run parallel? is there a way to make them run sequential instead?
They're meant to run in parallel, yes.
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
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
first thing that comes to mind is have an ai controller then send events to your state tree if that unit is selected to have it move attack etc..
Youβll probably need some way to keep track of what units you have selected and what commands you give them. So maybe a manager class is a good thing to have here.
Huh - looks like we might actually be getting an event-based thing for STs https://github.com/EpicGames/UnrealEngine/commit/938e3c049ca3ffa5ff34a1701d744a5217b96d9d
@slow bobcat π might be interested. Remember when I was talking about trying to do something like this a few weeks ago?
https://github.com/EpicGames/UnrealEngine/commit/f9dbb462772873d9ae867ae4fa81cf540a1eff71 - also looks like ST Comp's tick is going to be disabled by default.
Interesting.
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
Maybe with how some of the bindings are done? Idk
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
What....? But... Trees run ok tick and the context execution is ticked in the state tree component tick
EDIT: ufff ok... this has changed A LOT since 5.3/5.4... I see pain and tears in my future path to integrate our logic with how they work now...
ok this is super nice and a "about time" thing. Super nice to see the devs are putting time and love into it
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...
Ah, I thought there were no accessors for it but tbh I didn't verify in 5.4
nah they are just protected variables accesible from your how child component implementation
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)
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?
Move to is executing and failing. Open Visual logger and check the navigation section to see why. Might be the nav or something else.
Do you have Navmesh at runtime?
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
The problem with the car is that it moves with its own system rather than using a character movement component right?
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
Yeah that's what I was thinking
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
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
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
do you mean even though the finish execute gets hit, it does not finish the node?
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
Oh?
Finish abort doesn't work either
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?
I mean I did call finish execute but apparently it doesn't finish the execute
do you have the Receive Abort AI event implemented on that graph by chance?
No
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
It does hit the breakpoint
ah, so it is aborting then or its not
yeah must be something else then
curious, did you know about https://blueprintue.com/ ?
If I call finish execute after reaching the second patrol point it loops the whole thing
<iframe src="https://blueprintue.com/render/y5b56mug/" scrolling="no" allowfullscreen></iframe>
Shit
Nope
the link works fine
What that exists?
ohhhh i see
Nvm, I thought you were calling Finish Execute before doing additional patrol points but nope thats fine
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
keeps on going? oh you mean the character keeps walking in the direction they were already going?
Oh nvm
So finish execute works if I call it after reaching the second patrol point but doesn't work on tick
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
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?
I want to check if there's an obstacle then I want it to finish execute so it can go to the next task which is go around
Then continue with the first task which is to go trough patrol points
ah ok, well you should probably use finish execute with false for success so that selectors and sequences work as expected in that scenario
Huh?
(which is what you were doing i think)
I used finish execute with false
yeah this
weird that it isnt finishing though when you do that (and there's no abort happening)
Yeah ik
How are you measuring the spikes? Are you using Unreal insights in a packed build (development would suffice).
Yes, Unreal Insights on a packaged dev build.
i dont think behavior tree runs on every frame
sounds like you are just seeing behavior tree existing
any chance you can share a screenshot of the frame where you have the spike?
hmm, there's some info that I can't share but I will try.
you can always cover names too sensitive to show or something.
Side question: are you using UE5.5?
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.
So... It's either the cast, the component fetch or the bool fetch. The last one I would discard. The other two:
your custom controller, does it have a c++ base? If you are casting to the BP class, try casting to the c++ class and see if that's the problem.
It's very weird indeed.
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?
It does have a C++ base, and the component's reference is cached, there is no searching involved.
Yes, its a simple getter.
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
Oh, sorry, I miswrote. I meant the controller itself is written in C++, there are no blueprints involved.
But, that's useful to know, thank you.
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)
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 π¦
Talking to me?
nah
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?
The run behavior is (more or less in terms of cpu) the same as if you were to copy all the sub tree nodes in the parent, very little overhead. The run dynamic is expensive because the injection happens at runtime, which implies initialization of the tree etc. I run into performance issues due to the game using it a lot. Few ms here and there were "wasted" in it
ok good to know, but no gotchas then?
for instance aborts-- do abort settings carry through?
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
"No one will ever need more than 255 behavior trees" -Bill Gates
That's the famous quote right?
Did you ever figured out what was expensive? Super curious
Ah, sorry, I got busy π
Thanks for the suggestions Bruno.
I ended up writing a C++ based decorator to replace the blueprint decorator.
Execution time of the decorators went down by 100 times, and spikes could not be seen.
Ah yeah the magic bullet to solving random BT (or ST) performance oddities :D
But are you adding cpu stats to the code? Just asking in case you don't see them due to nobody actually measuring (BP is auto measured)
I did, yes. I added TRACE_CPUPROFILER_EVENT_SCOPE in the C++ decorator, and that's how I compared it against the BP decorator.
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
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
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
That's the blending probably. And how long are you taking to play the next one
Anyone look at Ali Elzoheiry's Smart Enemy AI series? Or recommendations? Working on a boss fight π
oo behavior trees π
that series pissed me off to the point that Iβm just fucking around with the tools. He hides steps to force people to his Patreon and I can follow shit to the letter and it will still fail.
it could be a skill issue but it just drove me nuts
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?
Not sure if bad or not, but sounds hacky AF. I woudk rather observe the bbk changes in the node: you can register/un register to things like callback in Become/Cease relevant (remember to enable it in the constructor) and enable/disable tick when the callback happens.
that's what I do - and on the BBK change i either pause or restart tick for the node
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)
So any idea on what I should do?
Why it gotta be so damn hard to just reroute my npc
Any idea why the AI move to fails?
Good to know! Thank you
He does respond to comments a lot, maybe you'll have better luck idk, but the monetization gives me the ick
also anyone notice how cursed my attack tree is
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
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
I also tried to move to 0 but it just failed
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
you should also call finish task with a false if it fails. Otherwise your tree will be stuck forever on path fail since nothing is finishing the task
How do I project the point tho?
It works on a location on the map that is accessible
I tried this
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)
Huh
I don't understand why
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)
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
Oh noway InstanceData couldve been a class
Thank you a lot
Yeah I think that's undocumented, I randomly found out by poking in the engine code
StateTree API is so obscure as for today, builtin tasks is the only thing helps understanding this mess lol
Yeah pretty much
There's some explanation in Mikko st video during Unreal Fest Prague 24 and some examples I recall
Another 3 hours stream to pick 15 minutes of useful bits from? :D
Hahah no no, it's quite short. He talked for about 40min. It's in the pinned messages I think
This one
https://youtu.be/YEmq4kcblj4
In this presentation we'll have an in-depth look into what State Trees are, how they work and can benefit your work.
As we'll walk you through the UI, we'll showcase how efficient and flexible this tool can be for both designers and programmers. We'll cover the core functionality, useful features and of course the latest coming out in UE 5.4 and...
I'll have to check, maybe it's useful if it has info like that in it :)
Whats this lambda lifespan btw? CreateLambda locks it somewhere or what? It doesnt put any handle into the InstanceData there
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
@misty wharf what's FStateTreeTask_PlayContextualAnim ? Doesnt exist in engine code
Maybe a part of some plugin?
Or maybe removed in 5.5?
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
Rider should still find it at least if you have the engine indexed
No its not, the plugin project is unloaded when plugin isnt loaded
Now I see it, thanks
Weird, I don't think I have it enabled and it found it :)
Are there any other AI-related unknown plugins I should be aware of?
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"
Any useful info from visual logger?
Try passing speed through an interface and set up an enum for speed values
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
Have you checked visual logger to see if there's something off with the movement? Is the target actor valid?
yes I think im nailing the issue, turns out Im not even entering that state
so its not executing the move to state
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
Visual Logger is your best bet to finding out
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!...
Well I looked at the vid a bit and it seems to give a fair amount of details on how it's set up, so I'm not sure what your question really relates to
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
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
Sounds like you need to configure the age of your visual sense so it expires Xs after the rabbit hides
sorry, im new to ue, how would i do that?
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
IAISightTargetInterface is used to customize how AISense Sight checks the visibility of an actor. Usage Β§ This interface should be implemented by the actor that is being seen - in other words, for example if you want to customize how the player character is checked, you should implement this interface on the player character actor.
okay thanks, ill look into it
"name I've seen around here somewhere" lol
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
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
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
I guess there might be some other way of doing it but this is the method the engine code uses at least
this is definitely the right way, will report back thank you!
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
If you use the state tree debugger, can you confirm the state that has the linked tree runs?maybe it's not even entering
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
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?
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
Isn't your liked asset badly configured there? Don't you need to setup the right one?
You have linked the regular one rather than the override
Look at the linked asset there. Worth trying
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 π
Not sure tbh. You will have to debug the code I guess to see why it faiks
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
Debug symbols include all engine code
Oh cool so maybe I can do that and breakpoint my way through it
Maybe, there are still optimizations applied to the engine which may get in the way, but it should at least give something useful
Did you ever use this state tree override feature?
Nah, I'm not even sure where this UI is so it might be a 5.5 feature?
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
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
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