#gameplay-ai

1 messages ยท Page 18 of 1

ruby shard
ocean wren
#

No it doesn't require perception.

lyric flint
#

@ocean wren thanks

proven stump
#

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

sand kettle
#

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

dense kelp
#

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.)

proven stump
spare panther
#

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

proven stump
spare panther
proven stump
#

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

celest python
#

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?

restive tendon
#

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.

rustic nova
#

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.

rustic nova
celest python
#

FStateTreeExternalDataDesc is outdated with 5.1

#

but it can be used for declaring schema parameters in the header

#

its somehow related with linker iirc

rustic nova
#

Ah yea the linker thing you mentioned, I kind of skipped over that and went with the parameters

celest python
#

i think to declare default params you still need it though

rustic nova
#

I did see mass used the linker a lot

celest python
#

yeah for tasks, its not needed anymore

#

only usage is schema params

rustic nova
#

Hmm maybe I should look at 5.2 source code to see what is deprecated

celest python
#

evaluators ๐Ÿ˜„

rustic nova
#

really? I thought those looked quite useful. I suppose you can always define a task which is always running

celest python
#

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 ๐Ÿฅน)

rustic nova
#

Nice doesn't seem like there are that many breaking changes between 5.1 and 5.2

rustic nova
#

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?

celest python
#

thats how I did

chilly nebula
#

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

rustic nova
celest python
#

but that would enforce you to add transition condition for each time you want to use it

#

a generic state would use tick

rustic nova
#

Yea that is quite the downside

chilly nebula
#

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

tawdry osprey
#

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?

chilly nebula
#

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

neon carbon
#

anyone familiar with blackboard based conditions, services and selectors ?

tawdry osprey
chilly nebula
#

Or you want the StateTree to be the "brain" that processes commands from the player?

tawdry osprey
#

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.

chilly nebula
#

--
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

tawdry osprey
#

Ah yes, that was also my next thought, and probably the next easiest solution

neon carbon
#

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

chilly nebula
smoky fox
#

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!

strong cargo
# smoky fox Hello! I'm getting stuck on a navigation issue I'm trying to make a move with a...

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?

uneven cloud
smoky fox
uneven cloud
strong cargo
#

I think @uneven cloud is right, though. A visual debugger should help.

smoky fox
# uneven cloud Can you explain what your intended behavior is?

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

strong cargo
#

And also shoutout to @uneven cloud for the super helpful optimization tips dropped here the other day! Took a lot of notes from that.

uneven cloud
smoky fox
uneven cloud
smoky fox
smoky fox
strong cargo
patent hornet
#

Or over level edges

clever skiff
#

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

uneven cloud
clever skiff
#

is that blueprint or c++

#

im using mostly blueprint

uneven cloud
#

It should be usable in BP

clever skiff
#

ok thanks ill take a look in to that.

polar inlet
#

cant find where the ai is being controlled in the LYRA project anybody know what folder or cpp class?

untold quiver
#

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

untold quiver
lyric flint
#

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?

clever skiff
#

do your object have collision on them?

uneven cloud
lyric flint
lyric flint
uneven cloud
lyric flint
#

its only a small area where the nav mesh is so its not like huge or anything

uneven cloud
#

In that case, my best guess is that the navmesh is being built before the level has fully streamed in.

lyric flint
uneven cloud
lyric flint
#

i will check one more time though just to see

uneven cloud
neon carbon
#

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

lethal helm
#

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

neon carbon
#

no timers, this is the distance calculator

lethal helm
#

whats inside follow enemy?

neon carbon
#

this

lethal helm
#

??

#

why did you reinvent the moveto node

neon carbon
lethal helm
#

moveto supports pathfinding

#

left is pathfinding right is no pathfinding

neon carbon
#

I didnt know, its my first time diving into behavior trees

#

should i replace?

lethal helm
#

yes

neon carbon
#

and what if my enemy pawn failed to move towards me?

lethal helm
#

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

neon carbon
#

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

lethal helm
#

thats not really a behavior tbh

neon carbon
#

also my enemy actor key isnt showing here

lethal helm
#

no

#

it's an object key

#

you need to make it an actor key for it to appear

neon carbon
#

yes it is in my blackboard

lethal helm
neon carbon
#

as an object

#

oh holdup

#

wait

