#gameplay-ai

1 messages ยท Page 57 of 1

rugged cloak
#

Thanks ๐Ÿคฉ

devout axle
#

Hey guys. Any idea why RVO avoidance is not working with my npcs? I don't know what to try anymore, they keep bumping into each other and they get stuck. I can't get on with my game with the npcs like this

misty wharf
#

You're gonna need to show your RVO settings and more info

#

You can also try crowd avoidance, sometimes it works better

obtuse igloo
#

Ohh I didn't think about using GAS! thank you for the suggestion ^_^

gray minnow
#

Hey! I'm trying to get my head around Behaviour Tree by moving what I've already done to different tasks, but I've got a lot of component references. What's the best way to deal with that in a task?

misty wharf
#

Depends on what exactly you mean by component references, and what you are doing with them

gray minnow
misty wharf
gray minnow
obtuse igloo
#

Anyone know why I can't use the Smart Object Subsystem in my Object Blueprint? I'm trying to allow my action class to access it so I can make a consideration for if it can find food.

#

Okay so I might of solved it, I just need to make a function inside the AI's controller that then uses the subsystem to call Find Smart Objects :D

uneven cloud
harsh storm
#

Yeah - UObjects don't have a valid GetWorld() I believe.

steel moat
#

Is there any difference when we set a location instead of Obj reference in the blackboard key of MoveTo Task?? im asking this because im seeing it and i wanted to know why both are acting differently

harsh storm
obtuse igloo
#

Hi, I'm trying to figure out how I can structure this BT so that the AI doesn't try to find more Smart Objects in the tree after the node has already been executed.

The "Eat Food" task will sometimes fail which will then lead the AI back up to Find Food again which will make it continuously claim objects...I just want it to claim one and not be able to claim any others even if the Sequence fails after the first one. ๐Ÿ˜ญ

#

Also to note, for some reason this fails execute but the smart object is still being used? I'm unsure if this is a bug or not but I dont know why it's failing.

#
steel moat
#

How does MoveTo Task works in Behavior Tree, Im updating the goal location of AI using a custom move to Task on the basis of a certain condition. AI is following player until the condition is true and when its true it will get a new goal location instead the default target location, but when the player is running straight the check doesnt get called and it doesnt get updated resulting the ai into continuosly follow player

floral compass
steel moat
#

im updating some properties of the task at runtime

steel moat
floral compass
steel moat
#

what other method do u suggest?

floral compass
#

All you need to do is change the native MoveTo's target from the Player to a point on the radius

steel moat
#

yea

floral compass
#

Sorry, to a point on the circle

steel moat
#

its fine i got it

steel moat
floral compass
#

You can

steel moat
#

they are locked?

floral compass
#

This is the option you want to enable

#

Then your MoveTo will update its target location as the BB key changes

steel moat
#

the BB Key is Actor-obj reference

floral compass
#

So? Just change it to vector. Works for both actors and vectors

steel moat
#

i cant keep the bb key as location cuz it makes the AI movement jittery

floral compass
#

That's not a problem with the MoveTo then, something else is wrong

steel moat
#

jump to 4:50

floral compass
#

I did, there is nothing related to what I'm talking about

#

Also that video is very old

#

Native MoveTo has changed since

steel moat
#

but it was working like that for me...

#

and when i changed the BB key to object reference it follows smoothly

floral compass
#

Maybe the tolerance here?

#

Might be worth playing around with

#

Could set it to 0 if you want maximum sensitivity

steel moat
floral compass
#

Huh

#

How does it behave at 1?

steel moat
#

this is how it behaves at 1 and location as BB key

#

this is how it behaves when obj ref as BB key

floral compass
#

Don't really see much of a difference.
Fixing the jittering in both cases is not a responsibility of the AI, but of the movement component or animation to smooth it out.

I doubt you really want to react to every single miniscule change in position

steel moat
#

i want it to check it at every frame as long as the player is in sight

#

not only when the player is changing directions or stop moving

floral compass
#

Oh you can do that, but that's different from the AI actually reacting to every miniscule change

steel moat
#

oh how, i want to keep the object reference as BB key too

floral compass
#

Have 2 BB entries, one for the "player", one for the MoveTo "location".
If player in radius: set "location" = "player.location"
If player out of radius: set "location" = closest point on circle

How often you tick that is up to you to decide. But the MoveTo certainly doesn't need to react to a change of 1cm for example.
Ideally you probably want the robot to stay on the circle and keep firing before it repositions, right?

#

If you update navigation with every change it will keep moving and perfectly trace the circle as your player moves

#

What would probably be better is to design both behaviors as separate behaviors, rather than handling everything in a single branch

floral compass
#

There are no BB tasks

#

What I mean is 2 branches in your BT: one for behavior while the player is in the sphere, the other for behavior while the player is outside

#

In order of priority

steel moat
floral compass
#

Well not just tasks, different behaviors/branches in your BT

#

But yes the MoveTo tasks would also be 2

steel moat
#

like this?

obtuse igloo
floral compass
# steel moat

Can't say yes to that because that tree makes no sense

uneven cloud
uneven cloud
# steel moat

Turn on use acceleration for paths in the movement component and adjust the acceleration speed. Also don't repath so often, give it a higher tolerance.

floral compass
#

They're two different tools each with their strengths and weaknesses

olive prism
#

How can i receive an update when my AI stops seeing my character?

misty wharf
floral compass
#

I don't think you can really say one has a pro over the other? What are the pros of using a hammer vs. a fork?

It entirely depends on the job you're intending to do with it.

rapid comet
#

Why is the NavMesh not including the ramp?

dense owl
rapid comet
light void
#

Alright, for one of my smart objects I need a Box (Fbox)
For test, I managed to make it work by using my current actor's position.
My game is taking place in a shopping mall. I would like, when an NPC gets in front of a store, he looks for smart objects to interact with within the store.
My issue: How can I associate a particular box (or set of boxes) with an entry point to pass it to the action?

uneven cloud
#

That is certainly a con of FSMs. For simple AI it works fine, but gets messy the more complicated the behavior gets. The main difference between a BT and FSM is that in a BT the transitions are not tied to the actions, which can allow for more flexibility.

uneven cloud
uneven cloud
light void
uneven cloud
dense owl
silver moat
#

In behavour tree i havea decorator witha veector variable i am using on value change to abort . when i change the value and it gets changed in bb the decorator doesnt abort . what should i do if i want it to abort and restart every time it changes ?

obtuse igloo
#

Just wondering, does anyone know a more optimal way to set this up?

I have a Smart Object Bed that the AI uses to rest, but since EndBehavior sets the SO free (causing other sleepy AI to use it while another is still using it), I decided to only EndBehavior after the AI has gotten the amount of rest it needs, and I'm afraid that using a Timer might mess not be the best way to set this up.

