#gameplay-ai
1 messages · Page 51 of 1
hi all. I have a enemy ai that is moving to random nearby locations. When i hit the enemy I want it to stop and play a hit react animation. At the moment the behaviour tree move keeps the enemy moving/sliding across the ground while the hit reaction anim plays. What is the best way to do this. Is there a way to interrupt or sleep a behaviour tree or would it be better to set a variable/flag on the blackboard when the hit occurs and use a selector to stop the move_to?
One of the biggest costs to Move To, regardless of if it's called from the BT or BP, is if there is no path. The EQS can test if a path exists by using the considerably cheaper hierarchical path test.
But ultimately, how expensive something is entirely depends on what exactly you are doing and how you are doing it.
You can stop and restart the BT.
if i do this, will it remember what "state"/point of execution it was at when it paused?
You can pause it via C++, but from BP you have to use the lock/unlock logic functions.
what class are those methods on?
AAIController?
I had a look through c++ class and there is no pause function?
There is a PauseLogic() on the UBrainComponent
The BT component overrides that function
CastChecked<AZombieController>(GetController())->GetBrainComponent()->PauseLogic("Hit React"); Im calling it like this and it does nothing : (
if you want to stop the zombie then I'd just adjust the movement speed of the actor for the duration of the reaction
that is really hacky though
Im trying to do it with gameplay tags now
hmm this doesnt work either. Im turned hit reaction into a gameplay ability that applies the busy tag
Any recommendations for an AI system asset? No budget cap.
I don't see how it is
It is a specific solution that only works for hit reaction and move to and doesn't solve the general problem of aborting or pausing a blueprint so you can let something else take over. Heres an example: what if i want to have an ability that can steal movespeed. If i implement this ability 6 months down the line, it will behave unexpectedly and I will spend ages trying to figure out why.
The last post on this thread seems to be the most elegant way to solve this: https://forums.unrealengine.com/t/getting-ai-to-interrupt-abort-behavior-tree-moveto-task/306919/23 but its still pretty clunky. Maybe BT's are not the way : (
This is an old topic and there are many conflicting ideas for making this work spread across the forums. Here’s what I feel is the most elegant solution for UE5 using just a few very simple custom nodes. Use case is the following: the AI agent should MoveTo a TargetActor. If during movement the TargetActor becomes unavailable, abort the MoveTo....
seems to be a common problem
The most polished one you'll probably find on the marketplace is most likely going to be the HTN plugin
Hi! I'm trying to make an AI walk around an actor, like, on a circle path around it. Is there a way to make this? I think constantly firing an eqs would help, but I am lost on how to make it.
I don't care about the target actor's rotation, I just need my AI to walk around it
Kind of like this, but around an actor:
You could use EQS to generate a set of points around the actor perhaps, and then just have the AI walk those points in order
Is there a way to get all the points and walk in order? Cause the eqs only returns the best option doesn't it?
You can choose the query mode, one of them returns all the generated points. I'm not sure but I would assume it would return them in order
oh okay, thanks!
GorkaGames has graduated from using PawnSensing!
Their latest video uses AI perception lol
That's why I said they're following the Brackey's approach
Shotgun videos out there. Doesn't matter if it's right.
It'll eventually be right
GDQuest from Godot did the same thing
I'm still of the opinion that if people find value from them then there's clearly something right about them
The "right" is that they exist
Just because something exists doesn't mean it is right though.
A complete beginner gets value out of it because they are a complete beginner. But it stunts their growth in the end.
I don't think it does
Don't know what you don't know. So you trust this person who has X amount of subscribers
Not saying people have to be perfect teachers and what not.
Using a less than optimal tool doesn't necessarily slow down learning to use something I think
If you can write systems using pawnsensing, switching to ai perception shouldn't be that big of a deal imo
If they're teaching people to use this long deprecated feature - what else are they doing incorrectly?
It builds on top of itself
Well if it works then it works, if it's not the exact right way of doing it, it's easy enough to correct
And I disagree with this mentality in the context of learning
Sure - the things that are being taught should be the right things
However if there's a hole in the path to learn something that isn't being filled by anything that seems worse than it being filled with at least something
There isn't a hole in this regard though. It's people not looking in the right places. IE - not YT
Where the goal isn't for you to actually learn
But instead - get views
I think there's a lot of easier ways to get views than making shoddy tutorials
It's faster to make videos about incorrect understandings than properly researching and learning a topic.
The entire strategy is to keep pumping out videos. Especially more so with clickbait-y titles and thumbnails.
Things being taught is often outdatet
Both from courses and yt. Aswell as schook material
Sure, but I kinda get the feeling that if you went down the path of researching it you'd get almost nothing done seeing how poorly UE is documented and the general lack of information
For all I know half of the stuff I'm doing could be all wrong but since I have a fair amount of experience in general I can at least make an educated guess that it might not be lol
Not saying that you have to research the systems completely inside and out and 100% master them though.
hi, how can i call to this?
Well it didn't take long for the basic perception questions to start after that Gorka video :D
This gets called automatically when the perception system updates, you don't usually manually call it
Ugh, that guy needs to be cancelled lol
at least makes content people seem to like to watch ¯_(ツ)_/¯
People who don't know anything like watching anyone that will show them how to do w/e it is that they're doing.
And YT's algo favors frequent uploaders as well
well if it helps people get their game projects moving then that's all good by me... if they never figure out they might need to learn better that's on them
I'm self taught and I'm sure a lot of what I used to learn wasn't exactly correct but I spent the time to improve because I knew I probably should
Granted, I think we just find it annoying because we end up having to correct the same mistakes over and over from all the people that watch his videos and then come here because “it doesn’t work”
Nature of the game tho, I suppose
so im following along on that pinned ai course, and i got to the navmesh section
im wondering if that will work on a 2d platformer
What do you mean it does nothing?
The biggest problem I have is the tutorials always use "this is THE way to do X". While there are MANY ways. And what they are often showing "works", but doesn't work well. Plus they don't explain any of it. So people aren't actually learning, they are blindly following along how to make things often in really terrible ways and not understanding that there are other ways to do things.
Up in one of the other channels, someone took a quick peak at one of GG's tutorials (the horror game one) and he was just telling people to put a value into a field. No explanation on why or what it does or how they came up with that value
And THAT'S what I strongly dislike
There's no hobbyist tutorials that explain their thought process for any of it. Or any of the WHY. It's a shit way to learn code (BP is still code). Coding is all about making decisions by weighing the pros and cons of different approaches. But what you get is people expecting to find the one way to make an inventory, when the answer is it depends.
And a lot of the reason is because most likely, they themselves don't know the why.
Because they blindly followed along to someone else's video and now think they can teach others.
Copy and pasting code is a fine way to learn. Then you want to make adaptations and need to understand parts of the copied code. This way you can learn step by step but you can accomplish a little more than when writing everything from scratch, which is a nice way to stay motivated imo
I run a EQS Query in C++ and it doesnt show in GameplayDebugger :c
FEnvQueryRequest RequestedAIMovement{EQSQuery,Target};
RequestedAIMovement.Execute(EEnvQueryRunMode::AllMatching,QueryFinishedSignature);
The gameplay debugger is garbage for EQS debugging. Use the visual logger instead.
Have you tried using breakpoints in your code to see where it's failing?
I have a UPercpetionComponent in my custom AIController that's set to detect only enemies. I've overridden GetTeamAttitudeTowards in the AIController, and despite returning Hostile, the perception component is not triggering OnPerceptionUpdated consistently. Does anyone know why that might be?
Can somebody explain to me, how instancing works for UBT_Node derived classes e.g Decorators, Services. If I have two controllers and they run the same BT, using a service. Will that service be instanced for each BT or it will be a CDO ? I don't really get when to use node memory and when not to.
C++ BT nodes are not instanced by default. Which means that if you want to save variables, you use the node memory.
So in a node if I have class members that I want to save and I don't use a memory structure, the node will contain the same info for all npc running the tree ?
So in other words the node will be of default value for all.
Yes.
It doesn't use the CDO. Let's say if I have 2 different BTs that both use the same service. If I have an exposed member variable that is a float Distance. In 1 BT I set that variable to 100 and in another BT I set it to 200. Any AI that uses the first BT will have distance = 100.
All functions should be considered const. Meaning that they do not alter any member variable. You can alter variables in the node memory, but not member variables.
Ohh I remember that from the docs. So it's a good practise to set everything to const if it's a class member.
If you find yourself needing to change it, move it to the memory structure
You can set BT nodes to be instanced by setting a bool in the ctor, but you lose some perf benefits
You don't want them to be set as const.
Any member variable should just be whatever you want to set in the BT.
Does anyone know how to make it so that when the Variable "Inside" is set to true, my Enemy AI stops chasing me?
Image
This 2nd image is a BP that makes the AI lose me when i am out of its pawnsensing but the issue is, it loses me too easily so i want to make it where when i am hiding in a closet with the Variable "Inside", it stops chasing me and continue with its task and roams around the map
Image
Much thanks if anyone help, and feel free to ask me to send any UE screenshots if you need more information, The whole Enemy AI was made from watching Gorka's Horror game tutorial video
https://www.youtube.com/watch?v=QoXxNpTyuV0&t=3369s&pp=ygURZ29ya2EgaG9ycm9yIGdhbWU%3D
Hello guys, in this detailed and simple tutorial we are going to learn how to make a full First Person Horror game in Unreal Engine 5.
↪️Project Files: https://bit.ly/GorkaGames_Patreon
🔊 FREE SOUNDS:
Footstep: https://freesound.org/people/RonaldVanWonderen/sounds/110099/
Jumpscare: https://freesound.org/people/dangthaiduy007/sounds/341670/
Sta...
sigh
- PawnSensing is long deprecated. Use AIPerception instead
- It was a weee bit hard for me to follow what it is that you want to do. Are you saying the AI loses you as soon as you enter the closet but you want it to be more like a delayed thing?
A really simple way to do things is to get a reference to the player and just check for that variable.
I'm getting this really weird issue with my BT where my AI is defaulting to a state that it shouldn't be, and I'm having trouble debugging it. I'm using a basic utility AI service to decide whether to attack, defend, or perform a utility, and its just defaulting to attack every time, even when I try to default the service to utility. The odd thing is that when i try to debug in game, the blueprint has the two pawns as options under the debug object selection drop down. Anyone have any thoughts or willing to help me walk through this?
this is what the BT looks like rn
Is your service set to call tick on search start?
Nah im justm dumb haha i was casting to the wrong controller class
blocked up my whole BP
changed my thinking on how to do AI halfway thru and then forgot about it, so I was using a deprecated class on accident
Services are run while the branch is executing. Your set up will not work unless you tell it to tick on search start.
why does it need to have tick on search start? It worked just not without it, but does that make it just work once?
Ok, yea now i'm noticing that my service only runs once. How do I get this to run repeatedly? I'm thinking its because im using a selector but not sure
A service ticks while the branch is executed. So if the branch doesn't stay there, it won't tick.
If you turn on tick at search start, it will call the tick before the BT searches for a task to use.
Ok I see, i was using on activation AI, not on tick.
Do you understand how a service works?
its been a while since I have looked at this stuff, so maybe not. My understanding is that its a BP that runs in the background while a branch is being executed, and you can use that to update various values as needed, whether they're blackboard keys or otherwise.
2, no, the AI loses me immedietly when i am not in its pawnsensing fov, I want to make it chase me forever which it does now, and stop chasing me when i enter the closet(When the variable of the closet "Inside" is set to true)
Do you only want the chase to happen when the player first gets seen?
Receive activation happens when the branch is first entered. Basically when execution starts. This is a good place to do things like set the move speed, because the deactivation always happens when you leave a branch
I want it to chase the player in many other ways too but i am not skilled enough to know how to do that so having the player get chased while seen will do for now.
is ai perceptionmuch better than pawn sensing? should i use that instead?
PawnSensing is old and outdated. AIPerception supercedes it
It's how you should be doing it.
The person who made that tutorial is just spitting out videos. Quality be damned
is there any UE youtuber that you recommend for me to learn UE? Not necesarly Youtubers
Ah ok, that makes sense! I had a lot of trouble getting started as it seems that the documentation is...lacking haha so it looks like the interval on the service in the BT overrides the tick rate? so im thinking something like every second to help with resource cost?
To solve your immediate issue though - just don't clear the BB value when you lose sight. So the "Stop Seeing Player" thing you set up. Just don't do that
The best way to learn AI is to do the introduction to AI with Blueprints, it's linked in the pinned messages
No. But for AI - do the first link in the pinned messages like Luthage said
oh sweet! will take a look
so Delete this?
Yeah. Because that is what is making you lose sight (based on the 2 screenshots you gave)
So the PawnSensing component will trigger to SEE them.
(Though, seriously, don't use that. Switch to AIPerception)
AI should also be done in the controller, not the character
That too
Controller = Brain
Character = Body
Brain tells body WHAT to do. Body decides HOW to do.
is this regarding the first person controller or the AI?
AI
What she is saying is, this logic shouldn't be on your character
It should be on your AIController
Why is Gorka telling you to clear the "SeeingPlayer" value every 0.2 seconds??
The first person controller is a player controller. AIs are not players
ohh so This image should be in my BP_AI_controller?
You should do the course and learn how to set up your AI correctly
Will do, Thanks for providing it
It's a minor setback, sure - but it'll help in the long run. Build better foundations and all.
[4602.03] Compile of BP_AI_Controller successful, but with 1 Warning(s) [in 33 ms] (/Game/AI/BP_AI_Controller.BP_AI_Controller)
alright then, i will switch to AI perception and do the course and give it a go
thanks guys
and girls
It's complaining because you don't have a PawnSensing component on the controller most likely. So that "On See Pawn" event isn't legal.
ahh
do behavior trees ever get... silently corrupted or something?
I’ve seen nav meshes break, not BTs tho
mine is starting to get stuck on debug nodes that immediately finishing tasks in a sequence...
Use the visual logger to debug
wtf is going on here?
the visual logger, which I'm not very used to, suggests that the selector child has changed from 1 to 0 (implying it should be on the left, correctly), but this does not appear to be reflected in anything else
sigh... it was an incomplete override of abort
If I have an NPC with an AIPerceptionComponent on its AIController, do I have to have a UAIPerceptionStimuliSourceComponent on all actors that I want to alert the AIPerceptionComponent, such as other NPCs?
Pawns are automatically detected. If you disable that in the ini, then every actor that you want to perceive needs to have a stimui source component.
In my custom AIController, sometimes, OnPerceptionUpdated doesn't fire, despite GetTeamAttitudeTowards returning the correct type. It seems totally inconsistent. Do you have any intuitions for why that might be?
(This is when there is a detectable character in range -- and I can see GetTeamAttitudeTowards being called)
Just because the team attitude is correct, doesn't mean they are being perceived. Have you tried using the gameplay debugger?
I don't think I have. That's not the same thing as the AI debugger, right? Or?
There is nothing called the AI debugger. The gameplay debugger is the debug drawing that is turned on using apostrophe ('). To get to the perception category you need to use the numpad, I think it's 4 as the default?
Oh lol -- Okay, that's what I have been using, but have not been testing the perception component. Will try that out.
I tried using the gameplay debugger. I can see the enemy NPC enters the bounds of the perception component, but still, it doesnt trigger OnPerceptionUpdated consistently. It's only rarely.
Here is the code I'm using in the AIController constructor to create the perception component:
DistantPerceptionComponent = CreateDefaultSubobject<UAIPerceptionComponent>(TEXT("DistantPerceptionComponent"));
UAISenseConfig_Sight* DistantSightConfig = CreateDefaultSubobject<UAISenseConfig_Sight>(TEXT("DistantSightConfig"));
DistantSightConfig->SightRadius = 1600.f;
DistantSightConfig->LoseSightRadius = 2000.f;
DistantSightConfig->PeripheralVisionAngleDegrees = 180.0f;
DistantSightConfig->DetectionByAffiliation.bDetectEnemies = true;
DistantSightConfig->DetectionByAffiliation.bDetectFriendlies = false;
DistantSightConfig->DetectionByAffiliation.bDetectNeutrals = false;
DistantPerceptionComponent->SetDominantSense(*DistantSightConfig->GetSenseImplementation());
DistantPerceptionComponent->ConfigureSense(*DistantSightConfig);
DistantPerceptionComponent->OnPerceptionUpdated.AddDynamic(this, &ANPCAIController::DistantPerceptionUpdated);
Why are you setting it up in code via the ctor?
Do you see the perception being updated correctly using the gameplay debugger? It should have spheres that follow the target as it moves.
It's the parent class for all NPC AIControllers, and all subclasses use the same perception component. The subclasses have functionality that I want to implement in C++, so I think it has to be in C++ for them to inherit the perception component
I don't see any sphere being added to targets
That means they aren't perceiving the target. Common problems with that are line of sight collision issues.
I see. I don't understand why though, as they are on a flat surface facing each other
hey, how would one go about implementing spawning ai out of sight? any tips?
have trouble finding an out of sight spot to spawn ai at since I can't run an EQS query on a player
Is there a benefit to running World Partitioned navigation on the dedicated server? Or is it only about being able to stream it in with WP map chunks
use the player as a context and test against that
is there any way to disable the detouring behavior of a DetourAIController?
don't use it, that's the only thing it does.
If you want to conditionally disable it sometimes, you can probably adjust the settings on the detour component but I don't know if any of those settings are exposed to BPs
that's fine. I'll look into it I guess.
I have a hefty stack of enemy unit controller base class stuff built on top of this one, and now have one variety which should just ignore others...
I think there are avoidance groups you can set which should allow you to do that
But yeah if it's just one particular type of AI that doesn't avoid the others, having it not use the avoidance comp would be one way to go about it... but if all your logic is in the controller class, then I guess it's gonna require some refactoring
im amused seeing that that the detourai class seems to be just the regular one plus a component with literally no other implementation details
oh, hmm, but do detour ai avoid non detour ai
They can do that but you probably need to manually register it with the crowd manager
It may require also implementing https://zomgmoz.tv/unreal/Crowd-Avoidance/ICrowdAgentInterface
yeah ok that tracks
I don't recall off the top of my head whether regular AIC's have it or not
scrolling through the path component, looks like no.
couldn't get this to work, I'll just fiddle with good ol' linetraces 🤷♂️
I mean, you'll need linetraces against the context, but if you want to check for something relative to the player, then the player should be a context.
but the ai doesn't exist in the world yet, I'm just looking for the correct spot to spawn them
Hi Guys, I want to Sync my Line cast for shooting with AI animation for shooting(which is montage).
right now i can line cast before the Animation starts but it doesn't look realistic
or i can line cast after the AI animation finishes i dont want that either
how can i do that
can I raycast by triggering a animation Notify State ?
is it a good thing for making an AI shoot by triggering a Animation Notify State ?
oh, well learning how EQS works is the place to start then 😄
don't try to do a very specific thing too quickly, you'll run into problems with the basics
patience 🙂
guys is it good thing to make the AI shoot through Animation Notify state ?
Be patient
What is this line cast you mentioned
Guessing you mean line trace
I think generally you want to talk to the animation from regular bp/tree, not the other way around
In other people's experience, is AI sight highly influenced by the height of characters and the terrain they're on? I'm finding that my character is detecting other characters very inconsistently. I imagined sight would function more like a sphere, but when I checked the gameplay debugger the line of sight seemed extremely thin
anyone had the issue where ai send each other flying when they bump into each other, but just once in a while? I've fixed this problem a few times but usually its just having the right combination of capsule collisions etc. tricky one to replicate consistently also.
Sight is a linetrace by default. You can change how it's done on a per-target basis by implementing IAISightTargetInterface
Oh, sweet. I'll look into that
You might have some invisible collision.
I do have some concerns about setting up the component in the ctor. Usually that should be done in pre initialize components or post initialize components. I also wouldn't recommend hard coding the values either, but that's up to you.
You can use an animation notify to do something during an animation.
Guys, 'AI Move To' (and other systems) goes to the specified location, which is good. But it goes by looking at that location. How can I make it go there by looking at the location I want?
I can adjust this with 'Find Look at Rotation', but the 'look' system in AI Move itself prevents this. I need to disable it, or change it?
Sight is a line trace. Pawn viewpoint to the target.
Do you want it to look at, as in just the head looking at something. Or do you want it fully rotated towards something else?
I want it to look at me as a complete actor. I can do that. But I want to ensure that when the 'AI Move' function is active. This function allows the AI to move by looking at the location it is going to. But I want it to look at me on the way there.
Use Set Focus on the location or actor you want it to be rotated towards. Then use allow strafe in the move to.
I'm trying, now.
You're trying to use the function Set Focus?
Yes, I hope it's works. Trying now
Thanks
Thanks, it worked.
im getting this odd behavior with my BT where my services are running, they evaluate that the pawn should move towards his objective, so he does. Then the target gets set, so it should attack, it evaluates an attack, and then just...quits and remains on the root node. Any suggestions on fixing this? Here's what my BT looks like, happy to provide anything else
Probably a little hard to see, but at this point, the service has deemed 'throw grenade' to be the best option. So its in that state, but doesn't execute any of the nodes under that branch
Use the visual logger to debug
will have to look into that. Didn't really understand how to use that in the past
Do you mind helping me figure out what this means? this is from the moment that the BT returns to root
For those of you who have enemies that use abilities with various range/positioning requirements: when an enemy is moving into range or moving to a desired spot to use an ability, do you constantly re-run the EQS query to keep their movement goal updated? Is there a way to pass in a previous query result to see if it is still valid in a later query?
Looks like they were added already, you can see them earlier in the log
Yes. I use a service to update the EQS. You can use a generator to get the current move to location and do tests on that before doing a full generator for all the points. In an EQS, the generators are run from left to right until the first one finds a valid item.
so the services are added, the result is output, but the branch isn't actually executing. it just returns to root
Oh wow I didn't realize there was an early exit built in. So I just need to make a custom generator where I can pass in a blackboard key and run the same filtering logic as the other generator in the query?
Yep!
You want to verify that the branch you think it should be in is actually valid by using the visual logger. Just looking at the BT during play isn't going to give you valid information, it's buggy as hell.
do you do that for every query that enemies will be using? like each one has an extra generator in front where you've essentially copy/pasted any filtering from the main generator?
Not every EQS, but a lot of them.
Alright, thanks
do i have to add the BT to the visual logger? I'm not seeing a way to look at it in the recorded data
Nope. It's already logged out for you. The blackboard data is on the left side though.
ok, so i see that once the target is set, none of the attack tasks show anymore. Does this mean that part of the tree isn't valid for some reason?
It'll tell you what decorators are blocking execution. It would help you to read it more if you named your decorators instead of leaving the default name. "Blackboard based decorator" doesn't help much.
Is EQS the best way to make an influence map nowadays? I need like a 3v3 AI so I'd like units to be able to move around enemy attack/ability ranges. Like a moba bot basically. What would be the best way to get started on that?
ahhh, good suggestion, will take a look!
@vast relic I know you were looking into influence maps did you happen to have any words of wisdom
I'm not seeing something specifically saying its blocking, just in progress
I wouldn't necessarily say it's the best way to make any influence map. One of the main points of an influence map is the sharing of data, which you don't get with the EQS.
The EQS however could be a way to do what you are looking for, just in a different way
That was going to be my next question I was going to say is there a way to make an eqs be centralized to all ai but okay sounds like that's not what eqs is for then
Execution forbidden is the term the log uses for the decorator, which I do see.
yea, it forbids the correct stuff given the current state. it's not forbidding the action that it has chosen, so not sure exactly what is going on. thx for your time tho!
Ah ok, i figured it out. Was a combination of bad service coding and then using a sequence instead of a selector. The sequence was cancelling the branch as soon as the low level state was wrong
could anyone help with doing a blueprint and behaviour tree combined system that chooses the directive based on the largest available float percentage out of 1 for dynamic behaviour such as switching to the harvest behaviour while patrolling or idle. dms appreciated
Don't ask to ask, just ask your question and if someone can help they will.
Hey guys I have this precise navmesh, but I when I try to use FindPathSync() to get the points from the result and follow them, I'm not getting an accurate path at all. Pictured is the terrain, and the solid line is how a lot of paths typically go when I want the dotted line.
There's enough triangles, so why is it only generating two points? It keeps going over valleys and through mountains like it's barely using the mesh.
If it doesn't need to turn I don't think it will create more than one point
What you get from it is not the exact line the actor should take, it's basically waypoints that can be walked to in a straight line iirc
I'm not quite sure why this seems so complicated. If it's a character it has gravity applied to it, so if it's walking in a straight line, it would follow the contours of the terrain
Anybody here got the faintest how I could make 3d sphere navigation?
Like for a planet? Instead of a flat plane as all games do it otherwise?
Custom decorators are constantly called, right?
As in, if I have a custom function on a custom decorator that function is being called every frame?
Depends? Is that branch firing every frame?
It's attached to a MoveTo node. I need my AI to stop moving once it's in range and LOS, which is what the function checks.
My understanding is that if this was a blackboard-based condition that it would only trigger once the relevant blackboard value changes.
As it is right now I imagine that every frame that MoveTo is still executing it is checking that function
I don’t think that’s how it works. Afaik MoveTo isn’t supposed to fire every single tick, that would break it. If that’s the functionality you’re looking for, use a service.
Yeah, a service that will set a key right? Then my decorator would be blackboard-based around that key?
Or a decorator that checks a BB key every tick, if that’s what you need. Or both. World’s your oyster
I have this custom decorator but this seems like it should be redundant.
I'll redo the decorator on the movement to be blackboard-based and I'll have a service set the key since that seems to be the most optimal. I don't need the movement to be interrupted on a frame-perfect degree
I've just been working with my own movement is all. Implementing gravity is simple enough but it's surprising the pathfinding works that way.
Tbh I would have expected it to give you a path along the surface also :)
but I guess it simplifies it since it assumes straight line movement or something
As the crow flies, prly helps keep more accurate distances
The CMC doesn't use gravity to stick a character to the ground. It does it itself by finding the floor and moving the character along it.
The nav mesh is a simplification of the world geo and terrain. It'd be really expensive to make it precise. The CMC is how the NPC walks up a hill, the nav mesh just says that it can.
Oh Character Movement Component?
Ah.
Any ideas how I could make pathing for a sphere world?
Kind of like Super Mario Galaxy, but for NPCs? I already saw a thing online for doing that with character gravity
Well I meant as accurate as the mesh itself is, that doesn't seem like it would be any more expensive than pathfinding in general
This fact took me by surprise aswelll
Suddenly pawns be flying
Currently doing some crazy linetrace along landscape
so, I wanna have the ai to smoothly stop at the destination, and Use Acceleration For Paths is the solution, but now there's a different issue
when it chases a player, and the player tries avoiding the ai by moving in circles without moving anywhere, the ai struggles to reach the player cause it is strafing even tho Allow Strafe is off
if I have Use Acceleration For Paths disabled, the ai will reach the player with ease
and I can't change that option through blueprint
it should've been possible to do that in blueprint
but nop, its C++ only
ah wait, pffff
I completely forgot about "Use Fixed Braking Distance"
Hey!
Any idea what RequestStimuliListenerUpdate does?
I was thinking that it would update the common PerceptionComponent events but it seems like it does not.
(I'm looking for a way to get a perception update while an actor is perceived, not only when it enters and leaves the vision cone)
what do you mean by "while an actor is perceived"?
I see that there have been a lot of discussions about that already.
...what I basically need is to force update the Perception events
like, get the stimuli data from it?
While I'm in the viewcone
ah, to make it update every frame?
Not necessarily every frame
But basically yes. I need a way to force update this event in order to get new stimulus data
I'm not super good with it but did gameplay programming with it.
So I probably could figure it out 🙂
...I'm just surprised that there is no easy way to do that. In the forums/reddit you read very often that the perception system is kind of flawed^^
EDIT: the On Perception Updated is flawed
People say this but I've yet to hear how it's flawed
iirc this updates things like detection by affiliation related things, if nothing changes it probably isn't gonna retrigger anything
The way to do what you want is to use a timer. You can get a list of currently perceived actors from the perception comp, and their stimulus data
Oh right!
Gonna try currently perceived actors then, thanks 🙂
https://www.reddit.com/r/unrealengine/comments/ukdz4k/ai_perception_sight_forcemanual_update/
This is one of the threads I came across
Rip
wtf is luthage? 😅
the person who replied to that post and also same name here, she's quite knowledgeable about various AI systems and stuff
Yeah I know it's the person in that post, I just had no idea who that is^^
although I don't recall having had that exact issue she specifies 🤔 maybe I misremember, the force stimuli listener update thing might fix it also but yeah not 100% sure
To give some context:
My Issue is that if the enemy reacts to a noise event it shouldn't set CanSeePlayer = true because it should first investigate the noise location. The problem is though that when the noise event originates from the player location and the enemy turns to the players location (basically see's the player) CanSeePlayer will not be set to true because the perception event executes the hearing sense branch 🤷♂️
...Though I guess I can figure it out thanks to your help 🙏 👍
You should be getting two separate events if you get two separate senses like that
...know what?
Now it does trigger both branches 😂 🙈
Ai is really weird sometimes.
...although obviously I made some silly mistake somewhere
If you read what I wrote, it says that the On Perception Updated is flawed, not that the system is flawed.
That's what I actually meant.
Sorry, wasn't my intention to misquote you 🙏
I've corrected it now
Force listener update should not be used to "fix it".
Yeah I haven't used it for that, just for triggering an update when updating affiliation, I recall it was needed for that to work
Definitely needs to be called to change teams.
Different kind of AI, but I managed to run Reinforcement Agent in UE5. (it's WIP and everything is rendered on CPU). Gonna leave it learning for couple more hours.
hi guys i need help in unreal engine AI Finish Execute called faster than the Event received abort AI
so that Event received abort AI is never called cuz Finish Execute (true) is called before abort AI
Well you are calling it yourself immediately
You need to call Finish Abort on the abort event by the way, not Finish Execute
But if your logic runs to Finish Execute on Receive Execute, then obviously you can't abort it anymore because it already finished. Only nodes that perform latent actions can realistically be aborted.
Is it acceptable to set a Blackboard value within a Decorator, or will I be labeled as a poor AI developer?
Who’s reading your code and giving out labels?😀
ahah mostly, the "future me". My question is just to be sure that i'm not creating an issue that I'm not aware yet
Not sure, I usually use decorators to check values not set them
While a character is detecting another character using the UAIPerceptionComponent, in the gameplay debugger, would you expect the sphere that indicates a character being perceived to be continually updated as the perceived character moves around? Or would you expect the sphere to stay in the place where the character was first noticed?
yo anyone know how to make the ai shoot a projectile at a player that is on a different level than them, without using line trace?
Same way as you make it shoot a projectile at a player that's level with it?
no like the ai is higher or lower elevation to the player.
It really shouldn't matter
You're just giving the projectile a target vector to go towards
elevation is taken into account
i need to do this without using line trace. there projectiles are not hit scan.
This changes nothing
Get reference to the target
Get target's location
Shoot projectile towards location
what the node for that one?
Node for what?
to shoot at target
There isn't a node "shoot at target"
If your projectile has the projectile movement component, it might have something like that. idk
I just gave you the logic. Turn that logic into code
pseudocode basically
are you talking about line trace?
For the 3rd time. No
Which part are you having issues with?
And why do you think we keep referring to how to do it as a linetrace?
it wont shoot the projectile at an angle only straight, like this.
it goes right over my head
Yeah - because you have to do the math to give it a trajectory.
anyone here familiar with state trees? How do I pass data from the state tree to state tree tasks?
I want to pass the context actor to a state tree task
dw i got it
Please direct me if this isn't the right channel for this, but I'm having an issue with smart links/navmeshproxies. I have a working NavLinkProxy, except for certain starting positions of the navigating character, the path data seems to be invalid? It causes the smart link event to not fire. I've traced it to the following segment of engine code in PImplRecastNavMesh.cpp around line 1532-1537:
const dtOffMeshConnection* OffMeshCon = DetourNavMesh->getOffMeshConnectionByRef(CurVert->NodeRef);
if (OffMeshCon)
{
CurVert->CustomNavLinkId.SetId(OffMeshCon->userId);
CustomLinks->Add(FNavLinkId(OffMeshCon->userId));
}
Sometimes the navmesh generates a path with a valid connection for that segment, sometimes it points to a different connection in memory with the same endpoints but userId is 0/invalid. I'm kinda lost here.
Why not set it in a Task or a Service instead? It will be much easier to debug for others.
Does anyone know how you can have a cooldown on a task that doesn't fail the task if it was in cd. Built-in cd decorator fails the task and it also starts with cd instead of starting as ready. I am basically trying to add an attack speed check before using that task.
You need to make your own cooldown if you need it to behave differently from the builtin
I'm not sure how you would not fail the task though - what is the point of the cooldown if it doesn't stop the task from running?
Maybe he wants to know why it instantly fails the first pass
I always wondered that, tho I prly missed some obvious setting
I think it's because Epic doesn't understand what a cooldown is
:P
There's no setting for it as far as I know
Although a while back there was someone here saying it works differently in packaged so who knows what's up with it
Anyone know for what reason my AI is moving fine when playing in PIE on a nav-mesh, but in a packaged Windows build they no longer move even though the nav-mesh is there? I have build navigation and all, so I don't know the reason.
I need rest to play no matter what. I made it work by using a bool check instead of BTD.
Need to attach a debugger or something, make sure your behavior tree / state tree initialize properly and actually run?
I remember I had that issue. I replaced with another nav mesh and it solved the problem.
Ah, okay! Thanks will do!
Using the Force Success decorator is usually the way to go for something like that
You can also use state trees instead 
That doesn't solve anything :P
It's just a different way of structuring it and it has its own features you need to understand to make it work
You can be in a specific state that you need to be in and you can literally "wait" in that state if you don't pass certain conditions, hence you technically don't need to re-evaluate the entire tree to check those conditions again
That part is certainly true, a lot of differences and state tree specific bs
Hi guys I need help, I am only setting the isAiming is true in BTT_Aim task after the aim animation is finished cuz i want to only once to play the aim animation and after that the AI should only shoot, but since the isAiming is false the node after Aiming Sequence is not playing, how do i fix this.
basically i want the BTT_Aim task to execute only once after that i want to execute BTT_Shoot as long as the the player is within the Gun Range( which is handled by IsInGunRange)
hello devs , i am sorry it might be a dumb question but i have this two states of AI "Patrolling" and "Attack" , and when ai sees a played it should drop everything he is doing , and immidetly start attacking part , i am setting "RobotState" blackboard to "Attack" state when ai sees a player but it is waiting to finish patroll part first and only then starts attacking part , i want immideate attack as soon as ai sees a player
correct me if i am wrong but can you not force success on a sequence? In that case put Aiming decorator sequence under another sequence and then make sure that one returns success...? I think? Been a while since ive done BTs
There's also force success decorator, description sounds like something that you are looking for
just an example, but try putting your aiming sequence under another sequence like this which forces the sequence to succeed, i swear that should work 
You need to set up observer abort. You also really don't want to force your BT to act like a state machine like you are doing.
Your logic is backwards. A sequence executes the nodes in order from left to right until the first one fails, but you want it to shoot after aiming.
and what is your suggestions to avoid state machine like acting?
Actually use the tree structure. Something else is clearly deciding when to attack. Just make attacking a higher priority and use a decorator.
Have you done the AI with Blueprints course on the learning library? That's the best place to start, instead of YouTube
nope, where i can find it?
It's linked in the pinned messages
Exactly because it checks isAiming is true if not don't shoot, but if aiming keep shooting
I fixed it don't bother thanks guys
I have a flying AI with 'enable flying' checked and movement mode set to flying. Even with this a NavMesh volume in place the MoveDirectlyToward node doesn't seem to work, the tooltip says 'without regard for the navigation system' but this doesn't seem to be the case. Am I missing something here?
Use the visual logger to find out why it’s failing
failed to project destination location to navmesh I made a new EQS and it seems to be working, have to test more tho
man i hate UE AIModule
Hi all,
I have this GetTeamAttitudeTowards implementation (taken from lyra) and my Enemy is Team 1 and the Player 0
why is the AI sensing other Enemies even if he returns them as friendly and I disabled detect Affiliation friendlies?
ETeamAttitude::Type AFireteamAIController::GetTeamAttitudeTowards(const AActor& Other) const
{
if (const APawn* OtherPawn = Cast<APawn>(&Other)) {
//log pwn
UE_LOG(LogTemp, Warning, TEXT("OtherPawn: %s"), OtherPawn->GetName());
if (const IGenericTeamAgentInterface TeamAgent = Cast<IGenericTeamAgentInterface>(OtherPawn->GetController()))
{
FGenericTeamId OtherTeamID = TeamAgent->GetGenericTeamId();
//Checking Other pawn ID to define Attitude
if (OtherTeamID.GetId() != GetGenericTeamId().GetId())
{
UE_LOG(LogTemp, Warning, TEXT("Hostile"));
return ETeamAttitude::Hostile;
}
else
{
UE_LOG(LogTemp, Warning, TEXT("Friendly"));
return ETeamAttitude::Friendly;
}
}
}
UE_LOG(LogTemp, Warning, TEXT("Neutral"));
return ETeamAttitude::Neutral;
}
So what you mean is you just want parameters to act as a blackboard, and it's definitely possible since we did this same thing at my old job. You need to do some c++ magic, get to the parameter struct variable inside your state tree and basically const cast the const away from the param variables and then assign values to them. I'll dig around as well and see if I can recreate it
Did my suggestion work? Or how did you fix it?
Used a conditional loop
hey guys im currently trying to change my Nav Mesh Agent Radius to 0 but everytime I do this in the RecastNavMesh-Default it works but after restart of the Engine its resetting again. I also tried setting the Agent Radius in my Project Settings but that didnt help either, does anyone know this problem?
Did you try my suggestion at all or you didn't bother?
you need to change the default navmesh settings inside the project settings if I am not wrong
yeah but thats what I did
its set to 0
but here you can see its not 0
always resets to 35
Is that this one?
uhm
no
I dont have supported agents
im gonna try creating one
oh it works now
thanks
and then try to delete and replace the existing navmesh maybe
Thanks for your help man, I didn't try what u told though since my solution works, if something gets broken I might try your solution tho thanks
When are you setting the team ID?
My AI is only chasing the listen server and I used ai move to on begin play
I want my AI to chase all players or nearest player.
Yes that is also an option. Or just store those variables on some ai component which is located on either your AI controller or your AI character.
Didn't have time to mess around with state tree parameters yesterday but I will definitely look at it today
Depending on what you are trying to do, you shouldn't store instanced AI variables on a gamemode, since gamemode is a singleton (only 1 of that object class exists at a time)
Hello ! Is that possible to modify an instance data externally? (eg. Task A instance Data got modified in Task B that is bound to instanceDataA.parameter )
It seems very complicated to communicate with parent task, evaluators or even global tasks in StateTree if you have any advices about that i would be more than pleased to hear them 🙏
If the data is modified I think it should get updated in the instancedata if it's bound to it
so if you have an EQS query with a line trace and a Post Projection Vertical offset of say 200 and enemy with a flying movement mode, shouldn't it fly (move directly towards) to the offset point or does the nav point always need to be on the ground? It seems like the functionality it there to navigate above ground yet this doesn't seem to want to work
The navigation works on the ground but as soon as I try to move the point up, either with Circle Center Z offset or the line trace vertical offset the points generate but the AI just won't move there. So idk does 'move directly towards' still need to have points directly on the nav mesh?
Ok, got it to work. I noticed in the Visual logger it mentioned to turn off goal projection. We Flying!
Hi, I have a question.
How can I make my BTTask wait until the attack animation of the task is finished before executing the next task?
Don't call Finish Execute until the animation has finished
How to do this depends on how you're running the animation - often this involves using an event dispatcher on your character which you trigger once the animation completes, so the BT task can listen to it
So, based on this, I shouldn't use FinishLatentTask in the code either, right?
`// Apply close range attack
IBossBaseInterface::Execute_ApplyCloseRangeAttack(OwnerComp.GetAIOwner()->GetPawn());
SelectedAttackState = EBTNodeResult::InProgress;
//FinishLatentTask(OwnerComp, SelectedAttackState);
return SelectedAttackState;`
I don't recall off the top of my head how this works in C++ so can't really say about that, maybe check how the Wait or MoveTo nodes handle it, they probably have some logic related to this
I'll handle it with wait for now, at least it works for the prototype. I really appreciate your help 🫶
np, it's pretty easy to set up in a blueprint BT task so if the C++ stuff looks like a pain then I'd just do that instead :)
(and C++ stuff related to latent stuff often can be kinda annoying)
My Pawn is int32 0 and my AI has int32 1.
When I check the log it says its enemy with the player (so its working). But in the update perception the AI gets in all other AI Pawns even if the log tells me he recognized them as friends. In the sense I configured to only enemies.
I double checked everything and the logs shows me that my implementation and the teams are set correctly. But why is the sense still returning friends?
Greetings!
Has anyone tried to use structures (arrays) (or probably create analog) in BlackBoards?
Example: I have an array of mob special features (feature - just string name or number). I want a decorator that will check "is array contains an element"
My first idea - use string as blackboard value and "contain" decorator, but it will be difficult because UE5 did not allow to use regular expressions
Assuming it's just a single montage or they all have the same length I just cheat like this
What do you mean it's chasing the listen server? How are you finding a target? Just using move to in begin play isn't really a good option.
Don't use a wait node. Just bind to the animation ending preferably using a montage that already has that functionality.
I didn't ask if you were setting it. I asked when. It's actually a very important question based on how the sight perception sense works. If you are setting it after the sight perception is registered, then you need to call update listener on the perception component when you set the team. This is because the sight sense caches the targets based on team.
Why does it need to be in the blackboard as an array? If it's just to create a custom decorator then it doesn't need to be in the blackboard. Decorators can check for anything.
That is a hack that doesn't work for animations of variable length.
Your right sorry. I codes it as a property and set a default in c++ construct. I did not override it in blueprint. So it should be set before the perception gets initialized?
I would verify that assumption by debugging it.
Thanks
Since you are using C++, you need to do a bit of extra work for binding, because BT nodes aren't instanced by default. If you are a solo dev, it's probably fine to just set it to be instanced in the constructor. If that becomes a problem, you can do the extra work to make an AI task for it.
Am I doing something wrong here? It feels REALLY weird that SimpleParallel can only have one child.
Thanks! Could you please send any guide or info about custom decorators? In documantation I can't find even basic nodes for custom decorator
🫠🫠
What do you mean by basic nodes? There are functions you can override.
Can I use a delegate in AnimNotify and bind in BTTask?
No. You'd have no way to bind to it. Just make it a montage and use the built-in delegates.
Thanks
They’re not children technically, they’re branches, and simple parallel allows you to have one branch run while a main task is running
hi, im currently trying to get my NPC move around in a specific area and not leave this area at any cost. I am using GetRandoMReachalbePointInRadius and put a custom Nav Query Filter there that has the Area i didnt want the player to cross set with a very high travel and enter cost but it doesnt seem to work, what can I do to make sure the NPC dont leave this area?
So chaining them really is the right way to have a bunch of nodes run in parallel?
For them to not go into a nav area, you have to set the filter to exclude it. If you are only adjusting the cost, they will prefer not to path through it, but will if that's the only option.
okay but is there a way to let them not LEAVE a nav area?
By excluding the default area
this is the room i dont want them to leave so i added this nav modifier there at the door so they dont leave the building again
but it still chooses a point outside of the building even with Excluding this area
Imo the use cases for that node are a lot fewer than they might initially seem
What area class does the nav modifier use? It looks like it's using the default
no its my custom one
Then your filter needs to exclude that area class
I just have a lot of things the pawn needs to be doing when near a target. Gotta keep moving to stay in range of it, do its attacks, keep rotating to face the target, it's gonna make some sounds too... Some of those are not brief tasks either, both the movement and the rotation take time and they have to happen together
You can prly use services for some of these things
Why do you need the rotate task instead of setting focus?
Hehe I always forget about set focus 😅
Got me beat, I have no idea what that even is. There's no AI task for it at least?
That should work. It does with everything else, but I don't use the get random points functionality so I can't help you there.
It's a service
I really don't understand why people new to AI expects everything should be done in a task. Is that what tutorials are teaching? Because it's really bad. Learn what the different nodes do, so you understand all the tools in your toolbox. Instead of just always using a hammer.
It’s likely they didn’t watch a tutorial at all and just reached inside the toolbox blindfolded 😀
Oh yeah, that's the only way I learn lol
Honestly, people here dump on tutorials constantly, and I know tutorials on other parts of Unreal I'm more familiar with are bad bad. I hate watching videos anyways. But the documentation is at best narrow, at worst outdated and incorrect. So what's even left as a way to learn except "reach into the toolbox and play around"?
🤷♂️ ig you could read the source code
i just had to restart unreal engine then it worked i assume the navigation mesh needed to reload or something lol
The problem is you can only dig into the source code of something you know exists, that wouldn't tell me about some service to set focus
I mean the AI Module source code
There are some decent vids that do a good job showing this stuff but if you don’t like watching vids it’s kinda moot
And yes, most tutorials out there are bad, but the ones pinned in these channels are usually good
QQ what does "Default" mean in this context? What other kinds of setting focus are there?
Back when I was first introduced to BT, yeah - tuts were just making everything a task. Also, most tuts that I remember mentioned that services are to be used when you want something happening on tick.
This was some years ago though
Tbh it seems most people who complain about tutorials don't actually have any experience trying to teach beginners, or forgot how difficult it's to learn something when you don't have a decade of experience
It has been a recurring theme that the teacher is still in a fresh learning position themself though
I mean how can they not be, when things are constantly changing?
And often have lacked any sort of structure
The BT hasn't changed in like...8 years
Programming principles doesn't change all that much
Maybe even longer
you may get a new tool in the toolbox
Isn't EQS new?
If by "new" you mean like 2016/2017
but abstraction, decoupling etc is still the same
hah TIL, I thought that was a UE5 thing
Heaven's no
It's been around for a long long time
I don't remember the exact year
But it's 100% pre-2020
Do the official course on AI with Blueprints. It will go over all the tools as well as some AI theory.
Honestly THIS is the root of the problem, that people want to be game programmers but they don't wanna learn to be programmers first.
They dont know what they dont know
The new things for AI in UE5 are pretty much Smart Objects and State Tree
Blueprints tricks them into thinking it's all simple and they dive right into making something complicated and no one ever tells them "this is what an Interface is, this is what Polymorphism is" etc
Is the modifier area a different color now? That was confusing me and I don't know why I didn't mention it.
if you just hack it together it's relatively simple... they wont ever see the technical debt they accrue over time. They just know it "sucks" troubleshooting, because its so hard with function calls and vairables being changed all over the place.
anyways, OT for AI
Can't wait to get into the AI bits of the project im on. Definetly checking out Luthage's endorsed course
It's about time i up my AI knowledge
Focus is a set of priorities. Default is a lower priority than movement (what the path following component uses). Gameplay is the highest. The focused used during tick is whatever actor or location has the highest priority at that time.
Ah, I think I've made a parallel system to this unfortunately.
If you want to make a service that uses the gameplay focus, so it's a higher priority than movement, just make a child of the default and change which one it uses.
That will allow them to strafe around a target.
This is why you need to understand the toolbox.
Yeah, it's a big learning from this foray into AI. I knew from the start that I'd have to throw out big parts of the AI toolbox and make them custom, like the pathfinding components simply cannot do what I wanted. But I think it would still have been better to learn to do things the normal way first and then modify, rather than start with the custom work.
The only thing I don't like about that course is that they don't have a C++ version or a part 2. So much of the AI functionality is just not available in BP.
Throwing out big parts of the systems is always the wrong direction to go in. Every single time I've seen people do it on projects has ended in disaster.
that's a shame. But as long as it covers most of the framework(s), I'll be happy to dig around in c++ afterwards
I've considered doing my own documentation of the AI systems, since I've done it several times for different studios. But I'm currently unsure if I want to do it written (better and easier for me) or videos.
there's also great help to get here
Some things just need custom work though.
Written
Glad I could help 🫡
+1
+1
And ping the heck out of me when you do it.
That's the way I'm leaning. Maybe embedded videos if I need to.
Pour into the cup, yes
Honestly video is only more popular as a format because it's easier to monetize, not because it's actually widely preferred
written is actually* searchable aswell
I hate when people do videos, but I do like the WTF is series.
short format, specific thing, for sure. They're also searchable ^^
I think video can be nice if you're talking a lot ABOUT something, rather than just breezing through with instructions
Sometimes the only way to show things is via a video. My AI team does BP reviews by making short videos. It's really helped us a lot, especially with knowledge sharing. Design won't read text.
Like I couldn't get anyone to use the visual logger until I made a video showing it off. It's a hard thing to describe in text.
If I could have it my way, there'd be some show-off video of it, along with detailed text going through every element with a microscope
Whenever there's a 2 hour video about a specific thing that some engineer has spent the last 3 years looking at, it just goes by way to fast
Yeah. That's the way I'm leaning. Gifs, videos, screenshots and a lot of text.
It's a bit of a balancing act ofcourse
to much text without any "breathing" can be overwhelming
If you can tell from my comments, I don't write a lot of words. I'm very succinct.
Okay is there some sort of known issue with Controller Rotation in the vertical axis? This pawn is VERY good at tracking my player pawn in the horizontal but if I get above it, it keeps looking horizontally
It knows the player is above too, because MoveDirectlyToward is moving it upwards
I don't think I agree with the most qualifier. At least half of my real job is mentoring people. People who are juniors, just new to AI or new to UE. I also mentor art and design who are new to UE and blueprints.
There are quite a lot of people who have had criticisms about it besides you though :D
Everyone I mentor had a lot of criticisms about tutorials.
I forgot to add that part.
And how many of them had actually tried to teach people?
Hah did you know that if you delete the child of a SimpleParallel it'll CREATE a 60s wait node when you hit "save"?
I wouldn't be here if not for the .. questionable.. tutorials i started out with.. Pretty horrid stuff but it got the ball rolling
Everyone on a good team teaches others.
So that would be everyone
And yet they needed additional mentoring, thus they necessarily might not have been teaching the right things
Everyone needs mentoring too
My partner is a generalist gameplay engineer. I learn a lot from her everyday, because she uses things I normally don't.
Technical knowledge becomes siloed by default. If you take a new hire who only has basic knowledge and have them work on some problem for a week, after that week they will know things about that proble (and their solution to it) that no one else on the team knows.
Technical work CREATES new information, always. Unless you're intentional about spreading that information, it will be siloed knowledge.
And no one is discouraging people from teaching others how to do stuff even though they might not be the actual expert on that subject... except when it comes to unreal tutorials
I think there's a big difference between knowledge sharing within a team and operating a youtube channel for general tutorials
And what is that difference?
My problem is that the tutorials are bad at teaching things.
The latter both requires and implies a level of authority that the former doesn't.
I think this is entirely fair critique and I think most people who make them would be happy to take notes and improve
Tom did that the other day ^ kudos to him
I pointed something out in a comment to a tutorial once and I think the guy was gonna just redo the video because he realized it was completely wrong lol
I have and it's been argued against and ignored.
Well I guess they can't all be reasonable people
There's also a ton of time gone into it already, without (presumably) creating the revenue they were hoping for
Tbh I don't think operating a youtube channel implies any kind of authority unless the creator makes an attempt at claiming to be one
I can understand lack of motivation for doing it all over again..
One guy is selling a course to become a "pro UE gameplay programmer" and I noticed some really bad things in the AI section. He spent a few days arguing with me and didn't change anything.
It's a problem of incentives. When you're a member of a team, at any level, you have a strong incentive to want your team to be as healthy as possible. They're the people you work with every day, and what they create is the codebase you have to live in.
But when you're making youtube tutorials, you care about views and you care about ratings, but you're disconnected from the actual end results, the code people make and their level of knowledge.
A long time ago I had a reasonably decent readership on my site on certain PHP-related topics and I was only considered a slight authority on certain things because the overall community seemed to feel that way
and I'm using the word "authority" very loosely here lol
yes it is!
See but that's the mindset! The readership, the number of views. You dont even get to KNOW what kind of code those people are making.
If the end results people get from your videos are bad then it seems it isn't exactly good for your channel growth
Sorry! Sometimes you have to force it to rebuild.
I have also regularly taught complete beginners as well. Not to mention having to re-teach people who decide to take a break.
Most of the people here who complain about tutorials are also in here helping others.
I think the bigger stretch is assuming that "most people" haven't tried teaching beginners
It's been like 15 years for me since I started writing content to teach others and more or less always heard complaints about beginners teaching others because their content was wrong so it's a bit more than a few people here :D
Also for real I'm about to throw this entire controller rotation situation in the trash and Do The Bad Thing by just making a custom task that handles rotation in a sane way
Yeah the rotation stuff is pretty iffy sometimes lol
Even if I could fix its inability to look upwards, it's got this weird jerkiness to how it tracks, it's not smooth at all.
I don't think hobbyists should be monetizing helping others. You don't have to agree with that.
Debug it. It's not hard.
I think that's a fair question to be honest
Like, I'm not AAA, but my studio has released 2 games now (not in UE mind you) and have made some money. Am I a professional or a hobbyist? 🤔
Yeah I dunno, I don't necessarily see why hobbyists monetizing it is bad. The incentives are to create better content because that's how you get more money, so I don't really see why money being involved would somehow make it bad.
When you make a living at doing a skill, you are no longer a hobbyist
How? I set a focus, the controller gives a rotation to the pawn, in between is a black box
so.. .to cross the boundry, i must monetize enough
It is not a black box. It's code.
Of course it's code. But it's not MY code which makes debugging it fraught from base principles, even if I could see it which currently I cant
Even if I FIND a bug, the answer then is "write my own version of it" which is what I was about to do anyways.
They should be a professional for a skill they are trying to teach. Not a professional teacher.
But it's not increasing the quality.
Feels like this requirement immediately disqualifies a lot of people teaching a lot of different things... like music for example. I don't know if a lot of people teaching music have had a professional career as a musician
And yet I can still learn guitar just fine from such a person
My biggest reason for not going "pro" is lack of self confidence
Well if the author does a poor job of managing their channel they aren't gonna see any more money so the end result is the same whether they were getting paid for it or not
(along with common debt lock from mortgage)
Recently started some freelancing tho, and it's going great, so maybe soon i can breach the treshold for being a hobbyist 😛
not enough to live by, that's for sure
I didn't say that it was for every topic, I didn't realize that I needed the "to teach game dev" qualifier here.
Fair enough :)
However then it does beg the question, why does that rule apply for game dev
I'm not a professional game dev for example
The biggest problem is that there are so many ways to do anything in game dev. There's no right way to do anything that works for all projects and teams. Yet tutorials teach as if there are and what they are teach is the only right way. When sure it works for your specific test case, but probably not for most things.
I realized as I was making this that it MUST already exist, because nodes like FaceTowardBBValue exist. Anyone know if the prior art is accessible here?
Do they though? I don't think they make any claims that the way they show is the only right way
At least I didn't notice, I suppose it's possible I wasn't paying that much attention because I was just trying to find the part that I was interested in
It's implied in the "how to do X thing" when they don't say why they picked that way.
Most people would probably be better off learning generic programming first
the principles of it
before moving into gamedev
It's not that unique really , imo anyways
Sure there's a billion nodes and functions, and entire frameworks
but the same concepts still apply
I don't really think it's implied... it would make most tutorials very very long if they needed to elaborate on every single design decision that went into it
Yeah, I usually recommend people starting with Harvard CS50 and CS50G first.
Those kinds of longer explainers are more for bigger courses in my opinion
There is no short route for becoming a game dev tho
And yet everyone comes here with the assumption that the tutorial is the right way to do what they are trying to do, even when it isn't working.
Even outside of game dev, different environments and frameworks are VERY different. Writing a react app in JS is going to be extremely different from writing a high scale AWS service. But yet, somehow, bad code is all bad in basically the same ways.
I mean why not? I would assume the information presented is correct
I can't really say that I've gotten the feeling that people come here to argue that the tutorial is right and people helping them are wrong
If anything, I've noticed it mostly in the sense that they want to understand it better
Personally I feel like .. a good bunch of 'them' dont care about understanding, they just want progress
If I was a beginner at something I would definitely assume that the info I was given is right, and that I must be doing something wrong if it isn't working lol
the tutorial did this, and when it's working, that is real tangible progress. Then we can move on to the next thing from another tutorial
You're going in circles. You're saying it's perfectly fine for tutorials to give bad information. That's it's completely fine that people who don't really know what they are doing are trying to teach others.
Sure, I think a lot of people come here after they've struggled with it for a while at which point I'd say it's understandable they just want it solved because it gets frustrating
And that beginners should be able to assume that the advice given is correct. But it's also fine that it's not.
There's a difference between information which does not work (eg. when someone comes here because a tutorial doesn't work) and information which isn't according to best practices (eg. "use pawnsensing")
But it's also apparently not OK for those of us that help the people getting bad information, to be frustrated that people are giving them bad information.
I never said that
You made a comment about most of us not remembering what it's like to be new. Or how hard it is to teach people.
Which was incredibly dismissive
I wasn't referring to anyone here in particular, just overall to people who complain about it which as I said I've seen plenty over the years
Best practices aren't just cosmetic, advice that discards them or disregards them will lead to tech debt that has a real cost to fix.
it's the difference between selling someone a car that won't start, and a car that has a leaky radiator. They're both broken, it's just a question of when that affects you.
Not using a long deprecated feature isn't just following "best practices."
True but the point still stands, that just because it "works" doesn't mean it's good advice
I agree with you on that. I did disagree that the example of best practices (pawn sensing) isn't a good one.
As a programmer, there is absolutely no reason not to have the source code. That is probably your biggest problem with using the engine.
I'm really used to working with closed-source systems honestly. You work with something like the iOS SDK and it just... is what it is. It's going to behave in ways that aren't quite what you want and don't quite make sense, but them's the breaks, code around it.
Unreal is not a black box like Unity. Everyone can download the engine source and use debugging to figure out how something is actually working. It's the reason why it's so badly documented.
And like, I COULD do all that, and I might learn some things... But the hack's already done and working.
Using Rider or Visual Assist for visual studio will let you navigate around the source code easily.
Rider has been a blessing
And yet here you are talking about tech debt. 🤦♀️
I thought VS was great, untill I tried Rider
Rider is so great.
just make sure you got some ram 😛
It's not tech debt if you never plan to fix it! 😄
Debt is debt!
I had to be convinced by someone at work to try it, so I did when my personal subscriptions were up. Now I use it at work as well.
Welcome to team Jetbrains
We hope you have the RAM
Rider 100% eats moar RAM than VS
It's there to be used so...
have at it!
take more, please
if that means less waiting for me, great
Only as long as the project continues. Whenever you ship your last update, any remaining tech debt is instantly "resolved"
When I compile UE source, I use VS because it takes less RAM and I can give more to the UE Gods 🙏
I never noticed, but my dev machines are pretty highly speced out.
Getting to the point of the last update is a lot harder with that hacky tech debt.
Why isn't this aborting? It just stays on this branch even though TargetActor HAS been set
Use the visual logger to debug
Found the frame where it locates the target. And for this frame, things seem correct! But then I guess it imediately goes back to doing the other things. Hm.
Interesting, that log implies that it evaluates down the right-side tree at least once, but I put a breakpoint on that whole branch and it never triggers.
Oh oh HO look at this, I replaced that RotateToFace in the bottom left with that default wait, and NOW it works!
.....ugh oh my god this was the dumbest mistake
Posting my shame here in case someone learns from it. See if you can find the bug here.
||If you have the Recieve Abort AI event, but DONT call "Finish Abort", you've got a task that CANNOT BE ABORTED||
Hello everyone! I have some AI in my game implemented with BehaviorTrees, but lately I decided to experiment with Unreal's new StateTrees, but the documentation is somewhat shallow on how they work. Is it possible interrupt a running state/task?
For example, let's say I have an enemy AI with several states with specific tasks on each, but I want whatever the current task/state is to be interrupted if the enemy detects the player, and then switch to chasing the player
I wonder how can I make Pawns to Work with Detour crowd avoidance? So far i haven’t found anything special that prevents simple pawnmovementcomponent handle it. CrowdManager only references MovementComponent not CMC. So I wonder why don’t my pawns avoid each other. What functions or things do I need to implement for them to work?
Another thing, does anyone know what ai.crowd,debug does? Like there are squares on the ground in different colors , what do they mean?
Is this the best channel to ask AI Navigation questions in? Ive been working on this for 2 days and I cant get the AI navigation to work reliably on my main world partitioned map. I'll list some of the options I've tried below:
- Project settings /Navigation mesh /Runtime Generation: dynamic
- Project settings / Navigation system / Generate Navigation Only Around Navigation Invokers: true
- Level /RecastNavMesh-Default / IsWorldPartitionedNavMesh: true
- Level /RecastNavMesh-Default / Runtime Generation: dynamic
- Editor / n.bNavmeshAllowPartitionedBuildingFromEditor 1
- NavMeshBoundsVolume is green everywhere
I can get it to run once in static or dynamic after switching modes, and then it's broken after that and neither mode will work in standalone mode. Sometimes I observed the AI working in one landscape section and not the other, but it's not consistent
Also, I have an empty test world that the AI works reliably in to rule out it being broken AI and not broken navigation
Is there a way to get the class of the currently running behavior tree in C++? I don't see anything in the docs
You probably have to get the owning BT component and pull the BT that's been assigned to it
I get the feeling this probably won't work correctly if you're using any of the BT nodes to run a subtree so for that you'd probably have to dig into the code to find out if there's some more accurate way
My AI really slows down when walking nearby edges.
Is it possible to make the AI chose the center of a path so that it doesnt walk that close to these edges?
hey guys, what would be the best way to make an AI agent only be able to pass through a gate one direction and not the other and reflect this to the nav mesh? for example a door which only opens one way but not from the other side so they would take a diffrent path
Hey guys, what's common practice to avoid duplication in behavior trees? Is running subtrees the way to go? Or are the other ways to compose nodes out of a few nodes (a selector or sequence with a few children)?
Haven't used it before but I think this may be what you are looking for https://docs.unrealengine.com/4.27/en-US/Resources/ContentExamples/NavMesh/1_2/
thanks that looks promising, have to get it into an actor and find out if its possible to do in runtime. as my navmesh is heavily changed throught what the player does and builds. but i think this would be the solution
Well, you can set the nav mesh to update at runtime anyway. Not sure how it works with placing/moving links though. Is it important that the AI alters their navigation for it? Cause otherwise you can just have a plane that blocks movement in one way and not the other.
yeah the runtime is the main part the player is building objects inside a room which the ai interacts with already, this also affects path finding. i wanted to be able to place a such "gate" which you can use to funnel the ai in a direction with if u blocked of the whole room becoming a one way system of sorts.
Just try making a BP that contains a mesh to block navigation and a nav mesh link? See what happens.
Does anyone know whether it's possible to set a value on a task node? Like RotateToFaceBBEntry has a precision, what if I want this precision to depend on something else?
Hi everyone, I have a question regarding EQS, I want to make a query that points the cone to a actor, so the idea is that I have a querier in the location (0, 0, 0) and I have another actor that circles around the querier, and I want to see if it's posible to make the cone always look at the direction the actor is moving
so the idea I thought could work was to make a context for this querier, but I think that it's not possible since I can only create context's that return actors and not locations
Subtrees usually yeah. The only way to compose nodes in this sense is to merge the logic in the nodes into a singular node, which can sometimes be a good idea depending on how your trees/logic are structured
I did manage to make it work, now it's time for me to get into more tweaking, but if anyone is interested how to make Pawns work with CrowdDetour you can text me :3
^Yeah you are likely to need to either register the pawns with the crowd manager and/or implement the ICrowdAgentInterface
If it's a combination of built in nodes and maybe a custom node that's being re-used a few times I guess that's a good case for a subtree?
Sure
this is a built-in feature?
I would love to see how you did that, but I'm currently trying to solve the EQS issue I asked before, can I ask you about this later on?
so i managed to create the context correctlly, but It's not working
if anyone has an idea
These two links should get your crowd manager stuff sorted https://zomgmoz.tv/unreal/Crowd-Avoidance/UCrowdManager and https://zomgmoz.tv/unreal/Crowd-Avoidance/ICrowdAgentInterface
This is probably like the third time I've had to link them both, I think I need to combine them into one guide lol
What exactly are you trying to do here?
thank you for the links
I'm trying to make the cone that is created to always look at a actor when doing the query
the actor will rotate around the querier (player), and I want to make sure the locations selected are always looking at the rotating actor
and not simply always in front of the player
I don't think this will work because locations don't have a direction/facing
it's just the coordinates of the location where it is in the world
Although I'm not sure if I fully understood what is facing what
correct, but if I grab to locations and substracts them then I get a direction vector, that should give me the place where the cone should be set
this is what I currently have
So what should it look like instead of this?
Hello, could anyone instruct me on how to link a sub-state tree? I have a state tree with root set to subtree and the main tree with a leaf linked tree state, but it will not fill the 'linked subtree' parameter
so if the player rotates, the cone will move with his rotation so I want the cone instead of moving with the player rotation that it would always look to the mountain in the sky
If you're trying to link to an entirely separate state tree asset, this is unfortunately not what the subtree option does. I don't remember the details of how it actually works off the top of my head though
Ohh I see maybe I understand what you mean now.. hmm
yeah it's maybe better to explain it like that
So despite not actually using the player's rotation in the BP graph it still rotates with the player?
well the context I have right now is actually using the player has it's center location, when I use the one I showed above it won't paint the EQS
since it's not working correctlly
the context that works simply returns the player character has the querier so it's location and rotation are set to the player
I guess I might need and empty actor that is set in the location of the player and that is always looking at the mountain, that way I could simply use that actor has my querier and it would do what I want
but i thought I could use math to solve this jejejeje
Crowd detour is built in yes, but by default it works only with Characters (or things that have characterMovementComponent to be precise)
for sure!
I think if you take the player position and just use 0,0,0 as the rotation when you start generating the points, it should not be affected by player rotation
I can't think of the actual rest of the math off the top of my head for it though, #game-math might also help
and the real issue is that the context is looking for a location, so converting the location to rotation and then to a location again, is a little bit useless
Basically what you want to do is have it first generate points from the player along the rotation axis 1, 2, 3, 4
Then you adjust the Z rotation say by 20 degrees, then again generate points from the player position along the rotation axis 1, 2, 3, 4
repeat until you're happy with it
this should give you the lines of points moving away from the player position as in your screenshot
You can do something like returned position = player pos + (direction * space between points * point index) for each "line" to plot the points on it
ok, let me see if I can make it work
thanks for your help, got a blueprint setup with the functionality i wanted now.
so i think the real issue is that the generators are expecting an actor, so i will try my hand at making my custom query generator
Ohh right you're trying to do this with a context... yeah I think you might need a custom generator
so I got into the C++ of the cone generator, and yeah it's set to only work with a array of actors, since I'm giving a location, then it's not going to work
I'm going to override that and see if I can get what I want
Yeah take the C++ cone generator code and paste it into your own file, tweak it so it doesn't use the actor's rotation for it and you should be good :)
yes, that's the idea
Did really small change and it's now working has I wanted with my custom generator
thanks @misty wharf for the ideas, I think tomorrows I will work with the Crowd detour
so my enemies avoid the player and themselves when they are too near
Okay interesting! Not something I need atm but good to know!
Glad it helped!
My npc was working fine but after messing with the navmesh slightly it no longer is able to use it for navigation, wasn't sure if anyone has any ideas on what could of caused that and how to fix it? I was messing with the recast nav mesh and making the agent radius smaller so that it would build navigation through doors
This is a long shot, but does anyone know how to make an AI walk around a sphere? Or how to change / where to change, the navmesh so it also works with spheres?
iirc there is a directional gravity plugin on the marketplace, I'd check that
I don't think you can modify the navmesh to work on spheres without very significant changes to it
Fair enough, I've mucked around with a character to change the gravity to work with the sphere but it's just trying to figure out how to make AI walk around it, unless there is another method without a navmesh?
Hi!
I'm having this issue where asynchronous nodes like PlayMontage will trigger executions long after my BT Task has finished.
Here's an example: I have a simple PlayAnimAndWrap task with a PlayMontage node which leads to various branches depending on the outcome.
However, something like this can happen in order:
- PlayAnimAndWrap is triggered in the Behavior Tree
- PlayMontage node is called in the BTTask
- Anim plays until blend out
- The "On Blend Out" execution pin gets triggered
- PlayAnimAndWrap calls FinishExecute
- PlayAnimAndWrap gets triggered again as intended
- PlayMontage node is called in the BTTask
- The "On Interrupted" execution pin gets triggered from the PREVIOUS animation interrupting the current one, on the SAME node
Is there a way around this? Like making every new BT Task an entirely new instance?
Adding a "IsTaskExecuting" check also doesn't do much because it IS being executed...but the callback that's being received is from a previous execution
BTs are data assets. Usually you don't make subclasses for them. What do you need the class for?
You can use nav links, which can be changed at runtime if you set up runtime generation in the project settings. You can also use modifier components and volumes that will also change the nav mesh during runtime.
Yes, of course you can use a BB key to set a value in a task. It's one of the main functions of a blackboard.
i ended up using a nav modifier on the actor and a nav link with some code to work out where each side should be to get onto the nav link and it works well. thanks for the answer though.
Is the agent radius smaller than the NPC's radius? Changing the agent radius should be done by making a supported agent setting, not directly on the nav mesh.
Nav mesh is the best option, but you can also use steering forces.
oh rly? How?
By making a variable for it called a blackboard key selector.
Ok I'll look into it thanks!
Making a new BT task a new instance is the wrong way to fix this. First I would try to not end the task when blending out and just use completed.
Oh I meant the specific asset. I wanted to check if "X Behavior Tree is running". But it's fine now, I just settled for checking if the brain component is running.
I did mean a parameter of a built in simple task though, not just setting any generic data.
Is that also possible?
You should make a child class to add a parameter or fully remake it.
Okay that's what I feared thanks
maybe to make sure we're talking about the same thing. Simple tasks have details you can change like the acceptance radius of a move to task. This is a variable on the C++ class, though I wish I could set it somehow in BP at runtime.
How does a large procedurally generated game generate navmesh?
Something along the lines of Lego Fortnite
Surely not using nav invokers as they were very slow last time I checked
Valheim being another non-UE example
Where ideally things are simulating even quite far away
Yes, I understand what you are asking. You can't add a variable to class without access to the class. You can edit the source code (not recommend), make a child class (C++ only), or fully remake it (BP).
I'm trying to learn AI Perception and the first tutorial I tried following did a terrible job of explaining everything. I know most UE5 Tutorials can be garbo but just checking if anyone has any suggestions.
By using navigation streaming
No the variable exists already on the task. But the only way to edit it (I can see) is in the details panel of that task node in the BT editor. I was wondering if I could set it through code or some kind of decorator node or something.
Thanks! This looks like it'd work nicely for static navmeshes where the world is known before runtime but for fully procedural terrain can it still be done? Or would the workflow be to generate the terrain and then build the navmesh on the users PC, then streaming segments?
The variable isn't a blackboard key selector. You can't make it one without access to the class. You also can't set it outside the BT without a significant amount of digging through code.
It also works with the different dynamic options.
Interesting, I'll try it out. So as soon as players start moving near a new segment it starts generating the next area and once far enough into that zone, unloads the previous one
Would this be what Lego Fortnite is using under the hood as AFAIK it's fully procedural for each player
You would have to ask someone who worked on that game to know how it was done.
Yea sounds about right. Unfortunate though! I guess I can make a copy of that class or a derived one.
I have a state tree task that has an index member variable. I would like to increment this index everytime the state is entered, however the behavior I observe is that the index is always reset to it's initial value upon task start. Is that normal behavior? Is the state tree task being reset/reconstructed, or am I doing something wrong?
Anyone here well versed with the visual logger? just have a couple questions that I can't find good answers to online
Thanks for the reply! In this case I need it to specifically be on blend out while also handling interrupts. I think I might be able to work around it by binding to the montage end dispatcher using the skeleton's AnimInstance.
Do you know where I can find information/documentation about instancing BT tasks in case this doesn't work.
All BP BT's are instanced
If you're in C++ land, it's a setting you flip in the constructor
It would take a significant amount of work to instance a BT task per execution. It's a better option to use an AI task (c++) or finding a different way to do what you are trying to do.
Oh - that's what they want to do? Ouch
They want to instance a new BT task every time it's used, not per actor.
Better to just ask you question rather than wait for someone to ask you
Show your code. You likely need to use the struct memory to do this
It's a race condition they are dealing with. The BT task ends when the animation is blending out. So it returns to the root. If the BT task is run again, before the animation has ended, it will get interrupted. I still say they shouldn't end the task until the animation ends, but they don't want to do that for whatever reason.
Yeah - that's an odd setup
Atm I am doing it in blueprints. If it's not possible with blueprints I am fine with going C++, just prototyping atm
I honestly don't remember the actual difference between BP and C++ for State Tree tasks. But I'd wager they're going to end up being the same as with BT
So you'd either want to go to C++ and muck around with the struct memory stuff (it's easier in ST than BT imo) or probably have the variable live on the ST itself (I don't think blackboards exist for ST) and update/read from that
Do you remember some struct names for the "struct memory" that I could search around the codebase for?
Look at how some of the default tasks look
Should be really really easy to grok honestly
Because their memory stuff is above the struct
So something like "struct STATETREEMODULE_API FStateTreeDelayTaskInstanceData" (or any InstanceDataType) is not reconstructed when the task is entered, but rather persists between runs?
Yeah
Okay cool, thats a lead then, thanks!
i'm trying to monitor some in-game signals using UE_VLOG_HISTOGRAM, it works but it seems like I am only able to scrub through the timeline after data has been collected. I'm trying to monitor the graph in real-time
Nevermind, found it. Config option "stick to recent data"
Correct. I'll take a deeper look into how we can solve this with AI tasks.
Thanks again for insight!
Does anyone know of any examples in UE of offloading AI processing to external processors / devices?
hey anyone got an idea how to make a clue system similiar to Hunt showdown? I want my AI to spawn and start searching for clues. I figured an EQS check would be the way but the implementation logic I am notsure how to do
Watch the pinned video on Behaviour Trees here, it shows you how to use EQS
No one is going to walk you through building your entire game AI. If you are new to the AI systems, it's best if you start with the intro course on the learning library.
OK thanks
I get that, it was more a logic question then an entire walkthrough. will watch
I am already using eqs. I will watch vid thanks
Any recommendations regarding debugging behavior trees? Would you add tasks or services to add prints for instance? If you want to print something that's a blackboard value, would you try to get it from a blueprint or make the debug print logic in a BT node? I sometimes set BP nodes to development only when it concerns debug info, is there a way to do this with BT nodes?
I would just start by using the BT debugger and visual logger, but if it's some specific node I know the issue might be in, I'll just add prints into that node's code
Actually I want to make a world space debug string on every AI showing me some of the most important info when it's toggled on. I was just wondering if there are any BT specific tools or good practices
seems like printing with 0 duration in a service doesn't work though because services have an interval
the reason I wanted to do it in a service is because some of the data exists only on the blackboard
You can extend the gameplay debugger to display custom stuff like that which could be useful for this also https://zomgmoz.tv/unreal/FGameplayDebuggerCategory
Yea I've looked into that for another project, it seems cool! But not really worth the effort for what I'm working on now.
Thanks for the link, I'll save it for potential later use
I guess adding a service for it would be the simplest way to do it otherwise
👍
I encountered the situation where an AI moving to a player stops if the player jumps and is too far from the navmesh so it escapes the query extent Z bounds. Is there a good way to approach this problem without just increasing the default query extent project wide, that seems far too heavy handed of a change.
Yea I had no luck trying to figure out the code required for my goal, probably doesn't help at all when I don't have any idea what I'm looking for while going through the code of a navmesh. I've skipped on AI for now and will just work on other stuff I think.
Hey there! Could anyone share a quick tip on using eqs so that the AI always choose the location closest to the target? 😊
Quick tip: use an EQS test
Did you ever figure this out? Running into the same issue.
Yeah, that's a quick one
There’s also environment query contexts you can use
What I understand about your tip is that there is no way to use the Distance test in the EQ to make sure the test always return the closest point to the target
Not sure how you got to that conclusion but sure
If you use a distance test and set the query on single best item mode or whatever it's called this is what it should do always
(assuming your distance test and other stuff is configured correctly)
Yes, that's it
Thanks
Hey, I went back to check that project and I changed the State Tree so the EQS is not running in the parent state anymore. Instead, it runs in the first child state and I only set "succeeded" when the query returns. Results are then used in the next state as before: using OUT/IN parameters.
How do you pass information out of the EQS state to another state if its the child?
I don't see a way to bind its output parameters in sibilings or the parent
Increasing the default query extent isn't a "far too heavy handed change."
It doesnt impact perf in any meaningful way? I figured there would be more navmesh triangles to iterate over potentially
I guess its unlikely since its along the z axis
Part of my problem is I also use the navmesh to determine some gameplay stuff (like who can teleport where) and I dont think the findpathsync function lets me alter the default query extents, so it has reprecussions I dont want
It does not. Be careful with premature optimization. If you want to know if something impacts perf, test it.
Most nav mesh functions do allow you to define a query extent. Increasing the extent in Z isn't actually going to have many repercussions in the way that you think.
I have a problem with the AI, the AI can see the player through the walls
Profile early and often to optimize what is actually necessary.
Are you using the perception component? Are the walls set to block visibility? Are the AI actually seeing the player or are they not dropping the target when they lose it? Do you have a max age set for the sight sense?
The gameplay debugger, apostrophe (') while playing, is the best way to debug the perception system.
For me I sometimes check if a teleport destination is valid based on whether you have a valid path to it. There could be scenarios where a valid path gets built by picking some point on a navmesh way above the true teleport destination you want, and then that would falsely consider the result positive (I actually did have this happen, its not a contrived scenario). I am using the TestPathSync function which doesnt seem like I can specify the query extent?
You do know that you can, and frankly should, project a goal location before testing the path. Which you can define the extent. Also if you're finding a teleport location, you'll want to project it to the nav mesh and then move it up by the capsule half height before teleporting.
Thats fair, I think when I first wrote this code I had misconceptions about what TestPathSync was doing. With everything you said, projecting first would be much better and then I can freely modify the query extents, thanks!
If you are concerned about perf, using a hierarchical path test instead of test path sync is going to make a much bigger difference.
I dont know much about that, can look into it. Im not particularly worried about perf for the teleports, those only happen once every 30-60s, was more for general AI pathfinding (if a map has 100+ AI patrolling around)
The most expensive path cost perf wise is when a path is not found. HasPath using the hierarchical mode, is a much cheaper test than finding a path.
Any idea why Hierarchical is not the default? Is there some kind of tradeoff? just curious why you wouldnt always use it if its just faster
There's a massive difference between "do I have a path" and "find me the best path".
I feel I am misunderstanding something. I assumed TestPathSync only tests "do I have a path", does it try to find the best path while testing if one exists if set in default mode?
Okay bit of a shot in the dark here but does Unreal have a built in editor functionality to allow you to export a pathfinding mesh and then reimport?
Export as an obj, fbx or something
I know pathfinding is more than that but I only need to adjust the mesh itself
Hello everyone, I want to study AI for the RTS game. Where should I start? With the documentation of epics or are there any good courses?
In this video tutorial series we will going over everything regarding AI in Unreal Engine 5; including some examples of AI behavior typically seen in commercial video games.
In Part 1 we do some basic character setup to prepare a character for use as an AI character.
SUPPORT ME
Patreon I https://www.patreon.com/ryanlaley
Buy Me a Coffee I buym...
Thanks buddy)
I'm probably missing something simple here. I made a C++ subclass of UBTDecorator_BlackboardBase, but when I edit my BehaviorTree and pick New Decorator my new class doesn't appear in the list. Is there something I need to do to enable that?
@neat summit I don't have my EQS query as the first child yet. I'm not sure how you're acccessing its output data.
I just have this, and the MoveTo task loops infinitely lol
And I can't have them run in the same state, as these are all executed concurently, and the EQS Query task has an async return
Go through Epic's course, it's in the pinned messages.
ok, thanks a lot
This was the answer. Can bind this to any property in the EQS Task, and it'll set it
The best course is the introduction to AI with Blueprints on the learning library. Hobbyist tutorials should be avoided.
No it does not.
okay, thanks a lot)
Hi everyone, how does "On Target Perception Forgotten" Event work for AI Perception in UE 5.2+ ? I tried setting max age of senses to something other than 0, and also tried calling "Forget All" function of AI Perception component, both of them removed the sense indicators in debug mode, but none of them called this event!
You need to enable the forget actors thing, project settings iirc
Hey guys! So I’m still kinda stuck on this AI issue. Now it seems like the behavior tree is suck on certain sequences.
So I have a timer in the Aicontroller that indicates when the enemies attack. And it’s supposed to roam around the player while facing the player and go to the player location when the first spawn in or if they are too far away.
Any reason why this counts be happening? Please help. Thank you
And just as a little point of reference, heres the tutorial series I used to make the ai: (I was still new to Behavior Trees so dont @ me lol) Obviously I made my own tweaks and changes but yeah
https://youtube.com/playlist?list=PL4G2bSPE_8ulvuPbPGC7rThydK5pBdB9G&si=lyt2hUlu_zOZd4vW
Your video is completely unreadable. It however looks like you have some sequences that fail on different tasks.
Why do you have a timer in the AI controller for when the AI attacks?
If it helps. And also I have a timer set for the attacks because of the tutorial series I was following along
I hate Ryan Laley so much. I don't even need to watch the tutorial to know it's going to be really terrible.
I highly recommend watching the introduction to AI with Blueprints course on the learning library. There are so many things wrong with that BT, I don't even know where to start.
Hm. alright then.
If you say so.
Most of your tasks should actually be services. You're trying to force the BT into a state machine, which loses all benefits to having a BT. You're setting an attack state randomly on a timer, instead of having actual logic.
You're just following a bad tutorial.
Gotcha. Im relatively new to Ai programming and nothing I really found was what I was looking for as far as what kind of Ai I wanted
No worries. The course will teach you the AI tools.
You're welcome
I've been meaning to ask you, how do you decide whether to put something in a service or a task? I've been using services as kinda like, data updaters. So like, finding a new location (after my initial task in the sequence does it) or making sure my health is the correct value, etc...
Hi All - Is there a way to make AI Perception (sight and hearing) not run on tick but rather run less frequently?
Hearing doesn't run on tick. It's event based. The only way to change the sight sense is to make your own or edit engine files.
What is the problem that you are trying to solve?
Anything that should happen at an interval or happens when the branch starts and/or ends should be a service.
Yep, that was it, Thanks!
What do these stats mean specifically? Does the tick include the tstas below? And then the execution is the content of the nodes and search is the evaluation of the tree?
Sorry if behaviour trees for dialogue don't belong in here but I'm in dire need of some guidance; in short I'd like to toggle a static mesh after the 'quest' is accepted (certain dialogue option is chosen), as well as changing the dialogue flow to display a different line if its accepted. In normal blueprints i could just tie this to a bool and have it check when the interaction is started / ended, how would i do it in a behaviour tree?
Not an answer but... is dialogue in a bt really an option? Feels so... backwards to its purpose
I vaguely recall people not really recommending using BTs for it
Nor convenient or easy to see the flow or even the spoken text
I tried it and while it worked for simple cases it requires a lot of awkward logic
I can only imagine
hey! I've done the
:Super( ObjectInitializer.SetDefaultSubobjectClass<UCrowdFollowingComponent>( TEXT("PathFollowingComponent") ) )
in our AI controller. We saved the BP and used it for a few days but realized that might not be the best option going forward. Upon removing that, the PathFollowingComponent is gone completely.
in the AAIController construction, it still gets created (line 44), and the pointer there is fine. But when anything tries to use it, it's nullptr
and so is the component in the editor
This is the way to go if you want to use the crowd comp, but it can happen when you change it again that any BPs will get corrupted
how that gets corrupted?? 🙂
I've seen similar problems before (don't remember if changing the class of the component or renaming the component or both), but why/how it gets corrupted?
Not sure but as far as I can tell same reason as those other types of corruption
is there any python script or commandlet on the webs that would "recreate a bp from scratch"? Maybe just gets a source BP and make a new BP?
Im experiencing a huge fps drop when skeletal meshes are moved in any way ( in the editor with the mouse, or while playing the game ). I tested many things and concluded that the more bones a mesh has, the more fps drops when it moves. Its not a problem with pathing, shadows or animations, i tried disabling all. Replacing the mesh with something without bones works like a charm, no fps drops. So what am i missing here? How can games have 50+ animated skeletal meshes chasing you while it stays above 60 fps? Mine drops to 30 when there are 20+ enemies..
And to top it all off, the enemy is low poly.
Am i missing something importmant here? Or is my i7 6700 and GTX 1060 6gb just to weak for this?
Please help, this has stopped my progress totaly..
There's ways to optimize skeletal mesh rendering, such as turning off some physics things on them etc. but this is probably better to ask on #animation or something like that
- Profile - are you sure it's the skele meshes that are the problem or is it the CharacterMovementComponent?
- Make sure the AI are using navmeshwalking for the movement mode, that helps
Also how complex skeletal meshes are matters. In terms of amount of bones and amount of skinned vertices. You generally want to limit 4 bones per vertex, but artists like to push that to 12, specially on faces.
i tried moving them outside of the game so only in viewport. moving them with the mouse still drops fps so that means it must be the mesh
the bones in the mesh
even tho there are only 10
the animation bluperint and the new control rig in UE5 might be churning many cycles of your thinking rock, depending on what you have there (real time retargeting used to be expensive, don't know how it is in UE5 these days).
So moving them around in the editor viewport, while the game isn't running, still causes fps drops?
yeah but now i see that it does that for all the meshes so ill scratch this sentance.. but swapping the mesh out for a different mesh with 0 bones doesnt drop fps
thats why im ruling out move component
cuz 1000 normal rocks or trees following me doesnt drop fps. If i put any mesh with bones back in, fps tanks
So what i wanna say is that if i put 20 enemies on the ground and make them follow me, fps goes from 60 to 30. IF i change their mesh to something with no bones, FPS stays 60 while they follow me.
You should profile with Unreal Insights to see where the time is being spent
im gonna be honest here, i never profiled anything and those numbers dont mean anything to me.. 😦 can you at least tell me pls what do i put into the cmd and ill try and figure it out 😄
No better time than now to learn #profiling
thx 🙂
is there a way to grab custom EQS contexes that return a UObject rather than an actor or vector as UEnvQueryContext_Blackboard base does ? I just want to grab a blackboard key which is type of DynamicAbility in a generator, but the best way possible I see is using a context in this case. Open to more ideas.
Thanks. I'll have multiple AI and I just don't need them checking sight every frame. It's going to waste performance and I'd rather have a timer that runs say 5 or 10 times a second. It will allow me to have more AI in the scene at once and save CPU for other things. I thought I read somewhere you could change how often it runs but maybe I misunderstood.
Anything that should happen at an interval
I consider services as "gates" as well, like for example whether its happening through an interval or not I dont use services for running behaviors but just gates to enable/disable specific behaviors. Are you strictly using services even when a Parallel + Task combo is eligible?
Ah I'm quite new sorry, it's not going to be a robust system just a proof of concept for the time being
Hey guys I'm trying to get a better understanding of navigation in Unreal. Does a dynamic nav mesh vastly affect performance? Or does the mesh get marked as dirty once it's modified and new paths are only calculated when this occurs rather than constantly?
There's some plugins that do wonders
got a question what's the difference between RVO and boids?
I'm making custom movement component
which is gonna glue at the navmesh while moving. Doing this for performance reason ofc
but need avoidance rn
as far as I can tell dynamic mesh performs the same if you never do anything to change it, but I could be mistaken
I have the same impression. I guess it's keeping whatever path was calculated initially until the next move command or the nav mesh changes? That's what seems sensible to me.