lethal helm
#

objects don't have locations

neon carbon
#

base class

lethal helm
#

it's slightly hidden

neon carbon
#

got it, thanks

lethal helm
#

as for the gait thing

#

you could make a service that ticks say every second on your moveto node

neon carbon
lethal helm
#

which then checks the distance and changes the gait accordingly

neon carbon
#

especially if i will be having a lot of these NPCs

#

in my level

lethal helm
#

it's complicated lol

neon carbon
#

that too multiplayer

#

thats why i want to keep most things in execution

lethal helm
#

the performance killing tick refers to running operations every frame

#

but services have custom tickrates

neon carbon
#

I see

lethal helm
#

so a service with a tickrate of 1 second will occur 1/60 as often as a true tick

#

which is nothing

neon carbon
#

the event tick runs every 0.01 seconds doesnt it

lethal helm
#

1 second / 60 frames per second

#

so pretty much

neon carbon
#

yes i noticed the BT tick runs slow and steady

lethal helm
#

to reduce confusion it would be more accurate to call the service tick, timers

neon carbon
#

yeah

lethal helm
#

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

neon carbon
#

all that

#

extra

smoky fox
jade gust
#

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

celest python
#

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

jade gust
#

it was showdebug, thank you

jade gust
#

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

sullen notch
#

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?

misty wharf
#

Two ways come to mind off the top of my head:

  1. Have a decorator which triggers when player is invisible, which would allow you to abort branches of logic
  2. 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)
sullen notch
#

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

misty wharf
#

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)

sullen notch
#

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

misty wharf
#

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

sullen notch
#

this is the bt too

misty wharf
#

It doesn't seem to be set to abort based on when the invisibility changes, can't really say much else about that

sullen notch
#

oh yeah mb i forgot to set it back

#

last night i was changing stuff coz why not

clever skiff
#

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.

misty wharf
#

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

clever skiff
#

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

misty wharf
#

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

clever skiff
#

yeah the smart object does basically that set object to being claim and unclaim but seem to be alot more work

sand kettle
#

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?

clever skiff
misty wharf
#

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

misty wharf
#

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

clever skiff
#

that true. i will test them and see which i like better

misty wharf
#

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

ocean wren
#

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..

celest python
#

Only thing is missing currently is UFUNCTION binding PepeHands

#

But I hope that'll happen to pikapray

clever skiff
quaint radish
#

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...

โ–ถ Play video
#

link is time stamped

#

it is not an option in my current version of 4.27.2 or 5.1

misty wharf
#

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

quaint radish
# misty wharf the PlayerContext is most likely a custom Environment Query Context

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...

โ–ถ Play video
#

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

celest python
#

anything that is not ryan laley

quaint radish
#

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

polar inlet
dense kelp
#

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)

uneven cloud
uneven cloud
wind surge
#

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,

lone stump
#

it probably stops chasing because you're running move from tick, every tick you run another move request. what are you trying to achieve?

clever skiff
#

i mean your delay might be the reason why

wind surge
spring inlet
#

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

crystal sequoia
#

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

wind surge
clever skiff
#

anyone can help with my above issue with ai ignoring my booleans.

cursive stag
#

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.

quaint radish
#

How do I get the owner of this EnvQueryGenerator?

quaint radish
#

breakpoint never fires, or maybe aicontroller is really not the owner..

#

i did try both actor and object options.

uneven cloud
#

The pawn is the owner

quaint radish
# uneven cloud 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?

uneven cloud
quaint radish
uneven cloud
quaint radish
neon carbon
#

@lethal helm is it okay to use blackboard conditions on tasks?

neon carbon
#

any way to expose this as a variable or modify it through BP?

misty wharf
#

You're going to need to create a custom version of the MoveTo node

desert kelp
#

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

misty wharf
#

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

desert kelp
#

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

misty wharf
#

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

desert kelp
#

yeah, but I will need it there once I have enemies wandering around

misty wharf
#

Either way there should be some way of using a different nav area for them... maybe via another component

desert kelp
#

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.

misty wharf
#

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

desert kelp
#

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

normal mesa
#

Does anyone know the name of a function I could use to just check if a path is available?

crystal sequoia
unborn jungle
#

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
                    }
                }
            }
normal mesa
#

@unborn jungle I assume there is a way to do this Async... ๐Ÿค”

