#gameplay-ai
1 messages · Page 42 of 1
just in the AIC blueprint?
Just coming back to this, check out the screenshot. Why is the move to task marked as Priority 0, and the decorator as priority 1? This would explain why if the selector fails, it wouldn't affect the move to task
Ah never mind, it seemed to just be a visual bug that got fixed by deleting and readding the move to task
guys can i spawn AI with an eqs??? afaik we can spawn mass entiies with it
- Run EQS to find a spawn location
- Get the selected location and spawn the AI
EQS itself doesn't do the spawning logic. Just the logic to find a place.
is the Epic AI dev course still largely up to date?
gonna start trying to code first enemies
Don't know - but Luthage recommends it and that's good enough for me to recommend it as well
everything I read about navmeshes is largely related to 2D planes; does anyone have exp with 3D movement in a zero-g sense? Picturing defending a sphere that you are walking on mario galaxy style from space invaders
and how the AI navigates/pathfinds
Navmesh is for walking on ground
If you need 3D you need to come up with some other solution
For the 3d navmesh, there is one on marketplace, something like DOT navigation,
Haven't used it but you can tree it...it's free
I think when we use any ai move node, AI does turn in the direction it's moving 🤔
weird, thats how it apperared to be in the videos i watched, but for me thats not the case im pretty sure
Can you share a video of that ?
alright
maybe it was a bit more than that
but here
@terse panther
I got a bit confused for a moment
and yeah I know the move node is unhooked, and that AI move is in a bp task named find navigable location, it was basically me trying to fix it yesterday and forgot about it
It doesn't cover the new systems (Mass, state tree and smart objects), but those are still under development. What it does give is a solid foundation with some AI theory, which helps no matter what system you decide to use.
You need to turn on Use Control Rotation, either on the character or the character movement component. I prefer the latter, but either works.
You are also ending the BT task before the movement has completed which is going to cause bugs and perf issues.
Hi all, I'm just getting started using State Trees for my AI, maybe I'm not fully understanding the concept, but why is it that each of my states gets run on every tick? Why doesn't the tree wait for each state to 'succeed' before moving to the next one? Is there a way I can make the tree function that way?
Can you give a more specific example? States definitely will wait for a task to finish before moving onto the next one
Maybe I have mine configured incorrectly then. It's a very simple finf player - go to player - wait a couple of seconds - then repeat
find actor
move to actor
o, wait, does that succeed the whole tree, including children?
Yeah if the Find Actor task returns success, it means the task is complete, which in turn causes the state to trigger its success transition
aaahhh ok
if you don't call finish task at all that should keep it in the running state, meaning it won't exit
amazing, you spotted the issue immediately! That fixed it, was at a dead end last night 👍 Thank you.
works fine now
Yeah I spent a while trying to figure these same issues out as well lol
so is it universally true that only leaf states should have succeed states? Or are there cases for branch / parents to have succeeds? @misty wharf
Hmm
I don't know of any examples off the top of my head, but I could imagine there could be some reason to use it on a parent too
Like maybe in certain conditions you want to be able to skip the leaf or something
I see, I guess I'll just go and experiment, but sounds like in general use only leaves have succeeds, that's good to know
I find it generally is as I suggested on the page I linked - you usually have tasks that either get data or do actions and the ones which do actions generally want to success/fail, while the data getting ones don't
At least so far that has seemed like a decent rule of thumb
gotcha
Shame. This note stuff should be in your profile bio
I almost never read anyone's profile so I didn't think of that but I'll put it there
can one put custom curves in eqs tests?
how do i make my player not register as a stimuli source for the npcs?
Most likely you have to turn off automatic registration of pawns as a source https://zomgmoz.tv/unreal/AI-Perception/AISense-Sight#turning-off-pawn-autoregistration
doesnt seem to work
Still being sensed? With AISense_Sight?
yup
You don't have a stimuli source component on your player I hope?
I don't
Hmm
added these lines
Try changing it so it just says AIModule.AISense instead of AISense_Whatever
nope doesnt work
someone said here its deprecratedhttps://forums.unrealengine.com/t/how-to-make-a-pawn-stop-registering-with-ai-perception/368928/5
Really, that would be weird... maybe try also adding bWantsNewPawnNotification=false
same, no change
What abotu if you put it into DefaultEngine.ini?
(with the original way you had it, with AISense_Sight)
That's peculiar 🤔 I don't see any reason why they would deprecate that
And yeah if you manually call that function that definitely should do it
I've got 200 zombies
and this is the node I use to have them move
but the zombies will get stuck on each other
is there a way to make them avoid walking into other pawns?
You can try adjusting the avoidance settings in the character movement controller, or try using the crowd avoidance system
you mean this?
Yes
Did you check the box that says Use RVOAvoidance?
it's as if their collision capsules are bigger
well now it's turned off
but I tested it already
Yeah try using the crowd avoidance system then and see if that works better. It might not be a perfect solution either if your NPC's are trying to converge to the same point
this happens with rvo
they all got different location targets
lemme try crowd avoidance
btw I just tested it and it seems to work just fine for me but it required a restart
in DefaultGame.ini with AISense_Sight
did it not work without the restart?
Nope
np
ohhhhh I see, well look I am just going to do it using th behaviour tree anyways
bro tysm
my casts keep failing
despite the AI clearly outputting my character through updated characters
am I missing something obvious?
they use to work fine
I would suggest using on target perception instead so you don't need the loop
Either way, the cast should work if the class is correct
the issue seems to be that it can't see the correct class when I use the cast
i'll have to just try a different way
this was a way I saw in a tutorial a while ago, the one i'm following now uses the way you suggested
I just don't understand how perception works and why this is failing now when it use to work fine
For me, onTargetPerceptionUpdated wasn’t firing reliably so I ended up using EQS and a built-in generator
interesting
well i'll try some of the other tutorials i've seen
i'm new to using AI so tbh i'm in the dark on what is good or not
Do some people just ignore the built in unreal perception and AI stuff and just make their own in code?
I want to learn the unreal way first either way
No, AI perception is the right thing to use, I was talking specifically about those binds like onTargetPerceptionUpdated
ok i'm glad that that's at least good
i have seen a tutorial where the guy tries to ignore all the unreal ai stuff and make his own basic AI and it seemed like the wrong path to me
yeah the new tutorials and stuff I'm looking at use ontargetperceptionupdated (AIperception) so i'm going to follow that until I have my head around some of the basics more
thanks
AI with blueprints on the Epic learning portal and the 4th pinned link here are good tutorials to start with
thanks
Question about EQS + contexts:
I want to create an EQS query that scores points off-screen higher. I want to use the dot product between the Camera's rotation vector and the querier -> item vector. My thought was I simply need a context for the Camera.
However, my camera is a component (not an actor). What's the best way to pass an actor back with the rotation of the camera so I can use that in the test?
so...my recast lets me change agent radius to 15 but it seems to reset to 35 when I restart the engine (not necessarily every time tho). It's set to 15 in project settings as well, so idk why it's doing this. @uneven cloud you mentioned something about minimum having to be 35? How else can I make the navmesh snug enough around the walls or increase the tolerance of the path's projection to navmesh?
You need to make your own supported agent settings in the project settings. If you don't, then it uses the default settings, which is a radius of 35.
Last night when i went to bed my AI was going to me, attacking, then chasing again.
Now they do the same thing, but with no animation while moving. I have tried everything, even removing the behavior tree and redoing it all locally on the AICharacterBP event graph. Everything works besides the animation while moving
Did i click something dumb right before going to bed? lol
gotcha thx
Are your casts actually failing or are you perceiving more actors than that specific class? I'm guessing it's the latter. You should debug it before assuming it's a bug.
You send it as a vector, not an actor
that is usually the case, you'll need to debug and find out why your animation is not playing
@uneven cloud If I send them as vectors, they have no rotation attached so the Dot product just receives a zero vector.
Context locations aren't query item types.
Ah, my bad! But theoretically I don't understand. How can the dot product test use the context's rotation if it never knows about it?
shouldn't it run through one actor at a time? It definitly is percieving more actors than one
specifically thinking about this
You use a context. A context of the camera's direction as a vector.
It's sending you an ARRAY of actors. So no it doesn't do it one at a time.
Point being you will likely see the cast failed print several times, one for each actor that is not a match
oh yeah I don't dispute that
but it should succeed at least once, which is what's mysterious to me
and it use to succeed at least once
well it's moot now i'm not doing it that way anymore
thanks though
The new way is working and does not use casting
So I have gotten my AI's 'run' animation to work while moving, but ONLY in the AI's event graph. But from the behavior tree I still cant seem to make use the run animation. They just come at you stiff then do the auto attack standing still as intended 😦
Show code
I would be happy! Just give me 20 minutes to eat. If you are still around cool, if no i get it ❤️
Just post it here so people can help
Ahhhh, that makes sense. Thanks!
Hm, yeah, although I'm thinking in the emptiness of space I may be able to roll some very crude pathfinding since there won't be any "maze-like" structures to navigate around, I may not need an optimized path-finding algorithm.
Not sure if this is the correct spot for this, but does anyone have any tips on running Build Paths for the navmesh on a build server (Python maybe)?
I recommend creating a commandlet to do that.
Ah, that seems like exactly what I want. Thanks again!
I saw someone on LinkedIn, he was using line trace for 3d pathfinder, like multiple traces around the character, and depending on which trace hits something, he moves the target opposite to the direction of that trace...
You might try this approach...
https://www.unrealengine.com/marketplace/en-US/product/don-s-3d-pathfinding-flying-ai
Or you can try this one
Yeah I think a line trace method would be easy enough, I won't have complex enough geometry to warrant much more
Can actors create Nav mesh on construct or is there anyway to have AI nav mesh bounds attached to an actor and spawn in along with it? I am making an infinite runner game, and I need the floors that spawn in to contain the nav mesh.
Every X floors is a town the AI shouldnt enter, so attaching the nav mesh to my characters location does't work.
You can move the bounds and then call On Bounds Updated on the navigation system. You do need to have dynamic generation turned on.
Im Not sure why I can't Set this EQS BB to Target as its a value I can set everywhere else . Only seem to be able to set it as its self which is not what I need.
What is the type of Target?
I assume it's object, but have you specified it's an Actor in the submenu?
If not that could be preventing it from showing up in that list
The target and self actor are the same Object type, And If it was only looking for either then Why does Locations BB values also show But not My Target 😦
In The EQS its looking for My player character
iirc SelfActor is by default an Actor
so you may have to specify Target is an actor because if it says just Object it means it could be any UObject type which may not have a position for the EQS query to use
it's a bit hidden, there's a small arrow thing to expand the object type selector which allows you to then specify the more specific class of object
Thanks, Fixed 🙂 I had object set Instead of actor . as the base class
It's weird how tasks are given automatic display names but services do not receive the same treatment.
I'd like to create a custom Blackboard key type. How do I register that (or do I have to) with the Blackboard system so that it knows about it?
(And side question. Is it possible to customize EQS generators to return something that isn't an actor or a location (e.g., a struct)? Is this a fool's errand?)
I vaguely recall BB keys are defined in some kind of structure that looked like it could be extensible
I think gameplay tags didn't use to have one in UE4, so maybe checking how that's defined would be a start
I took a look at Smart Objects and they define their own type that inherits off of BlackboardKeyType (or something like that). I was curious if I needed to tell the type system about it somewhere of it's some reflection magic? I suppose I should just make the class and see what happens, though. 😄
I suspect that you need to register the key type somewhere
That's usually how it works on these things
Need advice. I have a EQS to find a weapon spawner and move there which is working, but I noticed that Once the weapon was taken by a bot The other bots that picked is as the move to goal were still doing so and just standing there 😦 So I added a bool to the spawner to set when the weapon was taken and when it was respawned. and added only those to the array. in the context. Also tested and working. But the other bots still go here probably because it has not updated quick enough and it was valid when they first searched . so I put the eqs in a eqs service on a selector and set the interval to .2 seconds but its still the same 😦 I want the other bots to quickly search for another if the weapon was taken. what to do ?
I have this weird issue where my AI just start glitching out randomly in the map, I first though it was something wrong with the nav mesh, but it seems fine too (Show below)
The Move to node keeps getting called , so its somehow having problems moving?
Any help or guidance in what the issue could be woulld be appreicated ❤️
Use the Visual Logger to find out what happens
I recommend claiming functionality. Before moving to it, they claim it. Then when searching or claiming, check to see if someone else has claimed it.
I need a sanity check here, is there any reason that I should not scale a NavMeshBoundsVolume and should instead change the brush size? or should brush size always be left alone
I've profiled the navmesh generation but like, it's just slow. I don't see how there's anything it could be doing incorrectly. So at this point I just need ways to make it faster. right now the cell size is quite high, tiles are 64 cells square, but there has to be something I'm missing that makes things faster
like my level is essentially just a big chessboard, it's not a complex environment in the slightest. my only guess for why it's so goddamn slow at this point is that it's because the trees across the entire level are all in one Paper Grouped Sprite, and the bounds of that grouped sprite are causing an issue? like the navmesh is doing redundant checks against every single sprite in the group for some reason??
does this code actually need to be in Tasks on your behaviour tree? if you want background processes then you should probably be using a Service or just running the processes on the AI Controller, not in the behaviour tree
Does anyone know how to deal with the error "Cannot open include file [...]. No such file or directory." when trying to #include "DetourCrowd/DetourCrowd.h"?
have you added the relevant folders to your [project].build.cs?
Yes, I added the folder to PublicIncludePaths, would that be the right place?
It doesn't appear to matter as far as I've been able to tell. I find using the brush size makes more sense from a mathematical perspective, but functionality doesn't change.
if you set up your keys and tasks right, you can have a Move To task (the built-in one) that tracks your player. your random abilities can be fired off with a Service on that Move To - you can even do the random timing this way, since you can set a random deviation on the tick time.
when set up that way, the Move To task will only finish when within range of the player. so, after it, put your melee attack task there. assuming that the rest of your tree is set up right, this whole block will loop, chasing the player and firing off abilities until it's in range, then melee attacking. you'll probably want a Wait task after the melee attack just so it can't fire off on every frame
Not sure why But MY AIs are not detecting each other while using the gameplay tags , Both have ai perception in the AI controllers and A stimuli in the character. what did I miss
Hi guys!
The lack of combat and ai videos on youtube is frustrating!
I would really love to get advices from you all, im at that point that i know the barrier us about to break but still stuck in the "how to approach" the combat system which will include various types of attack etc.. and to combine it with a nice and fine ai behavior that will react correctly to hits or hit back or any desicion and logic it will have.
please give me light guys ❤️
Your question is very vague and I don't know if it can be answered. That's why you can't find videos about this topic either because it's very complicated and depends entirely on how you want it to work in your particular game
Generally the way you build these kinds of more complex behaviors is by combining simpler behaviors to form larger ones
of course, im not expecting to get an answer of how to build a full aaa game system, i just need a direction of how to combine simple attack with a simple reaction of an ai, in the form of a clean simple system.
the problem is that every tutorial is all about how to play a montage and make it look cool with a huge sword. it doesnt make any sense of how to approach and start building a simple system and thats why it frustrating
seeking the direction of how to start a system as such 🥹
I would try to approach it from the perspective of setting up the building blocks in a sense
For example, give your character class a function to perform an attack, and give it some logic that can run when it gets damaged that reacts to it
Then you can create some behavior tree nodes to start building logic to for example run up to a player and trigger the attack function
At that point you would want to test how it reacts to being hurt to test your logic for that, so you can make sure it works the way you want with the BT logic you have for it
When I pass in the controlled pawn in my State Tree task the return value is always null.
The controlled pawn is valid.
I will send some more code when I get back.
Print the querier value, print the return value, and check visual logger for any EQS related messages
Okay. I wil when I get back.
The return value is unknown in Blueprint debugger.
I will move to C++ once I get it working in Blueprint.
BP debugger is kinda iffy, best to print it or use an actual node to check it, like Is Valid and then print the output from the branches
Okay. I also used is valid and it never went through the valid exec pin.
That suggests the Querier could be null for some reason, but I think either Output Log or Visual Logger should have warnings/errors from EQS in any case if it doesn't return a valid result
Okay.
I will send again this afternoon.
This was pretty fun to get up and running
https://twitter.com/DGoodayle/status/1729567582842163512
Looks good
Thanks! Still lots of iteration to do on everything, but I'm fairly happy with it so far. Going to park it for now and focus on level design
im a programmer in a hack n slash project, how costly is having each basic minion running bt? since this kind of ai is basic, shoud i put the logic in the ai controller using pawnsensing?
- Do it and then profile
- AI doesn't use a player controller, they use AIController
- Pawnsensing is old and outdated, use AIPerception
Right! i think since this kind of minion just sees, the pawnsensing is enough?
No
Do not use that
Again. It is old and outdated.
AIPerception does what it does, but better
Ignore it
It might as well not even exist
Thanks! AIPerception then!
I am using a pawn and a floating movement component and a simple wandering AI logic. However I get these weird movements where they wobble and never make it to the point: https://youtu.be/1S66ZRlG06M
the BT
the service, but I doubt it is a service issue:
What's the best method to disable ai perception if the AI is either dead or unconscious , I only came up with this
or by doing this. Its there a better method?
Seems like a good logic 🤔
Do we know if anybody / any co.'s etc. / are trying to deploy the new RL/IL systems that came out in 5.3? (learning agents).
so I have a ledge right here, is there a way to make it so ai will be okay with jumping off the ledge if it knows there is a navigable surface below?
only potential thing to note with this is that you are fetching the component twice, since its all pure functions. once to read "Dead" and then again to read "Downed". its not going to matter much since component fetches are pretty fast, but I usually make small utility functions in cases like this, that just take in a component, do whatever calculation and return, so the component is only fetched once.
Yes. Nav links.
hey guys
morning
am scripting a muliplyaer shooter
the ai aims from the client POV
but on the server it does not need help please
More of a #multiplayer problem
has anyone tried or know of someone who tried to do some LLM style and hook it up with a game made in UE?
something like, let the AI play your game and see what it does, something like that
Hello, how do i find and addthe AI_Classic the AnimClass that, has the idle and running etc animation in it cuz i dont have it here
With abp manny hes just straight going around in the room im stuck at the animations thing idk how to make it so when the character moves, he has a walking anim, when he runs another and when hes just standing still an idle anim
Nothing to do with #gameplay-ai you can try #animation but for something that simple you can prly just Google it
I tried googling it
idk if i didnt search it correctly or not but i didnt find what i want
Could someone help me with this issue in the video above? I am moving my NavMeshBounds with my character, however it does not update its bounds untill i move it after pausing the simulation.
Why are you moving your bounds volume with your character? That is such a bad idea.
So i am new to UE5 and everything i read about this situation for people is the same. Specifically; using nav mesh in an infinite runner. All dynamic options in nav mesh generation that i have seen are still restricted by the nav bounds.
would it be feasable to just make the bounds a MASSIVE length in size (I only need it the width of the playspace)
For an endless runner, you move the bounds when a new tile is added, so that the bounds covers the current tile and the new one.
It should not move with the character, but when tiles are added/removed. This is because you don't want it to constantly be rebuilding, because it's expensive. Then you need to call On Bounds Updated on the navigation system to trigger that rebuild.
Luthage, you are the woman!
That works! I will get away from moving the bounds on tick and only doing it on next tile generation
but thanks for that node name! looks forever and no one mentioned that
You're welcome!
what if we unpossess the AIController of the AI and then destroy the AIController 🤔 ?
Never tried this one
try making the SetRandomLocation a BTtask and then try if the issue still exists
hi
when i spawn my ai with level blueprints pawn sensing does not work
what to do?
- check if it actually has a controller
- don't use pawn sensing, use AI perception
Pawns have a setting for "Auto possess AI" or something like this - by default it's set to "placed in level", if you want it to automatically get an AI controller when spawning via blueprints, you have to change it to "spawned or placed" or whatever the option was called
(or alternatively you can spawn the controller for it manually, or use the spawn AI node)
@terse panther If I use a character class with cmc it doesn't happen
I have a big NPC which uses separate nav agent type for navmesh (with bigger radius), now I need this NPC do ignore specific actor (small breakable fences) when doing pathfinding so that the NPC would just go through them. Is there anything to override to ignore some actors based on collision object type or maybe just TSubclassOf to achieve such behavior?
Is it possible to reuse the traffic lights system used in city sample with ZoneGraph? I've been searching for it but couldn't find anything
I've not tried it with navmesh for a specific agents but maybe you can get it working via some method like that
thanks, i'll take a look
Nav areas and nav filters.
i was thinking about it. I was thinking to make the actors bCanEverAffectNavigation to false, then add nav area component which sets infinite value for all nav query filters which are set in the controller and for my big NPC I set I don't set it at all
were you implying that?
Pretty much that.
but aren't there any classes/methods to override like in ARecastNavMesh or UNavigationSystemV1 to ignore actors based on object collision channel and for some specific agent type? It just seems to me that approach with nav area components is like... it will work, but it doesn't seem like a clean way to do it
You would have to test the actors based on some rule of your own
The function mentioned in the page I linked can be used to filter them out based on any kind of check you can perform on the object
Whether it's a better approach than what Luthage suggested, I don't know
I'm using a custom recast mesh which ignores certain specific actor types in my game to create a separate navmesh which is used for certain specific types of pathfinding checks
And at least for that the approach works alright
While working on my back up file testing things out of no where my AI started to stutter when trying to get to me, walking on outter edges of nav mesh tiles. I gave up fixing it and went back to original file. But the AI there is also doing the stutter step, are there ANY perams that will travel between projects?
It’s the same project no?
I copied the files to a new one GameNameBackUp
They are jittery and walking the edges between nav mesh tiles.
Well if you copied bad code to a new project, it’s still gonna be there hehe
well it was working when i copied it XD
Try using visual logger to see what’s happening
and for a while while i was testing things
You could always revert from source control, always an easy fix
Made another project and carried in the assets. Seems to work now, thanks for helping ❤️ Sorry so many questions. The AI has been the hardest thing so far for me. It seems to have more areas for missing up XD
Uh. Dumb question, but this is my first time using Nav bounds in UE5. How do you build paths? Like... I'm using the build > build paths option in the menu, but it's not updating.
Just doesn't update.
0s to buid paths.
Just had to delete my recantnavmesh and now it's working fine....
Sometimes it’s finicky
I've just built paths in my UE4 projects hundreds of times and never had that happen, so I thought something had changed. Good to know though. Thanks.
It’s prly generating under them
Yes it is. How do I get it to generate on top of those meshes as well?
Try turning can ever affect navigation on, then scaling up the navmesh bounds volume or increasing the step size in proj settings
CanEverAffectNavigation is on. Do you mean this?
The nav bounds is high enough
Yeah
And also have character can step up on to On
If that’s on, try toggling off CanEverAffectNav and if that doesn’t work I’m all out of ideas 😅
ah, they don't have collision
That’ll do it
Makes sense given I’d expect there to be holes in the navmesh around them when can ever affect nav is on
Is a nav modifier that moves with the player very expensive?
Its not ideal
I want to put some kind of nav modifying cone in front of the player (mimicking the fov of the player) so i can make nav mesh more expensive there and force enemies to circumvent the player
It actually works quite well, but i think i'm losing way too much fps
Additional negative score for point/paths that go infront of player
But does eqs return a path?
So i can make the enemy follow that?
It can evaluate a path
But generally, no
This way your nav is dirties every time player moves
It will be nav tick under stat gsme
So i can't just do a moveTo but i have to constantly compute the next point of the path and make the enemy go to that?
Yeah i can see it's very bad from fps
And every time player moves AI have to run pathing again
Your goal with AI is never to make a perfect system
Its to maximize the chance for y good outcome
They can sometimes go near player, but as long as thats rare, its a functuoning system
god damnit, so I tried to do it your way but it seems this ShouldGenerateGeometryForOctreeElement was introduced in UE5 and we're still on UE4.27.2 😢
Can you cherrypick it?
we don't have an established process of applying engine patches, so cherrypicking in my case would be just copypasting pieces of code from UE5 to UE4 🙈
I see, so EQS is my way to go here, thx!
I did have to make a small engine mod last time i manipulated path selection with EQS
is it like a normal practice to backport features from UE5 to UE4 either manually or via git? because to me it seems like doing a surgical operation with a plastic spoon
Basically, pull the cost in engine pathfinding queries into separate virtual function
So i can reuse engine pathing query with my custom cost algorithm
When i was last working with UE 4, we were known to steal UE5 systems
Its not always feasible though
If they just extended functionality, your golden
If they completely refactored the system snd changed half the API, youre fucked, basically
Interesting 🤔 Feels like there might be some method to do it in 4 too but not sure
Guys, How can I disable AI's chase when the character dies?
The Unregistered Perception or Unregistered from sense did not work.
If you unregister the character when it dies, this should trigger a perception update on the AI with successfully sensed = false
If this for some reason doesn't work, an alternative would be to add an event dispatcher to your character class which is triggered when it dies, and have the chasing AI add a listener to it
Even though I make "Unregistered" the character when it died, AI continues to chase. 'Perception == false' maybe didn't happen. I do not know.
As seen in the photo below, I make it follow whatever Actor is detected. Do you have any suggestions?
is your code checking the successfully sensed value from the stimulus struct?
Yes
'LostTrackOfTarget' creates a function about 'ForgotAboutTarget'. So when the times out, the key is reset.
Right- not sure what's going wrong with it, but you could try using the event dispatcher approach then
Oh, okay.
"add an event dispatcher to your character class which is triggered when it dies, and have the chasing AI add a listener to it"
I didn't quite understand this. Is there any chance you could explain a little more, please?
You'd create an event dispatcher in your character class, such as OnDied, which you would trigger from the code on the character which detects when it's dead
In your perception handling logic, you would cast to your character class, and add a handler for that event dispatcher
This way you can get a notification when the character is killed
Okay, I'm trying. Thank you
Anyone able to advise me what the purpose of this is for and is there any point with me using it ?
I was looking for a find path to location like a thing that check if there is a path there
It finds a path. I'm not entirely sure what is confusing about it
I've never used it before so weren't sure if it was a good thing to use
It's not great to use to check if there is a path, but the good function is not available to BP.
Just starting with AI; what do I use for a crowd of enemies to keep them from crowding, i.e. detecting nearby objects?
avoidance or sensing, depending on what you mean
if you want to avoid crowding while moving https://docs.unrealengine.com/5.3/en-US/using-avoidance-with-the-navigation-system-in-unreal-engine/
this would be the other option, or EQS I guess if you want to detect static objects https://docs.unrealengine.com/5.3/en-US/ai-perception-in-unreal-engine/
i'm doing 6DOF, so I think I won't be able to use the native navmeshes
might need to do everything custom then
i figured; just wondering tho if one of the senses might work out of the box in terms of how to sense nearby charactesr
I guess I coul do two sight configs, one for player and one 360 for other AIs?
if I can just get lcoation of nearby enemies I think I can roll something with that
anyone familiar with state trees? im trying to create a looping state where the AI will find a random location, move to it, wait, and then return to the root, but it doesnt actually transition back for some reason. is there something im missing? this is UE5.3
they will walk to the location, wait, and then nothing after it is called even though it should return to the "Roam" root
so my move to task is printing hello when the AI move to succeeds, but its spamming it. and its also not finishing the task even though the FinishTask node is plugged in, so im super confused lol
All this sounds like something you should maybe use a BT for instead
these are intended to be much more complex and state trees are much less headache than BT. but I cant get past why finish task wont actually finish task. it works fine on the previous node, and ive tried remaking the node to no prevail. I hear its an issue in 5.1 and 5.2 but they said its fixed in 5.3 so either they didnt fix it or im just not understanding lol. but I feel like it should work as I cant find any logical reason why it wouldnt
Those first 2 sentences seem… inaccurate.
State trees are alot more buggy afaik
And BTs are pretty straightforward if you watch the one video
That being said idk enough about STs, maybe zomg will see your question
well personally im able to understand them better is what i meant. behavior trees get messy fast and ive used them previously and understand them well, I just think state trees are what i need for what I want to do. both can do the same things, but state trees are much easier to follow and manage
For starters, BTs have a built-in MoveTo task so you wouldn’t need to make a whole task for it
It’s like 3 BT nodes and you’re done
Find location, decorator to check if it’s set, move to it, done
You don’t need to make everything a BT
You can simply make a small one and run it when needed
no i understand I use BT as my main currently and I understand them very well but it gets so messy, BT is not something I like working with. state trees are contained well and makes things easy to follow, create more complex parallel tasks and is easy to avoid logic spamming
the way state trees contain variables and pass them on to other states allows you to have really good control over what is happening, and you dont have to worry so much about the flow of a BT or manage a BB cuz you can jump through states to your liking with ST and simply have states inherit variables from other states
Hey guys, I'm trying to understand how the last of us 2 did the AI play random animations in their patrol
example:
https://youtu.be/0hGdU_ngMOc?si=ebhP2ULaDBemKCMY&t=41
I tough about 2 ways:
Way 1 - my NPC character have own motion matching animations, so I can rotate his body in behavior tree in the "ai move to" task and make investigation animation only on the upper body in random locations of the patrol path
Way 2- play montage in random location on patrol path of investigation but it means the montage would not be part of his motion matching, feel like later in process it would make me some problems when I would be want to scale things
Any suggestions or other ideas how to make it right?
A deep dive guide into the behaviours and combat options for both Ellie and Abby for Humans as found in 'The Last Of Us Part 2'.
The Complete guide to AI in The Last Of Us Part 2
https://youtube.com/playlist?list=PL121RGLbnrKxR2kCrX4p3HPkZ-sk6Mvoe
Survivor+ Stealth Walkthrough Guides for The Last Of Us Part 2
https://youtube.com/playlist?l...
From what I've heard, doing AI outside of Unreal's built-in stuff and and pathfinding stuff beyond simple nav mesh movement is kinda scuffed with blueprints, is that right?
I second this, I've used BTs for a while and only recently moved over to STs, and STs are much simpler to work with. What took me weeks in BTs is taking a few days in STs (+ they're not limited to just AIs).
just some notes:
don't think you need this, just go straight into your 'finish task node', you're probably just creating extra overhead
the details panel to the right is what really matters for your question, can you show that?
Also I think the wait task should just be a sibling of the preceeding task, you;re not passing data so it doesn't need to be a child.
I did mine like this (detail of Free Roam Move)
Well yeah if the system not built-in you would need to write your own in cpp. You can’t expose something that is not there
I'm working on units for a colony building game, they are pretty simple and there are around 500 of them, all of them are managed by 1 subsystem that tells each one what to do and where
they are stateless and managed by a large switch statement on tick
idk if this is the way to go but I can push 1000s of those with out sacrificing visuals or performance
So anyway about that switch statement, should I switch it to a state tree? isn't it essentially the same thing but with a nice overhead and nice editor?
Hey, Do you know if there's a way to ask the navmesh to rebuild just once at runtime. For the moment i've set the nav mesh to dynamic and it works but i really need it to rebuild just once so it's poor optimization to set it to dynamic
Why does it need to rebuild “just once” at runtime?
There’s a dynamic modifiers only if you’re using nav modifiers, that can prly help you get what you want
I can't use dynamic modifiers because i need the nav mesh to rebuild entirely
I'm creating my map proceduraly
So i need to rebuild the nav mesh once the map is created
And i dont need it to rebuild after the map has been generated
Because the map generate on multiple floors so i need the nav mesh to rebuild to take the stairs and 2nd floor
The state tree certainly is not just like one big switch statement on tick.
If you don’t change the geometry, it won’t keep rebuilding
If it is, make sure you don’t have something moving around with can ever affect navigation turned on
my advice is to check out how dirtying navmesh storage works and manually call that potentially from an overriden navsystem class
it should be possible without a custom class but if you need to stop certain things from dirtying it you might have to
A State tree is very different from a switch in many ways one of the biggest being transition states that allow you to go between states and layer states. If you use it like a switch you are under utilizing it by a lot.
I'll try that, thx !
I know but i have multiples differents action in my game that spawn new actors and i don't want to manually set their can affect navigation variable to false
I mean with inheritance you should only need to do that once but 🤷♂️
actors and collision meshes can choose to not dirty the navmesh but many things can
streaming levels loading etc
Does anyone know how to show ALL navmeshes at runtime? Cvar show navigation only shows the main one
iirc there's a setting for the navmesh which enables the debug draw for it... by default only the first one has it enabled I think
Found it, thanks
Does anyone know how to debug Blocked when using AI Move To? I can't see what the char is being blocked by
check visual logger, otherwise you might need to look at the logic in the movement comp or character or path following comp which fires when blocked
forget which one had the particular logic for it but I think it was one of those three
Visual logger also just logs "Blocked" but nothing more :/
does it make any sense to have LoseSightRadius less than SightRadius in AIController's PerceptionComponent? I've stumbled upon it in one project and thinking if it's that was an error or if that can actaully lead to some specific behavior? 🤔 the enemy itself seems to be "seeing" targets good overall, so I can't say like it looses sight of player inside this lose sight radius or out of it
Yeah check the comps then. I think the path following comp at least has a value that you can adjust for how long it is blocked before it gives up moving, so it might have something you can look at that would also tell you what it's getting blocked by
and I'm fairly sure CMC or Character has a function that gets called when the character is blocked by something
because I'm pretty sure I wrote some code that makes the character open a door if it gets blocked and the blocking actor is an openable door lol
Thanks I'll check it out
Hello everyone, I am trying to use SmartObject with Behavior Tree, the scenario is:
Imagine a scenario that I am on saloon, and the customer (AI) arrives on the saloon, see what chair is free and he pick up, sitting, talk with another customer (AI) and that, after 5 minutes (I am in this moment) he will see if some Beer is available on the machine, if yes, he will stand up (he can or lost the chair or mark as occupied whatever), pick the beer and search again the chair with beer on the hand and sit. (if don't have any chair available before or after beer, he walks random on the saloon)
I was watching a tutorial from youtube and he says to Disable the "Enable Auto Blend Out" from Animation Montage that I am applying on SmartObject, because I want that AI stay sitting on the chair waiting for 5 minutes, but he is stuck on Play Montage (GameplayBehavior Class BP) and also stuck on "Move to and use smart object with gameplay behavior" (Task Tree Behavior)
And I am new on the Unreal Engine, I am learning little by little with subjects necessary to do what I want.
Someone have some suggestion to do or something wrong that I did?
Does anyone know how to do non-cube based nav mesh bounds? For example, for spline roads etc?
The navmesh bounds is a volume, volumes can be modified in various ways in the brush editing mode of the editor
isnt it just use what ever shape bounds as the volume? for example cylinder would still be a cube
I think that the shape is just for visualizing the nav bounds
Huh?
I mean you can use the brush editing mode to adjust say the individual edge of the volume, or extrude one of the edges, move only one corner, etc.
ya but u need multiple bounds fot stuff like that
ya see?
it will just use the bounds of the shape
not the actual shape
its pretty much always a cube
ya the shape is a lie
it also wont effect the get random reachable point
imagine learning that you need to use the stairs builder to perfectly align the mesh to stairs and stuff
instead of just using 1 cube for the entire scene
also I'm pretty sure that you suppose to use nav links for stuff like stairs
I don't see why you'd need it for stairs unless you want some kind of special behavior for navigating them
ya I'm pretty sure that nav mesh doesnt work with stairs
It depends on how big the step is
it just smear the poly on to them
You could effectively treat it as a curving ramp really
ya
what type of game are u working on?
my AI is being stupid, if I place an instance it doesnt work properly, cant move at all, but if I copy the instance i placed originally, then it does work
This is completely untrue. As long as the stairs aren't more than the step height, then the nav mesh does work on stairs.
Have you tried debugging it?
what specifically/
Debugging is the process of finding out what it is exactly doing and why.
I know, but debugging what exactly?
If it's not moving, then starting with "why is it not moving."
And?
the location it should move to is being set
and the move to node is being executed
although a bit oddly
and not properly at all
What do you mean by that?
That is not debugging. Try using the visual logger. It will give more data on why the move to is failing.
Show your current code
Also, right click and type vis log and find the shape debugger node for it
It’ll show you where your goal is on the nav mesh and where the pathfinding is trying to project
behaviour tree
the find navigable location task
code for setting the keys up
code for the attacks
let me try that
wait in what part of the code?
it's a bp node so it would have to be in a task
oh gotcha
VisLogBoxShape
sry gave you the wrong node
Hi all I hope your well. I have a very specific problem with the AI perception. I followed Gorkas perception turtorial. Basically my main actor has an ability where he can swap out with another Actor and I want the enemies to chase the current actor that is being controlled. The way I have it set up in my Ai controller works for a little bit but the enemies stop chasing the other actor after a while. If I switch back to the main actor the enemies start chasing again. Also if the switched out actor leaves the level and comes back the Enemies dont detect him at all. Ive provided blueprints and a GIF to better explain what I mean below. Any helps appreciated. Thanks
I believe this is the issue as I need the enemies to target the player controller and not the actor
use this one instead and plug in your goal location
onTargetPerceptionUpdated does not always fire reliably
I had to use EQS and the built-in perceived actors generator
I dont believe thats the issue
The problem is the enemy needs to switch targets to the other actor
Please read through my issue. Thanks🤗
yup did so
now when you go to the vis logger, you'll be able to see a box there
like in viewport 🙂
think i found it
yeah
let me just change some settings
or not
perhaps I could try with the gameplay debugger?
try increasing the radius of the sphere
I had to make it 50 to show up
to see it, you'll need to click on the right frame in VisLog (click on each to find the right one)
oh i see
alright
so it seems to be correct
the position is, like has been shown since, being set correctly
It's a good idea to not #include condescension when you ask for help. So far you've shown a screenshot of nodes with pins that are not connected at all (i.e. actor). You can't MoveTo a PlayerController afaik, maybe you need to use tags/gameplay tags and add/remove them dynamically whenever you want to switch target. You can then grab that actor pin you didn't connect to anything and check if has the right tag before proceeding.
No condescion mate. Was just saying that what you mentioned wasnt to do with the issue I mentioned. I hope that clears up the confusion. Many thanks🤗
is it sitting on the navmesh?
yeah
Also its disconnected because it doesnt work how I want it to I was trying to find the correct node I needed
did you try increasing your acceptance radius?
good idea let me try that
well maybe i overincreased it
but anyhow
other than a drop in fps, no change
You need to periodically update your target, especially if the player is switching actors. I recommend using the EQS service in the BT and the perception actors generator.
This is trying to move to an actor not a location.
well thats the other node
chasing the player
neither work actually
i am pretty sure it just isnt able to move for some reaosn
I saw a task in his tree that finds a location in navigable radius, so I figured he's using a location
It's moving to an AI character.
When debugging, you actually have to read what it says. Not what you assume is happening.
adding to this, if you expose IGameplayTagInterface to bp, you can use a gameplay tag test on it, and when you want to swap actors you just assign them that gameplay tag @acoustic valley
i am aware, but a mighty strange occurance called missreading happened you see
I totally missed that tbh lol 😅
Thanks, I think I found another solution. I notice in my other actor the below wasnt ticked, but since I ticked it it seems to have resolved the issue:
This isnt going to conflict with my main actor though is it?
it prly will
I dont get any error messages
no, but your perception updated will fire inconsistently if you have multiple potential targets so you're likely to experience weird behaviour like I did
I wasted hours trying to figure it out before I found out about that generator from Luthage 🙏
where did you look for the info on that? Was it on Youtube?
Also sorry if i offended you earlier
google, youtube, tried to wrack my brain to find ways to sort the updates which was tedious af and had limited success. and np
@dense owl your profile picture is so cute
now it's one EQS query
you can add as many tests to it as you need to. just reminder that to use gameplay tags with it you need to expose that to bp (but it's fairly easy to do)
is there any way to smooth an AI's rotation when they are pathing around corners or diagonal movement? not talking about the snap that the default AI does as I already have smooth rotation, but it seems when an AI is walking around a corner they like to jitter to the left and right like they cant quite walk towards the target accurately or the control rotation goes crazy. any ideas?
CMC/char rotation speed settings might help
People, maybe the question is really really "I don't believe he did this question" but..... The trigger for animation or setup animation for IA it's different from Player/Normal setup?
Did you mean AI? And I don’t believe it’s any different
Oh yeah, AI
Hummmm gotcha
Thanks
You do have some helpful play animation nodes in BTs if that’s what you mean
Yes yes, now I think that I am understand now, I was trying using Behavior Tree with SmartObject, and I wasn't getting the "Play Anim Montage" in BP_GameplayBehavior, but now I got the node 😄
Was a mistake beginner, I am learning yet
this subtree is not being set, and I can't figure out why. I tried printing the display name of every involved variable, and they're all correct...
Why are you getting the BT component from the pawn?
the pawn has a BT component, and it has an asset variable to replace with their own behavior
the component, I figured it's necessary per pawn so they can actually reuse the tree
couldn't find a definitive answer on its necessity
welp I tried setting it to the controller and it works. Gotta test with multiple actors (edit, does work with multiple actors)
Team of one so I don't have anyone to high-five 😄 https://fxtwitter.com/dgoodayle/status/1731744536299270348
It might not look like much, but this is the first successful test of my AI simulation system. Both the on-map and off-map versions.
When the AI is off-map, the are fully simulated with their movement. When they come into the same level as the player they are visually there.
Ah yeah saw the tweet :)
I had a bit of a similar "simulation" of AI in my game but it's currently turned off because I scaled it down a little bit because of noticeable scope creep lol
Basically in my game you run a video rental store, and previously we had some random open world'y aspects to it where you could sleep during the day and stuff.... so of course if you sleep and the store is open, there should be some evidence of customers having visited. So when you sleep it would do a bunch of simulation to pretend like customers had visited and stuff had happened
Nice!
Are there any decent tutorials that demonstrate how to make an AI modular with behavior trees?
ex. Base AI uses basic melee attacks but the children of that AI use special attacks. Would I just swap the behavior tree they use, or is it too heavy to use many different trees? Should I just use an Interface? What if their attacks are ranged instead of melee, etc...
Have a generic task "Perform Attack" that just calls an attack method on the base AI
Let the specific class override the method to do w/e they want
Is there a way to build this BT such that it doesn't have little Wait nodes scattered as default fallbacks?
For example, the EQS service gets a combat position. If that succeeds, it moves into the default reposition/attack behavior. But if it fails (even the first time), I need a Wait node to re-evaluate the branch.
In my mind these are my options, but I'd love to be corrected:
- Keep the
Waitnodes. - Replace the
Waitnodes with actual behavior. In this case, if you can't find a combat position do... something else. - Remove the
Waitnodes and enableCall Tick on Search Start. - ...?
Having small waits as fallback behaviour is a good thing
Logically that makes sense. Aesthetically, my body rejects it.
Even if you were to have other behaviour, if your AI starts instantly doing something else when a behaviour fails, it’ll prly start looking janky af 😀
So even when you replace it with actual behaviour you’ll prly still need a bit of wait
You have several problems with this behavior.
-
The run EQS Service doesn't complete by the time you are requesting to move. It should be run EQS task and then move to with an update move location EQS service on the move to task. The way you have it, the NPC will move to an old location if you leave this branch and then return to it.
-
You are only shooting while moving. What happens when the player stands still?
-
You never unset running. This should be in a service instead of a task so it can be unset when it leaves that branch.
Brilliant, thank you! I'm going to go reconfigure it now.
re: #1 and updating the move location, can I use Observe Blackboard Value in the Move To task instead of a update move location EQS service?
solved 🙂
No. You need both. The EQS service looks for a location and sets the blackboard. The observe blackboard watches for changes and updates the navigation.
Ah I see so the pattern is the Task ensures it’s set once, while the Service ensures it’s updated continuously after the initial time?
Yes. It sets the location, so it's not trying to use old and outdated data. Then updates for a moving target only while moving.
Is there any way to limit patrolling area? For example I have a big NavMeshBoundsVolume but I need my enemy to patrol only some fixed area of NavMeshBoundsVolume?
I use UNavigationSystemV1::K2_GetRandomLocationInNavigableRadius to find next patrolling point
ok, so thre is a RandomPointInBoundingBox
Hello people! I am trying to spawn a SmartObject but I am getting UE5 crashed, Someone have some tip?
The idea it's a barman spawn the beer SmartObject on the table to the customer get these beer and after 5minutes they destroy the beer
Hard to say. You would need to provide more info on the crash log and such
Where can I get this information?
Let me see here
Crash log, using debug symbols for more info
Assertion failed: OwnerController->GetPawn() [File:D:\build++UE5\Sync\Engine\Plugins\Runtime\GameplayBehaviorSmartObjects\Source\GameplayBehaviorSmartObjectsModule\Private\AI\AITask_UseGameplayBehaviorSmartObject.cpp] [Line: 311]
Is it like this?
If you launch from your IDE with debugging it should break where it crashes
At least that one sounds like the issue is that you tried to use AITask Use Gameplay Behavior Smart Object with a controller that doesn't have a pawn
With debugging you say with breakpoint on the node?
Which sight method is more expensive? I mean like the pawn sensing component or maybe a few raycasts?
You don't need a breakpoint on it if you launched from VS with the debugger enabled, it will automatically break on where it crashes
Okay, let me see here
Use AI perception, but all methods use raycasts
AI perception is timesliced so it will avoid it taking an excessively large amount of time per frame
But you won't have that issue unless you have a fairly large amount of NPC's trying to perceive stuff
Oh, now I gotcha what you say, I am not using with C++ code
I am using blueprint
I don't use VS here
Ohh okay
Then it's probably what I said, you tried to use the AITask Use Gameplay Behavior Smart Object somewhere in your BPs, and whatever you're using it with is a controller that doesn't have a pawn
Huummm
I don't have any idea lol
Why almost doesn't have tutorial about SmartObject? 😦 sad
Are you using that node somewhere?
Right so the node has a pin for controller on it I think?
Yes
What are you passing into that pin?
Alot of information '-', but it's an AI I think.
Right
It's running by Behavior Tree
If you add an is valid node before the use gameplay behavior node, and use it to check controller->get pawn, will it still crash or no?
let me see
Still crash, one thing that I realized is, the actor that have smartobject (The chair) that already in the world and exit while Gameplay Behavior, don't crash.
But if I spawn while simulating the world and exit while gameplay behavior, it crash
which version of UE are you on?
5.3
hmm
hard to say why it would crash like that then, you would need to debug it on the C++ level I think
oh boy hahaha
it's strange because it works normal, but If I close while the function that some AI is using the actor that have smartobject, it crash
Oh so it only crashes if you exit PIE during the execution?
I don't understand why the plugin SmartObject it's not popular for tutorial on the internet
Ah okay... could be that the pawn gets destroyed and the smart object ai task isn't handling it correctly or something like that I guess
the system is pretty new and kinda complicated which might be why there's not much info on it out there
Huummmm
maybe if I convert the pawn as variable, and set on the blackboard?
and then on the function, get the pawn?
Hard to say, if it happens only on PIE exit, then I don't think doing that would help assuming my guess about why it crashes is correct
understand
Basically all actors are destroyed at the exit, and it sounds like there's a check for it somewhere that isn't taking this into account correctly
Yes
it's strange because this only happens when it's spawned while PIE
if already exist, and I exit, don't crash
crazy
Yeah there's probably some kind of situation where things are cleared in a certain order due to some internal workings of the engine and if it's spawned in the level it happens to happen in a slightly different order and it doesn't crash
gotcha
Well, I am begginer as well so
maybe something I am not doing correct also haha
But, thanks for the help! @misty wharf
Unless you're doing something really weird I don't think it should be causing a crash lol
I’m trying to use it for a lot of small enemies (like 300)
You'll want to be sure to set up either the detection by affiliation thing or turn off auto register pawns as sources
You probably don't want them all perceiving each other because with that number it would definitely start having a perf impact - might still be ok if they only detect player
What if I do want them to see eachother?
Well depends on how many of them are going to be doing that at the same time
But with perception sight, the system will linetrace to every single perceivable actor within the perception radius
so if you have 300 pawns, this means 300 * 300 linetraces
assuming they were all within their sight radius at the same time
at that point you might need to find some way of optimizing it for example by increasing the time between sight traces - but I don't really know why they would need to see each other tbh
How bad practice is it to attach collision boxes to weapons sockets of an ai and 'enable collision' during an attack only for hit detection? XD
Does anyone know the best way that I can go about having a zombie AI crawl through a window?
Am I able to use Nav Link Proxy to accomplish this or is that only for having the AI jump far distances to reach the player?
Or can I do this by making an actor with the window as mesh and then using ref boxes on either side of the window. (I'm also running into an issue of the logic for running the shortest path to the player while taking the window distance into account.) Then when the AI reaches the trigger box it plays an anim montage that shows the zombie crawling through and then landing on the ref box on the other side.
Does this sound right? Does anybody have any resources for this kind of thing? I'm currently watching a Matt Aspland video on having an AI interect with a door and I'm going to try and use parts of this to make a window like how I explained.
That is how I would do it. I would look up vaulting tutorials and then just apply the same logic to your AI when they enter the window box. In regard to the shortest path just check distance to windows as well as the player. If the distance to the player is longer than the distance to the nearest viable window they should use the window.
I would set some method of defining which building the player is in for this so they don't just hop into a random window thats closer than the player. You could do that with an integer and colliders for each building. So your first building collider sets player building interger to 0 the next building collider sets player building interger to 1 etc. and then tie all the windows in that building to the relevant building interger using an array or something.
Then the zombie checks if the player is further than the window, if it is true it checks if the nearest window is part of the players occupied building by checking the player building integer if it is true it goes through. If the nearest window is not a part of the player occupied building it will ignore it and continue to the player.
You wil often not find tutorials specifically focusing on your games intended mechanics you have to learn to search for associated tutorials that will be more likely to have dedicated tutorials.
For example I couldn't find anything on fish AI but I found plenty of stuff on flying AI and it's essentially the same problem being addressed how to have an AI navigate in 3D without a nav mesh
Awesome, thanks for the advice. That helps solve another issue I was already thinking that I would run into with two building being close to each other and the ai climbing through the closest window but not the correct building. I'll look through some vaulting tuts and the blueprints for the vault-it addon to see if I can stitch something together.
The last time I looked at the Smart Object system, it didn't work with dynamically spawned or destroyed actors.
Really? And destroyed actors too? oh no
I would do it with a nav link proxy and not collision boxes. Your zombie needs to know it can go through the window when it's navigating.
Yeah. There's nothing built in that interrupts the AI using a smart object when it's destroyed. Or remove it from the collection.
I was testing here, when a actor destroy a actor that have a smartobject, the lenght of array of smart object, decrease
Do you remember what version was it?
I haven't looked at it since they added them in 5.0. I had to build my own system, because it didn't work in the way that I needed it.
Gotcha
I know that some functions changed 5.1 to 5.2 and to 5.3
so I don't know, sadly the documentation is not updated
Unfortunately, you need to go look at the code most of the time.
Well, I am not using the code language (c++), like VS and whatever that use to see the code
but, thanks for the tip
Sorry if this is a dumb question I know literally nothing about nav link proxy and need to do some research this weekend, but can I swap out the jump animation for a crawling one? This would be the best way imo that way the collsion doesn't get weird when using reference points and an anim montage, that way I can still shoot the zombie the entire time its climbing through the window. Also this way the navigation logic is already built in and I dont need to write as bulky logic to specify where the ai needs to navigate to, it can just path to the nav proxy link instead of checking boolean building relations.
maybe to spawn is not working and to destroy is working
There is no animation that is built in, so you can use whatever you want. If you are using BP only, you'll need to use the smart link and can bind to the events to trigger behavior.
I don't believe interrupting an AI using it is working either. At least I haven't seen that in the release notes.
Awesome thank you!
I did this in GameplayBehavior class
Is it me or bDoFullyAsyncNavDataGathering is broken inside the ARecastNavMesh, it's fine in the editor window, but as soon as I start playing in standalone, many chunks of the level miss the navmesh...
From what I’ve read from others here, you almost never need it to be async
Hey all. So I'm using my blackboard to navigate my units. And I have a jump ability that launches my character to a specified location. But my AI is being extremely dumb and doesn't realize it's extremly close to the location and decides to go back to its OG pathway. Is there a way to refresh the AI's pathfinding?
Here's a video 
You need to show what you are doing, not the end result.
I believe you've seen that about async pathfinding and not generation.
Ah mb
What's the domain of an AI controller versus the pawn itself? Confused about what logic lives where
can you say what is the difference between:
GetRandomPointInNavigableRadius
GetRandomReachablePointInRadius
K2_GetRandomLocationInNavigableRadius
K2_GetRandomReachablePointInRadius
all of them gives us random point/location
Did you read the comments on them?
I'm fairly sure they have an explanation. The difference is in navigable vs reachable. Navigable point is not necessarily reachable (eg. it could be a point on the navmesh which cannot be reached due to obstacles)
Functions with K2 prefix are generally intended for blueprint usage, not sure why they would have duplicates of these two with K2 prefixes - could be they do something slightly different. Best way to find out is to simply open the function and look at it.
Probably a dumb question, but I can't find an interesting answer on the Internet. How do you get an AI to run parallel tasks? The BT "Simple Parallel" node doesn't solve the following problem: I have a boss that executes consecutive actions. But at any moment, if the player gets too close to the boss, the boss executes a Gameplay Ability in parallel with what he's doing (he doesn't interrupt his current attack). 🤔
If the goal is to make it so the BT runs this ability in parallel, then you would probably want to use a service
You can put the service in your BT in some branch where you want it to be possible for it to activate, then the service can choose when it's the appropriate time to do so
I see, it could work ! I'll try this
So i have to put the "condition logic" and "execution flow" inside the service ?
Is this the original purpose of the services?
I don't know about "original", but it is one way you can use them
Does anyone know if there is a setting for the height diff between 2 path points of a NavMesh Path?
I have a slope that has NavMesh built, and it's quite steep. It works for the NavMesh generation, but Paths along that Slope cause the AIs to hover in mind air, cause I think the "slope" of a path is not allowed to be that steep?
Sideview - Floor is Black - NavMesh is Green - Path between 2 points is Orange
The angle of the slope is not as steep in the actual level. Paint image is mainly for reference
I think there is a setting for maximum climable angle/ slope
maximum walkable slope maybe in the CMC
though I guess that wouldn't affect the nav mesh would it
Idk maybe it's pulled when doing the query from the agent
The NavMesh generates fine
It's just the path that is too low
Also, there is no CMC here
These are #mass agents actually
Maybe it counts as step height?
Na, step height doesn't matter. Moved it to 500 units, still the same
the mass agents don't use the CMC at all, but still use the navmesh? hmm
I'm learning
hmm
NavMesh is not tied to CMC
Mass Agents can just query a path and then be coded to walk from point to point
does anyone know how to make an ai moveto me but like 2 metres away isntead of right next to me?
Set the acceptance radius to 200
doesnt work
also heres a little picture
why not?
Use the visual logger to see what is happening
Because that is the purpose of that value
I got some SmartObjects in my world and AI is choosing one randomly. The SOs are sometimes separated by a door, which can be locked by AI or the player. I got a very bad implementation where the door BP will check if the claimed SO is assigned to it (I put an Actor Tag on the SO and check on the door if it is the same) and if the door is locked and the AI wants to enter the claimed SO will be freed. But there has to be a better way. Anyone that had a flash and knows how to gracefully handle it?
I think I had one myself right now. Maybe someone with some experience with them can confirm. I had one actor with one SO-component and one slot, so one room had multiple actors with SO-components but I think I could just place one actor and multiple slots in each room. When the door gets locked I can somehow exclude the SO-actor from that one room from the search
What behavior are you looking for? When the door is locked can the AI unlock it? Should they stay out of the room?
The AI controller is the brain and the Pawn is the body. The brain decides what to do and the body does it.
I recommend using the EQS to find a location near the player instead of moving to the actor itself.
They should stay out of the room, maybe walk up to it after which it will yell something out, maybe play an animation and then leave
Then yeah... Your implementation is not great. I recommend using a nav link with your door that you can disable when it's locked. That way they know when navigating that they can't get past it.
I have one on it because I think it wouldn't be able to find a path otherwise (to the door).
Thinking about it, if I disable the nav-link, how would the AI inside be able to leave?
I'll go and play with it a little more. If anyone gets a flash ping me
Nav links don't need to be bidirectional.
Here's the jump ability that sends the character and then updates the blackboard value in the character.
This is the function that changes the blackboard value.
And this is the Behavior tree using the blackboard
And these arre the details on the node.
How is the jump being triggered?
It's an input that fires the "Apply Ability" after it caches the location under the cursor
Does the trajectory calculation.
Is there a way to Force update the AI controller to rethink its path after I launch its ass?
"Stop Movement" node doesn't seem to do anything :C
Your BT that is doing the pathfinding doesn't know anything about the jump. You can't spread logic around like this and expect it to magically work.
You either need to stop the tree when you jump and restart it when it ends, or put the jump in the BT.
Ooo!
Ok that makes it more understandable.
Is StateTree's ContextActor supposed to be filled with the Pawn (when running as brain component)? I'm getting a nullptr there within tasks for some reason, and don't see an obvious code path where it gets filled. Context Actor class is selected in the schema
Thank you very much for the prompt answer!
That did it! So what I did is I actually utilized the On Launched and On Landed events to clear and then set the blackboard values on landed location, and voilah!
ok I just didn't bind it... it's so easy to mistake an unbound Actor type input with an input bound to the context Actor: @crystal hatch random UI feedback if you check notifications 😄
I’ll pass it on to Mikko.
So the body should be structured to be agnostic of the controller type, and the Brain calls pawn functions to execute, etc?
Hey everyone, I have a question maybe y'all can help with.
*Ive currently got a grid based tactical game that spawns AI actors as attachments to each unit actor that requires AI
*The flow path is... the Unit actor (theres lots of these) waits its turn (float in seconds) and then calls an event that another blueprint sees (the combat system, which there is only one of) which tells the corresponding AI actor to use A-star pathfinding to decide where it should move on the grid (the grid is also its own blueprint)
*The issue is, once I reach about ~40 unit actors with attached AI doing this the game slows down.
My question is im sure theres a more performant way I can approach this, im pretty new to game development so im sure theres some way I could improve this. Let me know your thoughts!
P.S. I tried working this through with Behavior trees in unreal but because the grid is int index based and I cant blackboard those values it wasnt working out.
Correct
Why are the AI attachments? What do you mean that the blackboard can't use int indexes?
Great questions, I was building off someone elses work for the first one, and when I searched through what was available to store for BB it will accept location data, or an int, but not the int index data type the grid values are stored in.
What is in the int index that is not an int?
nothing? maybe... its a set of ints like (0 , 1) to denote what grid square its on and as I was attempting to make it a blackboard key it wasnt having it. As I mentioned im not well versed in any of this but I was able to set keys with a single int, a location vector, but not the grid int index
Can you not just set IndexX and IndexY separately?
@uneven cloud I've updated the BT from before. If you (or anyone!) has any more advice on how to improve it or best practices, I'd really appreciate it. The comments from the other day were incredibly helpful.
Hi all, I'm trying to work on navigation for a basic ai. How can i make the ai navigate around an object placed during runtime? I allow the player to build a wall, but the ai just runs into it instead of trying to get around it. The wall actor has can ever affect navigation set to true:
Nevermind, nav mesh modifers decided to start working
Assuming I need to use Decorators, but not sure the correct approach
Hi guys! I'm making a zombie-like game where there's generic ai that chase the player when seen but also want special ai that do different things based on conditions and have different perceptions. (Ex. zombie that explodes near player, baby zombies that attach to the player and deal damage while attached, or zombies attracted to light or sound, etc.)
Would it be better performance wise to do this with multiple different behavior trees and ai controllers for the special zombies? Is it better to work with less varying ai controllers or less varying behavior trees?
The AI currently use one shared character blueprint with a data asset variable for what kind of zombie, overridable attack function, and a behavior tree variable that the ai controller grabs
@obtuse igloo There's no right answer to this question. It depends entirely on how everything is structured. I think you approach with this sounds reasonable as it allows reuse and you can easily specialize via the data asset. I would suggest using Unreal Insights to profile, it will show BT performance details also, so if it looks like a big hit you can look for things to optimize
Ahhh i thought so 😔 at least i have an idea of where to start! Just thought i'd make sure and ask in case anyone had a better approach! Thank you lots 😊
Hi guys, I have a bit of an issue with a Blackboard key right now, I have created the Key to be a object type for my target, and I'm trying to assign it to my Default Focus or to a Rotate to face BB Entry, but when I expand the blackboard key selector, it's only allowing me to select the SelfActor, any ideas of what might be the issue?
Your BB key is not set to actor
Object keys are by default just plain UObjects, expand the key from the little arrow icon next to it, it will allow you to specify the subclass. If you select actor (or another actor subclass), it should allow you to choose it in the nodes
Thank you @misty wharf that was exactly the issue, I had forgotten all about that
Yeah easy to miss it
Is there anyway to see why my EQS is not setting a target on my BT?
it seems to be executing correctly but the Target actor is never Set
Visual Logger should have details on EQS query results, maybe check that
how do I look at the Visual logger? I do have a test pawn for EQS but first time I have heard of the vissual logger
It's in one of the menus, maybe it was in Tools under Debug or something like that
Open it, click on the record button, then play your game so that the EQS query would trigger, and it should show you a bunch of stuff
so base on the logger (which is really awesome) It did find a winner for the EQS
but I don't see the Target getting assigned
maybe I'm missing something on the BT Task?
or should I make my own custom BT_task has I have done before
Seems it should work. Check the settings on the run EQS node
If you have it on all results mode instead of the individual result options that would cause it to not set it I'd imagine, but not sure why else
Are you sure that's the problem?
You are using a selector node on the second branch which would cause only the first child node to ever execute
ok, so the issue is that I have the selector with the Is not set decorator, I should simply set the decorator on the execute EQS and point it directly to the first selector?
No I mean on the second one where you do rotate to face target etc.
That one is a selector, so if rotate to face target succeeds, none of the following nodes will execute
Ok, I changed it to a Sequence
So I updated it to this
but it's still not populating the target:
If it's red like that it seems to suggest the EQS didn't succeed, that should show up in the visual logger also for the behavior tree logging part
it shows but I don't see anything indicating that it failed
plus has you can see in the screenshot before, you can see who the winner is for the EQS execution
I mean it should have a separate logging category in visual logger for the behavior tree where it mentions which node is being executed and the execution results etc.
I can't seem to find that window
but o well no problem, I will just build my own BT_Task for this and use that instead of the standar, since I can't seem to make it work
Still thanks for all the ideas and help @misty wharf
alright hope it works better, this looks like it should be working so not quite sure why it isn't doing so
Hello! How do I change the height for an AI to look for the nav-mesh. I have these flying enemies and my nav-mesh box is covering them, but when I place them at a certain height they still don't move. 😦 Any that can help me what I'm doing wrong?
@misty wharf I found the issue from before, I wont be needing my custom BTTask, the EQS wanted to give the value has a Vector and not a Actor, so once I changed the type from Object(Actor) to Vector in the Blackcoard, it started working has needed
Ooh, yeah that would do it
Didn't even think of it - that might be the cause it looked like the EQS node was failing
yeah I had to build the custom and then I tested all the GetItemAs functions to see what the real issue was
What's the point of StateTree linked subtrees if I could just group everything under a common parent?
I must be missing something
Anyone know why my AI are still attacking my Player with the State.Dead tag even though its being told not to attack them if they have the tag? Do I have to make my own custom decorator separate from the one the engine already gives us to make it abort?
@obtuse igloo does the actor implement IGameplayTagAssetInterface?
the builtin gameplay tag related bits generally require that for them to work correctly
yes
Okay not sure in that case 🤔
Its okay! I'm gonna jus try making my own function to grab the players tags and hope that that works
Heyo I started UE5 a few days ago and got a question regarding AI movement. I created an enemy AI that moves around and chases the player. It works fine on default shapes (cubes,planes) but the enemy wont move on landscape, what am I missing? Thanks in advance 🙏
Why don't you debug it? You can actually figure out why it's not working. Instead of just giving up and wasting your time on making your own version.
So based on the questions you and @uneven cloud are asking, it seems like my best option is to try and get behavior trees to work to make this more performant?
I'm unsure about how i'd debug it, I checked during runtime to see if it sees the tag on the player and it doesn't return as true
The questions I asked are because you are doing a lot of over engineering. That can cause performance problems, depending on how you have implemented it. The only answer to perf problems is to profile it and find out what is causing slowdowns.
You debug it by verifying any assumptions that you have. You can do this with breakpoints and stepping through the code, but I prefer using the visual logger. Is the actor getting the tag? Can your decorator see any tags? Is the decorator getting notified when tags change? You need to verify everything.
Im most likely doing just that Luthage. I guess the question im trying to ask is generally speaking, do you have any tips or design choices that have dramatically improved performance in projects youve worked on?
Ooohh right the visual logger I forgot about that, lemmie try it then! thanks
Improving performance is entirely dependent on what you are doing and how you are doing it. There aren't "general tips," that are going to work in all cases. Improving your AI code will do nothing if your problem is in the movement code.
So I followed the Behavior Tree Quick Start and my Enemy AI just stands there. I don't know where to put the "Player" tag because that image doesn't load, so I'm lost there.
It's this tutorial in case anyone's wondering:
https://docs.unrealengine.com/5.2/en-US/behavior-tree-in-unreal-engine---quick-start-guide/
Howdy all, just wondering if anyone could have any input to a concept i have:
So, its AI Hide and seek - as im just attempting to understand AI more its less player involvement.
We got a Hider - who will stay in a location unless panicked (IE Sees a Seeker) than it will find a random place and go there and try to loose the Seeker.
We got a Seeker - Who will go around looking for the Hider, unaware of the Hider's position at first and upon seeing them will give chase.
I know i could make a simple AI move about randomly using a custom Task or random navigable location, with a Boolean like "ifSeeTarget" that'll activate either a chase or runaway EQS and than the Move To in the Behaviour tree, so i thought to try and make it a tad bit more complicated but maybe doable for my current skill level.
I want to try and make it that there are "rooms", that are defined as hiding spots and searching spots for the AI, at first i thought it could be a Collison box that simply is in the middle of a room and the radius around it is the search / hide radius, but than in my research i heard of smart objects and wasnt too sure which one would be good to pursue for this concept.
But i hope that's enough information to atleast share the intention of what i want.
Any input on it would be helpful, or avenues to look at to figure it out on my own - just unsure what to focus on instead of possibly wasting time on stuff that wont do any help for my intention.
I would just use the EQS. Adding complexity, just because is a recipe for disaster.
I presume you mean using the EQS to define areas as separated areas? I think i can maybe work with that, something like make a hidden Actor to be defined as rooms and it to be the context for the EQS off the top of my head
Or do you mean something else and i misunderstood?
No. I mean using the EQS instead of spending a bunch of extra time marking up the world with collision boxes.
Right.
Well, I'll give just using eqs another go, guess I'm just stuck in the mud with the idea and want to make only rooms hideable or searchable.
Regardless thanks for the input
What would be the easiest way to have an AI that is chasing a player, move to cut the player off instead of moving toward the player? I'm guessing you need to use the velocity/direction of the target player to calculate an intersect point and move toward that? Curious if anyone has done this or has any helpful videos. Vector math is not my strongpoint 😄
It's literally that though really.
Just do Target->GetActorLocation + Target->GetVelocity() * predictionTime; and move towards the resulting vector
(Assuming Target is valid btw)
What is your problem?
My AI Pawn won't move and I followed Epic's tutorial.
But right now, I'm gonna take a break. I'm not in a good mood.
I have had AI working without a problem for quite some time now. Randomly today they just stopped moving. All other nodes execute correctly except the moveto. This is across multiple behavior trees which lead me to think it was a navmesh problem, but I have rebuilt the navmesh multiple times and the issue did not clear up. I didn't change anything I can think of to account for why my AI wont move. Any ideas?
Wondering, is there a way in Standard UE for a decorator / selector node to know how many children are in it’s direct flow path? I want to give random chances for sub nodes to run
I doubt that functionality is built-in, might have to write it yourself
is anyone using state trees?
Don’t ask these questions, just present your issue and someone will help if they’re around and able to
just want to know how is it going. is it buggy?
From what I’ve heard, it still has some kinks but it’s generally pretty stable
does it perfom better over bts?
i really like that you can send and receive events
I believe most issues stem from having debug tools that are less good than BT ones for example, so it takes a while to troubleshoot
Some people here say STs are easier to work with, but idk about perf
Thanks for the input!
just BSing it with a “is rand value > x?” bit, it’s not what I want, but close enough
How can I modify the pathfinding system so it chooses a path slightly differently depending on circumstances?
For example I have a melee enemy that needs to attack a ranged character. I want the enemy to try and avoid line of fire as much as possible, so he'll need to walk behind cover to get closer
How do I do something like this? I know about EQS, but is there a way to modify pathfinding with it?
Modifying pathfinding for that would be kind of tricky I suspect
You could use EQS to calculate points towards the target that are away from the line of fire, and use them more as waypoints or something like that
can you have an ai perception detect objects that doesnt have the auto register as source on? Because the register thing is causing me to crash so is there any other way around it? A tutorial?
because it seems every tutorial ever that relies on perceptions needs it turned on
because im trying to do is if my ai see an object it goes to it
Sure. You can add a stimulus source component to anything and it will register it as a source
Or you can register it manually with the perception system at any point during gameplay
If it crashes it would probably be good to debug why it crashes, because it shouldn't.
thanks
hey i am pretty new to really trying out AI for my projects but i now have a project that is the same as call of duty zombies max 32 zombies spawned per round and i have very simple AI that just goes to the player no matter where on the level i have 32 max spawn per round and my performance is terrible i have enabled update rate optimizations which does help a fair amount for my fps but the fps is still really bad
You may have to turn off features like physics interaction in the character movvement comp, or try using NavWalking as the movement mode
At least based on that it looks like the CMC is taking a big chunk of the time
But you should probably use Unreal Insights to profile and find out better
thanks i will try that out now 🙂 i did use unreal insights but i need to learn it more as there was so much information
Tick Time looks pretty high and that might be separate from the CMC ticking so you might have some expensive blueprint ticks
i tried it with nothing on tick and it still wasn't happy maybe i need to remove everything from tick to see what it doesn't like
Insights might tell you more so you don't have to randomly turn off stuff
i did make a multithreading plugin but it does NOT like using multithreading with trying to get the characters location i end up craching which is pretty obvious why
well thanks a lot i will try to familiarize myself more with unreal insights 🙂
This is probably the basic things you need to know about it :)
thanks man does unreal insights only work if the project is being run outside of the editor? seems to only work that way with me
It should work in the editor just fine
It is worth noting PIE does generally run a lot worse than standalone, but at least the game bits should give some ideas on what you can optimize
yeah it seems to run much better when n full screen mode because of all the UI in the editor
that button starts a profiling trace
and the trace menu next to it can be used to open them
oh there it is you legend that explains why it only worked when outside of editor 😄
apparently this little part of code was causing a lot of issues all this code does is if there is zombies spawning inside each other it will make them have no collision to each other until they leave the collision
Yeah depends on how many are being spawned at the same time it could run that a lot I suppose
it was correct though removed it and went from 22ms on game thread to 16-18ms
lol apparently the collision was causing 1.3s added RIP
I would have expected it to stabilize after the spawning had finished but I guess if the Box component is big enough it could keep triggering overlaps on a lot
the zombies spawn from a blueprint i made which checks if zombies are to close to the spawnpoint before spawning more i should of just used that but it still makes mistakes
Something I'm doing in one of my projects is the spawn point has a box of its own which is used to detect when the spawn point becomes free
not sure which is better for performance but i use line trace to check how close a zombie is which i will be changing at another point but i did use a box collision but it kept making mistakes
traces aren't too bad as long as you're not doing too many
overlaps are ok I think, but yeah you need to configure the overlap settings correctly to ensure only the ones that you want will overlap and the logic works correctly
any way to filter it by my zombie ai and not myself i don't know which this part is saying it is for but it is draining the game thread
my character isn't really using animations it is using IK for everything but not sure if unreal clases it as a animation still
if it's a skeletal mesh using anim bp probably
but most likely if you have just one player, it isn't going to have a significant impact on the total
since it sounded like you have like 30 other skeletal characters around
i want to put my multithreading blueprint node to some use see if that helps i tried it on my first AI setup which was running on event tick RIP but i am new to multithreading and me being me put the multithreading on event tick for the code that gets the players location and yeah it crashed but now i just use the behavior tree
kind of surprised me my pc didn't crash when using multithreading on event tick lol
Unless you're doing some expensive computations I'm not sure if you'd gain much benefit from using multithreading
i did look up AI agents the ones with people showing off huge AI battles but that's in c++ which is a shame
it seems the AI's character movement component is causing most of the performance issues i set the tick rate of it to be every 3 seconds and the game thread went to 12ms and 70-80fps
should i just turn off things in the movement component i don't need or?
Yeah turn off everything you're not using
Physics interaction iirc is one at least which will run a bunch of extra checks
Changing walking mode from Walking to NavMesh walking can also be a lot cheaper but you may have to check for any jank in movement as it can affect it
oh that's where nav mesh walking was
Still did it even after I made a brand new blank game
Then your code is probably doing something wrong
If you look at the stack trace you can find out what's going wrong to give you some ideas
Ok, I'm trying the tutorial again, but when I look at my blackboard variables, it says that the Patrol Location is invalid.
Ok, I got the patrol to work, but the AI never chases the player.
What all does an AI need to "see" the player? I looked at other tutorials and help threads and according to one, the tutorial on Epic's website is broken.
The AI perception system is usually used for that
Ok, how do I use it?
I'm sure there's plenty of tutorials for it if you google for AI perception
unreal ai perception component, unreal ai perception system, something like that
Ok, the tutorial I was following did cover that a bit. Searching lead to documentation on the debugging of perception, and using it, I figured out that the AI can see me, but it never chases me.
Okay so you checked that you get the perception event correctly or what did you do?
I did this.
Okay, at least it looks like it's doing something. You would need to check your BP logic that sets the blackboard key then to see why it isn't being set
Figured it out. The variables weren't updating the keys because it didn't know the key names. Whoops.
There is nothing to "turn on".
Are you using UE4 (world composition) or UE5 (world partition)?
UE4 is a lot trickier. I don't know if any guides that actually give the right steps, but I can type them out in about an hour.
Using state trees, is there a way to write to variables, so far I can read/bind but having no luck writing back to them.
@unborn jungle couldn't get it to work reliably
You would typically do this via exposing the data you want as an output parameter in the instance data so other tasks can bind to that
in the context of state trees, where would this instance data live? is there a specific way or do I need to manage that myself via a uobject or something?
Are you using BP or C++
The steps are weird, but trust them. I've shipped a couple of a games in UE4 streaming static nav meshes.
-
Turn off auto generate navigation in the editor settings. This will break things if it's turned on.
-
Make sure there is a nav mesh bounds volume in the persistent level. It doesn't even need to cover anything on the map. It just needs to exist or it won't build properly.
-
You can put bounds volumes in the sublevels marking the areas where you want navigation.
-
Load all your sublevels.
-
Delete all recast actors. If there is one in a sublevel, it will not work.
-
Make your persistent level to be the current level.
-
Build paths. And save. You can unload the sublevels and save again.
-
You should now have a recast nav mesh in the persistent level. This is not the nav data. That it automatically saved in the sublevels. The nav data will now be loaded when you load the sublevel.
-
You can make a commandlet that builds your navigation when you change the map. I have a build server that does this anytime a map is checked in, but they can also be run locally.
Nope. You need to load them all into the persistent level. It will not work to build paths in a specific sublevel. The Recast nav mesh actor is not the nav mesh. It's an actor holds all of the nav mesh chunk data.
The nav mesh actor can ONLY exist in the persistent level or it will break.
No. The navigation chunk data will be saved to the sublevel. When the level is loaded, the recast actor stitches the chunk data (stored in the sub level) together.
Yes, it goes through all sublevels that are loaded and builds the navigation data.
I don't know how to explain in a way that you understand. You will SEE one nav mesh building on all the loaded sublevels, but that's not where the DATA actually lives.
You see it, because all the nav data is loaded. It's not a workaround. This was Epic's own workflow. They improved it a lot in 5.
EQS question (created a query grid to find spawn points. It’s returning locations correctly which is great. Next part is I wanted to do a distance score where it’s calculating distance from the grid point to a specified actor. How can I accomplish this? I don’t see anyway to pass a variable into EQS or something so that I can set the actor it’s calculating distance to.
I know how to add a distance test, just not how to pass in an actor to calculate distance to.
You typically would do this via an EQS Context
The context can pull the actor from somewhere, such as a variable on the querier actor
There are not overlapping nav meshes. When the nav data is stitched together it's 1 nav mesh. I don't understand why this concept is confusing.
It's like a quilt that is made out of squares stitched together. When the sublevel is unloaded, the square is removed.
That is why it doesn't work. You really shouldn't do that, but if you are convinced that's how it should work the trade off is you can only use dynamic generation. Not sure why you thought static nav mesh would work.
Most games that are small levels that are loaded in and out are built as separate maps. Not sublevels.
Anyone have any ideas on why the "MoveTo" task in behavior trees doesn't work with vectors? I was stuck on this until I switched it to an object
Doesn't work if its not world space coordinator
It does
You prly just didn’t set the bb key properly
There is another basic movement component, the floating pawn movement component
but still pretty basic
You can use Add Movement Input
Okay how does one reference an actor in an ai task for it to move to, like i see ppl say use blackboards but still confusing because you have to reference the object. Ive seen ryan make his video on ai but it still confusing me because its towards the player and not a random object. Also i dont like using the get all things because it will effect fps.
You have to decide how to get the actor in the first place. What's the best way depends on what exactly it is (eg. is it just some common thing, is it via npc perception, etc.), beyond that it's just a question of assigning it to the BB
The get actor of class node is entirely fine to use if you understand its limtiations. It isn't going to affect FPS unless you call it on tick many times.
ok
for example a npc going to bed, if its near
Right - so you would need to decide how the npc would find nearby objects to consider
For example you could search all beds by distance, do a sphere overlap test for beds, or use smart objects, etc.
Like im trying to find other ways to references because its bugging me mentally
The ones I mentioned are probably the typical ways to go about it
the main problem is to get object reference withing a ai task idk if that got across
Searching all beds by distance is pretty fast unless you have a lot of them, a sphere overlap can be reasonably quick as well. The Smart Object system does some internal optimizations to find smart objects by location and things like that