I've honestly already got the navigation and movement of my tanks working already with the node I posted earlier. There's only one problem left I'm trying to tackle which is agent radius sizes. I'm breaking my head trying to figure out how the agent system works but can't get it working and info / docs are very limited too sadly.
#gameplay-ai
1 messages · Page 29 of 1
Agent settings are in the movement component. By default it takes the capsule size for the character movement component, but you can set that up however you want.
I wonder why there is no movement component that simple uses the local offset system to move a physics based pawn around the nav mesh. Why is there only character movement which is purely designed for biped / humanoids and wheeled vehicles that use advanced suspension and friction system which are complete overkill for most arcady usecases. Why is there nothing simple in between?
The navigation system and AI in general is awesome in Unreal Like, I've really succeeded easily in making very good working AI characters. But missing things like this sadly make it only good in those forementioned areas / situations. When you're making a game that has more than just characters you're out of luck. 😦
Once you set up the agent sizes for each pawn, then you set the supported agents in the project settings. The agent settings in the project settings has to be 1uu larger than your pawns. This allows the nav mesh to be created to fit your pawns.
You can have multiple supported agents, but this does create multiple nav meshes.
I only need two actually
1 for my character and one for my vehicles
But yeah because I'm not using any movement component on my vehicle I guess it's not possible
Don't make assumptions. There is a the nav agent movement component, which is a simplified movement component.
Ok, that sounds interesting, let me check that out then. My bad
What is this component called exactly? Can't find any nav agent movement component
You mean floating pawn? 🤔
According to Unreal docs, these are the only available movement components: https://docs.unrealengine.com/4.27/en-US/Basics/Components/Movement/
And well, wheeled vehicles can be added to that list I guess even though they're not mentioned here.
Don't think that's available in blueprint
Or.. it's the floating pawn movment component which would make sense if I look at what this component you link to does
it doesn't take physics and gravity into account afaik, it just applies a movement / direction vector
Which would make the pawn float
The tank in my game is based on a tutorial by Unreal btw
Developer Relations Technical Artist Alan Noon walks us through the creation of a fully functional tank! Learn about setting up a drivable vehicle with working treads, ground collision, a firing cannon, and more!
Which is ironic I guess
what is the point of UAITask? when should you use it combined with UBTTaskNode?
If you look at the link she gave you you’ll notice that UpawnMovementComponent is the parent of the other movement components. So even if it’s not exposed to bp, you can use its children
Yes, but it's children are only limited to floating pawn, character (which is only available in characters) and wheeled vehicle. There are no other children components of that class exposed to BP.
So just use a character?
Well, no because that has biped movement and is forced to use the movement system it comes with. I want to use addlocal offset physics based movement that works well with a tank. Character movement does not work for what I want my tank to do.
Or yeah I dunno. I guess maybe I could try using a character movement component and try to circumvent all of it's unneeded systems. But seems like an insane amount of work to alter it so much and have a whole bunch of stuff there that's not being used and can potentially mess with the way I want my tank pawn to move.
Seems very convoluted tbh.
That’s false
You don’t have to use the skeletal mesh
But as a last resort it could theoritically work I guess. Would have to completely redo all of my tanks physics and stuff which would be a lot of work as well. Kinda sad that I cann't use my own system when it works so well for none-AI movement 😦
Or even if you do, it’s not necessarily bipedal
Yeah sorry i don't mean biped. I mean like it's based on a character that can walk, swim, jump,... when a tank is clearly not a character but a vehicle.
But yeah, perhaps I can only try to use the walk system and use it as drive
Hmmm you gave me some ideas
Might try this
You can always have your tank float on top of the nav mesh with gravity on
Is what my units do
One message removed from a suspended account.
AI tasks are special gameplay tasks used for latent functionality. They allow you to wait for something to complete while keeping the BT task non instanced.
alright, though in the end I'm still instancing an AITask, is there any benefit? (instanced BTTask vs AITask on normal BTTask)
AI tasks are light weight. And only instanced when used instead of on load.
oh okay, good to know, thanks
if I put a task that has input arguments like this in a subtree so that i can reuse that tree across a few types of mobs, how can i pass parameter values into the subtree. eg. say i want mob 1 and mob 2 to both use a subtree that calls this task, how can i have a different Combo_Probability for mob1 and mob2
variables I think
Are you me? That god damn crash on Abort 😭
Edit: Tried to just copy the plugin from the main-ue5 to 5.2.1 but it looks like they made quite a few other changes
(Pings off don’t worry) I think this should be unpinned as the videos were privated
Hello my friends. I have an unreal event triggering issue within my project I was hoping someone could help me with. Today I have followed an online tutorial for setting up a detection system within my game. Before this my AI enemies would see the player as soon as the player comes into the line of sight of the AI. Now when the enemies see the player it fills up a user interface bar and only once it is full does this trigger the attacking state, which is turn allows for the Chase branch of my behaviour tree (see figure 1).
The tutorial I followed used the 3rd person character BP and an enemy AI BP. For my system im using the AI controller rather than a single enemy BP, so that the system will be universal across all enemies within my game. The tutorial also used AI Pawn sensing where as I have utilised my AI perception system for results catered to my own game (see figure 2).
The system uses Blueprint interfaces to communicate between blueprints (see figure 3).
The idea is when the progress bar becomes full it turns red and this sets a boolean “should attack” to be true”. Then when the progress bar fades back to 0 this sets the Boolean to be false. And the AI returns to a roaming state (see figure 4).
These events are in the AI controller blueprint, however the event is being called withing the 3rd person character BP. After adding break points within the blueprint ive discovered that the event call is being triggered from the 3rd person character BP (see figure 5). this message isn’t being received within the AI controller. Im unsure as to why. Any ideas???
im wanting to later improve this system by adding other variables that effect the speed that of timeline controling the detection progress bar. The player character has an invisibility effect which i want to increase the timeline time from 3 seconds to 6 seconds for example. now i could just use the "is invisible" boolean to trigger a branch node. each branch leading to a new timeline, however this wouldnt work if the player turning invisible half mid detection. therefor some kind of timeline multiplier would be better. another variable i want to add is enemy distance from the player character. if the player is within a meter of the enemy the time line fills up in1 second compared to 10 meters away taking 3 seconds for example. again a timeline multiplier of some kind. anyone come across the node, or combination of noes im looking for? thanks evenyone
is there a way to set a bool to true or false everytime the ai perception has sensed the actor?
the Succesfully Sensed bool keeps going True and False every frame
What is the max age on the sight perception
That's possible? You can enable gravity on floating pawn movement?
That might just be the perfect solution for my usecase.
In your sight perception settings on the AI component there's a bit where you set the max distance. Theirs an age setting also which dictates Huw long the stimulus is registered. If 0.0 it's has no time limit
0
age comes out as 0
even if it senses the actor
oh, right
the setting
by default it seems to be set to 0
tho setting it to 1 does not give a different result
I think I now the real reason I'm unable to properly use the Succesfully Sensed boolean from the stimulus
the socket which I parented the ai perception has wrong rotation
meaning I gotta add a socket into the target bone and rebuild the c++ asset again
and I'm on a HDD -_-
i'm trying to get a zombie character to jump when reaching a NavLinkProxy, yet they do not jump at all yet are attracted to the proxy, none of the code is going through since print strings won't print, what did i do wrong?
inside the character
inside the navlink
the navlink
I suggest you use a object collision
wdym?
Simply get a collider and use that to send a signal to the ai that will tell them to jump
i don't get what you mean
how is what i did not doing the exact same thing?
"event receive smart link reached" isn't even triggering despite the AI clearly reaching it
I made myself one using a collider actor and a line trace so the ai will jump over a object only if its facing it
will you please elaborate
The blackboard.
....
Your nav link is set up as a point link and not a smart link. You need to remove the point link and set up the smart link.
wait what?
i followed a tutorial
i thought it was set up to do the opposite
so how do i set up the smart link then
?
There are 2 different types of links. Point links and smart links. They are variables in the nav link proxy.
Point links are really only useful for C++. They don't get an event and are used in the path following component to trigger behavior.
Smart Links give events to trigger behavior that is available in BP.
i see but the tutorial i followed was using BP's
and it seemed to work fine
so what the hell happened
You need to delete the point link. Having them both will confuse the path following.
hm, removing the point link actually prints
so it goes through
but he's still not jumping
argh for fucks sake
why's he not jumping now then
Do you see a Link being drawn?
you mean this? yes
if it matters the dark green is going through the fence
i lowered the fence just to test
still does not jump, but prints
😕
I was talking about the CMC
Oh yeah ok. One thing i worry about is physics and collisions though. Not sure how that will work since you only got a capsule component to work with which wont work well for a large tank model. Unless i can have the tank model attached so it is seen as part of the physicsmodel. Not sure if that will work though. Not at home tot test it out sadly.
how do I make the ai perception detect the component of an actor?
like a static mesh using the physics simulation and the ai perception seeing that mesh
Idk if you can do that out of the box. Why does the AI Perception need to see a specific component and not the actor?
hmm
then it means that I gotta use a overlap event for this
this is how I'm getting the actor btw
I wanna make the ai know from where the object was thrown, and for that it needs to see the thrown object before it hits the ground
So you want the AI to know where the player was when it threw it?
yea
overlap event it is
cause for some reason the ai perception is not detecting the rock mesh
Your AI will detect actors
Not meshes
If you want it to detect a rock, make it its own actor
I just remembered something
I can parent the actor to its rock mesh component
or to say it precisely
make the actor copy the location of the rock
this'll make the actor move with the rock and will make the ai perception detect the actor
I gotta try it out
I mean yes, but you’re still kinda looking at it backwards
Your rock should prly be an actor to begin with
Not some component
so I need a specific blueprint type
tho idk what blueprint is that
hmm, still no detection
this is weird
the specific blueprint type is actor
it ain't detecting still :/
alrighty, so I needed a stimuli source for the ai to detect it
Correct
Somehow I've changed something in my project that is now preventing AI from moving in a packaged build. Works fine in editor, my nav mesh is building fine and displaying fine, but in a packaged build, it's a no go.
I even reverted to a previous engine.ini file when I KNOW it was working fine, so it's not a nav mesh setting I've changed.
Just dawned on me to check the nav mesh in my dev build and it looks like it's only building nav on a small portion of my world.
#packaging comes with its own set of issues
I am having an issue where my EQS test isn't getting called for my eqs testing pawn, at all. Have I missed a step?
This is the .h file
Does anyone know any good doc, tuts on setting up nav agents and multiple nav meshes bound volumes / recastnavmeshes to configure navigation for two differently sizes AI pawns? Been looking everywhere online and can barely find anything. I've also been experimenting in-engine. But from what I've experienced so far it seems extremely buggy and unstable. Adding a volume suddenly breaks pathfinding completely. Nothing seems to connect a pawn with a certain agent,... It's sad that this is so underdocumented and yet so important. :/
What I also find weird is that you can set a custom nav data class. Yet, you can't make any as the class is nowhere to be found in the blueprint creation class list.
So I'm guessing it's not exposed to BPs?
is it possible to find usages of BB keys in BTs in 4.27? ctrl+F doesn't seem to be working and in BB window there's no "Find references" option in context menu
Also is there a point to have instanced node memory for instanced nodes? I've been assigned to a project where this type of stuff happens a lot, dudes were instanciating BT nodes AND having node memory, I wonder what's the use for it if you can already store everything in object's variables in instanced nodes 🤔
Hi again, so does anyone know how to fix this? Would be extremely appreciated
Hi, first time working with the behaviour trees and I'm looking for some suggestions, I have the following sequence, at the end I want to notify some actors in c++ and start doing something, what's the proper way to do that?
Is there a way to subscribe to that FinishWithResult or do I have to create a custom task where I would create the event delegate?
Hi, I'm trying to create a C++ Behavior Tree Task. For some reason, my task tick doesn't get called, and the task keeps restarting before it can tick, as shown in the video below. I enabled bNotifyTick, but doesn't seem to help. My code can be found here: https://gist.github.com/cjhowedev/fc69bb725938f51d9ab1363aab943e1e
you need to override ExecuteTask and make it return InProgress if everyhing is ok. AFAIR default return result is Succeeded which makes the task to complete immediately when return InProgress makes it running indefinately until you finish it yourself in tick or until some higher priority decorator snatches the execution to another branch
also be careful with this one
if (!FormationKey.IsNone())
idr for sure but I've had problems with .IsNone() and .IsSet() on FBlackboardKeySelector. The ResolveSelectedKey might be the solution for this, but if your task still doesn't work check if .IsNone giving you a valid result
It's really not that complicated.
- Write down the agent properties of your different pawns. By default this is the size of the capsule, but you can override the size in the movement component.
- Create supported agents in the project settings that match your agent settings and add 1uu. So if the radius is 50, set it to 51.
- Build navigation.
You don't need multiple bounds volumes. When navigating, they will pick the best fit automatically.
There really is a lack of info on the web about the finer details of UE's pathfinding and navigation stuff though.
There is no point. Just make them non instanced.
It's out there, but you have to dig through all the noise as well. It's made even worse with professionals using UDN so everything else is of questionable value.
UDN might as well not exist for people like myself. Far too $
You're thinking of it backwards. The event should be on the thing that needs to listen for the BT task.
It existing does affect you, because the only thing you have access to is other hobbyists. I think they should give everyone read access to UDN and anonymize the UDN user.
Imagine…
But that’s a source of revenue for them so I doubt it’d happen
Most of the benefits from UDN is having Epic answer questions. Depending on the contract, they have to answer within X amount of time.
o.o nice
Hi! I'm wondering if anyone has experience with implementing 100'sof AI Actors to follow a player? E.g. like zombies that can attack the player. Even having <100 actors standing creates a lot of lag (I've read possibly due to movement component and/or skeletal mesh+/- animation). There seems to be very different solutions online, and I'm just wondering what works in this context.
Fake it
Most of the expense is the movement component and the skeletal mesh updating animation.
There is the anim budget allocator which will help with the bone update cost.
The movement component is a lot trickier. It was built for precision in an FPS, not for crowds. There's a lot of things you can do, that is going to depend on your project. Optimization is about profiling, making changes and then profiling again. There's no magic button or setting.
There is also Mass AI/Mass Entity which was built for having a lot of NPCs. It however is not production ready yet.
Speaking of #mass , haven’t seen MieszkoZ in here in a bit. Guessing he’s busy with that
Thanks for the detailed answer! So in theory I could cut a lot of the costs with the anim budget allocator and making a custom MC..
I looked at the Mass AI plugin/some of the implementations and it confused me a little bit. It seems like it was designed more for passive crowds.. i.e. not sure how it would work for actual enemies.
You're welcome. Making a custom MC is a lot of work. There are settings you can tweak and functionality you can change if you know C++.
Mass AI is not currently friendly to non-engineers. I don't see why it wouldn't work for combat.
I mean in theory, I could subclass the MC and just override some of the more expensive functions I don't need... Hopefully that works like I would think it does in my head lmao
If it doesn't work out I'll look further into Mass AI
Not trying to bloat this project too much
Yeah, that's what we do on every project. Making NPCs use nav walking instead walking will help a lot as well. You can set the default walking mode via the default ground movement mode if I remember correctly.
Ooh okay nice! Do you implement any avoidance behavior? (So the AI don't get stuck/clumped on each other?)
for the navmesh walking selection
Thanks!
There are 2 different avoidance options built in.
-
RVO, which is through the CMC. While inexpensive, it has a number of problems. Such as only avoiding moving characters and pushing NPCs off the nav mesh.
-
Detour crowds. This works with navigation to adjust the path to avoid other agents. Downside is that it's more costly.
Interesting, I'll take a look at both options.. really appreciate the help!!
I guess my question is how do you listen from cpp to the bt task completion? Is there something out of the box or I'll have to create a new task where I broadcast?
You shouldn't listen for the BT task completion. The BT task should signal to whomever needs to know.
So a custom task would then call a method from the owner?
Detour crowds also changes some stuff with thread pulling and post-process move doesn't it? Makes it a lot harder to have nice smooth movement.
That entirely depends on what you are trying to do.
My objective is to have the worker move to where player had place a building, once it reaches, I want it to start the construction based on a timer and then change some values within the building actor (eg bIsBuilt = true)
Then you'd want some construct building BT task that handles it. That tells the building that it's being constructed and waits for the construction to complete. Probably also play an animation.
Thanks for the help!
That sounds like a good idea
Hi, I've a question regarding AIPerceptionComponent, it is normal that I got a callback every frame or so, about perception succesfully detecting my character which is not moving ?
Ty for your reply but I had already figured it out myself by messing around and trying random stuff. I finally got it working. The biggest issue was that lot of the navigation stuff doesn't update well. Reloading the level, restarting the engine were basically all it took to get it working. As someone new to this though this is EXTREMELY confusing and frustrating at first. The lack of decent documentation doesn't help that either. Once it works its actually a nice and good system. But figuring it out is def a challenge to say the least.
Also encountered quite a few bugs such as navmeshes appearing double until your reload the map, changes not taking effect, ... There's def some bugs in the system that need be sorted out.
Also the navmesh color doesn't work until your reload the map.
All things considered though these are small bugs and annoyances. But they really make an already complicated thing unnecessarily confusing.
still wondering what to do now
the code is going through on both ends
since it prints on both
yet no jumping happens
It’s not tracking movement, so yes
i remember stumbling upon something like this. If i'm not mistaken it's either set non-zero max age for sight, or I think I found a place in engine's perception code where it branches (if-else) wether it should retrigger sight sense event upon seeing a character based on some property, but I can't remember which one
I think there's a setting to register actors that have already been detected or not
but if you're using the onPerceptionUpdated function, there are better options
I seem to have an issue with the ai touch sense
for some reason, there's no trigger when the rock touches the ai
I even added the touch sense on the stimulisource of the rock blueprint
I'mma watch a tutorial first
I'd just use an overlap event but 🤷
someone did said the ai system is a bit garbage
when I looked up
and they mentioned its best to use a hit event instead
and I see why now...
the report touch event ain't doing anything
The AI system is excellent
You just need to use right tool for the right job
And the Perception system can be deceivingly complex at first
welp, everything works perfect
except for one more thing
last thing I need is making the ai to never stop running towards the player
with "Use Acceleration For Paths" turned on, it stops before it even reaches the player
but when its disabled, its a guaranteed death for the player
having it enabled and changing the ground friction doesn't help much
it still stops before succesfully reaching the player
How are you making it follow
Am I correct in saying that behavior trees run every frame? Such that when you're in a Wait node/task, the behavior is similar to that of Unity/C# coroutines where you yield execution at the end of a frame, and this yield continues to occur until the Wait duration is elapsed?
Hmm, okay 👀 my understanding is that BTs run on the game thread and that every frame (when the BT isn't already running), there is an evaluation of the behavior tree. While the BT is running, each node/task may take longer than 1 frame depending on their configuration.
Did you add the touch event when the rock touches the NPC?
Depends on what you mean by "run every frame." The BT does not evaluate every frame. It evaluates until it finds a task to do. If that task immediately returns, it will evaluate the next frame. If it returns as in progress (such as move to), it ticks the task every frame, but does not reevaluate until it is finished.
Gotcha, that makes perfect sense! I remember that tasks have states too (running, success, failure, aborted), so that clarifies a lot for me. Thanks Luthage! 🙂
Is anyone using EQS with StateTree? The return data on EQS is async, and I was wondering how other people implement it. I have a parent running an EQS task but as of 5.2 it looks like the parent state is just calling repeatedly instead of once. No code changes, so I'm thinking about changing how I do these queries
not sure if this is an "ai" question, but what should I do if I want my AI locomotion animation matches with its scale? For instance, I spawn a bunch of the same AI blueprint but with random scale, but the locomotion animation is still in sync and don't feel foot sliding. Is there something I should do with the blend space?
Is this a 5.2 bug? Placing ANY task so far in a parent state causes all state tree functionality to stop, with or without transitions defined. The documentation says this should be possible and this worked in 5.1 just fine.
Could be, I think STs are still WIP
With move to from behaviour tree
Is it possible to have both an AI and Player controller on a single pawn, and switch between control or even blend control between the two? As the player provides input, it could influence the pawn's movement gradually more and more until full control is taken?
It should keep doing it provided the tree keeps being re-evaluated.
I had that enabled, now I've disabled it and now the ai won't pause after reaching a certain distance with the player
You can use the player controller to make things on the pawn happen while it’s being controlled by the AICon, but you can realistically only possess a pawn with one controller at a time
You mean the use acceleration for paths, I imagine
disabling that would make the ai start and stop movement instantly
tho I wanna make the ai move more natural
Yeah, you can use that in conjunction with the braking distance
but anyways, the issue doesn't seem to be visible anymore after disabling the Update Nav Agent option
Odd, but 🤷♂️
probably cause of how the ai has a collider which is used when the player is caught
and that option considers the collider as part of the ai collision radius
but idk
can i change the navigation modifier volume entry cost for one specific NPC? guess i have to set the default nav filter class to one which overrides the nav area costs
Is there a way to exclude an agent from it's own modifier? Imagine a large pawn that has a nav modifier so that other pawns don't collide or get stuck against the large pawn. This also prevents similar large pawns from colliding which eachother. HOWEVER, this also causes the large pawn to be subject to this modifier. Meaning path generation starting from the large pawn will always first look for a starting point outside of the large pawn's own high cost modifier which causes issues.
nvm I found a way
my NPC starts walking around even without behavior tree... anyone has an idea why that could be?
You probably have some move to nodes in the ai blueprint
yea found it...
my fricking onHit event fired for some reason
so it tried to get out of the way of smth
Hey, so I was thinking about making an air combat game (e.g. Ace Combat) but I'm not really sure how to approach making a somewhat believable enemy AI.
I mean making it so, that it flies towards an objective and maybe veer off when the player is in a certain range seems doable. But how do you make it so that its attacks on the player seem believable?
I'm not trying to make anything realistic or a simulator. Arcadey and fun are the goals here and therefore tricks and cheating are totally fine with me.
I'm mostly looking for advice on how to generally approach the topic or if anyone knows any good ressources/blog posts/plugins etc. on the topic.
Any help is much appreciated 🙂
Any help with navmesh not updating during runtime?
I don't have any experience with such things, but
- There is no 3d pathfinding in engine (you might not need this though, if your level geometry is simple like AC)
- Boids Flocking is a good thing to look into for avoiding obstacles, other aircraft and group behaviors
- Moving into position to attack a target is probably the hardest part. I guess Lerping velocity to point at your target/ slightly ahead of your target is probably a reasonable thing to try at first. You will probably have problems with over-shooting and turning circles. You'd need do some maths to calculate if a continuous spline/ curve can be drawn from your current location to your target location and then make decisions based on that - slow down/ gain distance first ect.
Using nav modifiers on moving characters is incredibly expensive and causes a lot of problems, such as paths being invalidated. There are 2 built-in systems you can use for obstacle avoidance. RVO and detour crowds.
Thanks will look into it
Ok yeah that was exactly what i was looking for 🙂
How much more expensive is the detour controller though?
it works brilliantly, but I might be a bit worried about it's performance impact as I'm sure this awesomeness doesn't come free ;P
Thanks! Yeah, the last part worries me the most. Maybe I'll have to make the enemies something other than fighter jets where less realisitic behavior is less noticeable. 😄
I'm sure you can do it 🙂
On the note of avoidance - People always seem impressed with Detour crowds, but my own experience with it has been pretty poor:
- The avoidance works well enough, but its limited to characters that share a nav agent (Unless this has changed recently?) So no avoidance between big and small enemies
- Like RVO its still local avoidance only, so if an NPC is blocking a corridor or whatever, others will not try find a different route all together
- It disables thread pulling and post-process move stuff which makes the pathing look a lot worse on complex paths
Am I doing something wrong that I have these problems? It hardly seems usable to me.
Something I've been experimenting with lately is spawning nav modifiers (well using an object pool but still) under NPC two or three times a second. They do not move with the NPC, and have a high entry cost but default movement cost. It helps with avoidance if the character is still, and when moving they prevent NPCs from forming lines. Of course there's a performance cost to turning nav modifers on and off, but am I still going to run into big problems?
before I go complain on UDN - has anyone else noticed that reflection captures rebuild triggers a rebuild of navmesh debug geometry when starting PIE, if navmesh debug draw was enabled in the editor?
Hi, I'm using detour crowd and i see that bots have problem with avoiding bigger Actors (like vehicles). Any ideas? Maybe there is better solution then Detour crowd?
detour does not support multiple agent sizes at the moment, there's a pull request somewhere that adds support for it
Do we have any other build in solution for this?
there was a workaround to set the vehicles in your case as dynamic obstacles in detour crowd
I can't dig the actual Epic response up atm
ok, thanks
[Reposted from #blueprint message]
I'm pulling my hair out trying to get this boss, Virgo, to behave correctly in Unreal Engine 5. She's being a real pain in the you-know-what!
Here's the deal: Virgo is untouchable and whenever the player gets closer than 1000 units, she's supposed to let out a big ol' scream, pause for two seconds, and then zip straight through the player. She leaves behind a smoke trail that damages the player slightly, and then after a mad dash of 4000 units, she ends up 3000 units away from the player.
That's not all, though. She's also supposed to remember where the player was 1.5 seconds before she made her dash, so the player has a bit of time to dodge her smokey trace. But I can't for the life of me figure out how to set up the logic for this "Movement Attack".
I've been trying to see this as a task Blueprint, but it's just not clicking. It's all nodes and graphs and it's really got me stumped. Can anyone point me in the right direction or give me some advice on how to tackle this? I would appreciate it big time!
a more clear picture from what i have in an image!
I’m guessing you mean Unreal Engine 5, not Unity lol.
gf also always get confused because i keep saying Unity instead of Unreal xdd
yes
Scythe attack is basically when all skeletons are dead, she's will be fighting the character.
basically like a 1:1 with the boss yk
Ok, so before that attack task I’d add a task that grabs the enemy target’s location and stores it in a vector bb key, then a 1.5 wait node
Then move to that stored location and perform the attack
writing notes, sorry for not instant replying hehe
Tho idk what that skeleton check service does, so you’ll have to make sure your branch doesn’t keep firing
BTService_BTSkeletonCheck basically only checks if the behavior tree for the skeletons is Active or not. aka if they're alive or not.
Ok
alright, i'll continue with this and see where it leads me.
will post an update on where it lead me to :D
i just realized i forgot to mention that both BTTask_MovementAttack and BTTask_ScytheAttack have dashes, which lead to help with the ScytheAttack whilst it should've been MovementAttack that i needed help with
however, storing the location in a key was definitely something i might've needed help with aswell dx
Don’t duplicate
If you’re reusing the dash in the movement node, just add that movement node before the attack
Also note that BTs have their own MoveTo node for normal nav (basically the equivalent of AIMoveTo)

There is a significant performance cost to nav regen, even for modifiers. It also invalidates any path of nearby NPCs, so they have to repath.
Why aren't you doing attacks as abilities?
mind elaborating? (i'm super new to this, so i'm always learning new things)
The gameplay ability system.
i never had to work with the Geamplay ability tab or classes, i'm not really familiar with them.
i've got a project to submit in the next month, and i doubt that i'll be able to pick it up in this short timespan D:
BUT, if it's a better option to go for, it's definitely something i can write to to look into once done.
there's resources in #gameplay-ability-system , but it does take some learning and cpp for sure
nononoono, definitely no CPP for now that's for sure 
There are market place things that do the C++ set up for you.
The main point is why are you doing this in the BT? Abilities aren't really AI. Even if you don't use GAS and roll your own simpler version.
oh this is good to know
Just remember, code plugins are a per seat license. So everyone on the team will need to purchase it legally speaking
Or of course, you buy it for them.
I think the GAS helper is free
I only know of this one https://www.unrealengine.com/marketplace/en-US/product/gas-companion
well if I do end up using GAS, I'm going to learn more cpp anyway
Admittingly, I don't look much because I don't use GAS. I have my own, much more simple, version.
I don't rly trust third-party stuff
GAS is really good if you are doing multiplayer. Replicated montages and prediction. Otherwise it's kind of a beast.
yeah, I heard mixed opinions on it thus far
I am 😅. But I still prefer my simple, homegrown solution. Definitely not as robust as GAS though!
GAS takes a bit to get used to, but it makes creating abilities so easy.
I do want to try it eventually, so far I haven't rly had any complex abilities aside from spawning an emitter or launching a projectile, but I'm working on new ones so I might need it
Sure, I understand its something to be mindful of, but is it prohibitively expensive? For example, you can set pawns to be dynamic obstacles which is more or less doing the same thing so someone at epic once must have considered it potentially useful
Yes. You should profile it and see how bad it is.
Pawns can be dynamic obstacles, because they inherit that behavior. There are lots of things you can do that are ridiculously expensive, doesn't mean that you should.
Alright, but then in what situation is a dynamic obstacle acceptable/ useful?
No one can answer that for you. Performance isn't black and white like that. It depends on your project. You get 16ms per frame for a game running 60 fps. The more stuff you try to do, the more you have to be concerned about performance. That's why I told you to profile it.
I worked on a small project years ago where I tried what you are doing. It worked, but it was too expensive to ship. Things that moved occasionally were fine, but not not multiple things in nearly constant motion in the same frame.
I see, thanks for taking the time to respond 🙂
The mixed opinions are wrong, GAS is incredible, the only legitimate mixed opinion is the complexity and time investment to learn it 😉
is there any clever way (or a plugin) that lets me draw the Nav Mesh at runtime in a packaged build
Well there’s a project setting you can turn on, might have to repackage tho
You can use navigation invokers but you still need a navmesh in the level, it will just only be used around the AI with the invokes
You can F8 and see the nav mesh. If I remember correctly it works in a development packaged game, but not shipping.
F8 didn’t work for me when I tried
What configuration were you trying?
There are different configurations. Development packaged game means all the debugging functionality is not compiled out. Test means debugging is compiled out, but profiling is not. Shipping means that all dev functionality is compiled out.
I distinctly remember using F8 on a console to view the nav mesh, but it's been a few years.
Ah, just normal unpackaged. But I’ll try it again tomorrow just in case
It should certainly work in PIE. You might need to hit P to toggle it on.
Yeah, P works in editor mode, I was trying to use F8 to view it at runtime
Or maybe I hadn’t pressed P yet when I tried
P still works in simulate mode (F8)
Yes.
That makes a lot more sense, i saw you mention it before and I thought it’s some neat way of viewing the mesh during Play
F8 toggles between the 2. It allows you to do a lot of things, like look around the level, change show flags and select actors.
Oh nice
Show collisions is incredibly helpful, especially if you are having weird line of sight issues. I swear at least once a month something gets added that breaks LoS.
Hehe, yeah, every time I have to mess with collision channels I end up breaking some other functionality that depends on it, so then I have to find the right set of conditions that pleases every actor 😀
I'm currently having an issue with my AI MoveTo. I've already checked that the NavMesh does exist and is generated in the world. My teammates have 0 issues with their version (I reverted to previous versions too), but my AI just does not Move.
the only difference, is that I got this warning, and I'm not sure how to fix it exactly, searching up brings me 0 results.
LogPackageName: Warning: DoesPackageExist called on PackageName that will always return false. Reason: Input '/Memory/UEDPIE_0_TestMap_MainGrid_L0_X0_Y0_InstanceOf_/Game/__ExternalActors__/LevelPrototyping/TestMap/B/2S/0EJZTAZS7TRWOU5BCQPKDH' is in a memory-only mount point
Little more background, I am using Behavior tree MoveTo, but it was not working, so I switched to AI moveTo, and it's still not working
Currently, the behavior tree is stuck on the MoveTo node
When debugging the AI, the Navmesh exist, but the Actor does not seem to be picking a NavGrid, as in clicking numpad 5 to debug the navgrid and nothing shows up (it was showing up before)
I've tried deleting all the cache files and regenerating, also tried reverting all my changes and grabbing the latest from my teammates, and even asked my teammates to send me their content folder to see if anything works
I've tried regenerating the NavMesh by deleting the old Nav mesh bound volume and creating a new one, still not working
anyone faced a similar issue before?
Sometimes you need to delete the recast actor(s) and regenerate. Replacing the bounds volume really doesn't fix anything.
Otherwise you should use the visual logger to debug. A lot of errors get reported there.
Are you not using source control? It's really important when working with others, but really helpful in these situations.
Already did, my actors are spawned into the scene, and there’s no error in the visual logger, everything was logging fine, it’s just not moving
Already did what? Delete the recast actors?
Yea deleted the recast actors
If it's logging fine, then it's finding a path. Just not moving. More likely a movement/collision issue than a navigation one.
I have checked that the character movement speed is more than 0, and there’s no objects surrounding it
My teammates character movement speed is 100 and theirs are working fine
I’ve already reverted everything and I’m still having this issue
You can have collision that is invisible.
There isn’t, I checked, and my teammates have the exact same map
I’ve also debug collision to view all the colliders, no colliders blocking it
Then you need to step through the code to figure out what is failing.
You said there’s no nav mesh when using Numpad 0 ?
There is
The Ai just wasn’t picking a nav quad when clicking numpad 5
What is the movement result when using AIMoveTo?
Same thing, AI doesn’t move
Returns fail
Where are you running this node from?
And I meant which one of these is printing? https://docs.unrealengine.com/4.26/en-US/API/Runtime/AIModule/Navigation/EPathFollowingResult__Type/
Drag off the movement result output pin and see which one it is exactly
Tried running from the character blueprint
Success apparently but it’s not moving ☠️
I’ve even tried making a brand new map just to see whether there’s anything affecting it, still have the issue
If you made a new level, added nav, and still can’t use AI movement, I’m running out of ideas here
Just for sanity check, did you verify the goal location vector with like a draw debug sphere or something? And what event are you running this off of, begin play or something else?
yup, the goal is valid, i tried putting it in event tick ☠️
at this point im now doing my most desperate move and am rebuilding the entire engine, will let u guys know in a few hours once its done ☠️
alright it works now, turns out the solution was really just to rebuild the entire engine, i have no idea why it worked but it worked, thanks everyone for helping out, really appreciate it.
No it's not.
And where should I make instance of this struct?
There isn't a "better" practice. Store it where it makes sense for your project.
Brain is AIController
Body is pawn
Do brain own the data or the body?
AI design question: how would you model sound occlusion for AI perception in a game with levels resembling Dark Souls?
or do we just forget it and give them 360 vision
Not directly AI related but you might check Division 2's sound occlusion systems to get some ideas as a start
They recently released some short videos about their own systems
I have a feeling it will be super expensive and client based 😛 but let me have a look yes
do you have a link? it's not very easy to find
cheers 🙂
yeah just found it, at a glance it sounds like our audio eng system - raycast everything around and classify the space?
I dont know much, there was another video they dive into more details but couldnt find
but yeah basically seems like it
Looking to develop ai code for a card/board game. Something like tic tac toe but a little more complicated. Would a behavior tree be a sensible way to implement this or does it make more sense to just code it like normal? It’s turn based, doesn’t involve any player movement / seeking so I’m wandering if there’s still any advantage to using the behavior tree tools or if that’s sort of a waste of time
It sounds like utility would fit better to me
at least in majority
in specific cases BT could interop with utility
Is there a way to use Nav Modfier volume and nav links inside an actor, cause I'm randomly generating my terrain from different actor pieces. Nav invoker works fine so far but not sure if I will need those extra options in the future
Does nav invoker automatically update nav mesh if for example gate is openned or wall is destroyed
or do I have to leave the area and return for it to update (as it is attached to my player character)
You can use a nav modifier component. There are ways to use a nav link proxy inside of an actor, but adding actors to actors is expensive. Depending on your programming skills, it's not difficult to make your own nav link component.
Invokers are incredibly expensive. So be mindful of that. They do regen the nav mesh dynamically.
Then invoker will cover most of my suspected issues and I only have and need one of them. My level combined actor is built out of many different actor pieces but they only get called a single time when spawning.
About putting nav link proxys inside of an actor, do you know where I can look into it some more? Or do I have to create a different actor class then call it as a child in the main one?
Invokers are actually considerably more expensive than a fully dynamic nav mesh. I've shipped 2 games that had procedurally generated worlds and did the profiling of both options.
I've only made components to attach nav links to actors, so not the best person to ask.
I see, thanks either way. I will look into switching back to prebult nav mesh if I experience performance issues
is it possible to use the same playercontroller for both players and ai? I have tons of events that would need to be shared and all my logic right now runs through the player controller. I'd prefer to not have to redo my entire game around a totally different controller
Yes and no. You can have the player controller tell the AI units to do stuff but only one controller can actually possess an actor at a time
Currently I'm trying to create an enemy player for a strategy game, so rather than remaking every event from the PC I'd prefer to just use it or inherit from it
The AI will need to manage things the same way the player does
Yeah, I have the same setup
PC has the events. I have 2 diff AICons to possess player or actual AI and run BTs or receive AIMoveTo commands in some cases
How are you sharing those events with the AI controller?
The only way to do what you want done is:
- Source edits
- Components
I'd say the 2nd is the easier of the two.
That's how you can share functionality across two classes that are unrelated or in a different fork of inheritance
I told you. My AI controller only handles movement and BTs
that's what I as afraid of, I wasnt sure if unreal had an easier way to magically give ai controllers the same events as player controllers
I dont think you understood my question then. I am trying to have an ai that acts like an enemy player, which means they need access to the same events as the player's controller as if they were a player themselves
The only way is if you add this functionality in the AController class
I assume that isnt worth it
It's not.
To maintain a source build just for this, when doing it through a component would work just as well
so clearly I've screwed up my project then. This begs the question, what is the correct way to maintain core "player" events for both the player and a "player" ai? Is the component the best way or is there a better standard practice?
There’s more than one char in a strategy game
I guess I didn’t explain it right
The functions for my units are on their individual bases
yeah that makes sense
my confusion is how to handle the management side of the strategy game with an ai. Things like setting down buildings or diplomacy or whatever else
I haven’t gotten that far yet, I’ll have to figure out if BTs are the way to go, or some other AI tool
BTs seem rough for my purposes, I might try to use the EasyUtilityAI plugin because it has some sort of task scoring system built in, which is what I am familiar with from real strategy games
though I have 0 experience with implementing AI at all
I only hope it isnt as painful as learning multiplayer
If you have 0 experience with AI, utility is not a good thing to start with. Easy utility is a bad name, because utility is not an easy concept.
I appreciate the insight but I'm not sure how else to get a scoring system like that with only a behavior tree. On top of that my game is turn based so I don't really know how the default AI can handle that either.
I'm only familiar with how I've seen it done in real strategy games, which is pretty much always with some sort of scoring system, so that's why I've gravitated towards that.
Can I have that set on Dynamic in multiplayer? is it expensive?
Hello, I have custom C++ decorator derived from UBTDecorator
I've added it to the one branch of a selector
And I've set Observer aborts to Self
Everything works except aborting
Branch doesn't abort when decorator value change to false
hi, I wanted to get an opinion about how to make game state wait for several pawn to complete movement to a certain location
keep a counter in GS and wait for finished events originating from pawns' UPathFollowingComponent?
or something better?
been struggling for the past 6 hours with an assert inside \Engine\Source\Runtime\Core\Public\Delegates\DelegateInstanceInterface.h line 118 specifically Assertion failed: bConstructed
I have a BTTask that creates a timer with a delegate, inside the timer, on certain conditions it invalidates the timer. When that condition hits, I get the assertion error. Any ideas what I'm doing wrong? I have a similar BTTask that works with a timer similarly.
the .h
changed the callback function to void and redid the logic inside so it never returns, that seems to do the trick. So I guess delegates should never return?
Multicast delegates, yes.
Hey guys, Im a bit stuck with behavior tree. It works as intended but after a bit of troubleshooting I found an issue, thought I don't know how to fix it.
The issue: This branch goes into selector between Sound Investigation and moving to Random Location. Sound works fine, it moves to where it last heard the target, it waits 5 seconds and forgets, then it goes back to moving to random location. But if its already moving to random location which uses AI Move to, then no matter if it hears player, AI wont react until he reaches the random point its moving to. I tried couple of things but it mostly just broken the whole sequence.
Is there a way to abort whole Task if player is heard and how would I go about doing it. I tried a few things with Blackbords, bools and clearing data but it didn't do much.
Thanks.
Yes, and it can be depending on your nav mesh size
the tree won't normally re-evaluate while a MoveTo task is waiting to be completed, but running an EQS query service should help. I have something along these lines:
I see, so Run EQS would go where my Sound/Random is, and then you are using new BehaviorTree for Random Wander, but I suspect a Sequence would do the job as well?
running EQS would set the Target if something is heard constantly, at a certain interval, which would then allow the tree to re-evaluate from the highest priority. Your decorator should then be set to abort lower priority.
and yeah, I just broke mine down into subtrees
I would like it if subtrees were able to be a bit more dynamic in nature though.
Like, that plugin...what is it called.
This one
ah, so you can customize params in them? yeah, I can see how that could be useful
Yeah I think that did the trick, have to test it a bit more. I didnt put any Query Template tho
Yup seems to work fine, thanks a lot
hey guys. anybody using root motion movement together with ai move to? my problem is that the char often cant reach a point while running. its only running in a circle arround the point where he should go to
that usually means your goal location is above or under the mesh, but I haven't played with root motion
I meant to ask you back when you made this comment - but have you done a stress test with a basic nav movement component?
Yes you can. The regen will happen on the server. It can be expensive, depending on what you are doing. It only regens the cells that something changed in. If you do it often or with large areas, it can get costly. Profile early and often.
No. We always optimize the CMC. We also need to share functionality between the player and the NPCs.
I've long thought about doing it just to see how much of a difference it would actually make vs just optimizing the CMC.
I make enough zombie games - surely it'd eventually pay off 😅
Maybe before 2020 😀
I made stress test with floating pawn movement back at 2019 on Huawei P10 Lite phone, which is extremely low end. It was able to afford 25 walking NPCs with pathfinding and MoveTo
UE on mobile? Gross
While feeding your info to China on tick? That’s performant af
I'm feeding NSA these days
Using nav walking takes out the biggest offender of find floor.
/offtopic Huawei isn’t 😀 /offtopic
It just assumes there is one?
Nav walking isnt 100% reliable though
Instead of the capsule sweep to find the floor, it projects to the nav mesh
ah, rite
Gotta do checks regularly to push it back to navmesh
Yeah, I do that by default for all the types of games that I enjoy making.
Did you add the observer abort functionality?
What do you mean? Is there something I should add in the code?
You have a lot of problems with your code.
- You aren't handling abort at all.
- Is this task instanced?
- So many pointers not being checked. Every uobject should be checked with IsValid
- Don't use is valid low level for gameplay code.
- Your gather callback functionality is wrong. There is a function you need to call to end the task instead of using a return value.
- All those hardcoded blackboard key names. Do you know what blackboard key selectors are? Do you know the template blackboard functions?
Yes. You have to add the observer functionality. Or you can change your parent class to the blackboard one if you want to abort on a blackboard.
Observer abort on your investigation is set to self. This only aborts the branch under it. If you set it to both, then it'll also abort the lower priority random location move to.
Ahh I see, should I then do that and get rid of Quary since its working with it at the moment
Thank you
The query is just finding a target and a good way to do it. The problem was your abort settings and I was just explaining why.
Alright, makes sense, thanks
That sounds like your acceptance radius and overlap settings are too precise. NPCs need to move to close enough to the goal.
@uneven cloud its already at 500 units
i guess the problem is my animations for sprinting. the sprint left and sprint right gives me the nice circle that its doing while trying to reach the point
so it has no animation at this movement speed to be able to get to the point. i hope that makes sense
and the move to isnt clever enough to turn in place to get there
How fast is it traveling in a frame? Doing circles around the goal means it can never reach it.
how can i see it?
Use the visual logger. Add a log each tick and then step through it's movement.
I mean I like it, looks like the goat is having fun
But it doesn’t seem you’ve tried the visual logger as instructed
never used it. just trying to find it
in Tools -> Debug
jeah i know where it is but not how to use it and get a number from it
hit Start. Then Play the game. Then observe the logs on the frames
jeah got this i can also see the points where he should move to
but not the movement of the animals and also not the speed
are you using a BT MoveTo or regular AIMoveTo node to move it?
bt move to
when i enable this its working without problems but have no anims for turning
Did you follow through instructions I gave? Specifically logging every tick?
From your video it looks like your speed is too high for your rotation rate. It can't possibly get to the goal because of that.
i am pretty sure that is the reason
so i think the only possibilty is to have other animations with higher turnrate?
or lower the speed but than the animal cant RUN away
Yeah. This is one of the many reasons why no one uses root motion for locomotion.
but looks so much nicer ;D
Not really. It's running around in a circle unable to get to the goal location.
Root motion is best used for like one off animations imo.
jeah i think in the end its the easiest way to redo the locomotion with normal ip anims
thanks for your help guys
Hello
I have small problem with AIMoveTo (BP Node).
Somehow, the On Succes triggers several times and I have to put a big enough delay so that the action that comes next triggers once.
For my example, I doing a navigation path with an array of points. Upon arriving to one point, I increment a integer by one to get the next point. If I have no or a small enough delay, it will increment one more time additionally. Anyone have any idea on fixing this problem beside an delay?
Event Tick -> Custom Event called MoveToLocation
You’re a crazy man
under the logic that it hasnt detected the player or ally
So you’re telling it to run the same MoveTo 60+ times a second and then wondering why it’s succeeding multiple times in a row?
So, I guess I should put the delay at start then.
I am new to BP, been this for sometime now
No, do not put delays on Event Tick
They do not do what you think they do
If you want to have something that tells it to move somewhere when it has a target set, use Behaviour Trees
Watch the 3rd video link in pinned in its entirety, that’s the shortest path to understanding the basics imo
Thanks.
I watched the video, stuck on the part of AIPerception.
Other than that, this should make it easier if I get AiPerception part working
Stuck how?
The event called "On Target Perception Updated" dosent trigger :/
Did you add a Stimuli Source to your target?
Yep
And you configured your AI Perception to use the Sight sense?
- edited the config file like they did to bypass the friend or foe system
K, so what happens exactly?
Or I guess you said it doesn’t trigger
Did you use the AI debugger at runtime?
Yes
I also print a string "I see you" instead of setting the actor
But breakpoint dont trigge so
Any info there? Was it in range?
Did it look like it was detecting it at any point
Does it show as being in range of your AI tho
Like is it showing as being inside the 30 degree cone you can see with the AI debugger
No, it dosent detect the player how much I move it around when simulating
I got it working 😄
Perception System Class i Project Settings was set to None
Anyone familiar with using gameplay tags on blackboards?
Tried doing some generic implementation to see if I could get it working - for what would eventually become more advanced Ai - but the blackboard doesn't seem to be reading the tags from my actor correctly/at all (condition isn't being met)
are you talking about blackboard keys or CheckGameplayTags decorator?
If the latter, you need to implement the IGameplayTagAssetInterface on your actor
Hi, I want to say thank you for the help yeserday.
It seems so easy with BT.
Moved most of my crazy logic for enemies and allies towards. Now I am just figuring out if there is a way to set the wait time through a blackboard variabel or do I need to create a delay in one of my task, ex execute movement
I wouldn’t use a delay
Are you trying to adjust the wait time on the fly?
Speaking of which, I have a similar question about BT nodes, which I may have kind of asked before. How come things like Wait time, or Acceptance Radius are not built to use Blackboard Key selectors, so you can adjust them as needed, and is there another way around that?
Aside from going back out of the BTs and using AIMoveTo nodes and whatnot, which can be a bit counter-intuitive when you're trying to use BTs
found this reply from MieszkoZ in 2014 😃 :
"Not yet, at least not in Blueprints. But there will be in 4.8. Stay tuned.
In C++ it’s the usual way - derive from BTTask_MoveTo and instead of using AcceptableRadius call a function on your AI.
Cheers,
–mieszko "
Why have you forsaken us, MieszkoZ ? 😃
Hey everyone, I have created a new EQS test and I would like to use the test score. It never seems to update however. I am making sure the values are within 0-1 but even if I set the score to 0 it never uses the score. It only checks if the test is a success or not. I have already restarted the engine, but this doesn't change anything either
use the AI debugger and see what happens at runtime
you can press / to expand the list of actors that are being tested
Do u mean to show the EQS debugger?
when in AI debugger mode, press numpad 3 to show EQS, then press /
It simply gives it a score of 1
Even though my score is set to 0 and I have made sure that there is only 1 test being performed
you're forcing it to 0 with a node?
why? what's the point of your test if you force it to give you one value?
Because it uses the test success instead of the test score
what are you trying to achieve here
Oh it is just for this test to see if it will become 0
My actual test is calculating angles between positions to keep my enemy in around the same angle
Your test type is boolean and not a float.
Oh that my bad for mixing up the pics. There are 2 pics, I made sure I am using float
Why are you creating a new dot product test? Also need to see the code to help as these images tell us nothing.
Pic 1: Code to get angle between two locations.
Pic 2: First part of test, the blurred out part is the player
Pic 3: Second part of test
But even if the float score was 0, shouldn't that still cause the EQS to be 0?
The attached pic was made when setting the score to 0, how come the score is 1? It seems to be using the 'Test Success' instead of the Test Score, even when the test type is set to float
^^
Why are you not using the built-in dot product test?
Would that work as I want it to?
Lets assume that playercamera is the player here, would this setup be correct?
What I would like is for my enemy to prefer staying in the same angle from the player
So the closer he is to that angle, the better
What do you mean the same angle as the player?
No matter where the player goes, the enemy should want to stay in the same angle
Lets say initially the enemy is in front of the player, lets say his angle is 0.
What I want is for him to stay in that direction from the player, so his angle stays around 0
Do you mean that if they are in front of the player, they should stay in front of the player?
No, because player rotation should not matter
Then you want the dot product between the querier to player and querier to item.
When comparing angles, you really shouldn't use the expensive functionality to get the actual angle. Learning how the dot product works is INCREDIBLY important for AI.
Like in this beautifully drawn image. Player is blue and enemy is red.
The left is the initial setup, but then the player moves bottom right.
I would want the enemy to position around that new black line, the further he strays away from that angle, the worse the position
What is angle 0? An angle is the angle between 2 vectors. In your image there is only one vector.
In my code I use 2 directions; A world direction which I set to (1,0,0) and the direction between the player and enemy
I still say that this is what you are actually looking for: you want the dot product between the querier to player and querier to item.
Why would you use a world direction of (1,0,0)?
Because I would want the angle to be the same no matter where I am in the world
That doesn't make any sense.
Well my complete final goal with my AI system is to reproduce or at least try to recreate the aggression system in GoW
https://www.youtube.com/watch?v=hE5tWF-Ou2k&t=728s&ab_channel=GDC
From this vid
I have already got quadrants working, shapes, etc.
And maybe I am going about this wrong because it shouldnt be as hard as I make it out to be lol, but I just want the enemy to be where I last saw him
In this 2019 GDC talk, Sony Santa Monica Studio’s Mihir Sheth covers how they implemented combat systems to deliver a bold new action experience that evolved yet stayed true to 'God of War.'
Join the GDC mailing list: http://www.gdconf.com/subscribe
Follow GDC on Twitter: https://twitter.com/Official_GDC
GDC talks cover a range of developmen...
You really should try what I recommended and learn more vector math.
I mean, I am using the dot and corss product to calculate my angle?
But I will try it
The result I get from the suggestion are not what I am looking for
Pic 1: results of dot test
Pic 2: How I expect the results to look like; From green to red, the further away from the angle, the worse the result
In the EQS pic the enemy is on the left of the screen (cant show mesh)
I know that my personal calculation would give me this result, but the EQS is simply not returning the float value but instead the bool value
But I'll keep messing around with the dot calculation a bit
But i would also be trying to get the float value to work
I've never seen EQS tests in BP. Is that new?
they're there, I haven't used them because why would I when I can just do it in the tree
I mean writing new tests.
The test I gave you should give you that result. You might need to reverse it. Use the visual logger instead of the gameplay debugger for better understanding of the results.
oh, idk about that, that looked more like something he coded in cpp and exposed to bp
Yeah I think I need to change some inputs of the dot product but I think it will work, I'll try it a bit later
Im thinking this should also give me the result I want:
Player to enemy and player to item, the closer the dot the better
But it isnt new, I have been doing it for quite some time
I meant is that new to the engine or something you created. You are losing a lot of functionality by doing that.
I am making my own tests.
Could you explain how that is losing a lot of functionality though?
Contexts, query params and significantly increases the perf cost and not sure how that works with the time slicing
Yup I was talking about the decorator. I'm assuming you can implement that with BPs as well? I'll test it rq, thanks for your help!
Well crap the interface isn't expose to BP interfaces for me to add without C++
yup, unfortunately not
Looks like this has been an issue (of not being in BPs) for a while, get on it epic!
they're busy with other stuff
but the gameplay tag interface is very easy to expose tbh
Yeah I already did it, haha. Just a QOL thing that realistically should've been done after ~6 years
you mean like this? 🙂
recently i started getting this issue where nav mesh are shifted away from where they supposed to be in. i found that changing the runtime generation type to dynamic fixes the issue, for now anyway
but what could be the issue?
Hello,
I am facing an issue with Behaviour Trees. It seems that after executing a "Play Animation" task, my AI pawn stops using its animation blueprint, and just starts T-posing. It's as if the animation BP is no longer active.
Everything is ok before this "Play Animation" task is executed. The animation does play successfully, but after that, its just T-posing.
when does the shift happen, on engine restart or..
when i hit play usually. but now it happens even in edit-time too lol
unless i move the nav volume it corrects itself but then i hit play and shifts again
that's very weird. I assume you tried deleting and remaking it?
yep
no luck
i've also tried to add another seperate volume on another part of the level, still the same issue
you're not messing with the nav mesh dynamically anywhere are you?
nope. i even deleted and re-added the navmesh to break any references i have to it
actually thinking about would "debug editor" build config cause the issue?
one way to find out
because i've also noticed that half of the capsule collision not being rendered lol
we will find out in like 30 mins 🫠
nope that didnt fix it. but it is closer now 🥳
Are you moving the world or the nav mesh actor?
Are you using the built-in task or one that you made?
ooh that would be hilarious if you were moving your whole world at runtime 😄
hey guys, how do I make an AI follow another AI? turns out running an EQS query and setting the target location isn't it
Built-in task node
The built-in task makes the animation a montage. I would check your montage functionality in the anim BP first.
That's a good way to do it. What is not working for you?
nope they're completly static
Does anyone have any idea as to why a nav link proxy I made will work if placed normally in level but wont work if its created as a child actor inside a blueprint?
the AI that is supposed to be following just stops at the last known location of the AI that is supposed be followed
it doesn't move
Are you running it as a service to update the location?
I'm quite new to AI stuff and don't fully understand what a service is. If that's what's going to fix my problem, I'll look into it.
Thank you!
Not necessarily what the problem is, but we’d have to know how you’re setting the target location
A service is a node that runs while the branch under it is running. There is a run EQS service that you can put on your move to task to update the location while moving. You do have to set the move to task to update on the blackboard change.
is it possible to export vislog data to some parseable format? csv or json for example. I kinda did some A/B testing and now need to process vislog data but I don't thing vislog window provides any sort of grouping and aggregating results 🤔
I'm trying to check for pawns in these points, if there isnt one its a good spot to choose from. but it always gives it a score of 1. Any tips?
maybe i need to watch more EQS tutorials I may not understand it well enough yet lol
seems to work okay on the querier but not player
Watch the EQS time stamp on the 3rd pinned link
will do thank you
Is there any way to debug which state our AI at in the State Tree? I tried ' but it doesn't show any helpful information
Is there a way to connect 2 far away points on a navmesh to make an AI believe they are connected?
Is there a way to force the AI controlled pawn to stay facing the player when executing a Move To task? Or does this require a custom task? Most of the tutorials I've seen talk about simply adding a movement input to the pawn/character for strafing, for example, but I want the AI to move to specific locations while facing the player. It also seems like this movement input method doesn't account for pathing (strafing into a wall, for example). Has anyone achieved this before?
it's alright, I scrapped everything
I see, thanks again!
My AnimBP is very simple. Anyway, it seems the way around this is to trigger the animation from the controller and then sync with the blackboard using a BB key. However, it does not work well since sometimes, it goes into the last Wait node, and the anim does not sync. I am using a custom enum to track my enemy AI's state in BP.
I removed the Play Animation node, and instead set the enum in the Controller code.
Then once the montage finishes playing, I set the state to Chasing.
I basically, just want my monster (I am making a horror game), to play a one-shot "Scream" montage when the player is spotted before chasing the player.
This is the AnimBP. It is very simple.
Ok, I have a solution, that I will post here for others in case anyone else has the same issue. It seems that the built-in play animation node unloads / disables your animation BP, and plays the animation you set on the node... At least that is what I got from the comments from this Youtube Video: https://www.youtube.com/watch?v=94WLK3AGZ7Y
So, you need to make your own custom task, that simply calls Montage_Play on your Pawn's Animation BP.
I simply set a delay to match the time that you get from the the Montage_Play, then finish the task.
What is the Play Animation Task Node in the Behavior Tree in Unreal Engine 4
Source Files: https://github.com/MWadstein/wtf-hdi-files
Those tutorials you found were wrong. All you need to do is set focus on the player. Maybe also set the move to to allow strafing.
Delays shouldn't be used in BT tasks as they are timers you can't cancel. Use a timer or the montage ended delegate.
I don't remember that being what that task does, but it's been a long time since I looked at it.
Perfect, thank you!
I am seeing some tutorials of ai of ue
What this green thing called? It help to move ai in only this green area
a navmesh
green navmesh is not showing on pressing p, I don't know why
Did you place one in your level?
make sure you select the landscape or empy space before you press P
??
i can't on this ?
oh hold on
you added the wrong thing
it's NavMeshBoundsVolume not Modifier
the latter makes holes in the navmesh afaik
idk what you're showing me, is there a language barrier?
NavModifier is not the navmesh
it's used to make holes in it
you should have one of those.
And I believe it comes with a RecastNavMesh as well
ohk, @dense owl thanks, I am testing navemesh first time
A RecastNavMesh is created when you build paths.
Is there a way to alter Nav Links to allow them to just connect two points regardless of distance
my ai does not complete this moveto task, in debugger it has a set location but the navmesh segment does not appear. (BT is just retrying from root on a loop during exec)
Check your Target Location vector to see if maybe it’s above or under the mesh. It’s also good practice to have a fallback behaviour (like a wait node after it)
Else try to rebuild your navmesh
The EQS service does not complete before the move to starts, so it's never getting a valid location.
What would I need to have a working ai mechanic where it would go to the nearest actor to the player and then begin to patrol around that target after it reached its location by a few meters?
My thought is simple parallel, but I never worked with it yet, only thing I know about it is it has two tasks with different use
after a bit of debugging, it seems the nearest actor to player doesn't have its tag changed properly
I'mma move this topic in #blueprint
Hopefully this is the correct channel ... How to lower the nav mesh for a BP Static Mesh object? I have added two assets; a boat and a bridge. However, as you can see in the screen capture the navmesh is above the objects, which makes for a fun mini-game to get my character to jump aboard, but not really what I am going for. Any ideas?
I think rn it’s generated by can step up on, especially on the top of the bridge, hence why it’s so high up
Also might be too narrow on the bridge for the mesh to sit on the planks
I think I found something ... I had imported these assets and the collisions were large rectangle boxes. So I removed all collision boxes and recreated my own, and multiples where I could then lower them to the surfaces of the bridge and boat. The characters can now walk on the assets instead of having to jump ontop. Not sure that is the best solve, but for now it works 🤞
Ah, I figured you’d already checked mesh collisions mb
Nah, still new to this. But I am learning 😀
try deleting the recast navmesh from the world outliner and then rebuild the path
this solution worked for me
can I use two selectors which I can switch between when their decorators are set or not?
Depending on what you mean, you might not need 2 of them for that. Elaborate or show some code
Basically using separate selectors for different mechanics unless a decorator from the main selector of the two changes
But anyways, I already found out and it works nicely
Been spending a long time making an ai move to the nearest actor to the player and then guard the actor with a random location patrol if its close enough to it
Tuns out I never needed to use any tags
anyone know why my Recastnavmesh settings keep resetting
every time i close and reopen the level/project the agent radius keeps setting back to default like 35
i have changed it in the project settings to (tho there it doesnt reset)
The settings are also the same in the DefaultEngine.ini
No clue how but it just stopped doing this
sooo
yay?
ok I gotta say having to put INIT_DECORATOR_NODE_NOTIFY_FLAGS() in decorator constructors caught me off guard
even twice in a week
shit just wouldn't work 
I have an AI Perception component on an AI controller but i'd like the vision to be based on where the head is actually looking. Is there anyway to set it up for this?
Have the head rotate towards Control Rotation of the pawn, it's already set up
Then rotate the body based on velocity
Animation wise
I'm triggering montages (search anims) where the head moves based on the animation.
Do you mean have the control rotation match the head?
no, do it the other way around
you want to tell the AI where to look in AI code, then have animation follow that.
don't drive the game from animation
That sounds like a lot of setup in the AnimBP. :/
If I recall, there is a way to just overwrite where it looks. So do it based on some head bone and then when the head moves, it just works™️
I think it is C++ required though.
Maybe GetEyesViewpoint? Or something like that
I might have to think about it for a bit but to confirm, where the sight is sensing is based on the control rotation on the controller?
I can't recall exactly.
While i'm here, any ideas why my AI gets stuck here? The pawn doesn't actually rotate. :/
It’s usually to do with the angle
What angle?
Sec I’ll get you the right setting
Precision
Play with that, may have to go lower or higher depending
probably because you're ignoring the control rotation 😛
you should have "use controller desired rotation" ticked and not "rotate to face movement"
sounds like you've set your characters up for human control
and the anim BP rework might be a lot but you'll be better off after it rather than trying to hack your way around what animations are
make the game work with capsules and zero anim, then go from there
That was exactly it. Thanks. 🙂
You probably right, I'm not the best at setting anim BP's up though haha. I should be able to sort something out though. Just need to spend some time thinking about how best to do it.
I've not gotten to it to much yet but the how does the age work for hearing (AI Perception)?
Another question regarding BT. I have a branch that aborts based on a BB var but if the branch gets to a specific task, i don't want it to abort, is there anyway to do this?
Can you show the tree?
I think i've sorted it by moving it out of the branch.
'Hey,Im new to unreal and I have a question. I have two AI controlled pawns. But one of them need an other agent radius size. I thought I can just make a second nav mesh with different settings. but this setting is controlled in recast nav mesh. How can I have two different Nav meshes with different Agent radius?
Are you trying to make the radius smaller than the default? You can't do that there. You need to make your own default agent size by creating a supported agent in the project settings.
If you are on C++, there is a function you can override called Get Pawn View Point. Or something like that. I use a socket so the function returns the socket location and rotation. It's a Pawn function, so characters can override it.
Hearing age is how long it hears a sound for. Or better put, remember hearing the sound.
Create 2 supported agents in the project settings. The agent sizes have to be 1uu larger than the actual agents. So if your agent has a radius of 50uu, you need to set it to 51uu.
Then when you build the nav mesh you will get 2 of them. When the AI try to navigate, they will find the best match.
Be careful with the amount of supported agents you make. It'll add memory to your level and cause slower loads if you have to many. So if you make a lot of AI, it's best to keep them in buckets of say small, default and large.
What happens if they forget the sound? Does it trigger the Perception Updated event?
I believe so.
Sight is the one that doesn't trigger an event when it's forgotten.
Anyone know a way to get the Pathfinding distance between a pawn and a location?
like the length of the path it has to walk to actually get there
right now i'm using a method where i take literal distances between two vector points, but do it with enough frequencies that it ended up being close enough. But for a tactical game i think it'd be better if the player can see how much it'll take to walk a distance before they commit
there's this node... I don't know how to use this node...
you can use the get path length node.
ah!
Yeah it came up when i was poking around n the context menu
but the tooltip is not helpful, there's no tutorial video, and the documentation might as well not be there
how do i use it?
where do i get the nav data and what do i filter?
I don't think you need to use them unless you have multiple nav meshes. It should automatically use the nav mesh in the level if it finds one. You should just need to provide the start and end points.
Has anyone else experiences an issue where the AI Perception (sight) would glitch when the NPC is close to the player? (NPC move to player type of thing) For a split second, it clears the CurrentTarget (player) which is messing up my BT. It seems like it might be something with the MoveTo task.
@rich pendant hey, sorry for the ping, but do you know how to work with this enum?
there's no switch or anything on it
I don't no, i've never used it.
rip
i want to check for situations where the pathfinding fail, and i think that information is buried in here
You might want to look into EQS for more complex path finding queries.
watch 3rd pinned link video (preferrably in full, but at least from the EQS timestamp on)
Aight, thank!
also you might be looking for this @ornate rock
that's ==
why doesnt my spawned pet character follow my main character when i use spawn node but does when i place the actor in the level manually
In a behavior tree task (or the behavior tree in general), is there a way to link animation durations directly to the logic execution? Simple example, but when I call PlayMontage from a task, it would be great if the behavior tree could just wait until the animation is finished so it's not continually executing tree branches. I know you can add a delay node and match it to the animation duration, but that seems clunky and prone to error if animations change. Is there a better way to do this?
Might have something to do with the GetPlayerCharacter node? Would it be easier to save your main character as a variable inside the pet and set it on pet spawn?
on pet spawn you mean where i spawn the actor or in the event begin play?
Make a new variable and set it to exposed on spawn
oh ok
how do i get it to show up on the spawn actore node?
cause i created the variable in the pet BP but its not showing up when i refresh the node
woops, clicked wrong expose on spawn
didnt do anything
You mean the pet still doesn't follow, or the variable isn't exposed on spawn?
pet doesnt follow
I'm not sure then, sorry :/
np thx
What are your auto posses settings on the character?
Do not add a delay in a BT task.
You can either do a timer or bind to the montage ended delegate.
Why are you turning off collisions when spawning it?
Using the visual logger should help you track down any errors the move to has.
idk how
Look in Tools -> Debug
Whats the right way to change the ai controller in the pawn?
The current method I am using is either destroy the controller or unposses it from the pawn, then depending on the selected option, the other ai controller is spawned and posses the pawn with it
But the errors I am facing are related to the referenced objects
And it seems the ai hearing sense seems to break whenever it hears something
Maybe I cannot reference the object after the event begin play in the controller and just use the cast node everytime?
yup, that was the issue, but now the ai would randomly stop chasing me cause it heard a noise, and that creates a small chance it would become completely confused and stand in place
ALRIGHT, fixed it sheesh
so note to self, don't destroy an ai controller, unposses the pawn from it instead
Hey. I have an issue with the AI sencing sight in the back before it has turned. So I fire my weapon to make noise and the AI starts to turn but immediately sees me before it has finished turning.
the pheripheral vision is set to 75 degrees
u know how i can make this ai stay on the right side of my main pawn when it follows it?
Hello, I am moving a minion AI to a spot around a player, But I want it to check if there is already another minion in that spot before I move there, if so then try another spot. Any advice on how to achieve this? This is what i've tried so far.
this always return false though even after i set it on the first task
And also it will not set it across all minions for that specific spot right? Not sure how to do it against multiple ai
Simplest way I can think to is get actor location and add a vector to it, like x +50 or something
Instead of get actor right vector just do get actor location then add to it to the right
I might be thinking about this the wrong way but I was thinking about using AI Perception to set focus on my AI which I would then be able to use to calculate some head turning in the AnimBP. The issue im having is that it just causes the AI perception to rotate all the way around the AI. I've set the character to rotate to the control rotation when moving which is fine as otherwise, the whole character would rotate when I set focus instead of just the head which I'm trying to achieve.
Would anyone be able to provide me with some tips on how to get it so the characters head/AI perception will rotate accordingly based on what they are looking at. When the head turn has reached it limit, it shouldn't be able to turn any further.
Set focus and control rotation is for turning the entire body. Look at is typically done via the animation instance. There are lots of tutorials for look at functionality.
Add a distance test for distance to allies move to location. You can use a context to get those locations.
Thank you I will try that. Haven't messed with contexts much yet
@dense owl
K, what happens at runtime in the tree? You might have to use alt+P
just the task
I do have a finish execute node
Like is the MoveTo firing
it's not
Tick the Success box
Else you’re telling the tree the node failed and it re-evaluates from the top
I did that now
still the same
I think your EQS might be constantly overwriting it
try making a Selector node above your sequence, move the EQS to that one and put a fallback Wait node on the right branch
like this?
almost, make another branch from the selector to the right of the Sequence with a simple Wait node on it
I don't think you need the SetAnimalLocation task
you're already setting that in your service
ok, your EQS query is finding Actors not Locations, yes?
also, something else I've noticed, only the hippo gets perceived
it's children aren't
got it
right, so you need to store that in an Object type Blackboard Key, not a Vector
i.e. TargetActor
I imagine your TargetAnimalLocation was a Vector key, yes?
yes
I'v even filtered it to BP_Hippo
now go to the BT and change all of those tasks to use that key instead
done, still the same
just for sanity check, can you show your navmesh?
k, and your TargetAnimal is showing as perceived in the AI debugger still?
also, do normal MoveTo Tasks (to whatever point on the map) work?
it does, once
well yeah it's begin play so it'll only fire once
right yea
ok, try setting the EQS query Sense to Sight. And in the AI debugger, press numpad 3 to show the EQS
and make the range something like 3000 just in case
should be working already tho given you have a TargetAnimal set
yeah so the EQS is doing fine, just your MoveTo is failing
can you show your updated tree?
is it reaching the Wait node in your sequence or getting stuck in the MoveTo?
the moveto isn't firing
oh?
it's going between the 2 waits
ok
yep
Need to figure out why it doesn't want to move tho. Go to Tools-> Debug -> Visual Logger , hit Start, then Play
click on the next bars
yeah that's what I meant
did you set your acceptance radius on the MoveTo task to 5000 by chance?
yeah
yeah that means stop anywhere within 5000 🙂
so try 50 or 100 max
I was gonna ask you about it earlier but I figured you left it as default 50
YES
OH YES\
😄
IT'S WORKING!!!
k, so what's a child of Hippo?
you are amazing, I'll give you credit the next time I do something AI related
there's an elephant and a rhino
yes, now it does
thanks a lot dude
now I need to figure out what I did
lol np
If i were to make an AI enemy patrolling using an array. Can I assign what patrol point each instance of the AI will take?
Sorry if this is hard to understand. I don't really know how to describe it
I just want a flexible way of haing each enemy have a certain patrol path they take
FYI your move to is called before the EQS service finishes. So you are doing a lot of redundant work with the waits, because you aren't accounting for it.
I don't understand. Do you mean to say that I don't need the wait nodes?
I mean that every time you hit the move to, the location is either stale or invalid. That's because your service finishes AFTER the move to has started.
I was gonna suggest adding a target set decorator to that sequence node
So it doesn’t advance to the MoveTo until it’s ready
But maybe shorten the right branch Wait node at that point so you don’t wait too long @timber stag
You want to use the EQS task. Then move to and a service on the move to to update the location.
Oh I didn’t realize there was a task 😬
That's how I always do my EQS stuff 😅
I'm trying to use the PathingGrid generator, but running into an issue where it should be generating EQS points, but it isn't. I attached my EQS query in my first image. If I put that query on the EQS testing pawn, no grid points are generated despite having a navmesh (and the pawn is touching the ground since I pressed End to snap it there); see the second image. However, if I move the pawn a little bit lower into the ground, the points are generated (third image).
This confuses me as I thought the projection settings I have, 1024 up and down, should reach the nav mesh. Am I missing something the generator is doing with collision / character capsule?
Wait - EnvQueryContext_Item isn't actually defined?? Am I looking at the wrong class?
@celest python While you're here - I'm not going crazy, right? 👆
Nope
UObject -> UEnvQueryContext -> UEnvQueryContext_Item is the inheritance chain
Well its utilized somewhere in the eqs framework but I cant see anything else either
best to ask mieszko when catch him around
It'd be funny if he just replies, "lol"
I haven’t seen him in here in a minute
xD
It may be utilized somewhere, but is it actually doing anything? 😅