#

Then you could do it in the background I suppose

unborn jungle
#

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

uneven cloud
uneven cloud
uneven cloud
uneven cloud
unborn jungle
#

Thanks I'll try that! FindPathToLocationSynchronously seemed to be very expensive when many AI agents are running it frequently just as a query

quaint radish
uneven cloud
#

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.

unborn jungle
uneven cloud
unborn jungle
#

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

clever skiff
#

i am also clearing the reference object once one ai get to the location so that the ai doesnt pick up on that location

silent hamlet
#

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?

ruby shard
#

how do I set Paramter value in StateTree ?
when my Task is Done I want variable X to be increased

dense owl
#

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?

celest python
#

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

strong cargo
#

I'm not sure if it applies to your case but it sounded similar.

dense owl
#

Yeah, no I mean like travel in 3d rather than just on one plane

#

If that makes sense

strong cargo
# dense owl Yeah, no I mean like travel in 3d rather than just on one plane

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.

real arrow
#

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

dense owl
#

Oh, that might make sense, Iโ€™ll look into that thanks @strong cargo

strong cargo
clever skiff
#

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

dense owl
#

@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

lunar isle
#

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

celest python
#

Prefer "steering" instead of manipulating the path

lunar isle
#

sure... but how

celest python
#

Trace from agent, manipulate movement direction from path following comp

#

Based on trace result

quick bramble
#

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.

quick bramble
#

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.

silent hamlet
#

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 ๐Ÿ˜

clever skiff
#

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.

celest mauve
#

hey guys, how to use "AI Move to" without rotating the AI character?

dense owl
#

@clever skiff was this smart object an alternative to using goal locations ?

clever skiff
#

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

dense owl
#

Nice good to know

clever skiff
#

the sims use this system alot. so im glad it in ue.

dawn loom
#

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

ocean wren
#

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

dawn loom
#

making my sight detect everything then filter ?

ocean wren
#

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

silent hamlet
#

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...
uneven cloud
dawn loom
uneven cloud
dawn loom
#

I think it doesn't ๐Ÿ˜ฌ

ocean wren
#

source code documentation

#

its not that hard to read thankfully

dawn loom
#

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

ocean wren
#

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

ruby shard
#

@silent hamlet if u r using AIController AAIController::MoveTo* would be enough I guess, in your StateTreeTask enter just call those funcs

ruby shard
#

how do I use something like Blackboard in StateTree ?

#

I want a shared data to be changed by tasks

#

๐Ÿค”

celest python
#

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 A_shrug worst decision ever

ruby shard
#

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

celest python
#

check UStateTreeComponent::SetContextRequirements

silent hamlet
celest python
#

There is a delegate on PFC that gets broadcasted on path events

ruby shard
#

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

silent hamlet
#

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?

celest python
#

its good

ruby shard
#

seems ok to me ๐Ÿค”

silent hamlet
#

oh

celest python
ruby shard
#

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

celest python
#

A struct would be UStruct* in reflection realm

ruby shard
#

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

celest python
#

Why not just use OUT param?

ruby shard
#

w8 how ?

celest python
#

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

ruby shard
#

where do I set those parameter as out ?

celest python
#

uproperty(category = "out")

ruby shard
#

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

vapid night
#

is nav mesh viable for an rts\city builder style game with large map?

celest python
ruby shard
#

yea, im alredy attaching ID->Actor* to the parent state , but this type of global data dosent work

#

weird, there must be a solution

strong cargo
# vapid night is nav mesh viable for an rts\city builder style game with large map?

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..

vapid night
vapid night
strong cargo
vapid night
#

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)

strong cargo
#

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?

vapid night
#

mmmm wdym by hand made graph?

strong cargo
#

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?

light kernel
#

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

vapid night
#

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

strong cargo
# vapid night the world can be almost flat so there wont be pre defined passages or something ...

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.

ruby shard
#

@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

vapid night
#

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

strong cargo
#

Here are some optimizations I've applied for these sorts of situations:

  1. Limiting the coverage of NavMeshBounds

  2. Limiting the number of invokers, and keeping their radius as small as reasonably possible, without being so small that you need too many.

  3. Limiting number of actors with certain components that have bCanEverAffectNavigation checked

  4. Having invokers remain stationary whenever possible, but also not move them too far when you do need to move them

  5. Having invokers only exist as long as they need to (but you don't want to be turning them on/off too frequently either)

  6. If you can, making your Tile UU as high as you reasonably can.

  7. 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)

  8. 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.

  9. The stat Navigation and show Navigation commands 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.

  10. 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.

  11. 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.