If anyone has any ideas please lmk! (clearing and invalidate timer node cannot be called here so I'm afraid the loop might keep going even after the AI is done using it?)

light void
#

I figured a solution to my box fo shops. Is there an easy solution to know the value of the corner of my shop easily? or do I need to place a random thing there, copy/paste the location?

light void
#

How can I setup a Blackboard key of type "FBox"?

floral compass
#

Think you'd have to implement that yourself in c++
I used to do that for gameplay tags I think, let me see if I can find the ancient writings for that in my repo...

light void
#

Don't send me back to C++ ๐Ÿ˜ข It's dark down there

floral compass
#

Yeah I'm sure there's a better way to go about it than this, there's a reason I stopped using it

#

Why do you have an FBox and not some actor volume?

light void
#

I could? The reasoning is quite simple: I don't know.
The smart object request I learned about require a query box, which is a box value. So I tried to define a box.
If I can do the same with an actor volume, and escape C++ hell, I'm for it.

light void
#

Might have figured it out. I'll give it a try.

floral compass
# light void Do you have some doc on actor volumes and how to set them up?

There's plenty volume actors that derive from AVolume that could be used here. Luthage mentioned ATriggerVolume earlier for example
There's also ALocationVolume but not sure how that works

Once placed in the level you can change their shape & dimensions. Then for your SO request you can get the bounding box of the volume, which is an FBox

light void
floral compass
#

E.g. you could find the closest TriggerVolume and put that in your blackboard

#

Then your task would just read that out

light void
#

One day I will remember. But today is not that day it seems.

light void
#

Next issue: How to turn a volume into a query box :p

floral compass
floral compass
#

I mean FBox is not exposed in BP so..

#

Maybe "bounds" ?

light void
#

More options. None that seems to work.

floral compass
#

Probably what you want

light void
#

Ultimately all I would need is the Min and max.

#

It gives me the center and the half size. So something like this should work?

floral compass
#

Maybe? Sounds correct

shy hare
#

Hello guys, I have a small problem, please, does anyone know, help me, I have 2 agents for a large and a small AI, and when I use the GetRandomLocationInNavigableRadius function, it constantly gives me values where the big bot cannot go, and because This is why AiMoveTo constantly fails, how can I make it find a random location where BIG ai can move, may be i should pass something to the GetRandonLocationInNavigableRadius function so can I tell it which navigation agent to take the random location from?

haughty tide
shy hare
ashen merlin
#

Yo folks! Currently Im working on simple AI that patrols area. Basically AI walks from A to B, then randomly select new point C, then walks from B to C etc. Everything works but I cannot figure how should I handle rotation of the AI towards new point. I was thinking about simple task that will calculate delta of the rotation between AI and destination point, then rotate AI via root motion animation and then proceed to walk. Does it make sense, or you have better idea?

light void
#

Well, it works... And it doesnt. I have no damn clue why it doesn't work properly. I get a claim, but now I get an error somewhere else.

olive prism
#

Hello, I have an EQS, it works fine but when I get very close to the AI, it does not execute the EQS, if I move a few steps away it executes correctly, does anyone know why this happens?

misty wharf
#

It's a bug in your code

dense owl
light void
#

I don't know what I effed up, but I effed up hard. Lost an entire day of work and I gotta get back to my previous backup. Yay.

ashen merlin
dense owl
#

Idk about the animation part

ashen merlin
uneven cloud
north oriole
#

is there a way to make an EQS test enabled or not (the checkbox on the left of the test) based on a query param?I know i can just set scoring factor to 0 but then it would waste resources computing the test for nothing

narrow mason
#

In state trees, can I only bind Task instance data properties from other tasks within the same state?

#

I'm trying to use an output param, as the input param of another task. But both tasks are in different states.

#

Doesn't seem to work

floral compass
#

You can bind inputs to outputs of all parent state tasks. I think you can also bind to tasks in the same state, provided the task comes before the one you're trying to bind in.

#

You cannot bind across branches though

#

You can do stupid stuff like this

narrow mason
#

Also, are tasks executed in order? For example, if I set some data on the output on one task? Am I guaranteed to get the correct value on the next task, within the same state

floral compass
#

As far as I could read in the documentation they claim that tasks are executed "in parallel", which is probably bs
So far I've only ever seen them execute in order. Nothing would work for me if that was not the case.

#

But no guarantees there

narrow mason
#

I think the parallel thing is that it doesn't wait for the first task to send a completed status before begining the next one

floral compass
#

Each State can have multiple Tasks, and all Tasks in a State run concurrently as long as the State remains active.
This part

#

Yeah I guess that makes sense

#

So you can't 100% rely on previous tasks having their outputs set up correctly as they might be running on tick or something

narrow mason
#

But, if any task returns a completed status, the entire state transitions, regardless of any other running tasks, right?

narrow mason
floral compass
#

Yes, it seems so. I have yet to use that, ever. All of my tasks just return "Running" and I control the transitions via events

#

Or on tick if necessary

narrow mason
#

How do you process events? Just got into that but I'm not sure when or how to process the event

floral compass
#

And then just call

/** Sends event to the running StateTree. */
void SendStateTreeEvent(const FGameplayTag Tag, const FConstStructView Payload = FConstStructView(), const FName Origin = FName());

To send an event. If the tags match, the transition will be triggered

#

That function is on the StateTreeComponent

narrow mason
#

I see.. There's no way to use the payload yet?

floral compass
#

Oh sorry nevermind, this one is better:

/** Sends event to the running StateTree. */
UFUNCTION(BlueprintCallable, Category = "Gameplay|StateTree")
void SendStateTreeEvent(const FStateTreeEvent& Event);
floral compass
#

Not in 5.3 at least!

#

Is it in 5.4?

narrow mason
#

Oh wait.. This is in the task, right?

floral compass
#

StateTreeComponent

narrow mason
#

Ah, I see. I'm not using that. I'm running a custom implementation

floral compass
#

Oh, I see. But I think you can still hook into that

#

Cause all it does is:

InstanceData.GetMutableEventQueue().SendEvent(this, Tag, Payload, Origin);
#

If you have a FStateTreeInstanceData then you can call that

narrow mason
#

Yeah, the Execution Context also has one

floral compass
#

Oh really?
That seems like it would allow for some really neat eternal back-and-forth transitions if you start sending events from tasks...

narrow mason
uneven cloud
narrow mason
#

Is it necessary that I always pass in an instance data type for my state tree tasks? I have tasks that don't have or need instance data

#

But, I get an error when trying to compile the state tree

steel moat
steel moat
uneven cloud
steel moat
#

Im just passing a vector value as location to a MoveTo Task in behavior tree

uneven cloud
steel moat
#

oh, so how to fix that?

uneven cloud
#

I literally already told you

steel moat
#

is that in behavior tree or movement component?

#

its my first time hearing the repath term...

steel moat
#

i did turn on the use acceleration for paths in movement component

uneven cloud
#

Did you adjust the acceleration and deceleration values?

steel moat
#

no its default

#

should i turn on fixed breaking?

uneven cloud
#

No. You should follow the instructions that I've told you several times now.

steel moat
#

im asking how to do that...

uneven cloud
#

They are variables in the movement component. Do you know how to change variables?

steel moat
uneven cloud
light void
#

Alright, I think I need some help. Basically, I have a blackboard key which contain a trigger volume. Then I use informations about this key to create a box and find a smart object inside (Green route). But not every places have a volume assigned and thus sometime the key is empty. In these cases, I have a backup solution that simply search around the character for a smart object (red route). Issue is that while it works, I repeatedly get a warning :

messageBlueprint Runtime Error: "Accessed None trying to read property K2Node_DynamicCast_AsTrigger_Volume". Node: Find Smart Objects Graph: EventGraph Function: Execute Ubergraph BTT Find Smart Objects Blueprint: BTT_FindSmartObjects

First of I get the warning not on the Cast but on the find smart object, which is weird because it still work. The object is found and the AI does the animation on it.
Second, How can I avoid the warning all together? It is a desired outcome that sometime the key is empty and it'll use the backup solution.

light void
shadow imp
#

Hi!

I'm struggling to get smooth movement through a maze for my AI controlled units. Any tips for what I can do to make it move with near-constant speed? As you can see the speed through the maze varies a lot.

I'm using DetourCrowdAIController, with a close-to basic NavMeshBoundsVolume.

(Also, sorry if this is the incorrect channel)

light void
shadow imp
#

I did indeed try that, but it did not change anything. I can confirm, if I change back to normal AIController, then the issue goes away. But I do indeed want the features of the detour controller, so I was hoping to use that

iron wigeon
light void
iron wigeon
north oriole
cloud stream
#

Hello fellas, anyone ever worked with "StateTrees" instead of "BehaviorTrees"?

Question: How can I manipulate a variable's value in a StateTree-Evaluator through a StateTree-Task?

What I have done so far: I created an evaluator with an output-variable, created a task with an input-variable, bound these variable through the task and finally tried to manipulate the value of that variable through my task.

Main problem: When I print out the value of both variables (in the evaluator via Tick-Event and in the Task via StateEnter-Event, after the change of value) the value is always "unchanged" in the next print-cycle...but why? It is as if the change doesn't reach the evaluator's variable. And what's even mor confusing, the variable's value in the Task also resets without even leaving the task's state!!!! What's going on here?!

steel moat
#

what is this used for in AI perception hearing sense config? theres not much info about it in the documentation...

wise sluice
#

Hello ! Is there a way to drive the MaxSpeed / MaxAcceleration of an AI thanks to a curve float?
I'm not sure if i can do that without breaking the whole logic

narrow mason
#

Can someone help with this? I don't have or need an instance data for the task, but it still asks for one

vague hollow
#

Hi guys, trying to figure out something with smart object and AI. My goal is to have an AI actor to also be a smart object that would dynamically move with the actor. I've only find one topic in UE forums talking about this : https://forums.unrealengine.com/t/smartobject-not-being-moved/786766 and didn't find any solution yet.

Epic Developer Community Forums

Iโ€™m having a stab at using smart objects but it seems like they are not moving? Am i missing a setting or is this intended? To clarify what i mean by moving: If you put a smart object on an NPC that moves around you will see the smart object component stay in place.

#

Anyone got experience with this ?

wise sluice
#

If you have access to unreal gitlab, they implemented something for future release
We took the code in our unreal version to move SO at runtime

vague hollow
#

@wise sluice Is it also available on the engine github ?

placid halo
#

doesn't the AIController posses the character/pawn before the character's BeginPlay?

#

or only after?

misty wharf
#

or maybe it was just called Possessed

#

Either way, both the pawn and the controller have functions you can override for when they possess something or are possessed by something

placid halo
#

I made a new character class but GetController() returns null, not only at BeginPlay but also later (like many seconds later). So I guess I must be doing something stupid somewhere (but the Controller class in the BP is set to the default AIController)

#

found it, I was just missing Auto Posses on Spawned.... sigh...

wise sluice
#

I encountered it!
Many many times ... ๐Ÿ˜”

#

But i don't know why even setting the option back to "Static" and restarting the engine keep the invalid data

foggy pike
#

Oh yeah, th e issue was that I had the navmesh volumes on a non-root umap

#

here

cloud stream
#

Hello, is there anyone who has experience with "StateTree"?

wise sluice
#

Hello! I've some experience but I still pretty inexperimented since it's pretty new

cloud stream
#

all in all it looks somehow like this:

light void
narrow mason
#

Is there a way to get/set a state tree parameter from a task?

obtuse igloo
bronze jewel
#

C++ navmesh PSA: don't use ARecastNavMesh::GetPolyEdges to see what nodes it's edges lead to. Use ARecastNavMesh::GetPolyNeighbors instead.

The problem: if there is a straight for edge that's connected to 2 different nodes, GetPolyEdges will report it as leading to only one of those 2 nodes.
Like on this picture, where edge 2 of node 53 is reported as leading to node 40 (dark purple number), completely ignoring its bigger part that leads to node 38
GetPolyNeighbors will also report navlinks

#

ARecastNavMesh::GetPolyEdges is only usable for checking whether edge is connected to any node at all, rather than being a wall

cloud stream
cloud stream
# narrow mason Is there a way to get/set a state tree parameter from a task?

Ok i tried it out. I can "read" the value but not "write".

People talk about this on the web too and say that parameters can only be read, not wrote into...

unfortunately, this problem also remains for evaluator-variables which can be read (and manipulated within the evaluator itself) but not wrote into through binding...

the only solution i cam across was to reference to your Actor (which you defined under context in statetree), cast it and manipulate the data in there.

narrow mason
#

I don't think they're meant to be manipulated.

cloud stream
#

Yes i don't think that too

narrow mason
#

How do you expose evaluator data

narrow mason
cloud stream
narrow mason
#

Do you have any tasks where you don't set an Instance data type?

cloud stream
narrow mason
#

If I pass nullptr to this, I get an error in my state tree

cloud stream
narrow mason
#

Ohh I see.

wise sluice
wise sluice
cloud stream
# narrow mason Ohh I see.

Since you are developing in C++ I can recommend you look into the Github of "Epic Games"'s UnrealEngine sourcecode. The plugin should be there and maybe also how they instantiated the Task.

But to get access into their project on github, you need to signup first (it's a simple and fast process, no worries): https://github.com/EpicGames/Signup

GitHub

Information about signing up for a free Epic Games account, and getting access to UnrealEngine source code. - EpicGames/Signup

narrow mason
#

I have source access

wise sluice
#

In theory

narrow mason
#

I've checked the issue. It's in the state street compilation. Seems there's no way to do without it.

cloud stream
narrow mason
#

I modify the component in flecs

wise sluice
#

In the end, the task will modify a fragment linked to a specific entity thanks to its handle

#

But yeah same issue than with classic Statetree and parameters, evaluators. You can only modify external source.

narrow mason
#

Yep. I was hoping to use a generic Move To task that takes in a location as an input param.

But I'd have to create a specialized GoToCover task that gets the location from the Fragment

wise sluice
#

Hmmm you can have an output on your task no?

#

THanks to instanceData

#
USTRUCT()
struct CURIOSITY_API FMassNavmeshFindRandomLocationInstanceData
{
    GENERATED_BODY()

    UPROPERTY(EditAnywhere, Category = Parameter)
    float m_fMinRadius = 1000.0f;

    UPROPERTY(EditAnywhere, Category = Parameter)
    float m_fMaxRadius = 1500.0f;
    
    UPROPERTY(EditAnywhere, Category = Parameter)
    FVector m_vSpecificOrigin = FVector::ZeroVector;
    
    UPROPERTY(EditAnywhere, Category = Output)
    FVector m_vTargetLocation = FVector::ZeroVector;
};
narrow mason
#

I find the cover location in a sibling state, so I can't bind to it in the Move To task

#

You can only bind from tasks on the same state or in a parent state

wise sluice
#

Why the move task is not a child of your find ?

narrow mason
#

Cause it constantly runs the Find task, which I don't want

wise sluice
#

That's normal

#

It enters inside it, find something and stay idle but Mass StateTree doesn't tick so it's not an issue

narrow mason
#

I don't want that behavior. Find, then go to cover on success. Stop trying to find

narrow mason
wise sluice
#

Ah yes ๐Ÿ˜ฆ

narrow mason
#

My state trees are tickiny

wise sluice
#

oh

narrow mason
#

Actually I think Mass state trees tick. Cause some tasks have tick behaviour

wise sluice
#

I can assure you it doesn't tick

#

They have tick

#

But they just tick on need

#

It needs a "Wakeup" signal

#

to tick and sleep once the states got executed

narrow mason
#

Yeah, I did notice that the tick is called in a signal, not a processor

#

I'd dig into how it works. But that's not a solution for my problem anyways.

I'll just use the specialised move to cover task

light void
#

Are smart object a problem for performances when not in use? I have quite a few of them (a bunch of "options", most of which will be unused at any time) and I am worried about the performance impact.

#

Like, I use them as spots where NPCs can go and "pose" (so rather simple things), but it's for a shopping mall, and there is eventually going to be 5~15 spots per shop... With room for 36 shops. and about 30NPCs moving around between the shops. Not sure I'm going to populate everything, but that's still easily a couple of hundred spots.

uneven cloud
light void
uneven cloud
uneven cloud
balmy token
#

Anyone knows why it's red under the character and how to solve it? (since it appears that the navigation is not identifying it correctly)

obtuse igloo
#

Anyone knowledgeable in the Smart Object plugin know the different between using the Mark Smart Object as Occupied node and using the Use Smart Object with Gameplaybehavior node?

devout canyon
#

has anyone had problem that having ai move to node when they walk causes tons of draw calls? they keep for around 50 seconds after AI and characters are deleted

shy hare
#

hello everyone , i got an issue , please help , sometimes anim montage doesn't get played but strangely "Blend out" or "Interrupted" never got called , (On video when Boss attacks second time , nothing got played) , why it misht happed , what is the issue please help , i provieded code as well

uneven cloud
uneven cloud
obtuse igloo
obtuse igloo
steel moat
#

is there any way i can compare two int variables in the conditional loop decorator of the behavior tree??

uneven cloud
obtuse igloo
# uneven cloud The function names tell you what they do. One marks it as occupied. The other ...

The other function that uses the SO also marks it as occupied within the function but i'm not sure, which is why I was wondering If i change how I have the AI use it by just marking it as occupied and unmarking it whenever I want to. Because when I use the function that uses the SO, it waits for the "end behavior" node before finishing execute, but end behavior marks the SO as free so I dont want to have to use it if possible

ashen merlin
#

Yo, Im playing around with StateTree and I cant figure out how enter conditions works. I made simple setup that only uses built in functions. Basically State 1 has condition that is always true, so State 1_1 will be always fired. Then I want to make transition to the State 2. State 2 has condition that is always false. As far as I understand StateTree after Enter Condition is failed should go to the next state (State 3 in this case, bcs Enter Condition for State 2 failed) but it's jsut stacked after failed condition. Any ideas?

sudden citrus
#

(apart from being outdated, it works perfectly fine when updated to new base code)

misty wharf
#

Something that was last updated 8 years ago is probably long forgotten by anyone and is just rotting in the list

#

There are like one line PRs which aren't getting merged so this seems to be just the standard way these operate unless you happen to get an Epic employee's attention who wants to merge it for some reason

steel moat
#

ive set sight as dominant sense yet, when the AI has first player in sight and second player makes a sound the AI switches the target from first player to second player

misty wharf
#

This depends on how your own code handles it

#

Perception system doesn't have a concept of a "target". It just perceives stuff.

steel moat
sudden citrus
#

when they run into the issue

#

I'm tempted to push an updated PR, give credit and see if they accept this time

misty wharf
#

Really, that's pretty weird lol

#

Must be one of these where nobody wants to take responsibility for it

ruby shard
#

anyone familiar with StateTree ? i dont understand Input,Output, Context
how do we set the result of a Task (FindActorRandom) to parameters value ?

misty wharf
#

In BPs you set the category of some variable in your ST task as Output, and assign a value to it

#

in C++ same but you use InstanceData

harsh storm
#

i wrote custom behavior tree system in blueprint from scratch for simplicity
๐Ÿค”

#

So you reinvented the wheel, in BP, because you didn't want to learn the basics of the current one?

#

Why not just make a state machine at this point?

#

Then possess it with an AI controller

#

What do you need an AI tool for on a playable character?

#

Yes

sudden citrus
#

yeah that's the ideal case for unpossessing and repossessing with AI/player controllers

#

way less work than reinventing BTs

uneven cloud
stone walrus
#

guys i have problem with an ai in game my ai always tries to go from corner of nav mesh which causes the ai to get stuck somrtimes how can i fix that please help thanks the video is given as well i know ai tries to take always the shortest path initially but how can i undo that and environment is not that big has a lot of objects in it so what can i do to fix it

uneven cloud
stone walrus
#

idk what up with ai

#

why it dont go from middle

#

where there is nav mesh

uneven cloud
rich wolf
#

hello, i am a new UE5 user and I am deciding whether to use box collisions or ray casting/line casting, to detect other vehicles on a race track for my AI vehicle, some people keep saying casting lines/rays is better, but i just lack the knowledge right now to know why, so which one would be better and why? ๐Ÿ˜ฎ

rugged quest
#

How do I set the world direction for an enemy just like setting the world direction for the player? I am trying to make a 2d, top-down game.

rugged quest
uneven cloud
uneven cloud
rich wolf
#

so essentially i have to cast rays 360 degrees around the car every tick and calculate the positions of cars nearby, then figure if there is room to overtake without colliding with anything

misty wharf
#

Or you could cheat and just check which cars are nearby and how close because you can just get a list of every single car and having this and a vector distance check is probably cheaper

#

I recall seeing something about racing game AI's on the Game AI Pro website also, maybe worth checking that

rich wolf
#

yeah there seems to be driver san francisco AI pathing article

#

but i try to avoid cheating, i have my AI currently driving using the same controls as the player would

#

i want the collision detection work similarly as well, or close to it i guess, but will see, i am very new at this

misty wharf
#

You're just making your life harder :)

#

You certainly could make it so the AI has a "cone of vision" or something, in other words, ignore all the cars that aren't within some angle in front of it for example

#

but at least I don't really see any point in using a linetrace for tracking a set of known objects

#

Of course once you've determined one of the cars is potentially in the way, you could use a linetrace to check if it seems like it would be useful in some fashion

#

My assumption here is also that you don't have like.. a thousand other cars

rich wolf
#

not yet, but then this would assume i would get every cars location on every car, and calculate, which cars are in the way and which arent

#

feels like doing lots of calculations on things that are irrelevant to current situation, especially when the car is driving alone and rest of the pack is somewhere far away

#

but cone of vision would not be enough, the detection should be i think, around the car in every direction, because if you want to start overtaking, you want to check to sides as well, if there is a car also... but if all clear and overtake can take place, then i guess it would start spawning spline dynamically around the car in front, so it would just increase speed and follow "overtake" spline, which, ideally would then be calculated on the fly depending what information is returned by ray casts

dire kayak
#

Hey!

#

How can I hide from AI perception?

#

I want to make it so that the player can hide in a closet, and not be detected there

rugged quest
#

For the 2d sprite character, I have to where it tracks the world direction, which determines which way is up and which way is down. If I move the character in a direction, it changes the sprite based on the direction it is going. I want to do the same thing for the enemy sprite, but I can't find the correct node or component for it.

dire kayak
dense owl
dense owl
#

Give it a 360 cone and a radius and youโ€™ve got your detection

#

Not sure itโ€™s worth going that route for a racing game tho

rich wolf
#

How else would you make the cars not crash into eachother, overtake, defend etc.

#

Also drive around obstacles

obtuse igloo
#

Is there a way to get an Actor's Smart object component and get the handles or slots from it instead of using Find Smart Objects to get the Request Result?

For context, I have an AI i can command to eat something, which is an actor set at the BT Target with a smart object component on it, but cannot figure out how to claim the object first before using it. The only thing I see that grabs the slots from the SO, is the Find Smart Objects node that comes from the subsystem :(

stray bobcat
#

Hey All - I'm trying to get my AI to see a deadbody. It sees other AI (alive) and the Player fine, but on my Deadbody blueprint Actor it doesn't recognize it. I've added the AIPerceptionStimuliSource and set it up as follows (pic). Is there anything else I need to do?

dense owl
#

Perception works at eye level by default if I rmbr Luthageโ€™s words correctly

#

Or was it capsule height? Either way, it wonโ€™t see stuff on the ground out of the box I believe

stray bobcat
dense owl
stray bobcat
dense owl
#

Itโ€™s not a pawn tho?

stray bobcat
dense owl
#

I canโ€™t recall rn, and I donโ€™t want to give you more bad info ๐Ÿ˜…

stray bobcat
#

No worries, I'll keep playing around. I'll try parenting it to a pawn and see if that makes a difference

stray bobcat
#

Ok, I think I've found the solution. I'm using Gameplay Tags and my player and AI characters inherit from a C++ class that implements the GamePlayTagAssetInterface. I don't believe this is available in blueprints, so I'll just have a base C++ actor that implements the GameplayTagAssetInterface so my Dead Body can get registered. Pretty crazy this isn't exposed to blueprints but hey ho.

rugged quest
dense owl
cloud stream
#

Can someone explain to me how "SpawnAI from class" conceptually works? Like, when does the BehaviorTree which can be defined in "SpawnAi from class" starts to run??? I am asking because I get an error telling me there is no BlackBoard found which I clearly did define in my BehaviorTree!

misty wharf
#

It runs the behavior tree immediately also

cloud stream
#

I thought, the moment a BehaviorTree gets active the defined BlackBoard in it is instanciated too, but it seems it does not in the case of "SpawnAI from class"

#

Ah here it is... until now, I tried to set a BB-Value via "Event BeginPlay" or "Event OnPosses", in both cases the BB is none.

But now that I tried to set a BB-Value via "Tick", it is existent...

That is why I need to know the conceptual aspect of "Spawn AI from class". I want to now when BT and BB gets active so that I know "when" I can manipulate the values in the BB-Variables. Can anyone tell me that?

misty wharf
#

I looked at the code for it, it just spawns the controller and immediately calls RunBehaviorTree on it

#

That's likely to run before BeginPlay I think in that case

cloud stream
oblique basin
oblique basin
cloud stream
# oblique basin Can't you use OnPossess for this?

I've tried OnPosses as well as BeginPlay, but in both cases the BlackBoard in the AiController is "none". Only after discovering "OnUsingBlackBoard"-Event I was able to set/change a value for a BB-Variable

oblique basin
cloud stream
oblique basin
#

Are you swapping out blackboards at runtime or using the same one per bt?

cloud stream
oblique basin
#

But if you manipulate BB keys exclusively using BT tasks, you won't need to worry about any of this

cloud stream
oblique basin
cloud stream
#

The order in which "the engine" triggers OnPosses and BeginPlay for the BP and AiController differs between placing and spawning.

I already forgot in which order, it was something like OnPosses of an AiController gets suddenly triggered before BeginPlay of the BP or something like that.

I am not entirely sure what happened there within the engine, but switching from "place in world" to "spawn" suddenly lead to many errors.

narrow mason
#

Petition to Epic Games to make State Tree task instance data optional
Not every task needs instance data and its annoying to create an empty struct for the task.

I'm just going to create a dedicated FEmptyInstanceData. But, I'm not happy doing so!!!

uneven cloud
uneven cloud
# cloud stream The order in which "the engine" triggers OnPosses and BeginPlay for the BP and A...

The BT does not trigger begin play or on possess. Understanding the actor lifecycle is incredibly important. https://dev.epicgames.com/documentation/en-us/unreal-engine/unreal-engine-actor-lifecycle?application_version=5.2

It's not a good idea to use Spawn AI From Class, because you don't have access to when the BT is set up. It happens after on possess using that node. Just set the controller to be created when spawned and placed in world, run the BT in the controller's on possess and then set whatever BB keys you want.

Epic Developer Community

What actually happens when an Actor is loaded or spawned, and eventually dies.

cloud stream
cloud stream
cloud stream
uneven cloud
uneven cloud
cloud stream
uneven cloud
cloud stream
#

Ah, like, compared to "Spawn actor from class" I cannot set variables before the actor gets added to the world via the "exposed" variables?
So using "spawn ai" function does set some limits?

#

Are there even other consequences? I am curious!

uneven cloud
#

Not sure. I don't use it because you don't have control over the flow.

cloud stream
#

How do you "spawn"...or..."use" an NPC/Ai? What would be your workflow?

#

Do you use "Spawn Actor" instead?

rugged quest
rugged quest
dense owl
rugged quest
narrow mason
dense owl
#

Yeah, Iโ€™ve had issues with Spawn AI from class as well, it hasโ€ฆsome limitations

harsh lily
#

how can i make the target on ai move as the player without using get player character

#

using a ref of the player doesnt work

vast heart
dense owl
vast heart
coral mesa
#

how exactly you pass condition to distance comparer?

coral mesa
#

Its quite annoying that cant get it hooked with what I want. Like position and such

coral mesa
#

I can't pass values into Transition?

stone walrus
vast wigeon
#

hello everyone. im very intersted in smart objects (especially with 5.4 update) but all the learning reseources i can find are a bit jank. i was wodnering does anyone have any recommended learning resource for them ?

uneven cloud
stone walrus
#

okay gotcha

uneven cloud
coral mesa
#

problem is mostly with passing values to statetree

#

can't bind values easily

lyric flint
#

Is there a way to make an AI not always go real close to the the edge of the nav mesh? I have a chaos vehicle which I programmed a follow system into, but the spline it generates for pathfinding is made stupidly close to the edge of the road, causing it to go offroad and get stuck (As I disabled nav generation on the landscape).

lyric flint
#

I found a workaround by making a premade spline and using that instead. It works okay

stone walrus
#

i mean

woven jasper
#

Can visualize the path of AI when using AIMoveTo?

woven jasper
#

Found ai.debug.DrawPaths

light void
#

I have multiple NPCs generated on startup, how can I select on of them in simulate and only follow a particular task for him and not for everyone? If I place a breakpoint, it trigger for all of them.

silver moat
#

ima having this issue whenever the robot run towrads me , the task itself is not finishing execution as a failureor success idk why is this happening stuck on it for 3 hours now .

golden orbit
#

Hi, why do my RecastNavMesh settings does not save? I change agent radius and it does work, but after restart of ue it just goes to default, even in project settings i have set them to my param and it does not work and always sets to 35 radius

misty wharf
#

@golden orbit are you editing it in the level or in project settings? If in level, it will overwrite those settings with the ones from project settings whenever the navmesh is rebuilt

urban spade
#

Hi guys! I have an AI animal in my game and I want this ai to run away when it sees the player. I have 2 tasks one of them finds the location to run away and the other one is moves to AI to that location but when the player sprinting the ai enemy freezing for a little little amout of time because finding run away location is working all the time how am I gonna add a interval time to task

golden orbit
misty wharf
#

So the values from project settings are not being reflected into the navmesh in the level or?

golden orbit
#

Yeah

#

But it resets to 35 every time

misty wharf
#

Does it also not work if you delete the recast navmesh actor and run Build->Build paths?

golden orbit
#

Nope

#

Still gives me 35 radius

misty wharf
#

๐Ÿค”

#

yeah not sure what's up with that unfortunately

golden orbit
#

That's bad ๐Ÿ˜ฆ

misty wharf
#

I would check in the navigation mesh settings page of project settings to be sure it's set up correctly, and maybe try configuring a specific agent type as I vaguely recall it might have these settings effectively duplicated for agent types and a "generic" settings page

golden orbit
#

where i can config agents? And what does it mean?

misty wharf
#

An agent is something that can move along the navmesh... it's in the navigation mesh or navigation system settings

golden orbit
#

Can it be something here?

misty wharf
#

Yeah add a new supported agent

#

it should give you the settings like radius etc.

golden orbit
#

Yep, and then?

misty wharf
#

Try rebuilding paths and see if it gets the settings from there or not :)

golden orbit
#

Wow

#

Yeah, it worked!

#

Thanks a lot!

misty wharf
#

Oh nice, yeah the settings are sometimes a bit confusing

golden orbit
#

Yeah, i would never found it xD

lyric flint
#

Got a question about Learning Agents, Is it a good idea to train an AI for multiple different vehicles instead of the same vehicle?

#

One vehicle type is a fast, sporty one while the other is slower and more designed for offroading

weary nova
#

Hey did anyone have this issue where the AI is not moving to a location even tho the nav mesh is there?
In the video you can see that the Actors stop moving in certain areas. This only happens after some buildings are placed. The Nav Mesh displays correctly green for the are but they won't go there. Any idea what the issue could be? There is also no Collision there when i order unit beyond this area they will walk over it.

dense owl
#

Visual logger and some of the vis log nodes can help you debug

lavish dome
# lyric flint Got a question about Learning Agents, Is it a good idea to train an AI for multi...

I am not an expert in Reinforced Learning, but judging by common sense I may assume that yes, it's better to use different vehicles as different agents to train different models. At least with a current version of LearningAgents in UE. The more your vehicles differ in terms of input/desired result interaction, the better exclusive models will work. For example, your sport car can performs more efficiently on track, whereas your offroad vehicle is obviously better off road. The input/reward will differ for them, so will differ the trained models.

uneven cloud
uneven cloud
uneven cloud
dense owl
#

There is a way, tho a bit hacky and not necessarily reliable ๐Ÿ˜…

#

But yeah it involves using the gameplay debugger/BT screen

#

If you select an actor in the outliner at runtime before opening the debugger you tend to get that one to be viewed. Similar with the BT itself

azure bloom
#

Why is there no dropdown for AIPerceptionStimuliSource? In Unreal Engine 4, you would have an option called Register Source or whatever and it would be like Sight, Hearing, etc and you could drop that down and there be more options, but there doesn't seem to be a dropdown now

#

Nevermind, I needed to put AIPerception on a BP and its under there

coral mesa
#

@misty wharf sorry for the ping again but do you know about how exactly to pass values to condition in state tree?

#

Sometimes they hit and other times they dont

#

doesn't seems to take values from evaluator

#

only from Tasks

#

I mean I want to do simple distance check to "stop" my character

civic sand
#

Should I be using pawn sensing or AI perception or just collision spheres and logic for a pretty basic player/enemy interaction: at a certain distance enemy faces player, a little closer triggers magic/ranged attack if the mob is either of those types and chase in the case of them being melee type until finally at melee distance triggers engage in melee combat...

dense owl
harsh lily
#

im having an issue with the ai not seeing the client and only seeing the server

#

what could be the solution to this problem

vague hollow
#

Hey guys,

Anyone really familiar with the AI Perception System ?

I'm trying to setup a component on an AI Pawn, the goal is to have 2 senses - say AI_Sight, with 2 different ranges. Then my AI should react differently depending on the sense triggered through a State Tree Component via event tags (1 event would be flee and the other alert for example).

I'm currently struggling to find a way to differentiate my 2 senses in my State Tree Evaluator. What I tried to do was to set a bool variable that will toggle an Event Tag then send it to the State Tree. But it clearly doesn't work for more than 2 different events. Any Idea how I could do that ?

#

this is what my BP look like

#

I'm feeling I cannot even have 2 sense configs for the same sense, and that doing all of this via CPP might be the better option from what I've read (I'll also need to setup a AI_Team sense)

vague hollow
#

I have some other concerns, while trying to dissociate the 2 different states (flee and alert) through 2 different senses (alert will be sent from AI_Sight while flee will be sent through AI_Hearing) It seems that my stimuli source cannot register more than one sense as source. See debugger :

#

Hearing doesn't have any querier

vague hollow
#

Even weirder. Unregistering my player pawn to sight and it still shows as a querier (even after rebuilding the project)

misty wharf
misty wharf
#

Sight sense does "queries" on tick via line tracing to check LOS

misty wharf
vague hollow
#

I was trying to have multiple sense configs and indeed it wasn't working at all, having multiple components is indeed the right thing to do

coral mesa
misty wharf
#

enter/exit conditions are evaluated when states finish

#

and it needs to find which state to activate next

uneven cloud
light void
#

Am I misunderstanding On targetPerception Forgotten? I am trying to check if an NPC sees the player. The beginning is fine, but the "On Target Perception Forgotten" doesn't work as I thought it would. How can I check if an NPC no longer sees the player?

misty wharf
sturdy sun
#

I've managed to create a "Random Selector", custom Composite Node for Behavior Trees.
So if anyone is trying hard to create one, here is the code:
https://dev.epicgames.com/community/learning/tutorials/8JL3/unreal-engine-random-selector-behavior-tree-custom-composite-node

Epic Developer Community

UBTComp_SelectorRandom is a custom Unreal Engine Behavior Tree node that randomly selects and executes child nodes without repetition until all are trie...

misty wharf
azure bloom
#

Hey guys, I set up my AI controller correctly, put AIPerceptionStimuliSource on my character BP, and put AIPerception on my AIController, (or the other way around idk) and made a behavior tree with a task to chase the player if the IsPlayerSeen bool is set, so in the AI controller, I set it up where it set that bool on sensed, but the AI doesn't move. I added debug prints to the sense so it does output, it does see me, but the ai doesn't move

#

I did put a nav mesh bounds volume in too

sullen plume
#

why is my ai tweaking literally i have the most basic code: move to player and ip ass in player correctly and whatnot. and istg these guys do not wanna turn they fricking shuffle backwards walk
Pls help me

#

my logic:

azure bloom
#

I don't understand why this is doing this

#

Okay

tough tulip
azure bloom
#

I'll show you

#

This is how my behavior tree is set up

#

My AI controller

#

@tough tulip

tough tulip
#

Right gotcha. Well you are not checking if your GetRandomReachablePointInRadius node is actually returning a reachable location.

azure bloom
#

How do I check that

#

nvm

#

I forgot it output a bool

tough tulip
tough tulip
azure bloom
#

I put in a branch with a print string for true and a print string for false

#

false, yes

tough tulip
#

Right, a good tip is that you can plug the boolean directly into the string field of the print string

#

It will automatically convert the boolean to a string

#

Right, have you tried increasing the range to 500?

azure bloom
#

Yes

#

It still says false

azure bloom
tough tulip
azure bloom
#

No

azure bloom
tough tulip
#

Okay in order to simplify this, please use the node called "AI Move To" instead of the Move To Location node

#

Then based off that, you can drag off the request failed and add a print string to see if that is firing or not

tough tulip
# azure bloom

Right I see. one thing I do spot is that you want to change your set blackboard value in vector node to fire off the execution pin above the on success pin.

Right now it sets the blackboard value after it has succeeded the move to and arrived at the destination

azure bloom
tough tulip
# azure bloom So basically set the value before the move to?

Well no. The Move To is a latent node meaning that the On Success and On Fail nodes will execute at later times, not necessarily in the same frame as the node was called upon.

In this case you can place the set blackboard value in vector node before the move to node. But you could also drag off the execution pin above the On Success Pin, and then drag to the set blackboard value in vector node

azure bloom
tough tulip
#

Oh I see

#

You have your acceptance radius set to 500 in the AI Move To Node

#

But your range in your Get Random Location in Navigable Radius is also within 500

#

so your AI auto completes

#

because it is within the acceptance radius of the location you have requested

#

Set Acceptance Radius on your move to node to 10 for example

#

then it will start moving

azure bloom
#

not moving

tough tulip
#

Please share another screenshot of the code

azure bloom
#

hold on

#

I'm trying to now cast to the player and use the player's location as a destination

tough tulip
#

And you are not simulating physics on the AI right?

azure bloom
#

You think players are AI?

tough tulip
#

No i don't think players are AI. I am simply verifying what your setup is without having to understand your entire project

azure bloom
#

Okay, I'll go in detail

#

So, I have a blueprint character named BP_Freddy, which has AIPerception, I went in and configured the sense and turned on Detect Enemies, Neutrals, and Friendlies. Then I made an AIController that has a AIPerceptionStimuliSource, then I made a BT and BB

#

I made sure in my AIController to run my behavior tree, and the print string nodes in the BT tasks are firing so I know the BT is working

#

Just the AI is not moving

#

Back when I was using Unreal Engine 4, there was no hole in the nav mesh, I could just stick my character in the level and it moved

misty wharf
#

Hole? ๐Ÿค”

azure bloom
#

yeah

azure bloom
misty wharf
#

turn off can affect navigation on the mesh

#

and/or the collision capsule

uneven cloud
azure bloom
#

now it's moving

#

That's what I needed okay

tough tulip
#

Glad to see it is working now

azure bloom
#

Thanks for your help Bandaro and others

harsh lily
#

it only sense the server when it sees it but not the client

uneven cloud
#

The server can't sense the client

harsh lily
#

so what is the a way to make the ai sense both server and the client

uneven cloud
#

It can't sense the client and it doesn't need to

#

AI does not exist on the client

harsh lily
#

why it doesnt need to

#

then how can i make the ai chase the client when it sees it

uneven cloud
#

Because sensing on the server is all it needs.

#

The AI will chase the SERVER version of the actor it senses

harsh lily
#

yea thats whats happening but my question is there a way to make the ai chase the client too

uneven cloud
#

That makes absolutely no sense

harsh lily
#

maybe idk how to explain it but ill show you a video

uneven cloud
#

NPCs are server owned actors. The server is the authority for them and the client version is just a puppet

harsh lily
#

on the left side the ai sees the player but on the right side the client the ai wont see the player

#

if the problem cant be fixed because ai perception and behavior tree only works on the server then what could be a solution to it thats what im trying to figure out

harsh storm
#

Show how you're acquiring the target

#

It definitely works. Many games have shipped with it.

harsh lily
harsh lily
#

before i used get player character but that obivously didnt work because then i would have to put in the player index which player

harsh storm
#

This code is hard to follow

harsh lily
#

yea i made a funtion to get array of the player

harsh storm
#

Why do you need that at all?

harsh lily
#

which one

harsh storm
#

A function to get the player array

harsh lily
#

i made it last night to see if it works

harsh storm
#

Show, from start to finish, your On Target Perception Updated event

#

Cut nothing off

harsh lily
#

ok

#

idk how to make it clearer when i zoom out

harsh storm
#

This looks like something Ryan Layley would do

harsh lily
#

yea some of it i got from him

#

i also added the ai perception stimuli source to the player

harsh storm
#

For the sight, you have it were if the Passed in Actor is == to the TargetPlayer, only then would you update the BB value. Why? Perception's entire job is to find the target player for you.

#

Why are you using the FindEnemy function at all?

#

Also, Run BT node should be in the possession event, not BeginPlay

harsh lily
#

i used the chase task in the blackboard and attack player

harsh storm
#

What does that have to do with the FindEnemy function?

#

You already have the target because you update the BB value

#

Just get it from the BB

#

That's its job

#

This part in your sight sense

#

Then in your task, you just read from that TargetActor key

harsh lily
#

so when the sight sense is sensed it should call to the target actor immediately?

harsh storm
#

It should just update the BB key

harsh lily
#

ok but what would be the target in the ai move to

harsh storm
#

Make a var in the task, make the type BB key selector. Make it public and then in the BT, select the key.

#

In the code, drag it out and call the Get Value as Object node, cast to actor and plug it in.

#

Any reason you're not using the built-in Move To task?

#

Because that can also just take a key and move to it

harsh lily
#

i added it in a task because i made it change the movement speed too

harsh storm
#

IE - what is the purpose of BT_Task_Chase existing?

#

Use a service to do that

#

You can put a service on the Attack Player sequence so when it enters that branch, you update the speed. And when it leaves that branch, you can revert that speed.

harsh lily
#

ok ill try it out and see

azure bloom
#

I am making a Five Nights At Freddy's game, since the enemies are animatronics, I want them to turn to me before they start moving towards me, how do I make this happen?

#

I also want them to play mechanical servo sounds as they turn

harsh storm
#

What have you tried?

azure bloom
#

Maybe a rotation node, wait 2 seconds, then move node will work

azure bloom
dense owl
#

Rotate to face bb key task is built-in, adjust rotation speed from the CMC

azure bloom
#

ah okay

#

what is CMC?

dense owl
#

Char movement component assuming youโ€™re using a char

azure bloom
dense owl
#

Show code

azure bloom
#

wait wait

#

selfactor

dense owl
azure bloom
#

Yeah well the moveto is in a custom task

dense owl
#

Ok, thereโ€™s a BT version too

#

Only downside it has is you canโ€™t change acceptance radius on the fly

azure bloom
#

Yeah he's not moving

#

Iset my vector key in the custom task, I think that's why

dense owl
#

Else the bb key will be empty

azure bloom
#

So wait, should I not have "find player" and ai move to in the same task?

dense owl
#

No

#

Find, rotate, move

azure bloom
#

Oh okay, so find the player, and set the player to a key

#

Alright, thanks

#

good cat

azure bloom
#

In my task I cast to the player and get the actor location and set that as a value and pass in the key, and then I choose that key for Rotate to BB entry, but it doesn't rotate

#

I fixed it

#

Okay, so I have this

#

I noticed that when my character moves to be, he has to rotate to me again and move, I just want him to rotate to me the first time he sees me and then chase me, how can I do that?

harsh lily
#

your right about the branch if actor == target actor and find enemy its uselesss

dense owl
dense owl
# azure bloom AI

Make it use a different tree/subtree if you donโ€™t want it to share the same behaviour as the other AI

cosmic stag
#

Is it possible to bake a Nav Mesh into a Nav Area?
I have multiple nav meshes (for different agent radii) in my map. I would love to be able to bake the inner nav mesh into a nav area polygon.
This would hopefully allow my most nimble AI characters to move with nav filters where they avoided large open areas when pathing.
I guess a secondary question is can Nav Areas be anything other than box volumes?
and a thirdary question, can NavAgents change their Agent type at runtime?

steel moat
#

How to mark character as enemy in AI Perception...i looked on the forum posts but they way too old and its hard to understand

dense owl
opaque bloom
#

Hey y'all. Trying to learn about AI in UE and having a problem, my pawn does not really move even though the location is being picked from the grid. It has a separate AI Controller that runs the behavior tree.
I can see the location changing but it's happening constantly and does really continue to the 'wait' command. The possessed player does not move at all either

ivory rune
#

Do you have navmesh in this map?

opaque bloom
#

No. I want it to move in a sphere

ivory rune
#

If you want the AI to do Move to task, you need navmesh anyway

opaque bloom
#

I was told that if I want to have a planet and move pawns in there I need to use the EQS system because navmesh is only for flat surface

ivory rune
#

EQS has nothing to do with path finding. It is just basically generate one or a group of results basec on your EQS test

#

I've no idea how to do path finding on a planet, but you still need a method for AI to know how to find the way to the result you got from EQS

opaque bloom
#

isn't the pathfinding task inside the EQS for that purpose?

ivory rune
#

Nope, EQS has nothing to do with path finding.

simple abyss
#

hey guys, a user posted that super weird AI teleporting behaviour which i have no clue yet what's going on. as you can see some AI falls from the sky whereas the other AI has its equipment teleporting to its body as it seems.

To give some context we are using world partition and the AI is set to spatial loading, although usually the entire map is loaded anyway (pretty small as of now), so this shouldn't have a big impact.

Furthermore the base mesh is the skm_manny_simple that has the materials set to hidden while all the cloth and gear are child components that use the leader pose node and use the leader bounds. The skeletal mesh is a skeletel mesh comp budgeted and we are using a custom AI optimization component that has different levels of optimization. the first one comes into play at 6000 units (cm) and has these values (though the AI here in this video are much closer so not sure if it is relevant).

I've also posted the base optimization settings for the mesh, very basic. Any help would be great! this bug is super weird.. maybe someone else has experienced something similar before

misty wharf
#

Perception doesn't know anything about your game's systems. You have to set it up yourself

#

For example, when the enemy gets killed, you could unregister it from perception. Or, you could have the AI bind to an event on the enemy which you broadcast when it gets killed so the AI can react accordingly

#

etc.

signal island
#
{
     UBehaviorTreeComponent* BT= &OwnerComp;
    BT->GetBlackboardComponent()->SetValueAsBool(FName("CanAttack?"), false);

    UAbilitySystemComponent*  ASC = UAbilitySystemBlueprintLibrary::GetAbilitySystemComponent(OwnerComp.GetAIOwner()->GetPawn());
    if (!ASC)
    {
        return EBTNodeResult::Failed;
    }
    
    UClass* AbilityToActivate = BT->GetBlackboardComponent()->GetValueAsClass(FName("AbilityClass"));
    if (!IsValid(AbilityToActivate))
    {
        UE_LOGFMT(LogChangerAI, Error, "Ability invalid.");
        return EBTNodeResult::Failed;
    }
    
    int AbilityLevel = BT->GetBlackboardComponent()->GetValueAsInt(FName("AbilityLevel"));

    ASC->OnAbilityEnded.AddWeakLambda(this, [this, ASC, BT](const FAbilityEndedData& Data)
    {
        ASC->OnAbilityEnded.RemoveAll(this);
        
        UE_LOGFMT(LogChangerAI, Log, "Finished executing {0}.", Data.AbilityThatEnded->GetName());
        FinishLatentTask(*BT, EBTNodeResult::Succeeded);
    });

    FGameplayAbilitySpec Spec = FGameplayAbilitySpec(AbilityToActivate, AbilityLevel);
    
    const auto SpecHandle = ASC->GiveAbilityAndActivateOnce(Spec);
    
    return EBTNodeResult::InProgress;
}``` Its crashing on FinishLatentTask(*BT, EBTNodeResult::Succeeded); am i doing something wrong? since this task is instanced and should be valid.
misty wharf
#

Hard to say. Check if this or BT is nullptr, that should give some ideas to start with at least

dapper crest
#

So we have some level variants and we have a dynamic nav mesh that should always update, also at the start of a level because some sublevels might be removed. When I simulate I can see it generating the nav mesh and then it just suddenly stops. The result of this is that an area that is blocked in another level variation, now has a gap there in the nav mesh. I'm not sure how reliable the simulation/nav mesh visualisation is, but to me it looks like it just stops generating the nav mesh at a certain distance from the center. Is this possible?

misty wharf
#

I don't remember off the top of my head, what does the function look like?

#

I mean what parameters does the function take?

#

Ah, are you using a stimuli source component or no?

#

Hm, ok not sure if this is actually exposed to blueprints in that case ๐Ÿค”

#

It's possible in C++ just fine though

#

Yeah the stimuli source allows you to make any arbitrary actor visible in the perception system.... pawns (eg. characters and such) get registered automatically with the system, so it's unnecessary on those as a result

#

You can place the stimuli source component on your pawns also - in that case you should be able to use that node to unregister them

dapper crest
#

When our player moves, the nav mesh is being updated. It's not creating a hole or anything (none of its component can affect the nav mesh), but it is regenerating. Why is that?

misty wharf
#

Every time you move the player the navmesh updates?

#

Or rather, it keeps updating as the player moves?

#

If that's the case then something in the player is set to affect navigation - it could be an actor you've attached to it or such also

foggy moth
#

whats the socially accepted way to destroy/stop AI on a pawn?

DeathEvent - i need to leave the mesh on the ground - i could do this in several different ways - but more importantly i need to:

1: StopLogic on the AIController/BehaviorTree
B: Destroy the AIController
42: just because i had to throw 42 in here....

I'm doing the following - BrainComponent is valid - but it still is executing the BTree....

BrainComponent->StopLogic("Death")

#

one thing i should add - this is comign from a delegate - is OWNERSHIP a problem here?

olive prism
#

Hello, I have these two blackboards so that when the distance with the target is greater than 500 the AI โ€‹โ€‹teleports and when it is less, it walks, but regardless of the distance, only 1 is executed and it does not respect the blackboard condition, why does it happen this?

olive prism
foggy moth
#

Red Arrow = selector

#

sorry i meant - selector/sequence

#

aka - Composite

olive prism
#

it is a sequence

foggy moth
#

Sequence tooltip - "if a child fails, then the sequence fails"

I assume you're fialing out on the first node tree probably... so the whole sequence fails.

olive prism
#

The sequence is executed correctly, but it does not respect the blackboard, if the player is 200 away from the AI, he will teleport when the distance for him to teleport has to be 500

And sometimes, I'm 1000 away, and the AI โ€‹โ€‹walks, not teleports

azure bloom
#

Okay so I need help if anyone can ping me here. Basically, I'm using behavior trees and AIController with AI perception, I want my AI to look at me when spotted, and then go into a rage (probably via another BT branch) so that way he doesn't break away from chasing me until I break sight. How can I do this?

dense owl
azure bloom
#

Right now, my AI rotates towards me and moves towards my position, waits 5 seconds and does the same thing

#

I want him to see me, rotate towards me, then go into a blind rage and chase me until either he gets me or he breaks sight from me

dusk pewter
#

I have a situation where I am using a maze generator. Once generated, I expand a nav mesh over it and it is dynamic. Then I rebuild navigation.
I have a solid lag of about 10 seconds while it gets rebuilt.
The navmesh scale is around 50x80x1.
I tried to use navmesh invokers around the main character but for some reason it doesn't work at all.
Is there a way to mitigate or accelerate the navmesh gen?

steel moat
#

This is my behavior Tree, what it does is: Whenever AI detects a sound it will first go to that location and do a random patrol at n number of points. The issue is when AI is running that part of behaviour tree where it goes to the sound location and does patrol search in that area, its not detecting new location, until its done running all tasks. I tried using on Value change on decorator but it doesnt work

#

this is the behaviour tree

dense owl
steel moat
#

to move to the new detected location

dense owl
#

Itโ€™s still set unless youโ€™re manually setting that key to nullptr

steel moat
#

ohh...

#

then how can I make AI react to the new Sound Location

#

can I restart the whole behavior tree if it detects a new sound?

#

Im watching behaviour tree videos to understand more about it

dense owl
#

Perhaps a service that checks if the new sound location is the same as the current one, and a Boolean decorator that checks its value?

#

Thereโ€™s likely a better way, others might know

steel moat
#

boolean decorator checks sound location?

dense owl
#

No it checks true or false

#

A service can run an update the location and check if the location is the same as current one

#

So in case your sound still goes off at current location you donโ€™t go aborting

#

But like I said, prly better ways

steel moat
#

lemme try this, I have to create a custom service right? theres only Default Focus and Run EQS

dense owl
#

Maybe even have the decorator observe the actual vector

dense owl
#

EQS is also a good idea

#

That BT video covers it

steel moat
#

the one posted by unreal engine?

#

this one?

dense owl
#

Just depends how complex you want to go ๐Ÿ˜…

dense owl
steel moat
#

will watch it

#

thanks!

glossy geyser
#

Hey there,
I'm currently trying to add a UPawnSensingComponent to an enemy character, but the editor keeps crashing (eventhough the compile worked well). Could someone point me to what im doing wrongly?

Declaration in headerfile:

    UPROPERTY()
    UPawnSensingComponent* SensingComponent;

Character constructor:

    // Set this character to call Tick() every frame.  You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;
SensingComponent = CreateDefaultSubobject<UPawnSensingComponent>(TEXT("SensingComponent"));
SensingComponent->bWantsInitializeComponent = true;
SensingComponent->InitializeComponent();
if (SensingComponent->HasBeenInitialized())
{
    SensingComponent->bOnlySensePlayers = true;
}
dense owl
regal drift
#

How do you iterate through the pathfinding result? Just need the list of FVectors.

This is the current code:

void ATestAiPathFindingActor::StartAiPathFinding(float NavMeshRadius, float AgentHeight, FVector TargetLocation)
{

    ANavigationData* NavData = NavigationSubsystem->GetNavDataForProps(FNavAgentProperties(NavMeshRadius, AgentHeight), GetActorLocation());

    FNavAgentProperties AgentProperties;
    AgentProperties.AgentRadius = 550.0f;
    AgentProperties.AgentHeight = 150.0f;
    FPathFindingQuery query;
    query.StartLocation = GetActorLocation();
    query.EndLocation = TargetLocation;
    query.QueryFilter = NavigationSubsystem->CreateDefaultQueryFilterCopy();
    query.NavData = NavData;
    query.SetNavAgentProperties(AgentProperties);

    query.NavData = NavigationSubsystem->GetNavDataForProps(AgentProperties);

    PathFindingResult = NavigationSubsystem->FindPathSync(query);
}
steel moat
#

How can i set the Query Params of the property in a c++ class, actually from where i can set it?

dusk pewter
#

@uneven cloud I'm experiencing a case where if the player runs into a moving AI with either a BTT move to or simple move to, that AI actor is pushed upwards. In my search, I see tons of responses to it but nothing definitive, yet you're #1 on the results.
I also followed a thread by the one and only everynone and it's not yet clear what causes this.
Would you have any tips on how to avoid it?

foggy moth
narrow python
#

Hi. Is it possible to create Navigation Query Filter on fly? Imagine bot that changes its movement and area traversing abilities dynamically. Isn't that why filter class can have functions? I know that several filters can be made before hand, but it scales real quick with number of areas.

misty wharf
azure bloom
#

IS there a way to overwrite a behavior tree? Say I have a parent tree that looks at you and moves forward, can you have a child tree for a child AIController that does something different while keeping the behavior for other AI?

misty wharf
#

You mean you want only the child to have a different BT and the parent to still keep the old one?

narrow python
narrow python
azure bloom
#

if I have a Run Behavior Tree node on the parent, and put the same nodes on the children controllers, I really don't think that will work

#

with different BTs

narrow python
#

Put different node with different tree

narrow python
olive prism
#

Why my decorator is never executed?

regal drift
# narrow python Is this what you need?

I am using C++ and try to make it work with my current MassEntity setup.
But i found this code below which i will try to use.

    TArray<FNavPathPoint> Points = PathFindingResult.Path->GetPathPoints();
    for (const FNavPathPoint& Point : Points)
    {
        //Do whatever
        Point.Location;
    }

Ether way thanks for the response.

narrow python
feral sedge
#

I'm not sure if this is the right forum. But my AI enemies lose navigation when reloaded in World Partition in 5.3.2. I know there was a collision issue with landscape components, but I turned off Spatially Loaded on the landscape stuff. But something is still making my NPCs randomly lose (and gain) navmesh connection on loading in. They will attack the player if close, but not move or chase, like if there was no navmesh. If I come back later after traveling, those same ai might work normally. If I reload in the area, they work fine. It's got to be the unloading and loading, but why? Any help would be awesome! If wrong channel, please redirect.

regal drift
uneven cloud
uneven cloud
dusk pewter
#

you know what the fix was?

#

I was doing just about anything

#

I created a new collision channel called "enemy"

#

and set it up instead of pawn

#

somehow, SOMEHOW, it worked

#

I dunno if the default collision channels such as pawn are done someway or another but this is what worked....

feral sedge
#

By "connection" I meant that the AI could/couldn't see the navmesh. What you said makes sense, but I'm just trying to understand what is happening with a static navmesh in World Partition.

uneven cloud
uneven cloud
# feral sedge I don't have the Navmesh bounds or recast set to be spatially loaded. Do you kno...

The navigation streaming isn't set up like other things in the world. The bounds is not the nav mesh. All it does is define where it will be built.

If the AI can't find the nav mesh, that means it doesn't exist. They directly use the navigation system for pathfinding. Like I said, you should start with finding out what the actual error is by using the visual logger. All of the navigation issues are logged there.

peak crane
steel moat
#

i thinks its cuz of lightning

#

I've created a variable of Blackboard key Selector in c++

UPROPERTY(EditAnywhere, Category = Blackboard)
FBlackboardKeySelector BlackboardKey;

and im trying to get its int value using this

void UBTDecorator_CustomLoop::OnNodeActivation(FBehaviorTreeSearchData& SearchData)
{
    NumLoops = UBTFunctionLibrary::GetBlackboardValueAsInt(this, BlackboardKey);
    Super::OnNodeActivation(SearchData);
}

But the value of the BlackboardKey is coming null always

steel moat
#

i am also getting this everytime i build my project

ancient wedge
#

Has anyone tried this in 5.4? Navmesh Generation for Large Worlds (Experimental)
How does it work? Do I need to enable something? ๐Ÿ˜…

steel moat
#

Error: Ensure condition failed: ObservedKeyNames.Num() > 0 [File:D:\build\++UE5\Sync\Engine\Source\Runtime\AIModule\Private\BehaviorTree\Decorators\BTDecorator_BlueprintBase.cpp] [Line: 68]

#

Im getting this error everytime i build my project, i didnt used to get this error before today, doesn anyone know anything about it?

#
[2024.05.31-08.34.47:726][645]LogScript: Error: D:\build\++UE5\Sync\Engine\Source\Runtime\AIModule\Private\BehaviorTree\BTFunctionLibrary.cpp(41): Runtime Error: "ensureAsRuntimeWarning condition failed: (NodeOwner != nullptr) && (NodeOwner->GetClass()->HasAnyClassFlags(CLASS_CompiledFromBlueprint))"
[2024.05.31-08.34.47:726][645]LogScript: Error: Script Msg: ensureAsRuntimeWarning condition failed: (NodeOwner != nullptr) && (NodeOwner->GetClass()->HasAnyClassFlags(CLASS_CompiledFromBlueprint))
[2024.05.31-08.34.47:726][645]LogScript: Error: Script call stack:
    [Empty] (FFrame::GetScriptCallstack() called from native code)
[2024.05.31-08.34.47:726][645]LogScript: Error: D:\build\++UE5\Sync\Engine\Source\Runtime\AIModule\Private\BehaviorTree\BTFunctionLibrary.cpp(44): Runtime Error: "ensureAsRuntimeWarning condition failed: OwnerComp != nullptr"
[2024.05.31-08.34.47:726][645]LogScript: Error: Script Msg: ensureAsRuntimeWarning condition failed: OwnerComp != nullptr
[2024.05.31-08.34.47:726][645]LogScript: Error: Script call stack:
    [Empty] (FFrame::GetScriptCallstack() called from native code)
[2024.05.31-08.34.47:726][645]LogScript: Error: D:\build\++UE5\Sync\Engine\Source\Runtime\AIModule\Private\BehaviorTree\BTFunctionLibrary.cpp(52): Runtime Error: "ensureAsRuntimeWarning condition failed: BTComponent != nullptr"
[2024.05.31-08.34.47:726][645]LogScript: Error: Script Msg: ensureAsRuntimeWarning condition failed: BTComponent != nullptr
[2024.05.31-08.34.47:726][645]LogScript: Error: Script call stack:
ancient wedge
steel moat
dusk pewter
#

@uneven cloud I find that unlikely since I set all physics volumes to ignore all channels/objects and same for the actual sk/sm. When doing hit checks it consistently only referred to the capsule collider root

steel moat
ancient wedge
haughty tide
#

So to my understanding when the same behaviour tree asset is used, nodes are shared across all behaviour tree components, hence the need to Node memory. I am trying to find where this happens in the source code, but I am struggling a bit to understand how BehaviorTreeComponents are shared. My most fruitfull investigation showed that there is the UBehaviorTreeManager that keeps instances of loaded BehaviorTreeComponents, but I cannot find the part that handles the sharing capabilities. Any ideas ?

misty wharf
uneven cloud
solid dirge
#

i need some help with BTTask - Ai Move To. When the AI enters this task is gets stuck and just stands there when only on success of finish execute is connected. When i connect regular exec pin, the AI wont even reach the destination. It just moves on to the next task. Any idea what to do?

#

This is the BP for the task.

#

This is the result when reg exec is connected.

#

AI never even traveled to the location. Just went on to the next task and consumed the object

#

and here i connected success only to finish execute and AI just stuck.

uneven cloud
solid dirge
#

Ai Move To only moves to an actor object

uneven cloud
#

I mean you should use the BT task

#

Make a new BT task for finding a location

solid dirge
#

i just posted a picture of a BTTask where I do htat

#

and in that task I use built in Ai Move To

uneven cloud
#

No. You are not. You are making your own move to BT task

#

I said you should use the built-in move to BT TASK

solid dirge
#

thats silly. Why would they allow people to make their own tasks if everyone is told to use built in

#

built in task does not work for my case as I want the actor to arrive at a random point around the object

uneven cloud
#

Your BT task has several problems. First you aren't checking to see if you found a location. It's also returning immediately.

You are missing functionality from the built-in move to BT task like aborting the move and the ability to update the location.

solid dirge
#

what is incorrect?

uneven cloud
#

That it can't do that. You can make a task to find a location, set it to the blackboard and use that for the move to

solid dirge
#

i see what you mean. I can try that. But I have a feeling is that the point I have that I calculate is reachable but not navigatable. It seems to be inside the mesh itself.

solid dirge
#

ended up being a collission issue. my meshes were set to block all and the destination not matter what approach I took was not navigatable. So making the meshes overlap, it is all working

#

both ways

old plover
#

Hey, quick question, how do I activate a Gameplay Ability from a StateTree Task (or a BTT I assume it would be the same) without an input tag, obviously for a bot.

narrow mason
#

Get a reference to the ASC and call activate

old plover
mortal magnet
#

I got a question about nav mesh, we use Nav link to link the nav to each other, but does it need to be only done once, or does it need to be done and every possible connection?

dense owl
mortal magnet
dense owl
#

Iโ€™ve also used nav modifiers for when I want something to block or not block the AI on demand

#

And for stairs I think you generally want the navmesh to cover all the steps and just have your AI walk up on them

mortal magnet
dense owl
#

Project settings. Be careful tho, you may need to ensure any moving actors have can ever affect navigation turned off so youโ€™re not regenerating the mesh for no reason

mortal magnet
#

@dense owl some stairs dont have navmesh on it, probably too narrow, but the nav link proxy added there fixes it

dense owl
#

Fair enough, but does the AI jump over the stairs or walk over them?

mortal magnet
dense owl
#

Nice. It is also very likely that nav link proxies are cheaper than dynamic mesh perf wise so if that works, thatโ€™s good

mortal magnet
#

@dense owl nice! thank you, will use nav links at the other areas then

#

also this is the default navmesh generation, is there anything you think would be better?

dense owl
#

Some settings in there can have intricate consequences

mortal magnet
#

@dense owl i don't suppose you know of any tutorials of AI being able to open doors?

dense owl
#

I don't but I'm sure you can find some

mortal magnet
#

Hopefully it's not too difficult to implement

dense owl
glossy geyser
#

Hello there, is it possible to reference a BTTask within other BTTasks? I would like to implement an attack rotation. It seems really clunky if i have to always do
moveto -> rotateto -> attack etc for every single action, therefore I'd like to abstract it, but I cannot find out how to do that.

stray widget
#

hey guys!! I am having some problems with how the AI controller is getting managed... actually I am trying to cache some controllers at the start of the play when the initial wave starts... and I want the controllers to stay in the game even after the pawn is destroyed... therefore, I overrid the Unpossess method and didnt call the base method... am not sure if thats how it should be done...

another thing is that when they are getting spawned, even the C++ version of it is also spawned, which I didnt really see with any other actors... is it normal??

#

The spawning is just like how we spawn normal actors:

misty wharf
#

You almost definitely should call Super::OnUnpossess and not doing so is very likely to lead to problems

#

If you're ever unsure of whether you should be calling the parent function, check what the implementation of the parent looks like. If there's any lines of code, chances are you need to call it or stuff will break

#

If you are spawning controllers yourself, have you turned off auto possess AI on the pawns? And if so, how are you spawning the pawns?

stray widget
misty wharf
#

I don't recall what part destroys the controllers, but I would assume if you unpossess the controller when the pawn is being destroyed, that would avoid it from triggering the controller destroy logic

stray widget
misty wharf
#

Yep, if you have it on the "spawned" setting it ends up spawning the controller for it when you spawn the pawn

stray widget
misty wharf
#

Maybe breakpoint the EndPlay function in the AI controller to see where it gets called from, might help figure out what's the right way to prevent it

stray widget
#

thanks for the help mate!!!

misty wharf
#

๐Ÿ‘

light void
#

Alright, so I have two behavior trees with the same blackboard.The default tree simply check which state the NPC is in (idle, random travel or chasing player) and act appropriately.
I have a button, when pressed that change the state to Chasing player. It work and the NPC start chasing the player. Wonderful.
When I switch to the other behavior tree, using the same Blackboard, the key does nothing. It doesn't seem like the behavior tree's branch get aborted.

umbral relic
#

trying to have an ai to follow and attack a player but I want them to constantly follow them and never suddenly stop in place when they reach the ai move to, what is the way to do this

woven jasper
#

So EQS don't take into account agent radius?

dense owl
light void
light void
#

Alright, while the "Lock AILogic" seems to have fixed my behavior tree actually aborting, it doesn't seem like it actually abort the "Move to and Use Smart Object" though. It allow other nodes to run (example the one changing the movement speed) but it does not stop the movement. The NPC finishes it's movement and disregard the player.

#

And it does go into the correct part of the behavior tree, going to "chase player".

light void
#

Anyone know how to interrupt the Move To and Use Smart ovject node?

dense owl
uneven cloud
uneven cloud
stray widget
#

And sometimes they create them in batches specially when the enemy counts out numbers the controllers... like spawning random type of enemy for a given count

stray bobcat
#

Hey All - Might be a silly question, but what's the benefit of Smart Objects? I watched a tutorial on them and they seem overly complicated vs having a custom BP and having the AI just look for a sphere overlap for the BP and calling an interface on it to claim it before moving towards it. I assume I must be missing something that makes Smart Objects much better??

misty wharf
#

Of course if you think it isn't suitable for your usecase for whatever reason you can always implement it yourself, the basic idea isn't super complicated

exotic copper
#

Hi guys

i tried to make a simple patrolling AI that goes between patrol points and waits if that patrol point allows ai to wait. then i made a decorator to check if the current patrol point has allowed ai to wait (bool is true)
so if the bool is false i want BT to skip only wait node and continue to the next node which is increase path index
but when i set the bool to false, BT skips wait node and goes back to first node ignoring the increase path index node
how can i fix this
thanks in advance โค๏ธ

misty wharf
light void
#

I think I found what I needed. On the other hand, I need a bit of help to understand how something works. the "Move to and Use Smart Object" node has multiple handles. One that is the default, unnamed one, the on succeed, on Failed and On Move To Failed.
In my case, I used the On Succeeded and On Move to Failed. But Someone pointed out that the reason it doesn't end is because it's an Async Task.
Thus I want to understand how these multiple handle works together.
Am I correct that the first, unnamed handle start as soon as the Task Starts? It doesn't wait for the task to end, only to begin?
While On Succeed only trigger once the Task has run it's entire course?

Thus by saving the task I can call an End task on it if I abort?

misty wharf
#

And yes otherwise you are correct

fluid ingot
#

Hey everyone!
Is the pinned course about Introduction to AI with blueprints still relevant for 5.4? Because I see it was done using UE4, and I don't know if its content is still useful or there are other practices or workflows that have changed over time.

This is the link: https://dev.epicgames.com/community/learning/courses/67R/unreal-engine-introduction-to-ai-with-blueprints/mX27/introduction-to-ai-with-blueprints

Epic Developer Community

This course introduces Unreal Engine's AI tools, exploring how AI agents work within a video game environment and the systems used to achieve realistic ...

dense owl
#

not much has changed in this area of the engine since

fluid ingot
#

Thank you @dense owl, really appreciate it!

fathom sun
#

Hello, I have a weird issue with my AI nav walking. Anytime they get on any ledge, they refuse walking. I have got a screenshot showing an orange sphere which is the destination of the current path segment, and it's right on the same height as the AI regardless the slope. You can also see that the navgrid is correctly generated along the ground. Does anyone know why it might behave like that?

dense owl
#

use visual logger to find out, speculation will only get you so far

fathom sun
#

What exactly should I do though?

#

I haven't used it much

dense owl
#

open it. Start recording. Run the game. When you encounter the issue, stop. then click on the AI Controller for that AI, and go through the last few frames recorded. The log should tell you why the nav is failing

fathom sun
#

I ran it, and that's the first thing that is recorded related to the navigation

#

After that it creates two other entries saying OnSegmentFinshed. The fourth one says that it was aborted, most likely by my anti-stuck code

dense owl
#

are you using dynamic navmesh generation?

fathom sun
#

I feel like flickering is due to the floor. It's fine on other maps

#

If it would regenerate the navmesh, I would imagine that those islands would change (since it's the only part flickering), but it doesn't since the path is the same, and it follows the same path segments

hoary vortex
#

Hello, I made a 3rd person character follow the player, but I want them to float in air instead of walking, how do I do this? when I set gravity to 0, it stops moving

#

I want it to float up if I jump and float down when I fall

dense owl
fathom sun
#

I'll try running a fresh new AI with bare minimum of setup just to see whether the problem is on my end

#

Yeah, it seems to be. That's weird though since I'm using AIMoveTo with actor as the destination. I can't think of what can be in the way ๐Ÿค”

dense owl
fathom sun
#

Capsule thickness doesn't seem to be the case. Just tried to make the radius be 5 on that working AI, and it still works

dense owl
fathom sun
#

One of the things that I noticed is that they walk as they should when their world static collision channel on the capsule is set to ignore

#

The last line in the debug information shows that

uneven cloud
winter ember
#

Hey anyone who uses State Trees + UE5.4 wondering if I can get some help. My State Tree Request Transition nodes are no longer working and I am wondering if anyone has experienced the same issue?

fathom sun
uneven cloud
vague hollow
#

Hey,

This is like a message in a bottle right here but you never know.

I'm trying to use the AISense_Sight Perception in conjunction with the AISense_Team. Basically what I wanna have is :

  • one target sights the player, gets a tag to enter the "alerted" state.
  • this target then replicates the signal with AISense_Team to all targets in range so they get to the same "alerted" state.

When the player exits the range of a target it should also replicate the sense so any target loses the tag.
What I have now is somewhat working for the first part. In CPP i created this function : UFUNCTION( BlueprintCallable, Category = "AI|Perception", meta = ( WorldContext = "world_context_object" ) ) static void ReportTeamEvent( UObject * world_context_object, AActor * broadcaster, AActor * enemy, const FVector & last_know_location, float event_range, float passed_info_age, float strength ); that I can call from my BP (see pictures) . The propagation of the tag works fine, but the propagation of the "RemoveGameplayEffectFromOwnerWithHandle" is just not propagating properly. Checked the engine code and it seems the default engine wouldn't allow me to make it work that way.

So if anyone has an idea of what i could do/some workaround to this/etc... LMK!

misty wharf
#

I don't know if the team sense would be the one to use, but you could always just use a sphere overlap check to determine what AIs are within range and some custom interface for it

fathom sun
vague hollow
misty wharf
#

Ah right

#

Yeah I've not used the team sense so not really sure as to its capabilities, but I've done pretty much exactly what you're talking about via a sphere overlap :)

fathom sun
#

After some debug I found out an interesting thing in CMC code.

In my game I change the collision profile after 2 seconds after spawn from SpawnCollisionProfile (which is meant to ignore things around the spawnee) to default collision. However, CMC sets the response to world static and dynamic to ignore when navwalking it enabled.

So I suppose that I shouldn't touch those 2 collision channels. I guess navwalking makes use of some intelligent hacks to increase the performance of the movement, and I'm getting in the way like that, though I wonder how exactly it works. Hopefully someone can shed light on that part so that I don't have to dive too deep in CMC source code ๐Ÿ˜„

misty wharf
#

there's no gravity, etc., because the movement is literally locked to the navmesh

fathom sun
#

There is one issue that I have with that though that I still need to investigate more. Anytime my AI character jumps, it falls through the floor as the static world collisions are set to ignore. Reading the source code of the same function I just sent, it does this

            if (DefaultCapsule)
            {
                UpdatedPrimitive->SetCollisionResponseToChannel(ECC_WorldStatic, DefaultCapsule->GetCollisionResponseToChannel(ECC_WorldStatic));
                UpdatedPrimitive->SetCollisionResponseToChannel(ECC_WorldDynamic, DefaultCapsule->GetCollisionResponseToChannel(ECC_WorldDynamic));
            }

which supposedly should set it to block as long as the default collision was block.

Now that I think twice, my default collision is set to ignore as it's assigned based on team during runtime. I think I can simply handle that in OnMovementMode changed

vague hollow
#

@misty wharf btw, we achieved it without collision sphere :)) still some tuning but it should work properly !

#

it's kindof a hack because you gotta make use of the signal strength of each of your sense stimulus to make it work but it works

misty wharf
#

Interesting approach... I kinda get the feeling that the team sense probably does a sphere overlap or something similar behind the scenes lol

vague hollow
misty wharf
#

Ah yeah looks like it just iterates all listeners and does a distance check. Makes sense given it would have a list of them available

#

Fwiw, you can create your own senses also if you want to make a less hacky implementation of this :)

vague hollow
#

Yeah, it's not really the AISense_Team implementation that is problematic, it's more about the RefreshStimulus and ProcessStimuli functions in AIPerceptionComponent that were implemented in a way that we had to think differently x)

#

But yeah along the way it could be a good idea to implement our own sense if it proves useful

misty wharf
#

Yeah, seems it would be useful if you could pass f.ex. a FGameplayTag along with the sense event

uneven cloud
solid wedge
#

Anyone use that AI Flank To node thats recently free on marketplace?

misty wharf
vague hollow
versed maple
regal drift
#

What is the proper way to use Async Pathfinding?
I can i just use the FindPathSync on a custom thread?
And how do i know if the Async Pathfinding is done?

I got singel threaded pathfinding to work. But now i want to get Async pathfinding to work and then implement it into my MassEntity setup. I am a bit unsure were to start, have some functions which i plan to explore. And i dont see to many examples of Async pathfinding code.

Functions to explore:
FAsyncPathFindingQuery
TriggerAsyncQueries
DispatchAsyncQueriesResults
PerformAsyncQueries

ashen field
#

This node AiMoveTo will call On Fail with Movement Result as "Blocked" when i set the movement speed of my Character to 0 for ish 5 seconds. Is there anywhere I can configure how long it should wait before calling On Fail with Blocked?

Specific events will change the movement speed of my AI Character, and during certain times, it will be 0 for longer and I would like it to not fail because of it.

misty wharf
ashen field
north oriole
#

Is there some way to get a path from eqs instead of a single point?or more in general to get some path on different conditions than just the shortest without modifying the navmesh?

rich wolf
#

i have a logic/implementation question about using behavior trees, i have my vehicle AI written in AI controller right, every tick it calculates what it has to do, and depending on some conditions at the moment, it calcualtes steering, throttle and brakes using player inputs, since the conditions are becoming more and more complex, i figured I should start building a behavior tree for it, and my question is, should i put this basic driving logic to every behavior tree task file for every tick and calculate the conditions, based on the current task inside the task file, or should i keep this basic driving logic in the controller and just calcualte the inputs inside tasks and somehow feed the steering, throttle and brake data to the controller driving logic

#

ALL of the behavior tree tutorials i find, are for the built in character AI and they do not explain any logic and relation for self written AI and the behavior tree relation

#

so it's a little bit difficult for me to understand how should i go on about this

#

and literally all the vehicle AI tutorials i've found, do not use behavior trees