#gameplay-ai
1 messages ยท Page 18 of 1
No it doesn't require perception.
@ocean wren thanks
cant figure out the node i need next. i need to keep track of each ai speed and when they stop moving, they deal area damage
Is there an event for initializing nodes when a BT first starts running? I would like to cache some values in the node based on the AIOwner
I don't want to cast and set them every time it is executed
Is there a way to make a dynamic context in C++? I tried in BP and it didn't work. (I'm logging the pawns last location and trying to use it to score the EQS Query. I know I could hardcode that value into the context but I was hoping to avoid that.)
i was def doing that wrong. i updated it to use delay tick and have a solid system to detect when AI reach a speed of 0. just need to make it start causing damage to placed actors.
heyo got another simple question for you AI folks, any idea of how I would cast to the character blueprint from the animation graph? here's the solutions i've tried but they all seem to end up with an invalid cast
if u look at my post above you im doing that using an event
aye, thanks. I'll give that a go
yup still need help. cant figure out whats wrong. the building isnt taking damage but the print text says its activating as its supposed to.
i disconnected ignore actors and its killing the other ai so the damage def works. just need to figure out why its not damaging the non ai actors
Hey, apologies for the late reply. I was bloated with tasks yesterday and forgot to answer. If you are still stuck @harsh storm might be able to help - I couldnt find his solution for that from message history
@ocean wren quick question, if I would want to implement ORCA to UE, how much pain I would be into?
Hi everyone, can anyone help me please? AISense_Sight is not registering actors in front of it. OnTargetPerceptionInfoUpdated event is just not being called and my whole logic fails.
Maybe you can iterate the FStateTreeExecutionContext::GetActiveStates and see if your state is there. I only started looking into StateTrees yesterday but really didn't see many (or any!) useful callbacks.
All good thanks for the help, the link to @harsh storm earlier post helped a lot too. I think I have a fairly good grasp on how to get everything working now. One question I have is: what is the difference between defining FStateTreeExternalDataDesc in the Schema vs. adding Params to the StateTree? They seem functionally the same to me?
FStateTreeExternalDataDesc is outdated with 5.1
but it can be used for declaring schema parameters in the header
its somehow related with linker iirc
Ah yea the linker thing you mentioned, I kind of skipped over that and went with the parameters
i think to declare default params you still need it though
I did see mass used the linker a lot
Hmm maybe I should look at 5.2 source code to see what is deprecated
evaluators ๐
really? I thought those looked quite useful. I suppose you can always define a task which is always running
yeah, there was a PR mentioning it was either replaced or will be replaced with global-ish tasks
(also thanks for making my life easier with blueprint assist ๐ฅน)
Nice doesn't seem like there are that many breaking changes between 5.1 and 5.2
How do you make a state end when a delegate is called? For example in my state I want to activate an ability and it will wait for the AbilityEnded delegate then I want the state to change to EStateTreeRunStatus::Succeeded.
Looking around the source code, I saw a method where you:
- define a bool in your
FInstanceDataType - bind on enter state to set the bool to true when the delegate fires
- check the InstanceData bool on Tick to return Succeeded
Is this the only way?
thats how I did
I noticed that there are state tree events, could those not be used to chance state like asked above? Or did I completely misunderstand the purpose of those? Havent really explored that yet ๐
State transitions have an event trigger condition
Do you mean adding a new transition to the task and setting it to trigger on event? I think that actually would work for this case ๐ค
but that would enforce you to add transition condition for each time you want to use it
a generic state would use tick
Yea that is quite the downside
Yeah this would only be useful if you have a set path you want to transition between. ie in your case your ability ends and sends an event, but then the state you executed the ability from would have to have a transition set up to go somewhere else when that ability ends
Hello dear AI-Hivemind!
I'm currently transitioning a bit of BT logic to ST, and therefore recreating a task I had before.
The task I have is basically taking one of my predefined Action Objects (Move To, Activate Skill, Attack,....) and executes it.
My issue: how do I bind data to these instanced Action Objects?
As this is a general task, I don't know which Task I'll have.
I found out that I am able to bind data through putting my Action Parameter into an InstanceData Struct and pass it to GetInstanceDataType().
The AIActionToSpawn has the UPROPERTY(Instanced) specifier, but the Actions' Parameters are not bindable.
How could I do that?
I would simply create a state tree task for every type of "AI Action" you have, that is simple to set up.
If you really need to have dynamic binding, you need to implement that on the C++ level and dynamically bind to your objects using something like the external linking.
I dont know your exact use case of course or what your "ai actions" are but it sound like unnecessary complexity to have a generic task that just picks another task?
Example of the linking:
bool FStateTreeDebugTextTask::Link(FStateTreeLinker& Linker)
{
Linker.LinkExternalData(ReferenceActorHandle);
return true;
}
And in the EnterState:
AActor* ReferenceActor = Context.GetExternalDataPtr(ReferenceActorHandle);
You could in theory do some reflection to dynamically bind the fields on your AI Action (which I assume is a UObject?) to the state tree task
anyone familiar with blackboard based conditions, services and selectors ?
Thanks a lot, I'll have a look at that!
I am doing a tactics game. The thought behind my AIActions: they form a common command language that every character can consume, be it ones that receive them from an actual AI or from a player. Also they are queueable and can depend on each other.
So is there any need to expose those to the UI in statetree at all? You can create a task that processes that queue and puts it output into a context to be consumed by the next task in the state tree.
What is the purpose of your state tree if you have something else that processes commands both from AI and player?
Or you want the StateTree to be the "brain" that processes commands from the player?
So is there any need to expose those to the UI in statetree at all?
I guess? I just started out with the STs, my impression is that the ST and context actor hold the data/parameters which are consumed or modified by tasks, conditions, evaluators. That was at least the setup I had with the BTs, where I would pass a BB key to the tasks to work with.
What is the purpose of your state tree if you have something else that processes commands both from AI and player?
The state tree's purpose is the tactical decision making for AI characters. Different behaviours (like flanking, supporting other characters, pinning down enemies) are basically just a set of actions, that the ST gives to the AI.
I meant if they are bound and the person authoring the state tree has no use of entering values into those fields, you can just bind those parameters without displaying in the ST task.
--
Different topic. Those of you that have been using StateTree for a while, I'm a bit confused about tasks returning Success vs Failure.
Code documentation states:
"@return Succeed/Failed will end the state immediately and trigger to select new state, Running will carry on to tick the state."
If a task returns EStateTreeRunStatus::Failed it will indeed fail the state, prevent further Tasks in running and trigger a transition.
However if I return a EStateTreeRunStatus::Succeeded then.. nothing happens at all? Further tasks run and the state doesnt trigger a transition.
Using UE 5.1
Ah yes, that was also my next thought, and probably the next easiest solution
I have a blackboard based condition with abort lower priority, which clearly highlights to the sequences on the right side, but when the BB condition is set true, the sequences on the right side do not abort
As for my above question, this seems to be fixed in 5.2 ๐
https://github.com/EpicGames/UnrealEngine/commit/05927bbfe845fbfe5fc7d0642095236b861fd131
Hello! I'm getting stuck on a navigation issue
I'm trying to make a move with a follow actor and I have navArea marked as excluded. But I noticed that the follow actor has a tendency to allow itself to walk in excluded nav areas the only exception being the UNavAreaNull which has this comment ":
/** In general represents an empty area, that cannot be traversed by anyone. Ever.*/
In my case I need to use tagged nav area to mark specific areas and I would like my excluded nav area to behave like the UNavArea_Null. Even if I make a cpp or blueprint child of UNavArea_Null the navArea does not work. I suspect that the problem comes from a check like this in the REcastNavMesh.cpp engine:
if (AreaClass == UNavArea_Null::StaticClass())
{
return RECAST_NULL_AREA;
}
So if anyone has an idea to prevent AI agents under follow actore movement from walking into excluded nav areas like it does with UNavAreaNull. I'm interested!
Looked a bit at where the engine uses RECAST_NULL_AREA and it looks like it does what you suspected. It seems to get used in RecastNavMesh to generate (or rather not generate) the NavMesh geometry itself. It looks like the navigation system is written with strict class-to-ID mapping, so getting it to return that ID for a different area class could have unintended side-effects in other areas of the engine. Even if you somehow override it to return the null area ID in recast, NavigationData.cpp generates a AreaClassToIdMap using the area class name and its index in the SupportedAreas array. I'm not sure what kind of discrepancies that could cause.
Maybe someone with more knowledge of the navigation system can help, but worst-case scenario, writing a custom recast class is always an option. ๐
This looks helpful
FRecastQueryFilter::FRecastQueryFilter(bool bIsVirtual)
: dtQueryFilter(bIsVirtual)
{
SetExcludedArea(RECAST_NULL_AREA);
}
Maybe you just need a custom FRecastQueryFilter somewhere?
Can you explain what your intended behavior is?
Thanks a lot for your answer ! I can't wrap my head around why under follow actor movement the agents can so easily move inside excluded nav areas. I feel like I'm missing an obvious parameter in the engine ๐ตโ๐ซ . Not generating the nav mesh on those areas would break many parts of my project, I'm starting to think I have to pull collision everywhere ๐ฅฒ
I recommend using the visual logger to debug it. It should show what exactly is happening.
Something I learned recently was that it's not hard for AI to make their way off the navmesh when modifiers get applied to their velocity. I'm pretty sure RVO, bRequestedMoveUseAcceleration, AddInputVector/AddMovementInput, and plain old physical forces are other possible culprits.
I think @uneven cloud is right, though. A visual debugger should help.
My want my agent to avoid specific areas, which I marked using a custom navArea, my agents most of the time avoid the navArea marked as excluded in its nav filter but sometimes it breaks in and stay stuck inside the invalid nav area. And this never happen aroun UNavArealNull
And also shoutout to @uneven cloud for the super helpful optimization tips dropped here the other day! Took a lot of notes from that.
Does the area move? Why is it a custom nav area instead of Null?
No ! I need a UNavAreaTagged to identify it later in the game
Can you identify it by anything else later? Nav area null is a very special case and any other nav area can be made to avoid, but still end up there. You can also double check with the vis log that they are actually pathing through it and why, which may be fixable.
The blue area is my excluded nav area that nearly managed to keep my agent from entering
I forgot to tell you that I was using the crowd manager ๐ตโ๐ซ . Playing with the visual logger and tweeking the parameters made me realize that when I disable the wall avoidance from the crowd manager my issue seems to stop ! Thanks a lot I'll look into this !
Yeah this is the kinda thing I was referring to. RVO/avoidance doesn't change the calculated path, it adjusts velocity based on the character configuration and agent settings after all the pathing has been calculated, which means it can nudge characters off the navmesh in some cases.
Or over level edges
question what the best way to make ai find out which table they can go to. i know i can use bool to set table open but if i have multiple of them that gonna be alot of bools. what the best way to make it dynamic to where i dont need to keep manually adding that the table or chair is occupied
tried looking around for info but didnt find anything
I would recommend looking at the smart object system.
It should be usable in BP
ok thanks ill take a look in to that.
cant find where the ai is being controlled in the LYRA project anybody know what folder or cpp class?
I'm in lyra. Not sure how I broke the AI but The enemy bot is getting correct pathing, It perceives me and its running running the "MoveTo" Node but does not move at all laterally from its spawn position. I think this is the root cause of some other issues i'm having. I cannot figure out how to fix this
What do you mean by controlled? The Behavior tree?
Hi all, i recently came across a issue with AI specifically when level streaming levels with Nav Meshes and static meshes in them, currently my biggest issue is the Nav Mesh wont generate on static meshes it seems to only work on terrain causing the AI to merge through static mesh floors and other objects
only terrain seems to have the nav data so is there anyway i can fix this?
do your object have collision on them?
Are you using world composition or world partition?
yes collision works fine until the AI try to navigate since in some areas my terrain goes under the static meshes
world composition
World composition can be tricky with navigation streaming. How are you building the nav mesh?
i am building the navmesh dynamically at runtime.
its only a small area where the nav mesh is so its not like huge or anything
In that case, my best guess is that the navmesh is being built before the level has fully streamed in.
i actually tested this before hand cause i thought the same thing however when streaming in the level with the navmesh through a console command it seems to only generate on terrain
stuff like ramps will have big issues such as the AI merging through it because its following the terrain underneath not the static mesh
That doesn't sound like you have proved that it's not a race condition. I would first check to see if you can build the nav mesh in the editor by having that section loaded.
If the AI is merging through ramps, it also sounds like you have a collision problem.
its weird cause if i have no nav mesh data there the collision would work fine just the AI would obviously not be able to move
i have built the nav mesh in the editor several times before and the nav mesh green area seems to only generate on my terrain
im wondering if there is some settings i am missing in the static mesh component or the static mesh asset itself
i will check one more time though just to see
with shift + " ?
that one?
The visual logger is under tools/debugging. https://docs.unrealengine.com/4.27/en-US/TestingAndOptimization/VisualLogger/
the abort self is saying ( true : fail ) but its not even failing
on the selector above i have a simple service that executes on tick AI , it calculates the distance to the enemy, if the distance is more than 1500 then it toggles the blackboard value "FarAway" to true
and the bool works just fine
those look like custom blueprint tasks
are you by any chance using any timers in any of those?
that can cause async badness causing the debugger to lie to you
no timers, this is the distance calculator
whats inside follow enemy?
because i want pathfinding
yes
and what if my enemy pawn failed to move towards me?
then the sequence fails and tries to do something else
since you have that decorator aborting lower priority tasks either it will switch to a higher priority task or keep running your sequence
Im trying to make my enemy sprint towards me if i am too far away, but if im close by then it should just walk
thats not really a behavior tbh
also my enemy actor key isnt showing here
yes it is in my blackboard
objects don't have locations
base class
it's slightly hidden
got it, thanks
as for the gait thing
you could make a service that ticks say every second on your moveto node
yeah but things on tick are dangerous for performance right
which then checks the distance and changes the gait accordingly
it's complicated lol
the performance killing tick refers to running operations every frame
but services have custom tickrates
I see
so a service with a tickrate of 1 second will occur 1/60 as often as a true tick
which is nothing
the event tick runs every 0.01 seconds doesnt it
yes i noticed the BT tick runs slow and steady
to reduce confusion it would be more accurate to call the service tick, timers
yeah
can do the exact same thing in a bp with a timer node
but services are convenient because you can just stick them on a task and they only run when the task runs rather then making sure to turn off your timer in a bp
yeah, if i do it all in my character bp then i gotta cast to ai controllers, then from that to the behaviour trees
all that
extra
Thanks a lot man, I missed the message ! Kinda tricky to tweak the avoidance in a nice way
hello everyone. Quick question: Does anyone know how do I toggle the pathfollowing debug display? In particular how to toggle whatever calls this method UPathFollowingComponent::DisplayDebug
its likely its a cvar
shift + f12 to the function and see where its called
either vlog or some cvar
at worst case some showdebug command
it was showdebug, thank you
this didn't show what I wanted lol Is there a way to show the path an AI is following? the AI debugger doesn't show and from what I could gather the VisLog only shows the point you're moving to
Im trying to make an invisibility mechanic, but i cant seem to figure out how to make the ai stop detecting the player when the ability is on
i have tried a bunch of different things with the blackboard keys, ai controller and the behaviour tree and none of them seem to work. I also have found it hard to find info about this online
do you guys know any good ways to set this up?
Two ways come to mind off the top of my head:
- Have a decorator which triggers when player is invisible, which would allow you to abort branches of logic
- Add logic into the sight perception handling which checks if player is invisible (if player becomes invisible when already perceived, you may need to force it to recheck visibility)
ive tried both of those ways, maybe im just doing it wrong?
im fairly new to ai, first time doing it so its hard to tell lol
well at least for #2 all you need to do is cast to player and compare if it's invisible, if it is, then you set the BB value for target to null instead of setting it to the player (or however you have it set up)
this is checking the material of the players mesh
i sent it to the bb and tried using a decorator
but that just refused to work even slightly and idk why
You need to debug it then to find out
It looks like the basic idea should work but it's hard for me to tell just looking at it
this is the bt too
It doesn't seem to be set to abort based on when the invisibility changes, can't really say much else about that
if i dont want to use smart object is there another way detect chairs in the level that are empty for npc to go to. smart object seem to be a bit complicated with not much documentation as it very new.
You can do it in any way you wish. Super simple method would be to get all actors by class and then check if it's occupied, but it might not be a scalable method for more complex systems
yeah i was thinking bool but then i would have to set it for everything since it a management game there always going to be different amount of chairs. trying to think the best way to not have to set bools
Yeah there's different ways to do it... I haven't really looked at the smart object thing yet so not sure how that solves this
For example, in your Chair actor you could have a method "Reserve" and "Unreserve"
so when someone sits on it, they Reserve() it, and other actors that are looking for free chairs can check if IsReserved() is true/false
yeah the smart object does basically that set object to being claim and unclaim but seem to be alot more work
Is it a good idea to make LoseSightRadius smaller than SightRadius in AI perception stimulus? I want the player to be able to escape more easily if AI does not see it.
The problem is that if i'm outside LoseSightRadius and inside SightRadius, GetActorsPerception returns a stimulus with SuccessfullySensed value randomly set to true OR false, which seems a bit weird... So I have a feeling that LoseSightRadius should not be used in this way...
Should I define my own radius for this or should I do logic based on AI perception's lose sight radius?
but to do the i would have to make box collision on the chairs to have them check if it a npc and if so to set it being reserve i think that can be done pretty easily
Yeah you could do it that way too, but that could potentially have multiple NPC's try to sit on the same chair simultaneously until one of them succeeds
In a system where the NPC who wants to sit on it claims it up front you can prevent it, since the chair will become claimed before the NPC has actually finished all the sitting-related actions like walking up to it and doing animations
that true. i will test them and see which i like better
Yeah sounds like a good idea :)
Sometimes it's hard to know up front which works unless you try to implement it and see how it is
You definitely need a "reserved" and an "occupied" state.. reserved for someone being on the way, occupied for.. occupied. The idea of reservation is so important.. also, you might want to ensure that occupied spots have some method of excluding people if they navigate past the spot.. I had cover where they NPC would reserve the spot, but then try and path through another occupied spot to get there..
Only thing is missing currently is UFUNCTION binding 
But I hope that'll happen to 
understandable. ill be working on those tonight and try to flesh out a prototype
https://youtu.be/HharcK84VQI?t=171 Can anyone confirm that this PlayerContext option for the Trace Test is a default test value or something that needs to be added?
In this series we will be creating AI for a shooter game, including behaviour such as shooting, seeking cover, flanking, and random personalities (courageous, skilled etc.).
If you want the starting project file with the animation and shooting code already prepared for you rather than use your own shooting code, head over to Patreon.com/ryanlal...
link is time stamped
it is not an option in my current version of 4.27.2 or 5.1
the PlayerContext is most likely a custom Environment Query Context
I'd imagine he explains how to set it up in an earlier video, but I suspect it's just a very basic context which always returns the player pawn
You are correct. Link is timestamped: https://youtu.be/3-jDztCAkk4?t=80
In this series we will be creating AI for a shooter game, including behaviour such as shooting, seeking cover, flanking, and random personalities (courageous, skilled etc.).
If you want the starting project file with the animation and shooting code already prepared for you rather than use your own shooting code, head over to Patreon.com/ryanlal...
he created the playercontext there
having a tough time translating this into multiplayer.. still unclear how to get the owner of the query.
these tutorials only use player character 0.
I need to get this AIs CurrentTarget reference, which is set after filtering through several players.
@lyric flint if there is a better video I am open to it lol
anything that is not ryan laley
whaaat. that is the first time I have heard that from unreal slackers
usually people rate laley pretty high
but maybe i sort of agree lol for this situation.
open to links to other video series that go over creating a cover system with eqs
yea i cant even find the behavior tree
Does anyone know the cleanest way to run an EQS query test from the querying actors previous location? I've figured out some ways to do it, but they're just to messy and convoluted. Any ideas would be helpful and appreciated. (Also I'm doing the logic in BT)
The query owner is sent to you in the function that you posted.
Use a context to get the location to the EQS. You'll have to cache the previous location on the actor itself.
Can anybody tell me why my monsters randomly stop chasing?
left one is patrolling
right one is clasic chasing bp
So I added another layer of sense check, hope it works,
it probably stops chasing because you're running move from tick, every tick you run another move request. what are you trying to achieve?
i mean your delay might be the reason why
An ai chasing me, but when it isnt see me for 7 seconds, it needs to stop chasing and start patrolling
that's bruteforce, not AI
use ai sensing/perception to detect the player, then write that to the blackboard and use the behavior tree to move to chase the player
i have an ai controlled pawn that is using a floating pawn movement component, I set that it can fly, and disabled gravity. It still won't seem to go very far off the ground (seems to stop a bit higher than my characters head, maybe z = 250ish) is there some other box i need to check?
it just runs the "move direction towards" node on repeat, have never tried to use the behavior tree with a flying pawn before so i am probably missing something simple
Looks like I need to watch some tutorial videos again...Maybe its time to learn behavior tree, thanks
anyone can help with my above issue with ai ignoring my booleans.
how do I get AI to use a specific nav mesh? my humans are dead set on using the vehicle mesh regardless of what I set my agents radii. I tried changing the navdata but it crashes whenever I try to create a new and this class doesnt show up in the blueprint class list.
How do I get the owner of this EnvQueryGenerator?
Seems like this is not the query owner like we thought.. or at least what i understood from your response
breakpoint never fires, or maybe aicontroller is really not the owner..
i did try both actor and object options.
The pawn is the owner
have a venmo? youve help me so much, so many times, with my actual job lol.. would like to pay as you have directly enabled me to move forward on a few tasks.
dm me your venmo?
Happy to help. I'm actually paid way more than I need. Thanks for the offer though.
Any way to know with the context Ive provided, when to use Actor and when to use Object, in that last screenshot?
Depends on if you turn on allowing non pawns to be the query owner. It's in the project settings. Then the query owner might be the AI controller and the query actor is the pawn.
Or it's just the query owner has been cast to an actor. I don't do a lot of BP and haven't dug into that specific difference.
oooo shooot! so this would have enabled my "cast to aicontroller" to work?
@lethal helm is it okay to use blackboard conditions on tasks?
any way to expose this as a variable or modify it through BP?
You're going to need to create a custom version of the MoveTo node
is it possible to get a navigation path that goes over shorter objects? Like say for flying pawns that can fly over rocks that a ground character would have to walk around
or right now I'm thinking I could do a line trace to each of the next path points till I cant see it
You could probably achieve this using nav areas
Make the rocks instead of blocking navigation entirely use a specific nav area, and your walker navigation queries would use a nav filter which doesn't allow navigating through the rock areas
right now what is blocking the nav, is just a static mesh. I would add a nav modifier to it? Not seeing just a setting I could set
I don't remember how it would work off the top of my head for it tbh. You can remove "affects navigation" from the mesh, this will at least make it so that the navmesh will get generated as if it's not there
yeah, but I will need it there once I have enemies wandering around
Either way there should be some way of using a different nav area for them... maybe via another component
added the nav modifier, and it did add obstacle areas, but not completely, will do more testing. My other solution attempt caused other wierd issues
Hm. Made a custom modifier type, didnt help.
Maybe you need to have it generate a second navmesh which is used by the flyers, with a higher step up value which would potentially allow it to just "walk over" those
well I dont actually have any AI yet. I'm just trying to get a clear straight path from the start to end of my procedural dungeon
if I dont spawn the rocks, I get a clear path that is exactly what I want. But once the rocks are there it messes with the navmesh. I tried to get it to generate the path before spawning the rocks, but I dont know how to get BP to make sure it finishes X before doing the next node
Does anyone know the name of a function I could use to just check if a path is available?
it turns out I had to uncheck "project goal location" which is checked by default, in case that ever helps anyone else
Is there a cheaper way to quickly query if a path is possible to a given location or not than using this func?
if (UNavigationSystemV1* NavSystem = Cast<UNavigationSystemV1>(GetWorld()->GetNavigationSystem()))
{
if (UNavigationPath* NavPath = NavSystem->FindPathToLocationSynchronously(this, StartLoc, GoalLoc))
{
if (NavPath->IsValid() == false || NavPath->IsPartial())
{
// NO PATH AVAILABLE
}
else
{
// DIRECT PATH AVAILAABLE
}
}
}
@unborn jungle I assume there is a way to do this Async... ๐ค
Then you could do it in the background I suppose
Sure but I wonder if there's another cheap helper func that doesn't need to calculate a path and can just quickly see if the nav mesh segments are connected or whatever
I may be able to use the enum that MoveToLocation returns and act if it's of type OffPath since my AI are already moving
Leaving it on means you are guaranteed to know that the querier is the pawn. Turning that off means it could be the pawn or the AI controller.
You want to use nav areas and filters. Filters allow you to set how specific AI treat nav areas.
UNavigationSystem::TestPathSync. I recommend using a hierarchical test.
UNavigationSystem::TestPathSync. Using a hierarchical test (doesn't find the best path) makes it rather inexpensive.
Thanks I'll try that! FindPathToLocationSynchronously seemed to be very expensive when many AI agents are running it frequently just as a query
I turned it on and tried to casttobp_aicontroller and only worked in one case and not the other. Worked for the PlayerContext "provide single actor" so that was fine. For GenereateCoverPoints, I still had to get the Querier, then cast to pawn, then cast to controller. Both screenshotted in your reply.
It can be. It's worse if they are trying to go somewhere they can't get to. I use the EQS to find locations and always filter out using the hierarchical test path and I rarely have navigation perf problems.
I've noticed a potentially even cheaper method, since my agents are moving anyway, I can query their current move result if it's a partial path or not and if partial I can determine that the goal loc is not reachable
Just getting a partial path is expensive, because they need to not be able to find a path.
Yeah! However in this case they are doing the move logic regardless and I was doing an ADDITIONAL FindPathToLocationSynchronously call to determine if they can't actually reach their goal
So at least both can be satisfied without needing that FindPathToLocationSynchronously if checking if the path is partial
i am also clearing the reference object once one ai get to the location so that the ai doesnt pick up on that location
So I'm trying to make my own StateTree task using pathfollowing component to move an agent on the navmesh and get notified when a path event occurs. Although, I'm not sure where to store the related delegate handles...state task variables are wiped out on each execution if I'm understanding this correctly. I saw that mass move to monitors the state of the move action directly by accessing the path... should I be doing the same? Any suggestions?
how do I set Paramter value in StateTree ?
when my Task is Done I want variable X to be increased
Is there a way to tell UEโs default AIMoveTo to move up and down the Z axis? It seems to be able to do it on its own when it wants (and set to flying) but if I try to force it to a certain Z value it doesnโt move vertically or it stops moving altogether. Iโve done a lot of digging into this and all I could find is that Iโd basically need to make my own navmesh. Is there a better way to do this?
Instance data of the statetree task
If you are looking for a fun move the logic of the path following comp to a struct and have that struct as FInstancedStruct, do the path following with that struct
I'm working on this right now, FInstancedStruct lets me have custom type of path following for each task
Someone was just asking about a similar problem earlier I think? I've never tried it but they said a Project Goal Location checkbox needs to be unchecked. #gameplay-ai message
I'm not sure if it applies to your case but it sounded similar.
They were talking about flying so I assume they meant the same thing. The navigation system was projecting the goal location to a point directly on the navmesh surface by default. That is, taking the goal point in 3D space (which generally is not precisely on the navmesh) and figuring out where it would lay on the navmesh surface for "2D" travel, then uses that as the goal location instead. That's usually what people want to happen for things travelling on or near the ground. That's why they needed to uncheck it for moving higher up to work.
Maybe I'm still misunderstanding, though? Hope it helps.
I've seen marketplace assets specifically for more complex 3D pathing so depending on what you're doing you may need a custom solution.
Idk if this is intended behavior or not
but when you switch to a new behavior tree (while the previous behavior tree is running) that has a diferent blackboard, the previous blackboard gets variables overwritten
that kinda seems like a bug to me, wondering if I should submit a bug report
because it overwrites instance synced variables
Oh, that might make sense, Iโll look into that thanks @strong cargo
No problem! Let me know if that ends up fixing it. I haven't done much with 3D pathing yet but will be diving into that sometime soon. ๐
im testing out smart object and i see the object that are smart in smartobjectcollection list but when trying to find those object i get 0 that come up from the results.
followed the documentation from unreal site
@strong cargo that did not work for me sadly. I think with him it just wouldn't go higher than a certain altitude but it would still move there. My moveTo ceases to function as soon as I add +300 to the z value before inputting the location vector. There was no Project Goal on Navigation on AIMoveTo but I tried it with Move to Location or Actor and set that setting to No, and it still yields the same result.
it's likely just my brain not being able to translate what I want to do into code yet, so I'll keep at it
I currently have a spline-path setup for a set of npc racers, but I will be adding in some moving obstacles on the track. What would be the best solution for having the AI avoid the obstacles?
I originally was using navmesh for it, but while it (usually, sort of) avoids obstacles, its incredibly slow in general.
I was thinking maybe having the spline points of the path moving during gameplay, so the pathing updates depending on where the obstacles are?
Unless there's a way to combine the fast-racing of spline paths, with the object avoidance of navmesh
Prefer "steering" instead of manipulating the path
sure... but how
Trace from agent, manipulate movement direction from path following comp
Based on trace result
Been doing some early exploration with the new statetree. When first sitting down to build some C++ tasks, I noticed that the C++ base I would expect to use (FStateTreeTaskCommonBase) is tagged with umeta=hidden, so it doesn't show up in the New C++ class UI in editor.
Is this just a side effect of it being hidden to avoid users creating blueprints off of it, or am I missing something and this is a clue that I shouldn't be deriving C++ tasks off FStateTreeTaskCommonBase.
Apologies, also a bit curious - it seems the state tree component is generally hardcoded to assume it's placed on a pawn rather than a controller. Anyone know why this is? I'm used to the standard separation of AI logic on the controller while the pawn is more like the "actuation" layer that can execute the decisions of the controller.
Edit: Hmm, just looked a bit deeper and I was mistaken, the pawn specific code I was looking at is actually conditional and there are other paths for non-pawn owners. Will keep digging, don't mind me ๐
I guess my confusion is rooted around the StartLogic() call in the StateTree component's BeginPlay not executing if the AIOwner is already setup, which it will be if the statetree component is on the controller rather than the pawn. Calling it manually in the blueprint fixes everything up. So odd.
I think the general idea with StateTree is to make it a generic gameplay state machine tool. You can use it for AI but that is not necessarily its main use case
Also if I understand correctly they are trying to decouple stuff from the ai controller as much as possible ๐
never mind i got smart object to work after doing a few breakpoint finding that it wass getting 0 as a reesult and it was because the make box part was incorrect. i change it and now it finding and claiming the chair it goes to.
hey guys, how to use "AI Move to" without rotating the AI character?
@clever skiff was this smart object an alternative to using goal locations ?
this was easiest if you want an NPC to claim something like a chair or a item you want it to use with out having too do abunch of array or bool. you can just find the smart object and the sub system will do the rest with locking that object usage until you tell it to release it.
so to me it was worth reading the documentation on it
Nice good to know
the sims use this system alot. so im glad it in ue.
I have agents that are supposed to detect the player (which plays as some kind of spirit) but also enemy npcs from other factions
the issue is that the rules to detect both are very different, both are similar to sight but detecting the player has a 360ยฐ cone of vision in a very short range while detecting other npcs is more of a normal sight detection
can an AI safely have two perception components?
I'm also thinking of using hearing or a custom type of sensing and then checking for LOS but I don't know how LOS is implemented for the sight component (iirc it can detect even if part of the object is visible)
another solution would be using the max of both values (so 360ยฐ and long range as with enemies) and then checking the vision angle to see if the agent isn't looking at an enemy behind it and check the distance to see if it's detecting the player at the appropriate distance
You can always build on top of the perception system.. just add some filtering to your perception system to remove percieved actors that aren't what you want
so this solution?
making my sight detect everything then filter ?
Yeah, basically, I did it by adding a number of thresholded filter components that could take a perception and filter it so I could add stuff like being in cover, being in concealment, being prone or crouched etc..
So the basics is just "here's everything that COULD be percieved" and my system added on top of it to then return the actually percieved agents (and some debug to demo what was adding to that perception value)
highly recommend making some debug graphs for this stuff.. hard to understand otherwise
mine had angle based and distance based values from curves too
I managed to get to a working solution for StateTree AI pathfollowing task. but I don't really have the knowledge to understand how bad it is. Can someone help out? My approach is the following:
I start a move request on EnterState in the STTask. Then if request is successful, I bind to the OnRequestFinished in the InstanceData. When the delegate is called in the InstanceData, I update the PathFollowingResult (also stored in InstanceData). I then poll this value in the STTask Tick to determine if the task succeeded or not.
Doesn't sound too bad in words until you see that the only way to bind a delegate in InstanceData I found is the following:
InstanceData.PFRequestFinishedHandle = PFComp->OnRequestFinished.AddRaw(&InstanceData, &FAIMoveToTaskInstanceData::OnMoveCompleted);
Also, this requires the handle to be mutable.
struct FAIMoveToTaskInstanceData
{
GENERATED_BODY()
UPROPERTY(EditAnywhere, Category = Input)
FVector TargetLocation;
mutable FDelegateHandle PFRequestFinishedHandle;
FPathFollowingResult PathFollowingResult;
void OnMoveCompleted(FAIRequestID RequestID, const FPathFollowingResult& Result);
};```
This thing looks to me like it could explode anytime...
You can either make your own sight sense with custom config or filter it while selecting targets.
is there any documentation on how to make a custom sight sense?
You can check the perception documentation to see if it exists.
I think it doesn't ๐ฌ
yeah I'm looking at the source code
it's well written usually and somewhat easy to understand
I guess I'll just look at that and see how they made it
but given how it's for a school projects with only 2 months left I'm considering the filtering approach more and more
works fine really..
I mean yeah, you have a small amount of wasted overhead, but it wouldn't be an issue unless you were doing tons of perception updates a frame and its already throttled
@silent hamlet if u r using AIController AAIController::MoveTo* would be enough I guess, in your StateTreeTask enter just call those funcs
how do I use something like Blackboard in StateTree ?
I want a shared data to be changed by tasks
๐ค
best you can do it passing blackboarddata
blackboard keys cant be passed with property access thing
for some reason they are instanced UObjects instead of regular FProperty/UPROPERTY's in a data asset
worst decision ever
I dont want to use blackboard
I want to use StateTree
there are somefunction for external data but I dont know how to use it in the right way
check UStateTreeComponent::SetContextRequirements
im doing that already. but how would you go about ending the task (if path becomes impossible for example)
There is a delegate on PFC that gets broadcasted on path events
I guess you have to bind PC->PathFinish to your task and store the result to check it in Tick
@celest python I was seeing that function, seems that I have to set data by Context.SetExternalData, I thought system can allocate that itself
yes, to both! but to bind to it and have a place to access its result I am using the InstanceData. And the only way i found to do this is:
which is...kind of terrible. or maybe not?
its good
seems ok to me ๐ค
oh
I didnt get why allocation is relevant with SetExternalData btw
i want to have a struct not a UObject pointer data
I wish there was some other way to have something like int* as Instance property bindable to Properties
A struct would be UStruct* in reflection realm
when ever task X is called I want a counter to be inscreased
and then I want to use that somewhere else in a Condition struct
Why not just use OUT param?
w8 how ?
Set parameter type to OUT, then set it in instance data inside of your task
other tasks will be able to access it
if its in the scope
where do I set those parameter as out ?
uproperty(category = "out")
is that inside Instance or task struct ?
btw where did you got that from ?
u mean the parameter can be attached to my task as refrence ? if so that would be good
is nav mesh viable for an rts\city builder style game with large map?
oh well that doesnt work with global parameters
yea, im alredy attaching ID->Actor* to the parent state , but this type of global data dosent work
weird, there must be a solution
how large?
Hard question to answer without knowing much about the gameplay/dev details. There are a lot of settings to tweak navmesh generation/usage. Is dynamic runtime generation needed or is navigation all going to be baked in ahead of time? How precise does it need to be? How many actors will be using it? How far do paths need to reach? Does the players local machine need nav data or do you get to assume all games connect to dedicated servers with plenty of resources? How much will navmesh rebuilds impact your dev iteration time? Etc..
around 5km^2
5km^2~ area, 1km^2~ visible area
everything is dynamic except for the landscape and some large rocks
expecting at max 250 npcs roaming around
long paths, up to 5km aerial distance
running locally (single player)
When you say dynamic, does the navmesh itself need to get regenerated by many moving objects, or can RVO avoidance and obstacle types be used to suggest areas are not navigable? Having lots of things with bCanEverAffectNavigation hurts dynamic recast perf really badly in my experience, especially as navmesh detail increases.
you can place buildings, each one has a collider which effect the cost and the building it self completely block navigation
the nav mesh doesn't move, same with the structures
for avoidance I'm using the crowd controller (currently)
I guess my other question is whether longer paths be simplified with a custom solution like a hand-made graph or splines, having the more detailed navigation only generated around groups of actors who need it, or does more complex navigation need to be plotted from start to finish somewhere?
mmmm wdym by hand made graph?
Like, is your longer-spanning pathfinding more for finding the optimal higher level path in a big map? Think like an RTS or MOBA with big pre-defined passages you can generally follow without knowing the details of what's in them (ahead of time).
I think the question is really whether your situation calls for only generating the mesh around navigation invokers, which will greatly restrict your engineering options but also enables you to do things that a larger dynamic mesh would be too expensive for.
On that topic, does anyone know of a way to implement a hybrid generation method where some areas are pre-generated and some areas are only generated by invokers?
hi guys. Recently I started learning to work with Mass AI and wanna make my own behaviour state tree. Many YT tutorials are about creating just walking pedestrians. Can you please suggest me some sources where can I learn more about creating my own behaviour for my crowd in project? I'm looking for state tree tutorials, but if there are any other ways to do it, I'm ready to learn more
the world can be almost flat so there wont be pre defined passages or something like that...
I was thinking on using invokers around the player and just teleport far away units between very crude "known points" points that will be generated by past units
something like that...
ofc it will teleport outside player view
If your gameplay allows for that, it should be viable. You may need to do a lot of tweaking and workarounds. Every invoker you add will have an extra periodic perf cost, and the bigger they are and more often they move around, the more noticeable that cost will be. You won't always be able to form complete paths either, so pathfinding queries will be more expensive if the start and endpoints ever leave their invoked area. I had a situation where most path queries were failing because NPCs could rarely find a complete path beyond their invoked radius, which absolutely tanked performance. If I added too many small invokers, it'd hurt perf, but if I made a single one that was too big, it was sometimes even worse.
@vapid night navmesh is enough for that , but for movement if units you may get into trouble, or ...
so you can write your own movement and path finding code
if they get stuck they will teleport when not visible
units arent actually effecting gameplay
they are visual only
the productions and stuff simulate day of work
maybe even using a grid instead of the known path thingy
and run A* on it
to full the missing data
Here are some optimizations I've applied for these sorts of situations:
-
Limiting the coverage of NavMeshBounds
-
Limiting the number of invokers, and keeping their radius as small as reasonably possible, without being so small that you need too many.
-
Limiting number of actors with certain components that have bCanEverAffectNavigation checked
-
Having invokers remain stationary whenever possible, but also not move them too far when you do need to move them
-
Having invokers only exist as long as they need to (but you don't want to be turning them on/off too frequently either)
-
If you can, making your Tile UU as high as you reasonably can.
-
Playing with the active tile update interval to not be so small you get frequent hitches, but not be so great that the amount of tiles needing regeneration gets too big (similar problem introduced with invokers that move too far too often)
-
You can also play with the regeneration time slice interval, but that one is a lot trickier to work with so don't go changing it unless your situation really calls for it.
-
The
stat Navigationandshow Navigationcommands are your friend for a general idea of where the hotspots are. You should be checking this every time you make a change. I use it often in editor for a ballpark idea of whether something is having a positive or negative impact, but your profiling will be most accurate when using a standalone build. -
As mentioned previously, missed/partial paths due to setting a goal location outside the navigation invoker radius (or starting from a location that is outside all navigation invoker radii) can have a HUGE impact on your perf.
-
If memory isn't a problem, having a big Tile Pool so you're not having lots of random allocations can be a perf win.
In summary, it's a balancing act that has a lot of game-specific interdependencies.
this is much simpler ๐ค
- Having invokers remain stationary whenever possible, but also not move them too far when you do need to move them
arent they automatically move in steps ?
say the player has an invoker and he move in a small area it doesnt matter that the invoker is moving, it doesnt need to generate new tiles because its still in range
it will only generate tiles when moving too far
and if he shoot to the side for example it will just skip tiles that are being generate if they are no longer needed
The only situation you would want stationary invokers is for having certain areas you want to guarantee usually/always have the same active tiles. One example would be if you have, say, a spawn area that requires navmesh projections ahead of the player arriving there. Stuff like that.
The part that hurts things is when the difference in active tiles is too big. That is, the more new tiles being added and old tiles being removed per tile update interval, the longer the perf hitch (if any) will be when the update triggers. Setting a large space between create/remove radius won't always save as much perf as having an invoker on an empty actor that loosely follows the relevant actor you wish to generate around, only updating its position to be closer to (or ahead of) them every X units. This scales with your Tile UU. The smaller the cells end up being, the more often (and higher number of) tiles will get added/removed as the invoker changes its position.
Does that make sense?
I dont think that I need more then 1 invoker around the player
i dont care if they are teleporting outside of the player view
And again, how much each of these optimizations helps/hurts you depends a lot on your gameplay, so start with whatever is most convenient for you, see where your hotspots are if any, and apply the optimizations that make sense for your situation. They all have a certain range where they will help vs hurt you, and that will depend on your other requirements. Limiting situations where paths can't be found/completed will probably have the biggest impact.
ya but the nav mesh can be really small, it just need to cover the visible area
which isnt that large
npcs that spawn outside of the visible area can just snap to the grid on spawn
and do they thing
and if the player is in the spawn area they can just spawn normally
Yeah, that's usually the case. I'm describing different ways of implementing when it moves, what its radii are, and how your other nav settings impact both those things. There's a big difference in the effect of constantly moving the invoker attached to the player and having a separate invoking actor that updates when the player moves a certain number of units away from it.
sec I think that I lost u ๐
Haha yeah it's a subtle distinction.
I wish I was better at sketching things digitally cause a visual would probably help. ๐
so I shouldnt attach the invoker to the player I should have the invoker actor follow the player say each 1000uu that the player has moved, right?
Something like that. It all depends on the recast settings and update interval.
https://docs.unrealengine.com/4.27/Images/InteractiveExperiences/ArtificialIntelligence/NavigationSystem/UsingNavigationInvokers/Invokers-Agents-Walking.gif
are you sure that the invoker isnt just update by chunks?
cause it seems like its
There are 2 things going on there.
Well 3. Let's start with what the radii actually mean.
- As that invoking actor moves, the radii do not describe the distance the actor needs to move before the active tiles change. It describes the distance from any given active tile within that radius. As the origin of that radius moves, it'll be adding/removing tiles at the radius edges every time it's moved beyond the extents of those tiles. This means it scales with radius and tile size.
- The active tile update interval describes how often tiles will be checked for whether they need to be flagged for adding/removing. They don't all update on the same frame though, which brings us to...
- The tiles you see gradually changing are defined by the time slice for regeneration. I think by default it's .7 seconds. So even though tiles got flagged for creation/removal on the update interval, the time slice will affect how many actually get generated over time, which won't necessarily be consistent.
I mention the time slice in the list I posted earlier, but I don't recommend changing it unless you really know what you're doing. Increasing and decreasing can hurt perf depending on your situation.
NPCs without a navmesh under them will hurt perf significantly if they are doing any path finding queries. Avoid that situation whenever possible by either eliminating those queries in that situation, or simply never allowing NPCs to end up in that situation. You could switch to a different pathing strategy in those cases, or lack thereof by moving toward a point in any variety of ways without any regard for pathing. Not sure whether they can use avoidance when moving off a navmesh. Haven't tried it yet.
If you have more than one invoker to move them between, having start and end goals in different invoker radii will have a perf cost cause they won't be able to find a complete path.
(if I'm wrong about any of this or anyone has a different experience feel free to chime in)
so I was thinking to my self about my solution using grid, it seems like a solid idea, lookup on grid is super cheap even for large maps, it will keep some what accurate pathfinding (good enough)
as for the "active area" it will be handled by the nav mesh+invokers, I'll have only 1 invoker around the player on low res settings
that way ill have accurate navigation around the player and fairly accurate navigation outside of the player view, and when the view shift to that area the ai will switch to the accurate navigation
But yeah as with any optimization you won't know the specifics until you try things out and measure the impact for your particular game. These are all the things I've played around with and dug into engine code to figure out. IMO UNavigationSystemV1 could use some improvements in how it handles navigation invokers. It does a lot of unnecessary reallocations every update interval and could probably be further optimized by configuring the engine to use a subclass of UNavigationSystemV1, and probably a custom recast actor. I haven't personally gone down that path yet.
it will give the effect that the npcs are actually moving around
while barely computing their paths
the actual "active area" is pretty small, I ran some tests with 250 npcs and default settings and it seems fine
so I'm not expecting that much of a performances hit from that
I'll optimize it ofc
I was more concerned with the far away npcs
it's probably even good enough for far-visible npcs... so the invoker area can be even smaller
If the navmesh resolution is low the number of tiles regenerated will be lower, so the generation of tiles will have a lower impact. It could be a totally negligible cost to have a huge invoker in your case. I've been in situations where that wasn't an option, so I've had to explore a lot of different ways of orchestrating invokers.
no problem! ๐
it was very interesting and enlightening
isn't binding a raw delegate going to cause a crash if the task is interrupted and now the PFC is broadcasting to nothing? I mean, does InstanceData survive when the task is over?
mh I can test this actually
Invokers are far more expensive than nav mesh that is full regen. Especially on a moving object.
then here is a crazy idea, instead of using invokers I can just move the nav mesh bound (in steps ofc)
would it be cheaper?
it shouldnt be cheaper than just using an invoker
Why would you do that? What problem are you actually trying to solve?
Need accurate path finding near the player and some path finding for the rest of a 5km^2 map
The problem I had was I couldn't work with how long navmesh rebuilds took in development. They slowed down my iteration process to a point where I was not progressing adequately, and the memory overhead was going to get out of hand. Having a fully green mesh is ideal, but invokers can be surprisingly cheap if you're using them in the right situations and prepared to do the tuning/coordination.
The accurate path near the player would be handled by the nav mesh. UE has had nav mesh streaming since at least 2016.
The path finding not near the player can be faked or simplified.
Is there a good way to limit how much of it is getting rebuilt as you develop and edit navmesh bounds? I've had to work in situations where the persistent level contains most of the geometry the navmesh will rest on, while more detailed navigable areas get streamed in. Even if the sublevels aren't loaded, all the volumes getting recasted to the persistent landscape was unworkable.
You can easily make a commandlet for building the nav mesh.
I've tried invokers on 3 separate projects and they were never cheaper than full regen.
You can turn off automatic building in the editor settings and just build when needed. I use a commandlet when the level is checked in, but I work on large teams.
What do you do for local iteration? Not rebuild for long spans of time and hope for the best when you have the time to wait a while?
I'd much prefer not using nav invokers if possible. It was just so darn expensive to work with in development.
You figure out ways to make a group of changes, build paths, get a snack, then test.
I don't doubt nav invokers are always more expensive. My understanding was they were designed more for large open world games, but if they're not even useful for that I totally understand avoiding them at all costs. If there's a good workflow for working in large composed worlds I'm into ditching them.
After a lot of fiddling I managed to cut down the cost of invokers pretty significantly, but having the navmesh ahead of time is always preferable. I was hoping there would be a hybrid option but it seems that's not available without a custom solution.
Invokers were at one point the solution for open world, but navigation streaming quickly replaced it. World composition nav streaming is really finicky and didn't really make it out of the professional spaces. World partition has a lot more tooling for it.
Well I'm stuck on 4.27 for now soo... is it still not a good solution?
And yeah world composition has been a nightmare.
It's not a nightmare. It's just not documented outside of UDN.
What do you mean when you say finicky?
I guess my biggest question is whether there's no case at all for invokers in the context of UE4 with large composed worlds. If I can avoid using them without too much trouble that's preferable.
Hi. I try to create my own AI Sense like "AI Sight" that I can use in AIPerception component to create my field-creature AI. For creating this, I have to know which type of sense and some information about it(like enemy's HP) when AIPerception component's "Event( On Perception Updated, etc)" start. At first, I tried to create different On Target Perception Updated events by Sense, like "On Target Perception Update_Hearing" and "On Target Perception Updated_Sight", but I failed. The only way I know is using "Tag", but It seems insufficient. Are there any hints for my case?
I mean there are some very specific things that you have to do. Such as you need to have a nav mesh bounds in the persistent level. It doesn't have to cover the level, it just needs to exist. Also the persistent level has to be the current one. All the nav data gets baked into the appropriate sub levels, mostly secretly.
There should be a function you can call to check the sense class.
any idea why finish execute not moving it self to the next task it was working b4 now it just doesnt budge it stay on the same task even tho it runs finish execute
Thanks! I find "Get Sense Class for Stimulus" function, so now I can use it for check. However, I want to use my own data type not only "Tag". Purpose of my custom AISense is detect what players are doing, like swing a sword, aim a bow, search my nest. I can implement this to fill a "Tag" when register stimulus, but I want to use my own data type. Is there any solution about this, or other way to detecting player's action?
Typically responding to what the player is doing is very contextual, so I don't recommend putting that in the perception. Especially because it makes deciding on targets more complicated.
Yes now I think that create custom AISense for this is not a good practice. Thank you for advice ๐
For some reason my ai's medium range attack is never firing, it gets locked into the Move To node of the close range attack and just chases me down to close range before attacking
i usually make my own move to as it always seem to look for the next location
hello
goodmorning guys
my ai is not responding to nav mesh bound volume
need help please
tried implementing the move to location function but it dosent move
Hello everyone! Digging through zone graph and can't understand one thing. Is it possible to use ZoneGaphShapes inside level instances? Looks like when I'm building zone graph in my main level it's also creates ZoneGraphData in instanced level and those graphs (inside level instance) doesn't connected to main graph.
How do you detect that the StateTree has stopped from inside a StateTreeTask? I had a look at the ExitState FStateTreeTransitionResult but it only describes that the states have Succeeded when the tree has stopped.
it's actually working. So..either InstanceData survives when task ends or...something else is happening and I have no clue ๐
does anyone know if we can end behavior of a gameplay behavior in a smart object at a later time as ending behavior seem to always just release the smart object after the logic ends and if i dont end behavior it just stays on using smart object which i want it do but also go to the next task on the behavior tree.
There are a lot of reasons why it would be failing. The visual logger will help you to determine why.
Yes. You do need a bit of C++ though.
damn
so i would need to do the ordering food bit in the gameplay behavior while it claim and then oncee it done it ordering and eating release it
When a gameplay behavior is interrupted it automatically ends. It was trivial for me to change that, but it took some C++.
i dont know any c++ so that a no go for me
ill learn it if i have too. but ill try to work it in while it claimed
gameaipro.com is a pinned link I found last night, there are a ton of great articles on game aI in general, perhaps you can find what you are looking for there?
Is there any blueprint function called when an actor tries to use a NavLinkProxy, so like I have a ladder and I have it trigger that when it reaches the point and it will move down the ladder or up it with my own logic?
so I am making AI for my game and I want the Ai to chases the player when it sees them and start roaming again when it does not, I'm using pawn sensing for this and I was wondering how I would make it so it roams again when it stops seeing the player because I have not found anything for it yet
This is the code I am using for it
it better to do it with a behavior tree as u can use decorators to cancel each action. but you should make custom events and then have a branch to check whether it see the player then hook up roam when it false and then chase to true. to achieve this you would need to set your bool seeplayer to true and false to do this you would need a retrigerable delay. Set see Player to true on pawn sense and then add the retrigerable delay so when it loses sight the delay wil continue to countdown to set your branch to false. then you can put your logic in the correct branch for it to continue to run. so it should be set see player true -> add retrigerable delay > set see player to false. connect this to pawn sensing.
You can set it up in BP if you use a smart link. Point links need C++.
if you want some inspiration, this should get you started doing what you are trying to do in probably a more manageable way:
https://www.youtube.com/watch?v=iY1jnFvHgbE
In this presentation, Epic's Paulo Souza uses Unreal Engine's built-in AI features to build smart enemy behaviors for a game with stealth-like mechanics.
By relying on the Gameplay Framework in Unreal, we're able to quickly create convincing AI using Behavior Trees. Behavior Trees are great for creating complex AI that can be presented in a way...
https://youtu.be/wW4t5QxOQaE
Look at this one, its kinda the same as yours where he is making the jump to jump on platforms
In this series of videos we are going to create an NPC which can jump onto or over objects in the Unreal Engine 4. We are going to accomplish this by using the Smart Link component of the Unrealโs Nav Link Proxy, weโre doing this so that we donโt have to rewrite or add to any of path-finding code in the Unreal Engine.
In this video we will crea...
It might be easier to add collision proxies at the top and bottom of the ladder. You typically want some logic on the ladder itself to control which agents are on, waiting to use etc. Usually you want to not have two agents going different directions too. I built my own set of components for that kind of logic.
Should my character know about its controller's perception component? Is it ok to subscibe a method from character to OnTargetPerceptionUpdated when it gets possessed?
Basically i'm trying to implement a suspicion meter that increases when character is in FOV. And when it reaches a detected threshold I set the target actor in the blackboard which makes my AI start investigating. Should that logic be added in character? controller? or maybe in the behavior tree itself by using a service on a node at the top level of the tree?
just trying to understand the responsabilities better for each part of ai...
Hi I'm using Pawn Sensing for my AI controller, it's working fairly well except I noticed a bug where it sometimes doesnt sense pawn if this pawn is overlapping over another pawn (which can happen, as it's a 2d game without collision between pawns), any idea why or how to fix it?
That is unnecessary. The nav links can handle it.
Pawn sensing is the out dated version. It's recommended to use the perception component.
thanks will look into it
Controller. The separation of concerns is best understood thinking of it as the brain (controller) and body (character).
I wish there was an easy way to set values on the AI controllers same way as you can on pawns that you place in the level... That'd make it much easier to have a nice clean separation with that sorta stuff
Of course it depends a bit on how your game works, but at least sometimes it's a bit annoying to deal with the AI controller as a result, so you end up putting a lot more into the pawn :P
Is this the right place to ask about Behaviour Treeโs? ๐
Yep
Sweet - Iโm trying to make a dialogue system with Behaviour Treeโs, similar to whatโs in Baldurโs Gate, Pillars of eternity etc.
I have a base for it down already but when I try to enter the next piece of dialogue, it spams through all the options and ends up on the starting one, I canโt get my head around how to stop it
For example: 1- โHelloโ, 2- โIโm Davโ, 3- โLetโs go and do thatโ
When I hit next to display โIโm Davโ, it goes through all three dialogues and returns to โHelloโ
fwiw, BT's are maybe not the best solution for dialog trees, but you can probably kinda make them work for it if yours is not that complex
It's hard to say why it would behave in the way you described without seeing what your BT looks like
Flowgraph
Yeah flowgraph is excellent, haven't tried it for dialogs but seems people use it for that as well
I already have a dialogue system set up via data tables and the likes but I was after multiple responses and this is the best way I can think of doing it
At the moment itโs just starting the dialogue window, and a sequencer with three options attached to that
I even got my name in the contributors list for flowgraph! 
Whatโs this?
You could post a screenshot of the tree, but my guess is if it jumps through several of them instantly, your BT Tasks are not waiting to finish until they actually complete or something like that
Flowgraph is a 3rd party plugin https://github.com/MothCocoon/FlowGraph
This is it currently
Any news about statetree yet ?
It got an update and bugfixes
no knowledge or examples?
https://i.imgur.com/5oPzcJl.gif
This happens when I click next
ive been waiting for any sort of insights
Im on mobile one sec
Hard to say but my guess would be that one of the nodes fails which causes it to restart the tree. Try pressing the pause button in the top bar of the BT editor, and step through it. If a node failed, it should show the connection as red
What's a smart Link?
Insights into what? By this point, you could've already been making your game's AI and learning more about it.
Data assets.
The docs for it is surprisingly decent to get going with State Tree
i dont agree as it didnt take me much further
It teaches you all the concepts you need though.
it didnt
I can't step through it doing that, but I used breakpoints and when I hit next once it goes through them all then returns to the top of the tree - could this just be because I don't have an end to the dialogue?
If you're waiting for a hand-hold tutorial on every possible application, you're going to be waiting awhile
It has more deep property binding system that works with instanced uobjects, evaluators are about to be deprecated
And some verbose bugfixes i dont remember
no the documentation was lacking then
the basic introduction did not convey what is possible
Nav link proxies have 2 different types of nav links. Smart links give you a lot more control in BP. There's a cost, but not a significant one unless your game is large.
It most certainly wasn't. But w/e.
What do you need to know or what are you struggling wirh
With*
where was it stated that a placeholder state needed x and y type of actions for it to be entered
What is possible? Whatever you need to be possible.
Oh. Huh. What's the cheaper one with C++?
You might want to look at the common conversation plugin. It's experimental, but it'd work better than a BT.
i spent 4-5 weeks with state tree so i can safely say the documentation was lacking
I'm trying to avoid plugins due to this being part of my final year at university
Took less than a day to get basic AI working with the documentation.
Then use async tasks
It's from Epic.
it seems the documentation has been updated
Tree implementation is not flexible for a dialogue imo
It's the same as it was in December
Simple links I believe they are called. Smart links get triggered automatically, but simple links you need to add the functionality in the path following component to trigger the behavior. It's not hard, but you need to know C++.
Write a k2node that can allocate new pins
I know C++, but how much do I need to know?
It's an Epic created plugin. It's there already in UE5, just need to turn it on.
Common Patterns is added since i was last into it
Was there in December
So docs debate aside what are you struggling with
I still have no idea what was the wall you hit on december
DO you recall the exact class name of simpleLink in C++?
Ah, I'll give it a look
5.0 and 5.1 documentation on statetree are different, i wholly missed the parts explained in 5.0
are they still relevant ?
It's not a class, it's a struct. Maybe it's called point links. I don't remember exactly. You can look at the nav link proxy actor. They work by using nav areas and you check the nav area in SetMoveSection in the path following component to trigger the behavior.
huh this is confusing for me, im reading stuff i havent read before
Yes, they are different. They updated the docs in 5.1
And they're likely going to update them again in 5.2
Alright. If you do remember, please tell me!
I was looking at this
I was making a derived class, is this smart Link reached thing for when it tries to use one point to get to the other?
Well. I also ticked it relevant but when it reaches the bottom point seen here
It won't print wuh like I told it too when I hooked up the event.
Thank you for the response ๐ I put the suspicion threshold settings in character and the suspicion state in controller. And in controller I calculate how the state should update by using the controlled character settings
It does snap to look at the NavLinkProxy point, so I know it's trying to use it...
Wait, could it have been since I had simple links that were used instead of the smart link? Ahhh, a minor technical detail that was easy to overlook. I will check.
Hmmm, could you add a timer function that checks if they're facing the same way as when they started? That's what I would do.
Is there a way to show the green Nav Mesh preview in built games?
We have a level creation tool and want users to be able to see the nav mesh to ensure the AI can traverse their terrain.
I finally got the AI to trigger the link, however it races past the first point it's using to reach the other, can I tell it to stop and stand still somehow, and then do the resume path?
is the AI Hearing sense range for AI Perception broken? for me no matter what value I set, it seems to only trigger when I get really close
in debug view, you can see the hearing range in yellow
when I step inside and shoot, it does not detect it
it only detects when I get closer
Hmmmm. Is there a function that fires off to give a hearing event, maybe?
Yeah, are you using the report noise event?
yes, I'm firing it when I'm shooting
I'm calling MakeNoise
thats the one, right?
you can see its working, it detects the noise event, but its like it has a reduced range, and not the one I specified
I think so. But, you should try multiplying your range value by 10
If you want it to be 1000 meters.
Because in UE5, the unit of distance is a CM
ohhhh
Or, do you want 10 meters? I'm not sure.
I see now
I tried multiplying the range before
If your max range is meant to be 10M, what you have in your code is right I think if it's 1000? I'm not sure.
ok yep, that was it, thanks!
I increased it to match the sense hearing range, so 1500 on both sides and it worked
Ah! Good.
Maybe the hearing range on the sensor is just the maximum distance it can, but the noise event's input is how far it will make that sound go
That's my hypothesis anyways. Now I just wish I knew why my AI keeps moving past my smart link point instead of stopping
Is the NavLinkProxy meant to only work with a jump or drop off point? Not something like a ladder, or elevator?
If it isn't for a ladder, elevator, or of similar affect, do I need to tell the AI to move to the same location after it passes it if I make my own thing?:
I sort of have it. But, after I do the logic to put it where it should be, the AI won't resume it's path in spite of me doing ResumePathFollow()
https://cdn.discordapp.com/attachments/1069462053196157000/1075227370568564877/2023-02-14_20-29-35.mp4 Here's what's happening. It's supposed to go to that second NavMeshLink and use that to go up
Instead of just stopping there
Anyways. While not efficient; I'd rather have them re-use the path they were, I can store the main point they were going to and do another move to for that position, but they will need to recalculate their path, won't they?
I am pretty sure Stop Movement Immediately kills the navigation pathing the agent was on because it fires and AI event that the movement completed unsuccessfully
So resuming will not do anything
In fact I think the component, if the implementation of the MovementComponent is in fact a Nav Movement Component, has a method called โStopMovementKeepPathingโ
That should get you where you want
Ahhhh
If that's what I needed, thank you so much! The BP search won't always yield what I need, yet it will exist. Let me check!
How do I get it to move again after though? This is so good if it is what I think it is.
Is there also a way I can set the cost of using a smart/simple link somehow? Like with a nav filter or what it's called?
No, that's not it. It will keep moving into the wall when I call that.
Instead of standing still and waiting the two seconds.
Unless, you mean I should call it somehow on tick when it's at the position?
Then though will it adjust rotation otherwise too? Like if I tell it to turn some other way, to play an animation, will it still snap the direct way forward?
Thanks for the suggestion though!
Hmmm, sad that didnt work for you. A lot of smart nav link stuff tends to manipulate the velocity of the character rather than pathing interrupts and teleporting. Is the aim to have the character ultimately jump or vault over? Because then you can just use Launch and play the appropriate animation when you add that in.
Vault.
They can't leap over, it would be quite silly if they moved that high.
It's just a shame my solution will likely have them recalculate the path, but I suppose that's more a momentary burden on the CPU than a long term one.
Yeahโฆ I think a mix if Launch with the vaulting animation would be the more UE native way to do it. Best of luck tho - would love to hear what you come up with
Right. Like I said, I'm thinking of storing the main point it wants to go to and telling it to go there again after it finishes crossing something, which would require it to recalc the path, albeit it would be shorter.
I guess question is how long it takes to calculate a path, though I think UE might be pretty good with that.
I don't see why it wouldn't work, just be less economic. Speaking of occasional deficiences of UE5, I wish it had built in prone support.
I just hope if I try to make an open world game later it won't be too problematic.
Does anyone know how games like gta make their civilians run when they detect any violence nearby ? I mean how to find a location to move to. As they run really far away from the voilence location.
I can do this using eqs but it will become heavy as I'll be using it on civilians, there will be around 50(minimum) of them .
Maybe something with the crowd system?
It doesn't seem like it would be that expensive
You can for example run an EQS which generates points in a circle around the "point of violence" at a given distance, and then have each civilian choose one of them to run towards (say based on distance)
The cost of this is more on just the individual npc level rather than on finding the points to go to
Hi!
I'm debugging a problem we have with nav generation, specifically during CreateHeightField, and I noticed that there's some logging during the process that is not shown in the logs. Our nav generation is done through a commandline (-BuildNaigationData). How does one enable the debug log within BuildContext so it's printed in the log? I see there's an implementation of doLog in RecastNavMeshGenerator.
What I mean (selected line)
tagging @crystal hatch in case he knows (I believe there's someone from your team here that can also answer nav question? let me know in case it's better to tag someone else).
Thanks!
This logging should be enabled by default, just filtered out due to this specific type of info being logged as VeryVebose while the default LogNavigation verbosity is Warning. You can change log verbosity at runtime with log YouLogName verbosity (so in this case Log LogNavigation VeryVerbose) and you can also add this one of the -execcmds in your command line.
Amazing. Thanks a lot Mieszko. This is very helpful
but i have to run eqs for each civilian, or is there a way to run one eqs and let all the civilians pick a point from that eqs ?
Sure. You could have some other actor/object act as a coordinator/manager for it
thank you for this,
i created an actor and using it to run the eqs and finding all the matching point, and will then give those points randomly to the civilians
a small question...
single big navmesh and multiple small , will there be any performance issue ?
afaik they end up being part of the same mesh, the nav mesh volumes just affect where it is generated
if it's very big you might want to check out runtime navmesh generation and use navigation invokers
But when it comes to performance, just try it?
i got an issue with our AI invalidating a huge area of the navmesh when they move, no idea why
i turned off "can ever affect navigation" on the sword, the rest should all just be the skeletal mesh and capsule collider
any idea how to solve that?
Make sure can affect navigation is off on everything in there, including anything attached to the actors
I don't think it should get invalidated unless something has that flag turned on
yeah i should give it a try
i just worry if i turn it off on the colliders that they might not see other AIs as an obstacle
If you have something that never moves you can of course keep it on that. If something that has it enabled moves, then this will invalidate the navmesh and there's not much you can do about it
There are other avoidance methods like rvo and crowd designed for moving things but it probably really depends on how you want it to work
i see, thanks! yeah since it's melee combat we'll probably need some kind of surrounding method for them anyway
maybe I should give EQS a try
how can I check if function returned true and keep the same Projection Location value when this is a pure node 
I think the only way to do it is to assign the returned value to a variable
Or rather, I'm actually not sure if it would end up calling it multiple times if you only have one connect per pin
hello all
please i have an issue
i put the nav mesh bounnd on my level but my ai dosent move on it
it only turns from one point to another
been on this issue for ober a week need help please
eren yager i dont know how to utilize that
||my name is not a reference to AoT
||
you just need to go to tools -> visual logger in editor
then start recording
then play
it will log everything relevant
oh no you shouldnt send that to me
when its recording it already outputs the data for you
you just need to find your actor in the log (read the docs for that) and see whats happening when actor starts to move
and send what you see here as screenshot
@celest python
sory am just following a course and am stuck ....the instructor demonstarted it easily with the above blue print
trying with mine and it dint work i knew there was a p
which course?
its a udemy course
step by step tutorial doe
so its the ealry stages of the ai stuff ot to deep
I'd say refund it, there is no udemy course that can actually teach how AI works
hmmm?teach how ai works? its a whole soul game kinda tutorial
evrything been wrking fine
Its likely you're learning incorrect practices instead but if you're ok with what course provides 
But anyway, vlogger says some external source aborts the movement
you need to find what it is
how did u see that
well ur seeing things my eyes cant lol
if I wanted to call AI Move To on my player character, I'd need to unpossess the player controller and possess the pawn with an AI controller instead, yeah? I can't have two controllers possessing the same pawn, surely not?
ok yeah, calling Possess from a different controller than the one a pawn is currently possessed by will just automatically unpossess the old controller before re-possessing with the new controller
certainly more annoying to deal with than Simple Move To Actor, but the extra blueprint output pins provided by AI Move To are worth the headache
@soft idol simple move to creates pathfollowing component on the controller, so all those outputs that you get from ai move to you can get from pathfollowing component. c++ is your friend here and i suggest looking at simple move to code in ai blueprint helper library
yep, doing so now
will probably end up writing a bp async action to have the same functionality
or custom node, whichever
so is this correct dynamic behavior tree work better with one ai controlleer? as when i spawn in two ai using the same controller/tree to use the same behavior tree they both get confuse but when i justrun the one ai they switch to the sub tree fine. i even try with having the character use it own ai controller
sorry for asking alot of question just not much info on these topics.
i guess the question is. Do dynamic behavior tree need to have seperate ai controller to work properly on multiple ai?
Nope. I run them just fine.
i think mine our getting confuse because of the blackboard condition as the ai get stuck once it check the tag to see what job/board need to b e ran
and it just stays at the check job task
i will fiddle with it more.
Anyone figured out if there's a way to run an EQS query in state tree?
Seems you just need to make a ST node that runs an EQS query
Why does the state tree get placed inside the character rather than the controller
isn't the AI controller meant to be what's used to well, control the character
Probably because state trees was built to be more generic. I believe the first user of it was Mass, which doesn't have controllers.
It's always better to use the visual logger to figure out exactly what is happening instead of guessing.
im not just guessing i know to use the logger
That's the mindset AI team trying to get rid of
New AI systems will be more generic and modular compared to current AI module
Its also not placed in the character, its can be placed to anywhere
The ST component is just a wrapper
yes just run the EQS query and return in progress until its completed then set the values and return finished
Can I make multiple AI navigators use the same path when navigating, or otherwise dissect navigation data, see where it turns and brakes, etc?
This is a question of ignorance: what connects the AI brain to the external world in terms of telling the possessed thing to do something without a controlled pawn?
ST expects you to handle that on your own or use StateTreeComponent which provides a default parameter for owning actor type that you can bind its properties to tasks etc
What are the common cases MoveTo task ignores nav link proxies and tries to reach the goal directly?
VisLog doesnt provide anything
There is also no navigation mesh on where AI tries to reach
Is there a nav mesh on top of the cube though? If I recall correctly a link proxy just allows the agent to be aware of another, separate, navmesh. And it's up to you to make sure the pawn can actually reach that place by jumping, flying or whatever needed. Basically I don't think your agent is ignoring the proxy, it's just trying to reach the other navmesh but it can't
Hey, maybe someone reading this has some more knowledge than me on the topic. I am working on a game in a survivors style (vampire survivors, soulstone survivors). Meaning we will have quite a lot of ai's running towards or around the player.
I am having trouble with the performance, especially concerning the movement component inside my ai pawns. As well as the tick times.
I already built everything around the ai to be cheap, also using the floating pawn movement component, no shadows, nearly no collision.
Still the movement component is eating a lot of my budget when it's reaching 150-200 ai enemys.
Since I can't program in C I am bound to solutions inside blueprints and UE itself.
Maybe anyone has some tips or tools that i do not yet know of. Any help is appreciated!
For more detailed reference, as stated the AI's using the Floatin Pawn Movement Component. I'm controlling the movement via behaviour tree and blackboards.
I think the best solution would be some kind of swarm agent, passing the move target to all pawns at once and instancing things like the ai controller/blackboard if possible.
For a procedural dungeon is it better to just use navigation invokers for navmesh
bit of an architecture/design question for AI related things - How would you approach a system where NPC's need to be able to walk up to different objects to interact with them?
In my game there are some different objects for them, and this design question came up because sometimes the NPC's don't pathfind properly, because they try to pathfind to the origin of the object
For some other objects, I have them pathfinding to front of the object which works fine. However this is a bit of a design question now since where should they really be pathfinding? It seems object-dependent, so I'm thinking of just giving my objects some interface which can be called to get the point the AI should navigate to
But on the other hand... What if objects can be interacted with from multiple positions? ๐ค Or if another NPC is in front of the object, and you should be pathfinding next to the NPC to use the object from there instead of directly in front? ๐ค
Switch to C++, prefer ECS ( #mass ) or tick aggregation, profile and optimize most obvious overheads and never prematurely optimize
apply advanced optimizations after profiling
What you explained looks like smart objects where StateTree handles well and CitySample has some examples for it
Yeah it's definitely very smartobject-like. Not sure of UE5's implementation is suitable, I heard it doesn't support runtime spawned ones very well or maybe that was a limitation in 5.0?
Luthage knows best
Buut yeah i remember that too
The docs for it do mention stuff about "spawned at runtime"
So who knows. We're considering an UE5 upgrade at the moment anyway so maybe worth a try at least
Well - the base concept of a smartobject is quite easy to implement yourself.
Yep
I have a component interface for this.. using pretty much the same interface as a smartobject.. claim and release, custom transform per interaction (i.e. you could have multiple, think of AI pushing the cart in TF2 as an example).
Don't forget to allow for a little motion warping.. there was an Epic livestream about the motion warping they added in for 5.0
So basically, its a component.. you get the AI to move to near the place the component says.. then warp them the last little bit
The other thing to think about is origin shifting.. that being the idea of moving from world-space to object-space. Its easier to animate things in the same space, so you can essentially get your animator to animate relative to a thing, then warp into and out of that space as needed
Works well for stuff where your AI has to do things like hang onto vehicles.. essentially you move your character from world space to vehicle space
Motion Warping is stupidily easy to actually use as well.
I thought it was going to be more difficult honestly. But nope - pretty straightforward.
Or entering a car, you get your animator to animate from a single spot, then warp your AI to that starting spot and play the anim
Interesting, good to know
My animations are basically just from Mixamo and some poor custom animations I made for lack of anything else lol
Yeah, in a AAA context, you'd have a bunch of animations or mocap.. so you'd have a known starting point for the animation.. your job would be to move the AI close enough that warping to that starting point wouldn't look like crap ๐
I find animation in general one of the most fascinating parts of AI
the amount of work that goes into a football (soccer) game is pretty crazy
motion warping, motion matching, FBIK, trajectory prediction and the like..
Theres a virtual function "GetTargetLocation" which can return whatever location (ment for aiming) which you can use as an alternative
Is there nav mesh inside the cube? What does the vis log show for the path? Do you have partial paths turned on?
You are unlikely to get decent performance with 150-200 AIs without C++. There are some tweaks that you can do with the movement component, but it will unlikely be enough. Niagara is an option, but you'd have to rebuild everything. Mass is another option, but I believe that also means C++.
At the end of the day, if you are only using BP you don't have the profiling options to actually know what is really causing problems.
The smart object system from the Sims. You can try Epic's version or build your own. I built my own, because there are a few issues with Epic's version, especially around multiplayer. Both are based on the Sims system, where the behavior is in the object. So an AI knows to look for objects to use, but how to use them are in the object.
There are slots that define where a character can interact with the object and a reservation functionality.
Thanks.. Yeah not doing mp at least :)
Yeah, my personal project uses the built-in system. I'm not sure if I like it, but I've already built the same thing 5 times now. Reinventing the wheel gets exhausting.
:D
I can imagine. What kind of issues did you run into with it anyway?
I'm basically building a kind of a management game so there's a lot of placing and potentially removing objects at runtime, having to save their state etc.
@uneven cloud What would you say your favorite chapter in GameAIPro is? ๐ค
What happened to your Doom-like game?
I'm also working on that lol
Ah yes - the forever multiple project dev. This is the way.
Yep :P
There's no easy way to build in way to have the AI choose between different behaviors. It was a very annoying oversight.
Ah like if you wanted different behaviors on the same object?
If holding knife , cut orange, else peel orange?
The AI LOD one by Ben Sunshine-Hill.
A small question with open world...
How Dev's setup navmesh in openworld games?
Like a big navmesh, and then nav modifiers on roads, footpaths and streets or something else?
Navigation streaming. I've heard it's broken in 5, but I haven't verified that. If it is you might have to use invokers until Epic fixes it. Wouldn't recommend that as a shipping solution though.
You want to use nav areas on things where you want to affect how they navigate, such as roads and footpaths.
I don't like nav invokers ๐
,
I am just trying these things on a small block out level but there i have to place every single nav modifiers by myself, but i case of open world would this a lot of work just to place the nav modifiers ? Or is there any procedural way to do this nav modifier placement
You can have a nav modifier on an actor. I believe you can also set the nav area on the mesh component as well.
oh yeah i totally forget that one,
we can put the modifier component on meshes like road or footpaths, That will save a lot of time
New contextual animation plugin could be also interesting for you. They use it their WIP interaction system. CitySample is already using it.
Will check it out, thanks for the tip
Handles IK for interaction, playing montage on all the interaction roles (target, user,...) and is also networked (at least in 5.2)
tbh animations are fairly secondary for me atm but might as well set it up if it's helpful
As for slots we also have something like custom smart object definition data asset which defines interaction slots/zones. Component then returns it or creates one dynamically.
Contextual animation eh? ๐ค
Might be the same thing they mentioned in the first UE5 demo and then never again :D but it is being actively worked on.
Huh - I thought that was something built into the new animation stuff. Not a different plugin entirely. lol
There is motion warping and contextual animations. Both are plugins.
+1 for Ben Sunshine-Hill's chapter. The whole "simulation bubble" is a nice way of thinking about it.. Alibi generation is a cool idea
Is there a version of the gameaipro's for Kobo e-readers ๐ค
There's the individual PDFs for the chapters which is a bit meh to read on it lol
I've no idea what one of those is... so no idea? ๐
It's like a kindle basically lol
Yeah I mean it reads PDFs just fine, would just be nice if you could get the whole book as a single PDF was what I meant :)
I think Ben did a GDC presentation on it too? might be worth looking
I've definitely seen Ben give at least one presentation on it, possibly too, my memory is shot
possibly two
my typing is also shot ๐
oooh, which reminds me.. got a new keyboard to try out
does this keyboard work? yaaaay!
Hmm, this is going to take some getting used to ๐
what kind of weird keyboard did you get if it requires getting used to
Well, I'm used to my old kb where the goddam thing would randomly forget its function keys
this is using cherry blue keys too.. doesn't feel the same as my other one
Ah
I suspect my other one required more key pressure
Yeah my old one is mx blue and my current one uses Topre clones, so typing on the mx blues is weird after using this lol
Topre clones have a very linear actuation
I suspect my other one is the one with higher pressure required.. but I thought it was also cherry blues
whatever, hopefully this doesn't have the same issue of function keys
cos that was driving me mad ๐
Ooh, got a wrist rest... don't like it ๐
new thing is new
So here's a question for you guys.. is it wrong of me to want to make cool visualisation tools for my AI? I mean like.. pretty circle drawing routines for AI position selection, rather than the lame debug drawing?
speaking of.. I should probably look at making a nice debug drawing api ๐
It's never wrong to make good debugging tools
Right! and you can't complain if they look super cool too eh? ๐
I think debug aesthetics should be a thing if it isn't already
Mind you, I'm still salty about slate's lack of a proper rounded rectangle
Depends on how many features you have to cut to spend time on making the debugging look super cool
Well, yeah ok this isn't for a production deadline kind of thing
even I wouldn't be that reckless
And to be fair, the debug vis will be part of the product anyway
this is for an AI director API
prolly should ask on UDN but mybe someone from epic is sitting there:
UPROPERTY(BlueprintAssignable, Category = SmartObject, meta=(DisplayName = "OnSmartObjectEvent"))
FSmartObjectComponentEventSignature OnSmartObjectEvent;
Any reason why is that protected ? ;s
i was able to get smart object to work but yes it was lot of trial an error
it one thing i dislike is the lack of documentation on everything
Decent humble bundle going on right now if you need tanks ๐
I do need tanks.. I always need tanks
Tank AI is super fun too
I also might look into direction of custom smart objects. Last time I heard the built in ones were not movable what is significantly reducing my use cases if I want to do a consistent approach.
Does anyone know why my Environment Query gets the location of the AI themselves? I copied the EQ_FindPlayer from the Action RPG project... with a Trace to EQS_PlayerContext which returns all actors of my character class. I verified that it actually gets the player with a debug sphere. But then the AI are just getting their own locations for some reason
Can someone explain to me why AI Perception seems to be buggy as all hell? Some levels it works when there's no objects to break line-of-sight and then other levels it doesn't work at all despite there being no objects to break line-of-sight.
Sometimes it works if I remove the landscape from the level, sometimes it doesn't work whether there's a landscape or not.
Been testing this in multiple levels. Some I create with nothing but a directional light, two pawns (one AI controlled with AI_Sight_Sense for AI Perception), and either a landscape or a cube for the floor.
Or I could just be really dumb and bAutoRegisterAllPawnsAsSources=false was the problem
are there any ue5 line formation AI tutorials out there? it feels like most UE tutorials out there are ancient (early UE4)
line formation?
creating formations is not a problem but keeping the formation while moving + avoidance is a problem
even with Kythera I saw some pawns falling from floor sometimes
remove all cliffs ๐
it was a plain floor 
remove all terrain, just levitate everyone ๐
I'll let Kythera guys know about this solution next time ๐ ๐
Formations are so old school anyway, who needs them
Lets just dance our way through the world!
And if you need some kind of formation.. just add flags!
Can you tell I was into animating sprites for a class? ๐
Looks like I might be working on some "formations" for interactions between VR agents and physical human dancers soon
of course mine will be driven by ML
Anybody managed to get AI to work with World Partition Navmesh? I managed to finally build the navmesh but the AI does not move
get in line boy
Get back to work
who do you think, who was working on this ๐คฃ
how can i have 2 AI communicate with each other?
also, what is the best way to have a blueprint communicate to the AI? for example, when a box overlaps with the player it lets the AI know where the player is at?
line formations are not super difficult though, it is mostly maths to assign units a place in the line
although idk the context so it might be less straightforward than with a custom implementation
The challenge that I find with formations + collision/avoidance is to find a good balance between keeping the formation tight (specially when arriving at destination) while having some degree of freedom since battalions will often collide and try to occupy the same space
yeah I see
Use smart objects. A central actor thst holds reference to the AI sends the info to the controller.
@hearty niche any tutorials about this?
There is one that uses it to assign cover, you could use it to send any other commands in theory
#runbehaviordynamic
This video is about using Smart Objects in Ue4 with C++
Similar concept to Uncharted
Hmm, looking at smart objects, they seem to have a behavior tree "behavior class" out of the box which seems handy for scripting more complex logic as I want to have in mine
However it's a bit unclear as to how that's intended to be used, for example it doesn't appear to have any mechanism to tell the BT what is the object being interacted with ๐ค I guess maybe it's just a matter of inheriting your own version of that which can assign it to the blackboard or something...
We managed to get decent cover system working with the above approach. The AI is essentially owned by a specific zone and it only has knowledge of stuff inside the zone. Problem with using premade stuff is how it is hard to add new features to (plus we froze our version to 5.0 for now)
Yeah, it does seem to more or less have the features I want, and would need to implement myself if it wasn't there
the smart object system probably doesn't do reachability checks, I have a custom system in place for that since the player can build stuff in bad ways where the objects couldn't be reached by the NPC's, but that's probably fairly easy to integrate by just having it filter out objects that don't show up in the reachable objects list
Although need to look into how that would work for slots say on multiple sides of an object, and the player places the object such that one side of the object is blocked... I guess I need to reachability check the slots individually, and somehow disable the unreachable slots
...and also I think I need a queue mechanism for them
:D
Yeah, definitely add a queue mechanism
Yeah, I suspect may need to make my own smart object component to add all the extra stuff
But at least the base system has a lot of the functionality baked in so it makes it a lot easier
SO as everyone says are pretty easy to sort out..
Yeah, the ability to get them by usage types is pretty handy also, although I'm going to need to add a fair bit of custom logic on top of that to do the selection appropriately, but I have that logic in place already anyway
You say these are player created?
Yeah it's a management game so the player can place objects to where they want them
There's some additional criteria when the NPC's select them, like if the object is a container and it's empty, there are cases where the NPC should not consider it as a valid choice for interactions, and some other rules as well beyond just "you can get an item from this container" which would probably be what the usage tag on the object would say
is there any reason why UPathFollowComponent isn't exposed to blueprints at all? I'm working on a custom BP async node which implements the functionality of Simple Move To but with the extra output nodes provided by AI Move To, and I want a designer to be able to abort the path following by calling AbortMove on the path follow component. But generally when I see a component that has zero functionality exposed to blueprints, there's usually a reason for that. Am I going about this the wrong way?
@ocean wren quick question - if I would want to add ORCA to UE manually, how much trouble would I be into? since its equivalent of RVO it shouldnt be complex as detour, right?
anyone knows who is the programmer behind StateTree ?
or is there any forum, ... to request feature ?
Mikko
Also in this server but disappear after first day
Mieszko was said he doesnt have much patience for discord iirc ๐
Mikko | Mieszko are the same guy ?
nope
Mieszko mostly working on #mass these days, Mikko works on StateTree and PathFollowing
Shouldn't be too hard.. I modified detour a bit for pushing agents away and following the codepath for that wasn't a huge problem
I assume you could either replicate that, or same with RVO
Does ORCA provide serious and practical benefits over RVO at all?
Hmm, I guess it depends on the use case.. have a look on YouTube there's videos of both approaches
Whats the problem you're trying to solve?
I watched a few comparisions, both end up in deadlock everytime xD
I saw Kythera using ORCA over RVO and it was working quite good
in fact it was working very good
Units very rarely get stuck and able to swarm around things properly
Yeah, there's a range of different crowd navigation and locomotion approaches.. have you considered just fudging detour?
Its internals seemed too complex at first glance to modify it
its actually pretty simple.. if you turn on the debug visualization for it.. it just samples in front of the agent and tries to steer away from hit samples.. pretty much the same way that do with Uncharted (at least Uncharted 1)
ah, didnt know there was a debug visualization for it
But I guess just finding the RVO code and redoing that isn't a bad idea either
Yeah, its weird, you have to mod the C++ code to enable the debug vis console command if I recall.. it wasn't something that would work by default for some reason
I want units to move in a straight line and not push each other, but only swarm around the target when its blocked - so I guess I'm looking for something steers the agent itself rather than pushing other ones?
It depends on how you want to sample the future collisions.. RVO does a geometric thing, which I don't particularly like
detour samples a grid and uses that to bias towards collision free movement
Alright, thanks 
ORCA if I recall, does a sampling also? been a while
Have a look at contiuum crowds too ๐
Didn't Jur Van Der Burg do an ORCA library at some point?
I didnt see any open source one
wasnt s/he popular with some algorithm in computer science?
something related with splines
Optimal Reciprocal Collision Avoidance