vapid night
#

this is much simpler ๐Ÿค”

#
  1. 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

strong cargo
# vapid night > 4. Having invokers remain stationary whenever possible, but also not move them...

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?

vapid night
#

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

strong cargo
#

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.

vapid night
#

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

strong cargo
# vapid night I dont think that I need more then 1 invoker around the player

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.

vapid night
#

sec I think that I lost u ๐Ÿ˜…

strong cargo
#

Haha yeah it's a subtle distinction.

#

I wish I was better at sketching things digitally cause a visual would probably help. ๐Ÿ˜…

vapid night
#

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?

strong cargo
#

Something like that. It all depends on the recast settings and update interval.

vapid night
#

cause it seems like its

strong cargo
#

There are 2 things going on there.

#

Well 3. Let's start with what the radii actually mean.

#
  1. 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.
#
  1. 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...
  2. 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.

vapid night
#

think that I got it

#

what about npcs that are outside the invoker range?

strong cargo
#

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)

vapid night
#

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

strong cargo
#

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.

vapid night
#

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

strong cargo
#

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.

vapid night
#

ya

#

welp thanks a lot

strong cargo
#

no problem! ๐Ÿ™‚

vapid night
#

it was very interesting and enlightening

silent hamlet
#

mh I can test this actually

uneven cloud
vapid night
#

it shouldnt be cheaper than just using an invoker

uneven cloud
vapid night
#

Need accurate path finding near the player and some path finding for the rest of a 5km^2 map

strong cargo
# uneven cloud Invokers are far more expensive than nav mesh that is full regen. Especially on...

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.

uneven cloud
#

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.

vapid night
#

What techniques other then a grid are out there? ๐Ÿค”

#

And spline or a graph

strong cargo
uneven cloud
uneven cloud
strong cargo
#

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.

uneven cloud
#

You figure out ways to make a group of changes, build paths, get a snack, then test.

strong cargo
#

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.

uneven cloud
#

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.

strong cargo
#

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.

uneven cloud
#

It's not a nightmare. It's just not documented outside of UDN.

strong cargo
#

What do you mean when you say finicky?

strong cargo
#

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.

stoic granite
#

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?

uneven cloud
# strong cargo What do you mean when you say finicky?

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.

uneven cloud
clever skiff
#

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

stoic granite
# uneven cloud There should be a function you can call to check the sense class.

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?

uneven cloud
stoic granite
stuck glade
#

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

clever skiff
visual dawn
#

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

glass spade
#

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.

rustic nova
#

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.

silent hamlet
clever skiff
#

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.

uneven cloud
uneven cloud
clever skiff
#

damn

clever skiff
uneven cloud
#

When a gameplay behavior is interrupted it automatically ends. It was trivial for me to change that, but it took some C++.

clever skiff
#

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

lament ruin
final loom
#

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?

feral edge
#

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

clever skiff
# feral edge so I am making AI for my game and I want the Ai to chases the player when it see...

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.

uneven cloud
silent hamlet
# feral edge so I am making AI for my game and I want the Ai to chases the player when it see...

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...

โ–ถ Play video
terse panther
# final loom Is there any blueprint function called when an actor tries to use a NavLinkProxy...

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...

โ–ถ Play video
ocean wren
sand kettle
#

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...

gritty glen
#

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?

uneven cloud
uneven cloud
uneven cloud
misty wharf
#

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

sudden hollow
#

Is this the right place to ask about Behaviour Treeโ€™s? ๐Ÿ˜„

misty wharf
#

Yep

sudden hollow
#

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โ€™

misty wharf
#

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

celest python
#

Flowgraph

misty wharf
#

Yeah flowgraph is excellent, haven't tried it for dialogs but seems people use it for that as well

sudden hollow
#

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

misty wharf
#

I even got my name in the contributors list for flowgraph! alex

sudden hollow
misty wharf
#

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

sudden hollow
#

This is it currently

plush cargo
#

Any news about statetree yet ?

celest python
#

