#gameplay-ai
1 messages · Page 5 of 1
i am just aware to use something in Every tick
is there a way to make move to player in a smooth way. i can use a Wait 5 seconds task. but it will make it not smooth
Your npc is flygin right?
How does AI perception work with a nav mesh that is only generated around invokers? I have added an invoker to the player and an AI npc. When the nav mesh areas generated by the two invokers are not connected, the AI npc does no react to sound events from the player. When the areas are connected, the npc does react
yes. gravity set to 0
You must add perception stimuli source component to player
Path finding is different for flying characters. You can search from internet
For example this video: https://youtu.be/IyJKrvy9afo
Support the channel through donations. Crypto accepted!
PayPal: https://paypal.me/reidschannel?locale.x=en_US
Patreon: https://www.patreon.com/reidschannel
Bitcoin: 1JFwWHr4X6uAeoZadukzqKjzFBj3Qjy7Sk
Ethereum: 0x2B2Bc108F1Cc0fF899959dEF3226637787d8C3dE
Dogecoin: DNQ33YnhpWoTBokBNVkZP5ub8KTLkpyjpv
Join our community discord!
Discord: https://dis...
thanks
You’re welcome
sorry, i misunderstood the question
Hello, I have prepared a setup to help you understand the problem better. I added an invoker to the Player and AI and triggered the sound with a report noise event from far and near. Got it on both occasions. It's not in the video, but then I tried it for different nav mesh fields and it still worked.
I also set the project settings as here. maybe you forgot? : https://docs.unrealengine.com/4.27/en-US/InteractiveExperiences/ArtificialIntelligence/NavigationSystem/UsingNavigationInvokers/
Perception has nothing to do with navigation, unless you made changes. Likely what is happening is that your chase behavior doesn't fire, because the AI can't reach the player.
Why are you using invokers? They are incredibly expensive and cause bugs like this. Navigation streaming works significantly better for large worlds.
No. I'm guessing that the box component regens the nav mesh as the agent moves, invalidates paths of nearby agents and does collision. There's a reason why that is not how avoidance is done.
yeah it's a shame because rvo and crowd following components have a lot of issues and i was trying to find a way to get some basic avoidance
People use invokers because there is much more information out there about using it and setting it up versus even knowing nav streaming exists. Let alone how to set it up.
That's unfortunate. If you do any level streaming, the nav data automatically streams with it.
Navigation streaming with world composition had some issues, but Epic had step by step instructions on UDN that should have been shared with the wider community. World partition fixes those issues though.
Instanced Structs doesnt show up on BT node instances... thanks Epic 
What are you trying to do?
I mean what do you need that for? https://xyproblem.info/
Asking about your attempted solution rather than your actual problem
I actually hadn't have a question was just venting to void but my AIs are spawned from pool by data assets and data assets has FInstancedStructs to determine behaviors of them. I wanted to have a decorator that checks if data asset has X type of instanced struct that equals to provided one from details tab
They need to be instanced structs because you want the array to contain different types of structs?
yep, with that way I can achieve modularism
each enemy can have any type of behavior
so I could have a single BT with HasDataStruct decorators on top of RunBehavior nodes
with only one single selector
Why not just a single RunBehaviorDynamic node where the subtree is taken from the data asset?
because enemies can have multiple behaviors too
like something can be both tank and a bull
first I thought of a procedural BT where I use arrays and data-driven simple system but I thought it'd be overkill
and probably too much boilerplate to write
but now actually thinking about it, to somehow support FInstancedStructs I still need to write some boilerplate so maybe I can consider that idea again
basically each data struct also will contain the BehaviorTree associated with the data and priority will be array order
I'll have some instanced UObjects as decorators
and do very simple BT logic maybe not even BT, will just check conditions and if any index lower than current index is true I'll just switch to that BT
this way I can even decide which behavior will be more prior 
why can't I open up this debugging tool in some levels? it works fine in testing maps but in more complex where AI spawn on dynamically streamed levels (via ULevelStreamingDynamic::LoadLevelInstance) it just won't open even though I'm standing right next to my bots and I can see in vislog that they are actually running
Thanks for the help, I made a mistake when testing this, it turned out to be a problem with navigation and not the perception itself
Thank you, I will look into navigation streaming, that sounds like a much better option
@celest python What I typically do is a dataasset with a TMap from GameplayTag to BehaviorTree asset. All AIs have the same top-level behavior tree with a bunch of RunBehaviorDynamic nodes in different places for different parts of the behavior. The data asset populates those from the TMap.
Has anybody used AI with world partition here? When the NPC is too far the controller disappears when I do an AI debug.
how can I get information about current navmesh in editor? like how many tiles does it have, etc
I do something similar, but it's a utility selection for which behavior subtree is run. I find it far easier to have the selection of subtree to be outside of the BT.
Are the AI that are disappearing in unloaded sections?
So you have a single selector + run behavior dynamic node and keep running a utility system to determine which BT to inject?
Do you remember how did this end up zoombapup? Been trying to test detour crowd since a week, I can say it just doesnt work 😅 I set different values to make pawns avoid each other but they always stick closer. I guess they only avoid each other when they face each other. RVO was making pawns slide horizontally without checking direction of other agents unlike crowd. So I might need to implement a flocking algorithm inside of the crowd manager
Never tried implementing one yet, but it looks so easy to do. Also it looks very cheap on cpu. Just not sure how it would work with crowd manager
Nope plus spatially loaded was off and I was chasing the npc. I had to turn on large world option in world settings. Another thing I notices was AI controller seems to disappear when the pawn is too far.
Exactly.
That sounds so cool, will refactor into something similar. Thanks
I would like to know more about this one.Plus how could I displace enemies that are standing?
I would override the end play function and print out the reason. Preferably to the visual logger.
Currently I was doing stuff on the significance manager and get AI controller seemed to be the one causing crashes too due to null pointers.
Anyways, the ai debug for the pawns literally said no AI controller but this changed when I got closer to the npc. Is that normal behavior?
Normally the pawn is responsible for the lifecycle of the controller. The pawn creates it during Initialize and removes it during unpossess. That depends on what your auto posses setting is.
How are you setting up the significance manager?
in the Nav Link Proxy, is it possibly to automatically copy the coordinates of the Simple Point to the Smart link?
depending on the version (i'm using 4.27) there should be a button that will copy it for you in the details panel
yeah, but thats not "automatically" that is manual
Misunderstood. Sorry. But that is beyond me then. I couldn't find any runtime stuff to copy it.
I register via actor comp and fire a delegate with a floatwhere I check for the values on the pawn in bp.
I change tick intervals according to distance there.
Same haha, finally they did it.
Just a minor thing from fortnite (assuming because fortnite ticket is attached)
Still it's something lol
With the Navigation System -> Supported Agents in project settings, I'm having some difficulty understanding how to set any actor to be a specific NavAgent.
It seems that the supported agents spawn get a NavData class spawned for them, and Links can filter what agents use them (which I guess affects what navmesh actor the link affects). But there's nothing for connecting a character to an agent. Are you just supposed to set the "Preferred Nav Data" in the CMC and that's it?
you are finishing your task with success = false. Finish it with success = true
where can i change it? I don't remember setting any boolean
In your FindPlayerLocation task. The last node "Finish Execute"
When an AI uses the navigation system, it tries to find the correct nav data for it based on the agent properties on the movement component. It will pick the one that best fits an agent, such as radius, height and so forth.
Is that on the pawn? Is the delegate on significance calculation or on significance update? Is significance working sequentially or concurrently?
coughs whaaaaaaaat
"GameplayBehaviors" 🤔
Do EQS Queries return items scored 0? (even if it filtered out others)
I guess math behind it allows that
Because I have a EQS Query that when it performs a search, it may filter out all but 1 item sometimes. and if there is only one item, then said item's score is always 0.00
I want to calculate a shortest path to any point within an area, rather than to one specific point.
For example, a unit in an RTS wants to cast an ability at a target that is somewhere on the other side of an unpathable chasm. If the ability has enough range to reach the target across the chasm, I want the unit to walk up to the edge of the chasm and cast across, rather than try to find a path to walk all the way around the chasm.
Is anyone aware of any existing solution for this, or would it require digging into recast/detour to write custom pathing functions?
There is a system called the environment query system (EQS) that would be much better than writing custom pathing functions. You want to know if there is a reachable point within X distance of the target and likely has line of sight as well.
sequentially. Concurrent crashes. Delegate on pawn calculation on actor comp. Delegate on post significance.
I would check to see if the AI controller exists in the functions without using a delegate. The significance manager multi threads the calls, so it might be causing problems.
I added a validation in the bp when I change the tickrate there
so this is in the significance function or post significance?
The significance function. I think it does it on post significance if it's set to concurrent, but not 100% on that
Concurrent just keeps crashing for me. Is it worth trying to use it? Sequential works. I could share my code for reference
I'm thinking about creating some AI entity that has to follow some path (just some connected points in space) that was already defined (you can think about it like an AI for TDs, but a bit more complicated), but it'll also be able to do something else depending on other entities (for example it may attack or move to some enemies if they're close enough and also reachable), but after they're done doing something apart from moving to the final destination it'll continue to follow the path from the closest point relatively to the current position (i.e. the entity can be agroed apart).
I thought that I should make these entities pawns, but the thing is that I have to implement my own movement component since there is none for pawns as far as I know, and it's one of the problems I'm facing atm.
Another problem is the definition of the path to follow - what instruments should I look at in order to achieve this? What the right way(s) of doing it?
Can someone give some advice, please?
there are various movement components you can use, flying/floating/vehicle etc, or just roll your own. They don't have to be as complex as the CMC
For the path, might want to look at the ZoneGraph, or roll your own with splines/waypoints
Yeah, I know that there're different types of movement, nevertheless atm I need only the regular walking, and maybe flying in future. I tried to search for different forum threads about this topic, and apparently people just advice using ACharacter for AI entities, so I'm trying to implement some stuff using it instead.
using a Character will get the basics working. Depends how many entities you want.
Since I'm creating a TD, a complex level may have hundreds entities at a time, is it a problem? Do you have any idea of how much performance I lose by using Character with its CMC instead of implementing my own pawn and movement component that just fits into my wills?
I have been making a basic boilerplate AI for my boss character. Using the Unreal Manny for the Skeletal Mesh and Using the ABP_Manny for the animation controller. My AI behavior works as I expect it to work but animations are not running and I am tired of troubleshooting this.
Can someone hop onto VC with me to help me with this?
If I set my pawn to fly instead of walk, the Simple move to Actor stops working.
Flying basically sets the gravity to zero and the same happens with walking if you set gravity to zero.
Dose this mean this is an AI bug if gravity is set to zero?
CMC can eat up a lot of frametime, certainly having hundreds running at once is going to be an issue. You can roll your own very basic one easily enough depending on what you need. The CMC has tons of stuff in it that you probably don't care about.
Any good reference to start from? I already tried to implement one by testing different stuff and reading the actual CMC code along the way, but I didn't manage it to work properly, the pawn did move, but it moved straight to the point dictated by the path finding algorithm, i.e. it would fly if the point wasn't on the same height level
So I have made a Spline Based path following system for my NPC and now I wanted this system to be behaviour tree based ? any suggestion where to begin ?
well, in a typical AI setup, you'll have a path follower that you give a path to, that will look at where the next point in the path is and send a steering vector towards that to the movement component as an input vector. In the movement component you take the input vector and work your velocity and movement based on that (and other things, like where the floor is).
So path follower is just something that commands the direction to follow, right? If so, doesn't path finder call RequestDirectMove on a movement component that inherits UNavMovementComponent automatically?
might want to start with a base from UPawnMovementComponent
Yeah, I did start from it
yeah, I can't remember what the standard path follower is called, think it's just UPathFollowingComponent
And I did manage to compute the velocity, the first problem I've faced though is that the entity can walk in the air
yeah look at UPathFollowingComponent::TickComponent to see how it feeds the movement component.
well you'll need to look at where the floor is (usually a line trace), and make sure it stays on the ground
btw after rewatching the CMC class implementation I saw that there is some function called SlideOnGround or something like that
So it may make the character move along the floor
the CMC includes a lot of extra stuff like jumping, crouching, walk, run etc that seem simple but all add many layers of complexity, which is why it's such a beast. If you just need something basic to follow a path and stay aligned with the ground, should be pretty simple.
uhh, I'll try to look more into that a bit later, and tell you what I got
Thanks though
What are the benefits of setting the MovementMode to MOVE_NavWalking instead of MOVE_Walking?
I used MOVE_Walking and had some MoveTo tasks in my tree and the character works fine
yea the engine disables collision for NavWalking characters, but I don't want collision to be disabled!
Concurrent really just means that you aren't waiting for all the significance functions to end before calling the post significance function.
I can take a look at the code and see if there's anything that looks fishy.
It's not a bug. When navigating, the AI controller projects the points on the nav mesh to determine if the AI can find a path. Failing to find a path is incredibly expensive, so this is used as an early out.
There are ways to make this work properly, but I'm not sure if it's available to BP. I believe there is also flying navigation plugins in the marketplace, but I don't know about the quality of them.
If you are going to have hundreds of AI at a time, you might want to look into using mass entity and mass AI instead. It's a new system for large amounts of AI. It's still experimental, but it's supposed to be production ready in 5.1
Oh, that's neat, thanks
Hi everyone, i want to ask for help, I want to have two navmeshes in my game and one box inside player's character, I want first navmesh to be affected by char, so that it cuts navigable area, but the second navmesh i want to ignore that box. Is it possible? The goal of that idea is to send first navmesh (that is affected by box) into GetRandomPointInNavigableRadius to get points in navigable radius but outside the box, and second navmesh(that is not affected) i would like to use for AI, so that they can walk inside box near character.
Okay. Don't use it then.
Regenerating navigation every time a character moves is incredibly expensive. Highly recommend using the Environment Query System (EQS) instead.
EQS will allow me to implement what i described?
It will get the behavior you want. Instead of using get random location, you can get a reasonable location.
I'm going to bed now will send in the morning. Is it ok if I dm you this. Character limit might hit fast considering 2 headers and cpps
Can the EQS be tuned to filter the resulting actors by tag?
I never worked with EQS. My goal is to spawn enemies outside of all players screens and not outside of navmesh and not inside of some static objects. If EQS allows that to be implemented easily then i'll learn it. So the question is will EQS help to implement it easily?
you could just return a context as an actor array and use the context as a filter
Do you want to avoid these actor locations or just consider something which does not have the tag?
I have a CTF game, with multiple flags. I want the AI to use EQS to find the nearest flag with a specific tag.
I have it already setup with a behavior task to find the flag.
You coukd do a get actors of class and only return actors which don't have the tag.
but maybe eqs is better?
Yes. The EQS generates things (locations or actors by default) and runs tests on them. Then sorts them by the tests.
I can right click the EQS composite and add a test, but its for Gameplay Tags not actor tags.
Maybe I can read an enum value directly from the actor found using EQS?
there is a controlled pawn in the function override. Use an interface so that it is not dependent on the class.
In the function override of what?
Do you know C++? Adding a new test is very easy.
eqs context.Its an object with a function you can define. You can returna vector array/actor array.
Very little lol
That's fine.
request sent
I've done some overrides with blueprints before, but when I click to browse to the EnvQueryContext_Querier it doesn't show where its coming from.
So where do I go so I can I override it?
I've never tried to use the context for filtering, so I'm not sure if that would work.
click the querier dropdown it should give a create new option
nah its just this
Just create a new bp look for eqs context
ah ha
now override the function needed
If that doesn't work, I can write a test for you. It'd take maybe 10min.
anytime. Might wanna switch to registering your points of interest in game mode (make an actor array variable) or something and query from there as get actoes of class/get actors of tag is costly if run often.
Your points may not change often and having the values cached would be helpful
Actors of class isn't that costly in a packaged game. In the editor it goes through all actors, but in a packaged game it uses the object TMap
oh? But wouldn't keeping a dedicated cache be cheaper still?
It runs once at the start for up to a max of 4 AI characters, then it runs again if they successfully captured a flag and begin to query for the next one.
So in other words it doesn't run that often because AI characters won't be capturing the flag all that often. I do however expect them to die much more frequently.
the function in my knowledge sear hes through all actors in the map for your actors which might be costier than necessary. @uneven cloud might know something I domt
Up to 4 times in the beginning of a match, then maybe once every 20-30 seconds after that.
Only if you want to query it not by class.
so storing and qeurying from a singleton still beats it right?
Oh, thanks for this info. That’s very helpful. I won’t waste my time on that then, I’ll find a work around. Thanks again 👌
The engine stores all objects by class in a TMap. It doesn't iterate through all objects to get you an array of actors of the same class. Unless you are in the editor.
Storing and querying from a singleton is cheaper is some cases and only marginally better in others.
I get how it's situational but say in case of Lyra where it uses get actors for eqs to a gun pickup, won't storing those points in a singleton be cheaper?
Just clearing out theory here. Normally, I would sphere trace in radius and get my objects of interest.
It depends. If you are storing it an an array by class, it wouldn't really make a difference.
If you can have any class be a pickup (usually via a component) then it would be cheaper, unless you used the object iterator on that component.
If you have a large world and store them in an octree, then it's significantly cheaper because of the spatial partitioning of the octree.
You got any docs on octrees and querying from them? I have heard people mentioning interactible objects are done in octrees.
I have never seen any documentation specific to UE. Epic has one as a built in data type, but it takes a bit to set up. I used the navigation system one as a guide to make a generic object octree. The smart objects also have one that is a lot easier to follow.
is there a way to make EQS run faster? what i mean is that it cancels the prompt if a new winner is selected?
because now it feels really janky, the AI moves to a winner and only when it has arrived it will move to the next winner
Are you running it as a task? If so, try running it as a service to update it.
@uneven cloud both give the same result i think
The task version does the search and then does the move to. The service does the search on an interval. So it's not going to give the same behavior.
is it possible to query the NavMesh to get a spline of the path from point A to B on the NavMesh?
You can get an array of the path points for a path from point A to point B.
Sent the code in DM. HMU anytime
I'm trying to understand the class, and so far as I understood the main functions I have to look for are SetMovementComponent and RequestMove, however the second one takes FAIMoveRequest and FNavPathSharedPtr as the arguments, but I have no clue where I can find the navigation path to initialize the shared ptr, do you know it by chance?
The path following component is triggered by the AI controller. I think the function is something along the lines of Request Move.
wdym the function? What function?
The function in the AI controller that requests a move from the path following component.
I would recommend using that, but if you don't want to for whatever reason you can look there to see how Epic does it.
@uneven cloud Uhh, I actually want an AI not to just go from point A to point B, but to go through some other points in between, in order to be able to define movement of an AI on a level, but I'm not even sure if I'm looking at the right thing atm
You asked how to get FNavPathSharedPtr and I directed you to where you can see how it's gotten.
Depending on what behavior you are actually looking for, it's likely not great to change how path following works and instead change how you are using it. If you are going from point A to B, but want to go to point C first you can easily do that by navigating to C then to B.
Gotcha, thanks, I'll try to just combine the MoveTo calls then
yeah just break it down into individual moves to each point you want to go to, that's all the path follower does.
I actually found out that when a new MoveTo is called, the speed is reset to 0, or something like that. I have two chained MoveTo calls without any frame-gap in between, but the AI speed goes from 600 (the max one) to 40 just after it reaches the first point, and starts going to the next one. Do you have any idea how to handle it?
well, you'll either need to wrangle the interactions with the move component a little so it doesn't stop at each waypoint (which the path follower does, use it for reference), or you could construct your own path and give it to the path follower to follow and let it take care of it
But how can I give a path to the path follower?
you need a FNavPathSharedPtr as @uneven cloud said. It's a shared ptr to an FNavigationPath. Then you can just add your path points to it.
And I need to just call MoveTo using it, right?
you'll be able to call UPathFollowingComponent::RequestMove
ah, yeah, thanks, I'll try it
or AAIController::RequestMove, which does the same
@floral mango I managed to request a move from C++, but now the problem is that the final interface in my behavior tree is different, with MoveTo nodes in it I had on success and on failed wires, but there is no such behavior with RequestMove, how should I handle it?
have a look at the BTTask MoveTo node to see how it handles it. You may want to duplicate that node and put your custom path follow behaviour in it
My ai needs to slow down a lot when moving through tight spaces like doors. Any way around this?
Or just generally around edges and corners
I'm trying to replicate it, but I'm struggling with passing the container containing the vectors, because as I understand blackboard can't just store a TArray because it doesn't derive from UObject, so how should I pass it there then? The only idea that I have is to wrap the vector in some uobject just for the sake of passing it in the blackboard
I don't know where you're getting your path from, but it doesn't **need **to go into a blackboard
It's in my AIController. If it shouldn't go in a blackboard, where should I put it instead?
hey, anyone could help me with this? for some reason I don't have nav mesh on my landscape
Only on 2 squares
I thought if MoveTo takes a place to move at, then I may give my BTT the path it has to follow
assuming you have created a task node like 'BTTask_FollowWaypoints', just handle it in code inside there
So I just need to retrieve it from the AIController the BTT has access to, right?
yeah, you can get the owner controller from the task
Ok, gotcha, thanks
Hey people! I had a question about the EQS system in unreal, which I've been working with a bit on some projects. And one issue that I've come across a few times now is they way I want to set up my enemy AI with the EQS system. So basically my question is about the runmode that EQS uses. Its an enum that holds 4 choices; single best, single from top 5%, single from top 25% and single from all results. I've wanted to modify this percent value for some different reasons, but I cant quite figure out how to make a custom enum for this thing. Has anyone else done it or know of any way really to change/modify it. Feels a bit wrong for me to have to set up the scoring and such around these set values instead of tweaking them for more precise results.
If you set "use acceleration for paths" to true on the movement component, this will no longer happen. It stops all movement unless it's using acceleration and deceleration.
Oh, good to know, thanks
you can also tweak one of the bools in CMC
there is a function determines if velocity should be snapped when new path received or not
that function is virtual but in base class it just checks a bool that I dont remember its name
That would be an engine source change.
The top 5% is the top 5% of the score. It's pretty easy to tweak the score to get good results from that.
You can also get all results.
That bool is called Use Acceleration For Paths.
oh yeah, it was bRequestedMoveUseAcceleration
How can I set default values for the RecastNavMesh that is automatically generated when you use Build Paths? I tried changing the values in Project Settings then deleting the RecastNavMesh and then Build Paths, but the newly generated RecastNavMesh has different values from what I set in Project Settings.
You set it in the project settings. However if you set them so it won't work for the default nav agent settings, the change won't fully take. You need to then set the nav agents in the project settings as well.
You do have to be careful about nav agent settings. If your AI has a capsule radius of 40, the agent settings have to have an agent radius greater than 40. You can override using the capsule in the character movement component's agent settings though.
Thanks, adding a Default agent in project settings and changing its values worked. Still not quite sure what this Default agent is though, how do I assign it to my AI?
The reason why this is is so you can have different nav meshes for different sizes of AI. If you have 3 different sizes of AI, say a small, medium and large, and you set it up properly they will be able to move in different ways across the level. So the large AI won't try to navigate to places it will get stuck at.
Epic hard coded a default one so navigation would work without having to set it up if they are using a normal human sized NPC.
There are agent settings in the character movement component. When the AI uses the navigation system, it finds the best fit agent data for it's settings.
I see, that makes sense now. Thanks!
You're welcome!
Just to note having multiple nav meshes does cost memory, so it's best to group them together. Small differences like a radius of 40 and a radius of 50 is not going to be noticable for the player in terms of what kind of geometry they can navigate around.
Is there a way to prevent AI-controlled pawns keep pushing player pawn while keeping the collision enabled?
I want to have a collision between AI pawn and player pawn, but just prevent AI pawn somehow end up pushing the player upon colliding...
How do I make an AI turn in place to align to an object? Like moving towards a bench aligning before sitting down?
How do the Data bindings in EQS work. I've just tried setting up a min distance binding as a query param, but it's unclear how I push values to that? I had assumed it would be in the BT: there's a "Query Config" that takes a param name, but it's disabled in the editor.
Untick then tick again the Query Template property. Then parametrized eqs properties can be set in BT node either directly or used from blackboard
Perfect, thanks! Am I right in thinking that if a BBKey is set it will use that, otherwise use whatever value I type in the value box?
I'm not sure whats going to happen in that case. Maybe the default value will be used, maybe backup manual value. You should test it
Alright, thanks for the help
In theory you could use bt task RotateToFaceBBEntry, but imo it works horribly. What I did - I had interactible actor providing transforms like which direction a character should face when starting interaction and where should the character be. Then I made a couple of custom tasks to interpolate npc location and rotation to those provided by the interactible actor and when those finished - start the actual "interaction" (montage)
I'm playing with sight component, and after an AI containing it kills a player, the AI stands at that point until his age time doesn't expire, is there some native workaround or I have to handle it myself?
When your player dies is it unregistering as a source? Do you have forget actors turned on?
How are you selecting a target? The perception only provides you with sensed targets.
If you mean that you don't set the BB key as a parameter, then yes it takes the value you enter.
Where can I find "forget actors" checkbox? I checked both sight and sense components, but I found none
That functionality exists in On Pawn Bumped in the character movement component. You can override how it works in C++.
It's a config change, so likely in the project settings.
oh, yeah, I found it, gonna check if it works
nope, it still doesn't
btw just to make it clear: when my player dies I set ignore on every channel on his capsule component, so the sight will not see it. To detect whether there are actors I use GetCurrentPerceivedActors preceded by a RequestStimuliListenerUpdate
You don't need to do call request stimuli listener update. That's a rather expensive call and only should be done when changing sense config or team.
The player should unregister as a stimulus source to the perception system when it dies. I would check to see if that is happening.
How does it have to unregister itself though? I thought it would be automatically undetected when it cannot be seen by the sight component
The perception component has currently sensed and known targets. Known targets are recently sensed and has not expired.
It really depends on how you are selecting a target from the perception.
Unregistering removes it from the known targets as well as the sensed targets.
But how do I do it?
It depends on how you are handling death. When it dies, it needs to unregister with the perception system. There is a function that is called something like Unregister Stimulus Source.
I prefer using the stimulus source component instead of auto register, so it can listen for a death delegate and handle it.
But if I'm gonna use AIPerceptionStimuliSource, will the sight component detect both capsule component and the stimuli source?
I turn off auto register pawns in the project settings.
The stimulus source only registers and unregisters it's owner actor to the perception system for the senses you want. Perception is not detecting it.
I can't find the auto register pawns in the project settings, is it called something else?
I'm not at my computer, so I had to Google it. The last comment should work: https://forums.unrealengine.com/t/how-to-make-a-pawn-stop-registering-with-ai-perception/368928/3
Hello, Is this still a valid solution? I’m having trouble getting it to work. I’ve added this flag to my DefaultEngine.ini file but all pawns are still being registered as sight sources. Thanks, Scott
Thank you very much, I'll try to make it work with stimuli sources instead
btw the source should be in the controller object, right?
The source can be on the character.
Is there a perfect object to put it in, or it depends on the context?
It depends. I prefer having it on the character. But I also have fixup for team affiliation checks to use the controller and not the pawn.
I don't remember if the perception system handles that. We use team affiliation for other things as well.
Gotcha, btw do you have something practical and open source in mind in order to see how other people implement such systems?
Or some material to learn from in general, except the official docs
GDC Vault has a lot of good content, some of it free. The Game AI Pro books are also free online. Unreal Fest has some good talks that are free. Epic does a lot of live streams and videos and they have a learning portal. Googling questions can also get good results.
Outside of that, I'm not the best person to ask. I've been working professionally in UE for over 10 years.
Check pinned links
there is a general "what kind of mindset you should have to build AI systems" video
from an ex-ubisoft developer worked on Far Cry series etc
explains how terrible was their experience back then and how it gotten better over the time by learning from mistakes
Thank you very much, I'll follow this content
@uneven cloud btw I finally made it working, thank you very much! I spent several hours today trying to make it work without the stimuli! It's such a shame that the official documentation about AI perception doesn't even mention the existence of these config parameters that changes so much
You're welcome! Happy to help.
From what Epic has said, they expected the community to do the documentation, but that hasn't worked out very well.
Yeah, it really didn't 😛
I've been working professionally in UE for over 10 years.
So how much you hate UE? 😛
I get annoyed about it sometimes, but working with proprietary engines is so much worse.
It's easier to deal with if you find something that works in a way that you wouldn't do to ask yourself "does this work for a multiplayer arena based shooter?"
Replication framework and reflection* stuff is most liked features among the people I've met that used in-house engines before
I worked at one major studio where only 1 person could add data for designer to use in the editor. If I wanted something exposed to them, it took 2 months and it was always wrong.
I lasted only about 6 months there, before going back to UE.
I wonder did they manage to ship something? 😅
For all UE's faults - it's one of the better ones out there. Let that sink in 🙃
Yeah I keep hearing horror stories from every other engine
I seriously wonder how some studios able to ship things
Even godot has some quirks.. what to say 😄
They've shipped many popular games on that engine, including the one I worked on.
Is it a bug that in pure blueprint, AIPerception Hearing works only if in "Detection by Affiliation" has "Detect Friendlies" checked?
For every other sense, "Detect Neutrals" work, except for hearing.. smh
Oh - it has "some" quirks alright 😛
Can I use EQS for AI to move to some PointOfInterest object? This PointOfInterest object would need to be found first, then set as a variable and EQS would find a path to this variable.
Because so far I wasn't able to find a way how to set up a variable that would be used by EQS.
Yes. You can create an EQS context for your point of interest object and then generate points around that context and do tests with it.
Ooo I see, thank you!
Hey guys, how do I know if a task has switched within a task? Basically I have a toggle for AI aiming that I enable in the ExecuteTask. However I have to disable aiming when the task switches. But OnTaskFinished and AbortTask is never called when the Aim task was switched. This is what I currently have:
EBTNodeResult::Type UBTTask_Aim::ExecuteTask(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory)
{
const AAIController* Controller = OwnerComp.GetAIOwner();
AShooterCharacter* AICharacter = Cast<AShooterCharacter>(Controller->GetPawn());
if (AICharacter)
{
AICharacter->StartAim();
}
UE_LOG(LogTemp, Warning, TEXT("Execute Task!"));
return Super::ExecuteTask(OwnerComp, NodeMemory);
}
void UBTTask_Aim::OnTaskFinished(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory, EBTNodeResult::Type TaskResult)
{
Super::OnTaskFinished(OwnerComp, NodeMemory, TaskResult);
const AAIController* Controller = OwnerComp.GetAIOwner();
AShooterCharacter* AICharacter = Cast<AShooterCharacter>(Controller->GetPawn());
if (AICharacter)
{
AICharacter->StopAim();
}
UE_LOG(LogTemp, Warning, TEXT("Finished Task!"));
}
You need to set a bool in the constructor for OnTaskFinished to be called. It's something like bNotifyOnFinished or some such thing
Related question. Is there a way to get OnTaskFinished in Blueprint?
Anyone else have an issue where AI don't move in UE5 Editor unless playing in PIE/Single Process?
Yes. You would need to make a child of the BTTask_BlueprintBase and add the functionality yourself. However if you know enough C++, I highly recommend not using BP for behavior tree nodes.
I now have a problem where Complete is getting called instantly and it's resetting my aim. I just want the aim to reset when any other sequence/selector is called
Do I have to create two task like StartAim and StopAim and add StopAim to every other Sequence/Selector or is there a better approach to resetting the aim state for the AI?
seems very convoluted. I guess i don't really understand how Behavior Tree is suppose to work when it comes to state management
So tasks can return immediately or they can do a thing, like move to a location, and return once it has finished or aborted.
However what it sounds like you actually want is a service. Services can work on an interval while executing the nodes below it AND/OR do something on entering that branch and exiting. OnBecomeRelevant and OnCeaseRelevant. Decorators can do that as well.
AI must be broken in UE5 for simulating servers
So a service would set the flags like "aiming" based on conditions?
Why does my AI keep moving to a wrong Z axis position? AI first finds random Point of Interest, then gets its location and radius in order for GetRandomPointInNavigableRadius to generate random location. Then I set this location as target location for Move To node. This target location always outputs correct position of point of interest on all axis (x,y,z). But AI sometimes just moves to a different Z axis position, meaning he will go to a different floor inside of a building to reach its destination.
I've been stuck with this for quite some time and I do not understand why is this happening, when target location isn't the actual location AI moves to..
Yes.
Because you are using GetRandomPointInNavigableRadius. It gives you a random point, not necessarily a reasonable one. A radius in 3d space includes Z.
If you want a reasonable one you should use the EQS.
Simple question really
if I have an AI, how would I make it look at another actor, that isn't eye level?
How would I make it look up (pitch) at another actor?
Setfocus, does not appear to shift the pitch, or at least while also moving to the actor?
Any help would be really appreciated :)
Humanoid character?
Sure yes
I don't want to tip the character over just have the control rotation apply pitch
You would go with IK and animations to rotate the arms to head towards target
for a shooter AI that is humanoid
No, no, no
I don't care about visually here
I literally just want to have it set the pitch
up
or down
just to the target
(Visually is already done with the control rotation)
override UpdateControlRotation
on AIController
call GetFocalPoint();
find rotation to it
apply desired rotation
by using FaceRotation on owner pawn
So override the C++
That does indeed sound easy
providing it works
I already tried overriding "SetControlRotation()" and it just ignored it 🤣
Wait
Actually
you might not even need to override
enable bUseControllerRotationPitch
or* bUseControllerRotationRoll
Is bOrientRotationToMovement in CMC enabled
Because:
NewControlRotation = (FocalPoint - MyPawn->GetPawnViewLocation()).Rotation();
it already uses a 3D direction to find a new control rotation but FaceRotation only rotates yaw
Is bUseControllerRotation enabled in CMC?
Yea it's not on, EG ❎
enable it
if doesnt work, debug
by both drawing lines to target rotation and seeing values on FaceRotation
because it works for me
Maybe it's this
if (NewControlRotation.Pitch != 0 && Cast<APawn>(GetFocusActor()) == nullptr)
{
NewControlRotation.Pitch = 0.f;
}```
Seems kinda dum...
I'll just override and remove that part perhaps that's the issue
I'm trying to get it to aim at an actor and not a pawn, so maybe that's why it won't pitch up
Hmm?
imagine not allowing rotating pitch to an actor in an engine that suppose to support every type of shooter game xD
UT Engine™️
Hopefully even if it's moving to it will now look up...
Because most games do look at separately from control rotation.
Why though?
It's usually driven by the animation team. Focus point is the center of the actor, when look at generally wants a specific socket.
You have so much more control that way. The AI can move in one direction and look at something else, with constraints.
If I remember correctly, the anim instance (base class for the anim BP) has functionality for it.
Ah, true
You also typically don't want the full body to rotate to look at. Usually just the upper body or just the head.
EQS indeed works like a charm, the only thing that scares me is the label "we do not recommend shipping projects with it" on unreal engine docs. 😅
The EQS has been "experimental" since at least 2015. It hasn't really changed since, except for a few small additions.
In UE5 they added a new generator for perception targets and I believe some new tests. A lot of games have shipped using it.
i never noticed but: whenever you create a blackboard it has SelfActor key. Is it populated automatically by possesed pawn? I'm using it and all works fine, but I realized that i actually never set it 😄
huh 😄
indeed it is
cool beans
Anyone know why a Behaviour Tree might get stuck on "Rotate to face BB entry"?
Checking "use controller desired rotation" on the enemy fixed it 👍
Actually no it didn't fix it 😄
This seems to have fixed it though
alr
so anybody know how to get a boolean value from a bt to a blueprint?
this is what ive come up with so far
but I have no idea what to put in for the Key Value
pls @ me
how do i fix something like this with navigation?
Drag from the pin and type in "make"... it should pop up "make literal name" or something like this, use that and fill in the BB key name into the field
Yeah I solved it literally minutes ago
heh :)
Thx though!
what is a good AI tutorial which doesn't have 30 minute long videos but short and condensed videos?
i know Ryan Laley's videos
but they aren't that good
are there any others?
what would you say is a good project to practice AI?
A stealth game? a zombie shooter game?
Depends
It might sound weird but I'm working on a arcade zombie shooter game with minimal AI but I ended up writing 10k lines of custom AI code
So in my opinion focusing on a single AI character rather than a whole "AI system" is the best practice
So a stealth game with single enemy AI that chasing player would be a cool practice imo
Anyone knows why would BlackboardComponent->GetValue return a null value even though it's actually not?
I've been trying to debug this for a few days, I'm pretty sure it's not null
even gameplaydebugger displays the actual value
but whenever I try to access, it's null
Have you initialized the blackboard key selector?
yep
TargetGoal.ResolveSelectedKey(*Asset.GetBlackboardAsset());
I'm debugging the source code to see if its actually returing a valid value or not but surprisingly VS debugger is not able to display all values
Cant see the FWeakObjectPtr value of RawData
But RawData is not null either, so I assume something happens during FWeakObjectPtr conversion
Oh wait.. finally managed to see what FWeakObjectPtr's value is. GetValueFromMemory<FWeakObjectPtr>(RawData) returns nullptr
Why though.. it doesnt make sense 
const bool bValidKey = BlackboardComponent->IsValidKey(TargetGoal.GetSelectedKeyID());
ensure(bValidKey);
const uint8* RawData = BlackboardComponent->GetKeyRawData(TargetGoal.GetSelectedKeyID());
ensure(RawData != nullptr);
I used ensure() to check if data is valid too, it doesnt break
Any idea how I could make sure AI avoids the road and only moves on the pavement. At the same time, Traffic AI makes sure cars move on the road.
Edit: Solved: You have to specify the ItemType in your generator's constructor
I'm trying to write a EnvironmentQueryGenerator and for some reason the EQS system refuses to use it, because it has a "broken template"
class PROJECT_API UGTAIEnvQueryGenerator_Cover : public UEnvQueryGenerator
{
GENERATED_BODY()
protected:
virtual FText GetDescriptionTitle() const override;
virtual FText GetDescriptionDetails() const override;
virtual void GenerateItems(FEnvQueryInstance& queryInstance) const override;
};```
it fails in the `UEnvQueryManager::CreateQueryInstance()` around line 909 `if (InstanceTemplate->Options.Num() == 0)`. It seems the "options" are the generators you drag off of the EQS Root and it's not recognising mine as vaid for some reason - If I replace my custom generator with a built-in one then it shows up there and runs the query
Log reads
``` LogEQS: Error: Trying to spawn a query with broken Template (generator:invalid itemType:MISSING): EQS_CoverTest_AllMatching, option 0
LogEQS: Warning: Error creating query instance for QueryTemplate: EQS_CoverTest - Owner: BP_EQSTestPawn_C_1```
I'm going to keep digging, but if anyone has been through this before and has insights, that would be helpful
Slightly more info. When I enter UEnvQueryManager::CreateQueryInstance(const UEnvQuery* Template, EEnvQueryRunMode::Type RunMode) the passed-in template has the correct option, but then the system tried to find an entry in the cache, and finds a broken one with no options and decides to use that
How can I set priority in case of overlaying nav modiifer volumes
Isn't it awesome BTNodes doesnt wrap texts by default 🥲
Typically you use nav areas and filters to alter how an AI navigates. You set the nav areas on the geo and AI use filters for navigation.
As far as I know, there is no built in system for handling overlapping modifiers.
Did you figure it out?
I discovered it's happening because of a race condition issue but so far it doesnt seem like related with my code
I ended up refactoring system directly to avoid wasting time
straight roads would have been no issue but roads curve in our game.
It's fine if there is no support but what can I do alternstively as nav modifier obstacle is also not preventing the NPCs from walking there.
can u guys give me a small summary on what blackboard and behavior tree are , thanks in advance
Are the roads objects that you can adjust the nav area with instead of using modifier volumes?
Blackboard is the memory and Behavior Tree is how the AI executes actions. I would watch the AI with Blueprints tutorial on Epic's learning hub for an overview of the AI systems.
nope pavement and roads are combined afaik and currently the art team uses it so worried about merge conflicts.
The other thing is I want some npcs to be able to mkve on the road. Like say a police npc can walk on the road but the civilians avoid it and only go there as last resort.
You can set the nav area on the mesh itself, if I remember correctly. Depending on how they are set up you can do some tweaking there.
With nav areas, you can do all kinds of functionality. There are a few built in ones, but you can also make your own. You adjust the cost of using that area as well as entering. So you can make the sidewalk be low cost and the street be higher cost.
Then you can use filtering, which can change how AIs use the nav area. You can change the costs or exclude areas completely.
I've created a UEnvQueryTest in cpp. I've assigned it to an eqs queryand eqs query behaviour tree node. My UEnvQueryTest_Custom::RunTest() is never hit, i've set a breakpoint. Is there anything obvious I could be missing?
With the debug visuals all locations are green with no scores, but shows the query is running
Apologies I had some part unhooked and figured it out
Why is navmesh being dumb here, and how to fix it?
there are no visible or invisible objects here
whats that thing floating above it
if you move it does the bad navmesh section move with it?
if so could be capsule height related
Do Behaviour Tree Services continue to tick (interval) throughout the lifetime of the BT? Or only if its section of the tree running?
Double check collisions using show collisions in the upper left corner of the viewport. Then if there still isn't anything there, delete the recast nav mesh and rebuild paths (build menu).
Services only tick when the section under it is running.
I restarted unreal, moved the objects a little and it was gone 0_o
Is there any way to tell my already-checked-for-runtime-generation navmesh to update? During a specific moment I want it to update faster than it is
@uneven cloud what do you use to plan your AI?
or do you just go for it in UE5 without preplanning anything?
I use Miro for planning and documentation.
@uneven cloud do you have a link?
@uneven cloud thanks
i don't think that is something i need to use as i am a single developer
it's nice for diagrams, I really like that it supports emojis which sounds silly but if you scale them up enough they function like modern cliparts
never heard of people using it for planning though... trello perhaps
In the constructor of the custom test, did you set ValidItemType?
I solved it, I actually had removed the test from the query at some point during debugging
How do I stop a nested behavior tree? I'm using Run Behavior Dynamic. I've tried all sorts of things like setting the dynamic null, restarting the brain component, forcing a fail response from child. It just keeps ticking
Yo does anyone has this ai series
Is there a way to force a behaviour tree to immediately fire a task or service, bypassing the general timer? Alternatively, to instantly and temporarily disable the behaviour tree for a few seconds?
The context is having the AI stagger/stunned from being damaged (should immediately stop any other behaviour)
My AI does not seemt to be getting culled despite not being in line of signt. I am facing the AI but there are boxes in front of the player. Stat AI still shows a lot of AI being rendered
You can add a decorator that will look at some bool value in your blackboard that will indicate whether your entity is stunned or not, and if so, the nodes that are executed under this decorator will immediately terminate themselfs
For some reason my AI is not moving.
I spawn 160 npcs with identical behaviors but some of thr npcs don't move.
Is there something I don't understand about BT's? Why BTT_Shoot task never starts? The focus task is completed with success, so why doesn't Shoot receive execute?
did you call FinishLatentTask
no, what's that?
a function to finish current task and let BT process execution logic
oh I'm so dumb, it's supposed to be a sequence, not a selector 🤡
it... still doesn't work?
how would I do that? I can't find it anywhere
inside of your BTTask graph
I can't find it in the right click menu, do I look for it somewhere else?
Is there any relevant function name starts with "finish"?
doesn't seem like it, I also searched all possible actions and still can't find it
Finish Execute
It might be due to the pathfinding stuff. Go to your project settings and then the navigation part. In there it has a max agents count or something like that. Change that.
What's the sensible way to set up initial values to a blackboard? My AIController doesn't have a valid blackboard component until after I have started my behaviour tree, which is too late
Maybe a root selector service
but wont work for dynamically running behavior trees
You could add that stuff manually if I recall correctly. Run Behavior Tree node creates a BT comp and BB comp if one doesn't already exist.
It looks like this is working. Telling it to Use Blackboard creates the component, so that seems to be the simplest way to get started, though I might look into some way of incorporating it into the tree itself at some point
Not sure if its the best way but I do this UObject driven
I have an UObject that has a reference to BB and I have a function SetupBlackboardKeys that I set values inside of it
each AIController has its own type of that Uobject to init blackboard
then I run behavior tree
but I'm going to move it to BT later on because I realized BB values must be behavior driven
BB values must be behavior driven
Is this for replication, or?
no, it's because I have a modular system that I only use a single AI class and init them with data assets, so I dont have the opportunity to get benefit of inheritance
and for example single AI can use multiple behavior types, like a zombie can be a Tank and Ranged at the same time, I had to decouple the BB and it's data from gameplayframework
Thank you!
how should I change the nav mesh at runtime?
I want to add some mechanics that will add or remove static actors
I'm checking rn, it should do the trick
that and you might probably need invokers
How can I apply a nav modifier area on a spline road. Nav modifiers volume only gives rectangular shapes
I would like to know more about the nav area thing
What would you like to know?
How could I have the nav modifier area on non rectangular surfaces. Nav modifier volumes are cubiods.
how could I apply nav modifiers on a curved road?
Cant the roadmesh itself define what nav-area it is?
Thars how i made my spline roads work atleast
I mean that area should have a different area type like how navmesh modifier
When using AI Prception Sight, how do i use the Sight Age? I want my AI to forget my player when the sight age is reached. Is there something that gets called when the AI looses it's sight target?
Every mesh can have a nav area set. You don't have to use nav modifiers.
I'm trying to decide whether to use Blueprints or Behavior Trees for an enemy AI I'm working on. The enemy should do different things every frame, depending on what state it's in (chase, patrol, etc. The usual stuff). What advantages would BT's have over Blueprints for something that's running every frame, constantly taking in information like desired movement location and stuff?
Far more performant, easier to follow and easier to debug.
Interesting, I hadn't heard that it was more performant. If so, that's great to know!
Hey I'm trying out smart objects, is this a bad idea. I'm also finding that in my level the smart object component attempts to register itself before USmartObjectSubsystem::SpawnMissingCollection . Is this a known issue / evident that I've set things up incorrectly? I'm not using world partion
yeah looks like components register before world subsystems begin play without world partion, but the other way around with world partition
oh okay so if you're not using level streaming and you're not using world partition to do the same, then there's an editor button to press . If your smart objects aren't working and you're following the docs try this button:
hmm seems like smart objects are only designed for static locations? I think perhaps these are not for me
Yeah they are still incredibly experimental right now. They don't work for moving objects, dynamically created objects or usable for the player in multiplayer. Supposedly, they will be production ready in 5.1
Oh good thing I never bothered with those then if they don't even work for the most basic of basic things like that...
Don't work for dynamically created objects ????? that's like why did you even include it in the release
well they probably need it for world partition and matrix where there's lots of things that ( guessing here ) can't all use eqs/perception at once in a mostly static ( benches ) world
i don't think i'll end up with enough actors to need a system focused around it
you could create a noise event with a damage tag and make the perception catch that
how?
ok thanks
I don't have the navigation option. Does this have to be done in BP?
this is done in the mesh viewer itself (if thats what its called)
Is it possible for the mesh to affect navigation but have no collision? I could create custom splines which can change the navmesh generation. I have a spline road and pavement and I want the road to have a higher pathfinding cost.
road is usually cheaper cost x)
Using spline and ISM's
(and some faulty logic)
Worked quite alright , for the proto that it was
(unrelated but noticed i could upload above 8MB, niiice )
Is there a way to temporarily interrupt a MoveTo? I'm trying to do a knock back when damanaged but the ai/pawn just powers through it and keeps moving like nothing happened
What does this mean?
Use the stop movement node
for pedestrains it has to be more expensive
Dont you just want a high transition cost
I could use a query filter to override
Exactly
I did the inverse. Everything was quite expensive. Then roads were cheaper, and had cheap transition cost, compared to moving back to off-road, which had a relatively high transition cost again
Different road qualities ment cheaper and cheaper etc
@potent bane did it work? It just stops movement, I hoped the pathfinding system would abort too
I didn't try it yet
👍
hey there, have you found an answer to this question?
Hi! does anyone know why my "Vector" variable is not being set?
I'm even trying to hard-code it to see it working
Is that "FindRandomLocation"? You need to set the Vector with the TargetLocation key in the Behaviour Tree. In the details window for FindRandomLocation.
Vector is set with "SelfActor" and not "TargetLocation"
Is that a theme or something?
Flat Nodes plugin, it's free.
Yeah, that is "FindRandomLocation" I'm not sure what you mean by set the vector, am i not doing it already?
I changed the name from "Vector" to "TargetLocation" to match the one on the blackboard
Inside your Behavior tree, click on the FindRandomLocation task. Then you can see the details of your FindRandomLocation task in the details window. There you can see the Variable that you created (Vector or renamed to TargetLocation). Set this variable with your TargetLocation blackboard key.
here?
it's set to "None" and i have no other option
oh got it, thanks!
btw, i'm just figuring out AI and my setup is local multiplayer do i need to take anything extra into account?
As far as i know, the AI Controller runs only on server, so it should be all the same, right?
You will need to replicate some things on the character, but that depends on what you doing. You do need to take into account that NPCs are server owned actors, so they can't use server and client RPCs.
Anyone play with state trees yet? I couldn't even figure out how to change the runtime parameter bags lol. They look really great tho I'm sad I can't use
Also wow that's the most complicated code I've ever seen for a state machine. Tree or not
People in #mass is more familiar with it
its meant to be used for general purpose things but I guess it has some bounds to #mass indirectly one way or another
I'm look forward to it in 5.1 but I guess I'll roll my own for now
I looked into it a bit, but going to wait until 5.1 because it's so incredibly rough right now.
Not a fan of the concept that they wrote a new AI system that can't use any of the other AI systems (like EQS) and is probably the most design unfriendly system I've ever seen. Which is actually saying a lot.
I never did actually, but in my tests I've never seen an issue so I'm guessing it's just an upgrade over regular pathfinding? There may be some issues around temporary obstacles and dynamic nav mesh regeneration but I've never experienced any problems with it
The difference with hierarchical pathfinding is that it uses the polys of the nav mesh instead of the nodes. It's faster because it can cover larger distances quicker.
The path is not going to be the "best one," because it has fewer options, but it's significantly faster. I use it all the time for HasPath, because the most expensive navigation quarries are ones that fail.
So I'm dealing with a pretty specific issue. AI characters seem to like taking the shortest path, which is fine, all well and good. But I have a character with a pretty large hitbox, but it still manages to get through areas I do not want it going. I'll send a screenshot of my navmesh.
You need to set up your agent data in the navigation settings for the different agent sizes.
Characters this big really should be going around this.
You can set up different agents?
This is news to me.
Yes. I would group them up such as small, medium and large, because it creates separate nav meshes for each type.
Is this in a different menu seperate from navmesh? Probably in project settings yeah?
Then when it tries to path, it finds the best fit for the agent settings in the character movement component.
Yes it's in the project settings. I think the navigation section at the bottom.
data layers section?
Theres two options here, Navigation Mesh and Navigation System.
I never remember which one it is. I just know it's the last option.
Yeah, doesn't seem to be the bottom one in UE5
Creating this it seems to have completely disabled any kind of movement, but hopefully I'll figure out these settings
Thanks for the help.
They haven't moved them. It in navigation settings -> agents (at the bottom) and adding to the supported agents array.
You need to make the agent data based off the agent settings in the movement component. By default the radius and height is based off the capsule. If you make the radius smaller than the capsule, they can't navigate.
Yeah I thought it might be that section.
Do the default settings of the recast navmesh get overridden then?
Yes.
Interesting, so I've created a new layer, set radius to 10, and my characters is also 10, but isn't moving.
New settings.
Got to make sure what I had working works before moving on to bigger agents.
It needs to be larger than the radius. So I'd make it 11.
ah, thanks.
Nope. Maybe I should explain my code here. When I click on one of my squares, the character is meant to move there, before setting up these layers, it works fine, but after creating it, it wont move at all. Are there any other settings that are super important here?
Or hold on, so character needs to be bigger than the agent radius?
Yaaay
That works. My hope is that my team thinks my AI setup is so bad I'm never allowed to do AI again.
Thanks for giving me the right directions @uneven cloud . Much appreciated! Not sure if there is some way I can credit you on here like an award but eh.
Happy to help. If you are ever curious how it finds the nav data for the agent properties, the function GetNavDataForProps in the navigation system is where to look.
Is there a way to know which AI sense was triggered? For example I want an enemy to react differently between hearing something and getting shot
Doesnt it provide sense info?
this is all the info that you can get from stimuli that I know of
it also has Tag value but I've no idea how to use it
iirc it's just empty
yeah it just says None
I assume you can assign something there bit I've no idea how
stimuli source has no option for that
Weird if theres no info about the sense by default tbh
huh there's a GetSenseClass function, I'll try playing with that
yea that must be what I'm looking for
Is that from the stimulus struct?
I don't believe that it's exposed to BP. It's a function on a struct, which can't be exposed to BP.
can I do something about it? I've never worked with the code in ue4
Do you know C++ at all? You could do it with a Blueprint library function.
yeah this right here works, but I got another problem now, ReportDamageEvent doesn't update target perception
nvm it does...?
did it ever happen to you when you do something the first time and it doesn't work, change it, doesn't work, change it back, and it suddenly works?
Usually when I'm burnt out or very sleepy
How can I pause a behavior tree? I want to be able to pause behavior on far off agents for optimization
lock resource
Me?
I only see an option via anim instance
braincomponent has resource lock interface too
Anything else I can do to optimize far off NPCs?
Wild, I never knew about that actually. My question is how do you decide which nav mesh each different type of agent uses?
Anyone also having the issue typing something to "add decorator" tab doesnt show anything
remind me pls is it possible to force nav mesh to be visible in game (be it PiE or standalone) for debugging purposes?
sadly, doesn't work. can it be due to my levels (including those with navmesh volumes) are loaded by ULevelStreamingDynamic::LoadLevelInstance? Also I can't open visual debug (the one that is opened by apostrophe) for my mobs that are spawned in these levels that are loaded in the runtime
This only checks if this specific stimulus is a specific type. Not if a specific sense is currently active or known. It will break down if the AI sees something and then a sound event comes in. The sound event will trigger this event, it will fail with sight sense regardless if the AI is still seeing it or not.
quick sanity question: when we abort a run behavior, does it keep the state of decorators etc?
if I have a cooldown that is 60s, and aborted after 30s, then run the behavior again after 30s would cooldown finish or would decorator wait another 30s
Seems that would depend on the implementation of the decorator 🤔
iirc decorator class functions are const
so I'm not crazy about its not saving the state
It will fire twice , won't it ? Once with the sight stimulus, and once for the hearing stimulus?
If the sense wasnt active it would trigger the stimuli update , would it 🤔
Sight is triggered when you first see the target and then when you don't actively see the target. Would have to test it to see if it fires again when the sight sense has expired. I know it doesn't trigger the OnPercetionUpdated when it expires, because I added that to my source.
Ah, ok. Havnt played to much around with it yet, remember it was a hasstle even to get the sound source correct with sneaking etc
Hard to evaluate the distance that a sound at a given strength can be heard
Yeah I don't use OnTargetUpdated at all. I just use OnPercetionUpdated and trigger an EQS query.
Is it possible to adjust the grid orientation in EQS queries? If I have my character on a tilted axis, can the EQS grid compensate for orientation of the "generate around" context?
Hopefully fairly simple question. I'm writing my own Move To task, since I need it to be in 3d and such. How can I make it so the task doesn't end until I reach the destination, and also slows down when near and stuff?
on a task you have 2 things for that:
- Receive execute AI
- OnTick
On receive you should do "Move to location/actor/ and set the "Execute finish" coming out of "success"/"failure" of that move
so the task keeps going while it's moving
and on "Tick" do all your validations (like adjust speed base on distance, if target is out of range, etc)
If someone has the website to copy/paste node graphs i can share you one
.
Hmmm, but if it executes finish then doesn't it move on? I want it to continue to tick until it's reached the target, unless I'm not understanding the OnTick event for Tasks
Trying to understand decorators in Behaviour trees and I'm kinda flummoxed. This should be the simplest set up: Testing a boolean Blackboard value. My understanding is that this should only allow the sequence to run if the value is set? But no combination of settings makes it have any effect on the execution of my tree. What am I missing?
probably you need a root selector
and under some conditions root level decorators are not accepted
It looks like if I add it to the first node on the sequence then it works
Let me try the root selector
That worked, thanks!
np 
New problem... How does one set some starting values in a Blackboard? I'm trying to have them exposed in the Pawn, so I can set them in the scene, then calling the AIController->Blackboard but it's not working
ah, right, I should have to specify "self"?
plug "self" node to there
yep
also ensure you call this after setting up BT
and BB
Thanks! 😄
My AI has BT entries to patrol the area (walled in navmesh test area) but it sits there doing nothing until I give it a literal nudge (physics). I'm currently shooting it (AddImpulse) to get it to start patrolling, but whilst amusing is not practical.
Any ideas?
Is the AI on the nav mesh? Is it failing to find a move to location? The visual logger is a really good tool to debug issues like this.
It's on the navmesh. Well floating above it (VerticalDeviationFromGroundCompensation set to 1000).
As I say it works fine after a nudge.
When I start, all the EQS points around the AI are blue. As soon as the pawn is hit by bullet (and knocked back) the EQS points are then green.
Expected Behavior:
The actor moves to the patrol point, idles for a few seconds, then goes to the next point
Actual Behavior:
the actor goes to the next point without any wait time
probably a dumb question, any idea how to fix this?
A selector proceeds to the next branch when the current fails. If your middle branch succeeds, the next one won't get triggered. Use Sequence instead of a selector if you want to trigger multiple actions in a sequence.
Hi. I'm trying to make system where AI tries to find point around player which is closest to AI, but at the same time try to slightly avoid other AIs. So that they do not overlap + it surrounds player slightly (priority is to go for the player with shortest straightest path).
I managed to get closest points from AI to Player, but it currently does not ignore other AIs and I'm not sure how to do it. Help would be appreciated as I have no idea how to combine these behaviors.
Use an overlap test @elfin hinge
@plucky sun I tried with custom overlap channel as well, didn't seem to work.
Were your points filtered out?
Make an EQC_OtherAICharacters and add another Distance test like this: Distance: to EQC_OtherAICharacters (at least 100)
No they were no
This should filter out locations that are too close to other AI characters
I'll try this out, tried something similar, but though that settings might have been wrong
Just make sure that the Querier itself is not included in EQC_OtherAICharacters
@brittle lynx It looks like that it did work! Thanks a lot. "at least 100" was the issue why it did not previously
I currently have this in my "pet" controller, when the pet sees the player, it will update the key for its blackboard, I want to also update the key for another "Master" blackboard as well, but i cant figure out how
There are several "Masters" but only some have "Pets", and the pets should only update the player key to their specific masters
The pets master is stored on the blackboard as well
What do you mean by another "master" blackboard as well?
i have 2 actors, a "Pet" and "Master" that use the same blackboard, when the pet sees a player it updates the blackboard for itself only, i want it to also update its master, but no other masters
You'll need to get the pet's master by getting the actor from the blackboard using Get Value As Object.
While you can directly set it by getting the master's blackboard, I highly recommend making a function or event so the master object can set it
Is dynamic nav mesh generation much more expensive rather than static if I actually don't have any movable actors that affect navmesh? I think I have a problem with nav mesh and level streaming that may be fixed by enabling dynamic generation but I'm not sure what is the cost of using the dynamic generation
i have this now, but its still not giving the master the player, im guessing its something to do with the "get blackboard" having target of self, but im not sure what to use there
You are setting the blackboard on the pet twice. You need to get the blackboard for the master.
What is the problem with navigation streaming? Dynamic regen is a rather expensive fix for a problem.
how can i do that? i thought get value as object was getting the master object, then i was updating the key with the next set
In your last screenshot you only have 2 set value as object.
You need to use get value as object to get the master actor. Then get it's controller. Then get it's blackboard.
oh ok, i was thinking something like that initially, i just had no idea what nodes would do that lol, thanks!
how do i get the controller from the the master object? im trying to use cast to MasterController, but it does not work
You need to cast it to at least a pawn and then use Get AI Controller.
For some reason on some streamed levels NPCs can't move over some medium size locations (approx 20 sq meters). Visual logger shows that either pathfinding eqs tests fail or some FImpl:: SomethingSomething fails. Debugging both pathfinding and MoveTo goes well deep down to navigation guts where the path is calculated at polygon level but debugging works horribly there so I can't figure out what's the problem. I was hoping that maybe turning on dynamic navigation generation could fix the problem but I'm still concerned about the performance. I'm loading the sublevels with ULevelStreamingDynamic::LoadLevelInstance
Thanks a lot! its working now!
can I have a run behavior node as a main task for a parallel node?
like the main task will be another sub-tree
Hey guys. I'm using behaviour tree for ia of my enemy. Is there a way to give one-time orders to the enemy from other actors?For example, once the player reaches a place and hits a box collision, an enemy spawns and an immediate order to move to a certain place is given. Once the place is reached, it acts by itself as normal trough the tree
One way would be to launch a separate behavior tree for this ai from your quest system and then make your ai somehow report about completion of the quest task, for example by making a specific task that sends the quest system a message with a gameplay tag. The quest system then can further decide what to do with the ai, e.g. switch it back to default behavior
Another way could be that you build your ai bt in a generic manner : make a task-evaluator that takes in some set of blackboard keys like where to go, what eqs to run, what actor to interact with and put this task into some core sequence, so that it runs after "completing" each generic subgoal. That task, however, should also communicate with some quest system so that it could set the provided bb keys appropriately
Is there some example of BT built this way available?
Never seen any. I'm just sharing my own experience here
I'll try to draft something on paper for you, maybe that could help you
Something like this
Wow than you so much for the effort!i'm storing this and using it as inspiration
Anyone familiar with the MiniMax Algorithm? For the life of me I can't figure out why mine don't work. It seems to be keeping the first move it runs across every time....the thing is I've fairly sure I have recreated the algorithm just like the example I seen from a Javascript version....
Here is the Log
LogBlueprintUserMessages: [GM_TicTacToe_C_1] Final Move: (0.0,1.0)
LogBlueprintUserMessages: [GM_TicTacToe_C_1] Player: Computer Move: (2,2) CurrentScore: 10 Depth: 0
LogBlueprintUserMessages: [GM_TicTacToe_C_1] Coords: (0,2) Score: 10
LogBlueprintUserMessages: [GM_TicTacToe_C_1] Move Over
LogBlueprintUserMessages: [GM_TicTacToe_C_1] Player: Computer Move: (0,2) CurrentScore: 10 Depth: 0
LogBlueprintUserMessages: [GM_TicTacToe_C_1] Coords: (2,2) Score: 10
LogBlueprintUserMessages: [GM_TicTacToe_C_1] Final Move: (0.0,2.0)
Blueprintue.com doesn't read Enumerators so all of those fields will have enumerator0 or whatever written in them....basically the Max sets the AI move, Calls MiniMax with the Player as Input and then sets the move back to Empty....the for loops check to see if the positions are empty. On Best Move it's Initialized as Minimizing Player with the Player as input. On the Check win it returns -10 if the Player Won, 10 if the Computer Won, and 0 if no one has won.
Best Move Function
https://blueprintue.com/blueprint/d1q6y66b/
MiniMax Algorithm
https://blueprintue.com/blueprint/-c57s-x7/
This one Checks for the Winner
https://blueprintue.com/blueprint/e08q5vo_/#comment-1463
I know it's a lot but if anyone has a clue I would be very grateful for any leads on this...I've been stuck on it for going on 4 days now and have rewritten the algorithm 3 times from scratch....
any tips on optimizing crowd ai? I reduce ticking components and turn the skeletal mesh completely off at far ranges. Navmesh walking is on. Capsule colliders are turned off too.
What else can I do?
What should be called after UAIPerceptionComponent::ConfigureSense() that has been called on object runtime (i.e. after all the initialization)?
If I don't use the function after the initialization at all, then perceptions work fine, but if I do, then it doesn't. I need to edit my senses over time, so I have to call it on runtime.
UpdateListener in the perception system.
How can I access the system? My class derives from AAIController
UAIPerceptionSystem::GetCurrent
Thanks, I found it. The problem still persists though.
So, if I don't configure the sense ever again after the initialization, then my actor that's implementing IAISightTargetInterface is constantly updated by the sense system, and its CanBeSeenFrom function gets called every time as well.
However if I do configure after initialization, the function gets called only once, and by using the AI debug thing, I see that the circle that's pointing the detection point doesn't move with the character, but stands at the first detection location.
My current code to change something on runtime is
SightConfig->SightRadius = Range;
PerceptionComponent->ConfigureSense(*SightConfig);
UAIPerceptionSystem *AiPerceptionSystem = UAIPerceptionSystem::GetCurrent(GetWorld());
if (IsValid(AiPerceptionSystem))
{
AiPerceptionSystem->UpdateListener(*PerceptionComponent);
}
Any ideas how to fix it?
I had to go look at the code. There is also RequestStimuliListenerUpdate() on the perception component that really just calls it on the system.
I would step through the code in the sight sense to make sure that it's getting updated.
Gotcha, though I still have to download the editor symbols for debugging. I'll tell you what I got later on. Thanks for the help 😄
blackboardbase is just a convenience
you certainly can do the access in the others too but blackboardbase just implements a bunch of functionality that's commonly used
you can have as many blackboard keys for your tasks as you want, there is no limit on that
just make a new property with the appropriate type
I figured it out....man, it took me 4 entire days and I ended up rebuilding the entire algorithm from scratch 4 times, once for every day...and spent the rest of the day trying to debug it.
Here are my scores for the Minmax algorithm. My Wins are on the left
Round 1 = 0:1
Round 2 = Tie
Round 3 = 0:2
Round 4 = 0:3
Round 5 = Tie
Round 6 = Tie
Round 7 = 1:4
Round 8 = Tie
It's not unbeatable, but I'm also limiting it to how many moves ahead it can look and there may still be a slight bug in it somewhere
anyone know how to separate a hearing stimulus from a sight stimulus?
With blueprints, how do you access the pawn that being is being controlled by the AIController? I read GetPawn should work, but that targets PlayerState… any ideas?
the tag
I found this to work. the tag only outputs none, I couldnt find a way to add a tag to a visual stimulus, but I know you can get a tag from a hearing stimulus
are there any performance losses in enabling "Generate navigation only around navigation invokers"? Should navmesh generation be dynamic in this case? In my case I need navigation to be generated only in some NPC areas in a relatively big world and I was thinking it could be good to make a spawner a navigation invoker but I'm not sure how expensive this feature is
Hi all I have made this NPC spawn system by it trigger on run the game so is there any way to make it area base trigger NPC spawn system
do I need to look into Foliage system or this area wise trigger system can be done on this BP ?
@uneven cloud Apparently the config initilization went wrong, I initilize config values with some other variables. I did it in the constructor, but by moving it to OnPosses() instead solved the issue.
The actual issue was that the config said that nothing has to be targetted, so it just didn't assign a new value to TimeUntilNextUpdate, and it had max float instead. That's why it didn't update.
I have a bit of a problem with AIs following players, I followed this method of setting it up:
https://docs.unrealengine.com/5.0/en-US/behavior-tree-in-unreal-engine---quick-start-guide/
Problem is if I have multiple AIs, they will lose line of sight if another AI gets in the way. How can I fix that?
I'll use the blackboardbase in cases where the functionality it has is useful, otherwise the regular one
Aha. I Initialize via a data asset during possession, so that makes sense I've never had a problem with it.
Invokers are the most expensive option, but it might be mitigated with a non moving object. I would definitely profile it.
For level streaming are you on UE4 or 5? Is it always some areas that navigation doesn't work or does it work sometimes and not other times?
ah, I solved this problem already. it wasn't an issue of level streaming or anything. i was digging in the wrong direction all that time
What do you mean by area based? You can have it triggered by anything you want. Commonly spawning is triggered by the player with a trigger volume.
Interesting. What ended up being the problem?
those sublevels i am loading are kinda islands in terms of shape, and those islands were rotated 180 degrees after loading the sublevel with navigation. alas, the navmesh didn't rotate with the level actors
my coworker reminded me that I can check out the navmesh in simulation mode and it was litteraly like navmesh wasn't rotated, i.e. pieces of navmesh floating in air and such
There's a function you can call with the stimulus to check type. Get Sense Class For Stimulus.
Hey would anybody be able to answer a basic question about Behavior Trees for me
For some reason, in my sequence, is constantly plays the task here and never gets to the selector. I dont understand why
so we actually ended up enabling dynamic navigation since we don't have any movable actors that affect navigation during gameplay because we really need an ability to rotate those islands at load time
Is the task finishing true?
Looks like it
Is anything beneath the selector gated by a decorator?
What is the variant that you are currently testing?
1, friendly roaming
Is the blackboard value what you expect? Is it going in the branch you expect? Is it failing on find player?
for some reason its not getting the correct values
Are you using a blackboard selector key to set the blackboard in the get variant task?
Overall though, that logic should work if everything is set up right?
You'll likely end up with a rather large tree, but yes it should work.
Hey can anyone explain why this EQ test has undesired behavior? My expectations that all items not on the island are filtered out. Left hand side: (correct) When using Filter & Score I get the expected results. Right hand side: (incorrect) When using just Filter I get unexpected results. There is only one test and no other differences between the two other than filterscore mode, and I'd prefer to just filter and not score.
For performance reasons filter only doesn't run on all of the items in the last test if your run mode isn't return all.
ahhh
It only filters out until it finds the best result. They are sorted by score and then starts filtering.
i thought filtering happens first so that scoring is optimized?
It's been a long time since I've dug into it, but it auto sorts the tests based on expected cost. If you have a high cost filter only, it will be sorted last so that it can early out.
okay thanks for the info i'll do some more investigating
okay yeah if I put it as first test filter only, and then a scorer below it I get expected results
thanks again
i just gotta say env queries are sick
You just haven't used them enough to run into the frustrating weird design decisions that prevent various usecases which seem very common
I mean EQS is still good but it has a bunch of weird things about it that you sometimes have to work around :P
yes 
does anyone know any good websites like hackerrank to do some ai stuff like they have here? I've recently started doing it for fun but I'm wondering if there is anything better and/or prettier and/or interesting
How are AI in NPC and enemy usually implemented in 2D games?
I'm thinking about making the NPC and enemy have different 'lane' they can move to. So they will not collide with each other.
But some of the task in behavior tree feels more catered towards 3D implementation
Like the task 'move to' will account the 'Y' axis too, and will make the sprite rotated which normally not something that 2D games expect the character to do right?
There's a bool you can set to true to make them instanced
Forget what it's called but I recall it had some comment which made it clear'ish - and you can check how the builtins are implemented, some of them muck with the properties
I forget what the specifics were but even non-instanced nodes are kind of instanced, but there was some bit where it worked a little differently
You can set it to be instanced in the constructor, but you'll lose the perf gains from not instancing every node of the tree for every character.
BT nodes have node memory which you can use to save data. You can look at the built in move to task to see how it works.
this might be sort of a noob question, but I have these zombies and I want them to chase the player or other pawns, search the last known position and then roam around again if unsuccessful. If they walk in front of one another, the one in the back loses visibility and goes searching, is it possible for them to just ignore each other entirely? I cant seem to find a good solution for this lol.
the yellow capsule is them updating the last known position when they lose sight
that is what I meant, so let say I have trigger volume of 15 meter radius and since player is not in that area so no NPC will be spawned in that trigger volume so as soon as the players enter the trigger area the NPC should populate in that area.
hope this made sense 🙂
Yeah you can bind to the overlap events to spawn and despawn when the player enters and exits.
Sight sense uses visibility channel and you could turn that off for your zombies, but that will have unintended consequences. The senses also have a max age where you can set it to remember recently seen actors so they don't lose interest so quickly.
okay bossman will try this
HI! Im looking into making a vampire survivor kind of a game. This means TONS of enemies (1000 is my goal). My first thought was that i should drop the idea of using acutal AI, and just develop my own simple movement component, so i did that, and used the Move component to blueprint. After this I've tried learning the profiling systems, and found out that the movement component was the biggest hurdle to my performance. So actually i found the best solution was to use the "projectile movement" instead. This seems super light, and has helped performance alot! I am doing around 400-500 enemies without going below "unplayable" fps, but i still feel like im far from a 1000.
Any tips on how to achieve a 1000 enemies or more? I've looked a little into MASS, but im only working in blueprints and the documentation on MASS is very hard for me to understand and use.
You can kind of see how it functions now here: https://www.twitch.tv/videos/1608903434
@uneven cloud should this overlap event should be before or after in this blueprint
It's instead of using begin play.
okay
You might want to look at using nigra for simulating crowds. From the looks of it you aren't trying to get complex behavior, so it should be enough. Epic did a video on it a while back.
Unfortunately Mass requires in depth understanding of C++.
Hmm alright. Whenever i was trying to look for "niagra as enemies" content i couldn't really find anything that did what i wanted. But i guess i need to dig deeper. Any references you can point me towards on the top of our mind?
Displaying thousands of characters on-screen in real-time has always been a challenge - until now. Unreal Engine's Niagara visual effects system opens up doors to go far beyond what was previously thought possible and this presentation by Epic's Joseph Azzam showcases how you can utilize the power and versatility of Niagara to create massive cro...
I've watched that entire video 😄 But i guess ill try again. I might understand it better now. I just felt like it was alot of "presentation" and not alot of "tutorial". But ill give it my best. Thanks alot @uneven cloud
that's exactly what it was haha. I wouldn't use that video for learning purpose
Any ideas of learning puposes? 😬
need help
Just ask your question.
Also, does anyone know why my move to player isn't working in my behavior tree? I'm not quite sure how to go about this.
Actually ignore me
Maybe putting it on the correct branch output would help 🤣
hey i i m making swimming animals but only on surface
how i can generate path point on this swimming surface
when this surface is overlaping pwans
Can i increase distance to generate path point from pawn when he is flying?
because when my pawn is above 2-3 meters he is not finding paths points
I think you'll struggle with that amount and pure bp, if 1000 somehow can be visible (and thus 100% active) at the same time
you cant have inheritance by assets but you can use Run Behavior Dynamic node
with injection tag
Welp, this is going to be the thing that kills me I guess
Someone explain why that is failing , I'm right next to the target
Probably due to the nav mesh making it impossible to reach the target location.
Is there a function that returns the closest point on a NavMesh to a given Location?
I'm having trouble with the AI not being constrained to a plane. I have it checked in the pawn but it moves all around and doesn't stick to a single axis. is there anyway I can constrain the AI?
Use the visual logger to debug it.
Not really. Project location onto navigation can do an OK job, but it can do some unexpected behavior. Using the EQS can give you a lot more control.
Are you level streaming the map?
You can use level streaming for navigation.
I have never not used level streaming for the server in a multiplayer game. If there are no players in an area, it should get unloaded.
Navigation data has a memory cost as well.
I don't fully simulate bots in areas the players aren't around, because it's a waste of cycles. Games are smoke and mirrors and there are cheap ways to approximate things.
It entirely depends on your game, your target hardware and the density of your map.
I don't know of any tutorials, but it's not terribly complicated. However world composition is a bit more frustrating to work with than world partition.
-
Place a nav mesh bounds volume in your persistent level. It doesn't even have to touch any of the world, it just needs to exist.
-
You can either make your bounds volume in the persistent level cover the entire map or put them in your sub levels.
-
With the persistent level set as current, build navigation. The nav data will be saved to your sub level and the recast actor in the persistent level.
-
If navigation builds when you have a different level selected, delete the recast actors and repeat #3. If you turn off auto regen in the project settings, this will happen less often.
With world partition, you don't have to worry about what level is selected. The nav mesh is cut up the same way that the world is.
Is the Run Behavior Node broken in UE 5.0.3? Once control flow enters the sub tree I can't seem to get it back out and the subtree itself was just a refactor of a previous set of nodes that worked, did not alter anything
tried using the visual AI debugging tools and it seems to just hang on move-to tasks that wouldn't normally hang, and I have all flow routes setup so that it should properly finish execute if anything goes wrong or after a set amount of time
yeah I think if you can't figure out Niagara you'll want to learn C++ to work with mass or build a custom system yourself. People have also achieved 1000+ AI before by also implementing custom optimization systems if you don't need all of the AI to be on screen (doing things like disabling the AI and not rendering when not in view of the camera or when a certain distance away.
Glass Beaver has also achieved like millions of AI onscreen before, but he developed a custom GPU rendering system for it
It's all pretty hard tho. Have tried myself to get hundreds of AI in a game, and there's really no easy way, you just kinda gotta get down and dirty and learn how to correctly profile
show your setup
(Gotta love it when the process of going to type in my question helps me figure out the answer 😛 )
Hi guys, do you know why this is happening, i'm not understanding how to fix this. In testing map the AI works fine walking inside navmesh, but in another map, the navmesh appears to push AI away from the ground. This second map is a world partitioned map.
You want to look at collision view. The nav mesh isn't an actual mesh that can push AI up like that.
I would do a vampire survivor type of thing data oriented with a subsystem moving everyhing in the world in a tight loop
I already made one for projectiles and it can handle like 10k projectiles in flight no problem
Struct Projectile
blah
blahblah
ProjectileSubsystem
For each Projectile in ProjectileArray
Projectile.Velocity = whatever
Line trace
Projectile.Position = whatever
etc etc
Something like that. Do the data transformation in a tight loop instead of haveing a million ticking things.
Ooooh. Okay. I wish I had a better understanding of that. Hmmm 🤔.
To use stuff like "velocity" it would need to be simulating physics yes?
I don't know much about line traces but could look into learning that stuff 👍.
To "not have a million ticking things" would that mean to go in and disable ticking on those projectile objects ? 🤔
No, velocity is just a vector in the Projectile struct.
What I'm talking about is instead of doing this:
Thing1.Tick -> DoStuff
Thing2.Tick -> DoStuff
Thing3.Tick -> DoStuff
You instead do:
Subsystem.Tick -> ForEachThing -> DoStuff.
If this is your first project and you're new to programming probably don't start with trying to do thousands of entities running around.
Sort of like an ECS framework.
Aaah okay. Would that be possible to do in blueprints ? Or is that most likely a c++ thing @vast relic ? ☺️
C++ for sure. BP is like 100x slower, you need c++ for big perf stuff
Alright. Thank you for all the info ☺️
When moving an ai to an actor via move to location or actor / move to actor / simple moveto, does it not fire a finished event when the target is reached within the acceptable radius? Not using a tree, just using BP directly in the controller.
Works fine with a vector location, but the ai seems to continuously try to reach an actor if its specified, and never stops
Thanks for reply...I tried some things and uncheck "Generate Overlap Events" on AI solves the issue...
Mass entity is already a built in ECS.
Yeah but starting with that is probably a bad idea if you have to ask about doing it in BP
It's simple enough to have a structure representing projectiles/entities and updating a few k of them in a tight loop in a Subsystem.
Subsystems aren't available in BP. Reinventing the wheel is even less of a good idea. Mass has it's issues, but there is a lot of built-in functionality.
I agree with Adriel here. Doing a subsystem with a loop is more than sufficient for what they were asking for. No need to over-complicate things and confuse potential beginners.
what is a good way to implement Movement similar to StarCraft 2 in Unreal engine ? any material or anything is really appreciated
A random loop wont solve any problem though, it needs to be ordered and if entity count is huge, logic needs to be seperated into smaller composites so instructions and data would fit in smaller CPU cache
Even mass is barely able to handle 2k from what can I see in demonstrations
a regular loop doing random calls wont help on its own
never played starcraft 2, is that some sort of flying movement?
@fair plaza it likely never reached the acceptable radius
I've attempted cranking up the acceptable radius by a hundred at a time to test, unfortunately it never fires off as succeeded / finished
That was my thinking at first, as well
Interesting, and you're using stop on overlap as well? I don't think I've had this problem.
Aye, I am. Yeah it's a strange one, I don't ever remember this being an issue. I'll double-check my logic if it isn't a known bug or intended to be this way, then maybe submit a bug report if I can replicate it in a separate project.
RTS Movement and collision avoidance in General
RTS Units gets stuck together, ue4 avoidance is working but it is not the best
Do smart objects require us to make our own MoveToSmartObject task? When I use the built in FindAndUseSmartObject my AI just slides to the smart object instead of using its walking animation
and here is the sub behavior tree
it should be equivalent to what is currently connected under here:
so my question now is, is run behavior (containing execution flow X) equivalent to just actually connecting execution flow X
execution flow X being any execution you can connect
hello there, how can I get an AI follow a path with limited turn rate, kinda like a car?
also please ping me in case you reply to my question
Does any move to trigger your walking animation? The smart object task just triggers a regular move to.
How is your walking animation triggered?
Because it's not a regular event. It's a delegate where multiple things can listen to it.
Are you using a character with the character movement component?
Essentially you need to clamp the rotation that happens with control rotation, which can be done with some settings changed in the character movement component.
Sorry, i'm not that advance in understanding Unreal. But let's say i have a blueprint animal, which has a child dog. The animal could use perception to 'see' human. Do i need to re-do that in the dog blueprint if i want to recognize a particular human?
that could work, I will try and come back if I encounter any issues. thanks.
You could create an event that is called when perception updated and overriden by the children.
You need to turn off control rotation in the character, turn on use control rotation in the character movement component and adjust the rotation rate. The character version snaps to the rotation, but the movement component can be adjusted.
it should be the same yeah, but can't say for certain 🤔
i did aldready have that in the parent
but it doesnt let me call the parent event on the child
You need to create a new event. Then call that when On Target Perception Updated triggers.
Create a custom event
Okaay! Thank you
Good callout, I wasnt playing the movement animations
Well RTS in general not a suitable genre for Unreal Engine, you'll have more problems like rendering characters and optimizing the framework
Not really true. The default GameFramework classes for characters etc are no good for an RTS (because of it's FPS roots), but the engine is eminently capable of powering an RTS, you'll just have to roll your own for some bits.
biggest problem is rendering, rest can be solved with moderate difficulty
of course unit count matters
good luck reaching 1k units without years old engineering
I have several thousand NPCs running in editor at the moment, and this isn't even an RTS 😛
do you render them all?
and do they run their AI logic while moving and updating animations etc
Yes. Like I said, not using the main GameFramework classes, making extensive use of Mass etc.
It's fine, I'm working on a arcade twin-stick shooter (without mass), I'm trying to reach 50 enemy characters + 4 player characters, they are all running animation and being rendered in the camera, I was barely able to reach 60fps on a GTX1050
I think animation part is going to be solved with animation sharing plugin but rendering is still my main bottleneck
you have to remember that ACharacter and associated stuff was originally designed for small arena shooters, and was never really meant to scale. You do need to get more creative to have a lot of complex characters.
But that's just a limitation of the basic GameFramework, not the engine
Yep, so far switching to navigation movement mode and aggregating it's tick helped a lot, though I wanted to roll my own networked movement component too but adding root motion support was too difficult
And I couldnt find anyone did it before too, so I gave up and decided to continue with CMC
What did go wrong? The Behavior Tree Debugger doesn't highlight any Decorator that it failed or something 😫
hmm, I remember this happened to me too, but cant remember how I solved
:/
at worst case you might try removing saved folders but it would purge everything u saved so far
because I assume this is related with some cache issue
I backup my saved folder and if it doesn't work, I just put it back. Let's see 👀
didn't help :/ But thanks for the suggestion Eren
I re added the Decorator and that seemed to solve it for me 👍
Edit: nvm 🥹
What's that?
Hopefully quick question. I'm doing a sphere-trace from a Task, and I have "Ignore Self" turned on, but it's still triggering. Does it only work if the function is called in the objects' Blueprint?
it has a hidden pin you cant see named "worldcontextobject"
its hidden in BPs
UE sets it to current graph's owner object behind the scenes
if you are calling it in a task, it will use the task as "worldcontextobject" and try to ignore it
so you have to use the array
IgnoreActors one
and plug ur owner character ai
how do I prevent an AI controlled character from strafing?
disable bCanStrafe on movement task and set orient rotation to move to true in character movment component
Is there a way to get navigable radius with some parameter? Let's say I want a navigable point that Y coordinates is 100
You might also want to look into using the animation budgeter. It saves a lot of perf.
Anim sharing plugin is great. It's how I got like 400 animated characters on screen.
Does anyone have more information on the new "State Tree" in 5.1? How's it different/better than a Behavior tree?
thanks for the suggestion! i'll take a look
you can think statetree as selector(s) on top of a state machine system
its introduced with 5.0, so not new with 5.1
Thanks
Trying to decide if it'd suit my needs better than a Behavior Tree. Hard to know what sort of things should go where
yeah state tree is definitely not suitable for actual development right now
but i assume for small things like day/night cycle (as mentioned in docs) it can be used
since scope is small
this old pin links to a youtube playlist that had its videos set to hidden, only one titled "Channel Update" remains.
Holy necro dude. That thing is like 4 years old, lol