It got an update and bugfixes

plush cargo
#

no knowledge or examples?

sudden hollow
plush cargo
#

ive been waiting for any sort of insights

celest python
misty wharf
harsh storm
plush cargo
#

i hit a wall in december

#

decided to wait and focus on other things

harsh storm
#

The docs for it is surprisingly decent to get going with State Tree

plush cargo
#

i dont agree as it didnt take me much further

harsh storm
#

It teaches you all the concepts you need though.

plush cargo
#

it didnt

sudden hollow
harsh storm
#

If you're waiting for a hand-hold tutorial on every possible application, you're going to be waiting awhile

celest python
#

And some verbose bugfixes i dont remember

plush cargo
#

no the documentation was lacking then

#

the basic introduction did not convey what is possible

uneven cloud
# final loom What's a smart Link?

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.

harsh storm
#

It most certainly wasn't. But w/e.

celest python
#

With*

plush cargo
#

where was it stated that a placeholder state needed x and y type of actions for it to be entered

harsh storm
#

What is possible? Whatever you need to be possible.

final loom
plush cargo
#

an empty state was simply not triggering

#

by conditions alone

#

just an example

uneven cloud
plush cargo
#

i spent 4-5 weeks with state tree so i can safely say the documentation was lacking

sudden hollow
harsh storm
#

Took less than a day to get basic AI working with the documentation.

plush cargo
#

it seems the documentation has been updated

celest python
#

Tree implementation is not flexible for a dialogue imo

harsh storm
uneven cloud
# final loom Oh. Huh. What's the cheaper one with C++?

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++.

celest python
final loom
#

I know C++, but how much do I need to know?

uneven cloud
plush cargo
#

Common Patterns is added since i was last into it

harsh storm
#

Was there in December

celest python
#

I still have no idea what was the wall you hit on december

final loom
#

DO you recall the exact class name of simpleLink in C++?

plush cargo
#

5.0 and 5.1 documentation on statetree are different, i wholly missed the parts explained in 5.0

#

are they still relevant ?

uneven cloud
plush cargo
#

huh this is confusing for me, im reading stuff i havent read before

harsh storm
#

Yes, they are different. They updated the docs in 5.1

#

And they're likely going to update them again in 5.2

final loom
#

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?

final loom
#

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.

sand kettle
final loom
#

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.

wind surge
#

How can I fix my ai stuck on walls while roaming?

#

this is the roaming bp

final loom
#

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.

rotund swallow
#

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.

final loom
#

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?

vernal jacinth
#

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

final loom
#

Hmmmm. Is there a function that fires off to give a hearing event, maybe?

#

Yeah, are you using the report noise event?

vernal jacinth
#

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

final loom
#

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

vernal jacinth
#

ohhhh

final loom
#

Or, do you want 10 meters? I'm not sure.

vernal jacinth
#

I see now

final loom
#

Yeah, in UE5 the unit of distance is a CM

#

Try that?

vernal jacinth
#

I tried multiplying the range before

final loom
#

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.

vernal jacinth
#

but I did it here:

#

I need to increase it on the MakeNoise function instead

final loom
#

Try that, see if it works.

#

Hope it helps!

#

Let me know if it does though.

vernal jacinth
#

ok yep, that was it, thanks!

#

I increased it to match the sense hearing range, so 1500 on both sides and it worked

final loom
#

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

final loom
#

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?:

final loom
#

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()

#

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?

fallow gust
#

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

fallow gust
#

That should get you where you want

final loom
#

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!

fallow gust
#

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.

final loom
#

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.

fallow gust
#

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

final loom
#

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.

final loom
#

I just hope if I try to make an open world game later it won't be too problematic.

terse panther
#

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 .

final loom
#

Maybe something with the crowd system?

misty wharf
#

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

slow bobcat
#

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!

crystal hatch
slow bobcat
#

Amazing. Thanks a lot Mieszko. This is very helpful

terse panther
misty wharf
#

Sure. You could have some other actor/object act as a coordinator/manager for it

terse panther
#

a small question...
single big navmesh and multiple small , will there be any performance issue ?

misty wharf
#

afaik they end up being part of the same mesh, the nav mesh volumes just affect where it is generated

full oyster
#

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?

misty wharf
#

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

full oyster
misty wharf
#

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

full oyster
#

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

celest python
#

how can I check if function returned true and keep the same Projection Location value when this is a pure node PandaOhNo

misty wharf
#

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

visual dawn
#

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

celest python
#

check visual logger first

visual dawn
visual dawn
celest python
#

||my name is not a reference to AoT sadcatup||
you just need to go to tools -> visual logger in editor

#

then start recording

#

then play

#

it will log everything relevant

visual dawn
#

ok sir am the recorder and ur the logger

#

@celest python this file u need right?

celest python
#

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

visual dawn
celest python
#

its not moving at all

#

you are also checking first input

#

check other entries too

visual dawn
celest python
#

quick question

#

why dont you use latent AI move to task

visual dawn
#

trying with mine and it dint work i knew there was a p

visual dawn
#

its a udemy course

#

step by step tutorial doe

#

so its the ealry stages of the ai stuff ot to deep

celest python
#

I'd say refund it, there is no udemy course that can actually teach how AI works

visual dawn
#

evrything been wrking fine

celest python
#

Its likely you're learning incorrect practices instead but if you're ok with what course provides A_shrug

But anyway, vlogger says some external source aborts the movement

#

you need to find what it is

celest python
#

it says there is another request happening

#

UserAbort NewRequest ForcedScript

visual dawn
soft idol
#

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

lone stump
#

@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

soft idol
#

yep, doing so now

#

will probably end up writing a bp async action to have the same functionality

#

or custom node, whichever

clever skiff
#

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?

clever skiff
#

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.

dense kelp
#

Anyone figured out if there's a way to run an EQS query in state tree?

misty wharf
#

Seems you just need to make a ST node that runs an EQS query

hushed bloom
#

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

uneven cloud
#

Probably because state trees was built to be more generic. I believe the first user of it was Mass, which doesn't have controllers.

uneven cloud
clever skiff
celest python
#

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

celest python
final loom
#

Can I make multiple AI navigators use the same path when navigating, or otherwise dissect navigation data, see where it turns and brakes, etc?

lyric flint
celest python
#

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

celest python
#

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

silent hamlet
#

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

proven hearth
#

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.

harsh storm
#

Time to learn C++.

#

Ain't no way around it if you want performance.

hushed bloom
#

For a procedural dungeon is it better to just use navigation invokers for navmesh

misty wharf
#

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? ๐Ÿค”

celest python
#

apply advanced optimizations after profiling

celest python
misty wharf
celest python
#

Buut yeah i remember that too

misty wharf
#

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

harsh storm
#

Well - the base concept of a smartobject is quite easy to implement yourself.

misty wharf
#

Yep

ocean wren
#

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

harsh storm
#

Motion Warping is stupidily easy to actually use as well.

#

I thought it was going to be more difficult honestly. But nope - pretty straightforward.

ocean wren
#

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

misty wharf
#

Interesting, good to know

#

My animations are basically just from Mixamo and some poor custom animations I made for lack of anything else lol

ocean wren
#

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..

misty gale
#

Theres a virtual function "GetTargetLocation" which can return whatever location (ment for aiming) which you can use as an alternative

uneven cloud
uneven cloud
# proven hearth Hey, maybe someone reading this has some more knowledge than me on the topic. I ...

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.

uneven cloud
# misty wharf bit of an architecture/design question for AI related things - How would you app...

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.

misty wharf
#

Thanks.. Yeah not doing mp at least :)

uneven cloud
#

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.

misty wharf
#

: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.

harsh storm
#

@uneven cloud What would you say your favorite chapter in GameAIPro is? ๐Ÿค”

harsh storm
misty wharf
#

I'm also working on that lol

harsh storm
#

Ah yes - the forever multiple project dev. This is the way.

misty wharf
#

Yep :P

uneven cloud
misty wharf
#

Ah like if you wanted different behaviors on the same object?

misty gale
#

If holding knife , cut orange, else peel orange?

uneven cloud
terse panther
#

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?

uneven cloud
terse panther
uneven cloud
terse panther
haughty coral
misty wharf
#

Will check it out, thanks for the tip

haughty coral
#

Handles IK for interaction, playing montage on all the interaction roles (target, user,...) and is also networked (at least in 5.2)

misty wharf
#

tbh animations are fairly secondary for me atm but might as well set it up if it's helpful

haughty coral
#

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.

harsh storm
#

Contextual animation eh? ๐Ÿค”

haughty coral
#

Might be the same thing they mentioned in the first UE5 demo and then never again :D but it is being actively worked on.

harsh storm
#

Huh - I thought that was something built into the new animation stuff. Not a different plugin entirely. lol

uneven cloud
#

There is motion warping and contextual animations. Both are plugins.

ocean wren
#

+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

misty wharf
#

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

ocean wren
#

I've no idea what one of those is... so no idea? ๐Ÿ™‚

misty wharf
#

It's like a kindle basically lol

ocean wren
#

oh right

#

I am guessing not? I mean isn't there a PDF converter you could use?

misty wharf
#

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 :)

ocean wren
#

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 ๐Ÿ˜‰

misty wharf
#

what kind of weird keyboard did you get if it requires getting used to

ocean wren
#

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

misty wharf
#

Ah

ocean wren
#

I suspect my other one required more key pressure

misty wharf
#

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

ocean wren
#

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?

ocean wren
#

speaking of.. I should probably look at making a nice debug drawing api ๐Ÿ˜‰

uneven cloud
#

It's never wrong to make good debugging tools

ocean wren
#

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

uneven cloud
#

Depends on how many features you have to cut to spend time on making the debugging look super cool

ocean wren
#

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

echo lark
#

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

clever skiff
#

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

ocean wren
#

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

haughty coral
#

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.

cinder vale
#

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

clear pasture
#

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

dense owl
#

are there any ue5 line formation AI tutorials out there? it feels like most UE tutorials out there are ancient (early UE4)

ocean wren
#

line formation?

celest python
#

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

ocean wren
#

remove all cliffs ๐Ÿ™‚

celest python
#

it was a plain floor sadcatup

ocean wren
#

remove all terrain, just levitate everyone ๐Ÿ™‚

celest python
ocean wren
#

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

hearty niche
#

Anybody managed to get AI to work with World Partition Navmesh? I managed to finally build the navmesh but the AI does not move

hearty niche
opaque coyote
mortal umbra
#

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?

dawn schooner
#

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

celest python
#

it has to interop with avoidance

#

otherwise it'll break

dawn schooner
hearty niche
mortal umbra
#

@hearty niche any tutorials about this?

hearty niche
hearty niche
#

Similar concept to Uncharted

misty wharf
#

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...

hearty niche
misty wharf
#

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

ocean wren
#

Yeah, definitely add a queue mechanism

misty wharf
#

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

ocean wren
#

SO as everyone says are pretty easy to sort out..

misty wharf
#

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

ocean wren
#

You say these are player created?

misty wharf
#

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

soft idol
#

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?

celest python
#

@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?

ruby shard
#

anyone knows who is the programmer behind StateTree ?
or is there any forum, ... to request feature ?

celest python
#

Also in this server but disappear after first day

#

Mieszko was said he doesnt have much patience for discord iirc ๐Ÿ˜„

ruby shard
#

Mikko | Mieszko are the same guy ?

celest python
#

nope

#

Mieszko mostly working on #mass these days, Mikko works on StateTree and PathFollowing

ocean wren
#

I assume you could either replicate that, or same with RVO

celest python
#

Does ORCA provide serious and practical benefits over RVO at all?

ocean wren
#

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?

celest python
#

I watched a few comparisions, both end up in deadlock everytime xD

celest python
#

in fact it was working very good

#

Units very rarely get stuck and able to swarm around things properly

ocean wren
#

Yeah, there's a range of different crowd navigation and locomotion approaches.. have you considered just fudging detour?

celest python
ocean wren
#

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)

celest python
#

ah, didnt know there was a debug visualization for it

ocean wren
#

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

celest python
#

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?

ocean wren
#

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

celest python
#

Alright, thanks thanks_blob

ocean wren
#

ORCA if I recall, does a sampling also? been a while

celest python
#

ORCA just feels like RVO+ to me

#

I didnt get the difference much

ocean wren
#

Have a look at contiuum crowds too ๐Ÿ™‚

#

Didn't Jur Van Der Burg do an ORCA library at some point?

celest python
#

I didnt see any open source one

#

wasnt s/he popular with some algorithm in computer science?

#

something related with splines

ocean wren
#

Optimal Reciprocal Collision Avoidance