#gameplay-ai

1 messages · Page 45 of 1

uneven cloud
#

The perception uses senses to perceive actors/events in the world. Sight, hearing, touch, and so forth.

The environmental query system (EQS) is used to ask questions about the world.

sand nebula
#

@uneven cloud Do you happen to have any idea why this is happening?
LogAINavigation (Error) AAIController::MoveTo: Destination is not valid! Goal(Invalid)
LogAINavigation (Log) MoveTo: Location(X=340282346638528859811704183484516925440.000 Y=340282346638528859811704183484516925440.000 Z=340282346638528859811704183484516925440.000) Mode(partial path) Filter(None) AcceptanceRadius(50.0 + overlap)

I'm using this setup to get a position however these ones from the debugging (Print string seem fine) but the one in the visual logger are huge

uneven cloud
north oriole
#

If I only reach an offset of the player, then i never reach the player which is literally my goal?Or, you just mean an offset so close to the player that the enemy can already attack them from there?

deep bramble
#

My AI character is only rotating towards me instead of moving towards me. I have perception working and the behavor tree is also working, but the character wont actually move towards my player. What could be causing this?

It's showing this in the visual logger:
LogPathFollowing (Log) Moving directly to move goal rather than following last path segment

uneven cloud
deep bramble
#

What's odd is that I've setup other AI characters in the past and they don't seem to have this issue.

#

Acceptable radius is default 5

north oriole
dense owl
deep bramble
#

I assign focus to my target actor (using perception), then MoveTo target actor and the BT looks normal.

dense owl
#

Is your target bb key the actor itself or its location vector?

deep bramble
#

The target is my player character not a location vector.

#

Targeting using perception is working, and it can track my player character as I run around it in circles but it will only rotate and won't actually move towards my player character. There aren't any issues with navigation which I can see with the runtime AI debugger UI.

#

Fixed it. The problem was that I had some mesh that was affecting navigation mesh enabled so it was always in some invalid spot.

dense owl
remote magnet
#

Is there a way to retrieve a parent actor from a state tree's task blueprints? I'm having trouble locating any such function.

remote magnet
#

Figured it out! I missed a plugin so not everything was showing up correctly.

#

I do have an additional quandary though, how do I go about triggering specific states from external scripts? I see something about events and tags, but it seems a bit confuddling.

#

Something like this?

mild bobcat
#

If I'm trying to construct a floating AI in a zero-G environment, I'm going to have to probably need to recreate a "Move To Location" from scratch; do these functions run on Tick? I'm just wondering about how they work in the abstract

#

I'm assumign it's something like:
Pathfind once,

Then every tick to "continue on path" until reached

potent loom
#

it's pretty simple when you have a path

FVector UNecroAiComponent::MoveAlongSpline()
{
    const auto ClosestSplinePoint = SplineComponent->FindLocationClosestToWorldLocation(ControlledCharacter->GetActorLocation(), ESplineCoordinateSpace::World);
    const auto MovementDirection = SplineComponent->FindDirectionClosestToWorldLocation(ClosestSplinePoint, ESplineCoordinateSpace::World);
    ControlledCharacter->AddMovementInput(MovementDirection);
    return ClosestSplinePoint;
}

but the path bit is the tricky bit.

#

but this would run on tick, which is basically not optional for characters it has to work like that

random cedar
#

Hello friends
I'm really at my wits' end when it comes to a flying opponent

So now I'm just trying to program a projectile movement so that it moves in the air in my direction.
My question is, is it possible to tune a projectile to move as soon as it sees me, i.e. with Pawn Sensing?
i upload my Bp image
Because the problem is now taht it moves in my direction but not if he sees so at the begin of the game he starts to move

(I know that's not the right way for a flying opponent, but I'm still far too new to unreal to be able to do everything without being able to see the whole thing in a video or picture)

fierce carbon
#

What could be the reason my zombie hand slash is knocking my character around? I have set Ignore Radial Impulse on both the character and zombie but it is still happening. Although, I am applying radial damage for the attack, is that the reason?

mild bobcat
mild bobcat
dense owl
#

What’s an IA in this context ?

#

No like literally. Do you mean AI?

#

If so, you’ll need to troubleshoot it using the Visual Logger. We can’t really guess at what could be wrong too much, other than the obvious stuff like did you forget to add a navmesh?

#

Not really, it should know. But you could be trying to move to a goal location that’s not on it for example. Use Visual Logger in Tools -> Debug.

#

You should also manually give it a location you know it’s on the navmesh for sure to test

#

Then you’ll know for sure

#

You hit record, play the game, let the AI nodes fire. Then you can pause and click on each frame and read the info. Often, the problem frame is highlighted in red. You can also use some VisLog blueprint nodes to get some extra visual indicators, like drawing a debug sphere at the goal location vs projected location

silk spear
#

Is there a way to manually rebuild navigation at runtime? I don't want to set it to dynamic, just to rebuild once after I set up my level

uneven cloud
# dense owl What’s an IA in this context ?

IA is AI in a lot of different languages like Italian, Spanish and French. Because the words are swapped. Instead of saying I have a green jacket, they say I have a jacket green. So it's intelligence artificial instead of artificial intelligence.

dense owl
uneven cloud
uneven cloud
dense owl
uneven cloud
random cedar
uneven cloud
dense owl
uneven cloud
random cedar
uneven cloud
uneven cloud
random cedar
uneven cloud
random cedar
# uneven cloud Not entirely certain why you are trying to get philosophical. Your ideas on usi...

As already mentioned, I'm a total beginner, so I referred back to a simple tutorial. It also mentions that it's not the right way, but rather just a "wrong" option

https://www.youtube.com/watch?v=XEqUWYb6n8I&t=381s&pp=ygUUZmx5aW5nIGFpIHByb2plY3RpbGU%3D

Hope you enjoyed the tutorial, comment with any questions or suggestions.

Follow and support my Instagram and Twitter to track the development of my games!
https://www.instagram.com/joshgoblue_dev/
https://twitter.com/JoshGoBlue_Dev

If you would like to see more tutorials in the future, subscribe and comment ideas!

▶ Play video
misty wharf
uneven cloud
random cedar
# uneven cloud That isn't actually helping you.

You're right, just like Gorka's tutorials xD, but I'll leave that topic for the future for now...
Anyway, thank you very much for the tips and ways you mentioned on the topic of “Flying Ai” 😄

modest token
#

in vermintide, theres a lot of enemies that spawn like 100 - 200 and when i try to add a large amount of my enemies into the game, the performance sucks

#

is there a way to make unreal engine handle a large amount of AI's?

#

note: the performance isnt like 1 FPS its more like 20 which isnt and never wanted when fighting this many (or more) enemies

misty wharf
#

It's possible but it's unlikely to be super simple

#

For starters the Character Movement Component is expensive enough to cause issues when you have a lot of enemies. It has features which can be toggled to alleviate the issue, but it may not fully solve it. Beyond that, there's also things like costs from skeletal animation which can also be optimized but it's a complex topic of its own

#

The best way to find out what you need to do is to profile your game using Unreal Insights

deep bramble
#

Can also make your own dynamic tick system that adjusts the tick rate of actors depending on their distance from the player using the significance manager and the viewport.

uneven cloud
uneven cloud
modest token
uneven cloud
modest token
dense owl
#

#mass has some pins and people that know these things

uneven cloud
modest token
sand nebula
#

Hi guy! I'm using the following setup to try and set a bool for my running animation to have a random jump while running. However as I'm debugging on why its not working I found out that the "get distance to" my character seems to be resetting to 0 everytime.
Here is my debug:
LogBlueprintUserMessages: [ABP_Jester_C_0] 0.0 LogBlueprintUserMessages: [ABP_Jester_C_0] 1880.454346 LogBlueprintUserMessages: [ABP_Jester_C_0] 0.0 LogBlueprintUserMessages: [ABP_Jester_C_0] 1879.905029 LogBlueprintUserMessages: [ABP_Jester_C_0] 0.0

Does anyone know why this is happening?

modest token
sand nebula
modest token
sand nebula
dense owl
#

Ok hold on

#

Other Actor means the other actor, so don’t get player char

sand nebula
#

Excuse me for misposting 🫠

dense owl
#

You need a ref to your target actor

#

Your Target pin should be self

#

Jester should be other actor

#

Provided you’re doing this on your char and Jester is the intended actor you want to check distance to

uneven cloud
#

It should not be self in the anim bp

dense owl
sand nebula
uneven cloud
dense owl
sand nebula
#

Yeah should post it there, my bad

dense owl
uneven cloud
sand nebula
#

Okay 🙂 So I have a Jester Character that walks around. As soon at is detects the player by sight, it starts to move towards the player. When moving towards the player the speed gets set from 30 to 300 and it starts the running animation. What I'm trying to do now is, to check if the distance between the Jester and the Current player is greater than 250, in order to set a bool "IsInPlayerRange" to True, otherwise false. This bool contols an Animation State in which the jester jumps instead of runs

#

The problem that it seems to have is that it goes back and forth when reporting the distance between 0 and 1800, the actual distance instead of a consistent 1800

uneven cloud
dense owl
#

BT and a service/task that checks distance should do the trick

uneven cloud
#

The AI should determine if IsInPlayerRange is true and the anim bp should get that from the AI. Not calculate it itself.

uneven cloud
dense owl
#

I figured this would not be the only behaviour they need for their AI in the long run but 🤷‍♂️

uneven cloud
#

You are making a lot of assumptions

#

And jumping 10 steps ahead

sand nebula
#

Aight thanks for pushing me into the right direction on where to look! I already have a Behaviour Tree (if that's what you mean with BT) for patrolling around and chasing the player 🙂

mild bobcat
#

How do the AI Controllers have "Move To" within a single node? Are there just a bunch of state and hidden tick functions that move towards a target while the right state is ticked?

In trying to make my own custom Move To for 6DOF for an AI Pawn/Controller, I'm a little unsure of how to start.

#

I'm only still checking out some primers on Behavior Trees, but it seems like something that a BT could do for me anyways, since it can itself evaluate per tick what it needs to be doing.

#

It's either overkill or a good bridge for not having the MoveTo functions I need, by having tasks as simple as "accelerate towards target" and managing all the typical things a "move to" node must already manage

uneven cloud
mild bobcat
uneven cloud
#

Moving that functionality to a BT would be a very bad idea.

mild bobcat
uneven cloud
mild bobcat
vivid drift
#

What exactly are you trying to navigate? Often 3D doesn’t need path finding because there’s no obstacles

uneven cloud
#

That's not even remotely true

mild bobcat
mild bobcat
# uneven cloud Not in any performant way

I'll forgo pathfinding then until I'm more confident in how it all works together; FloatingPawnMovement and Move To Actor should be sufficient for now until I need more complex navigation.

#

I naively thought all the AI movement funcitons would only work in 2D with a navmesh but it seems to work with floating just fine.

vivid drift
mild bobcat
#

I'm starting with the idea of an astronaut defending a bare planet with AI floating directly towards targets/player, but ideally it could get more complex than that (navigating a 3d maze, or being inside a sphere with entrances, etc.)

uneven cloud
vivid drift
#

Yeah, but not many games need intelligence :p

#

Flying npcs are usually dumb and that’s usually fine. Not to say there aren’t cases where you want it but… eh. Indie games probably not

fierce carbon
#

What do I need to take into account when trying to replicate zombie AI? Isn't the character movement replication built in and just needs to be turned on? Would the only replication required be with the player characters it's interacting with? Just trying to understand the basics and where I should start.

vivid drift
#

Nothing AI related needs to be replicated. The ai figures out what to do on the server and whatever it tells it to do is the stuff that gets replicated

uneven cloud
fierce carbon
uneven cloud
fierce carbon
uneven cloud
fierce carbon
uneven cloud
#

Character movement is already set up to be replicated, you just need to turn it on.

fierce carbon
#

Yeah cool

uneven cloud
fierce carbon
#

With the character movement being replicated with it replicate any animations it has?

uneven cloud
#

No. The animations will not be replicated.

fierce carbon
uneven cloud
#

AI is not replicated. How you replicate the CHARACTER depends on what you are doing.

fierce carbon
#

Because the "same" CharacterMovement component is used on both.

vivid drift
#

No

#

Your AI CONTROLS a character

fierce carbon
#

Yeah, so it's different since the player is a client and the AI is on the server?

vivid drift
#

No it’s pretty much the same

#

AI on server tells actor to do thing. This action gets replicated.

#

Player on a client asks the server to tell the actor to do a thing. The server says ok. The action gets replicated from the server

fierce carbon
#

So movement type animations will replicate the same as a player?

vivid drift
#

Animations are entirely local

fierce carbon
#

Ok

vivid drift
#

Your local animation blueprint should figure out what to do based on the replicated variables

#

Montages being different

fierce carbon
#

Ahh I think I understand now. At least a little bit more, I'll look at more tutorials. Thanks.

modest token
#

for a simple Ai is it better to make a Ai from the pawn or character class?

#

it will only go towards the player and do attacks according to what enemy it is

#

since it would be more performant than using a character class and im not using like 90% of the characterMovement

mild bobcat
modest token
mild bobcat
#

but if you don't think you'll need it, then why not?

modest token
# mild bobcat Even something as simple as Add Force and Add Impulse aren't available in the ot...

well my enemies are currently made from the character class and im using addimpulse. i guess ill stay with the character class instead of pawn but how do i turn off most of the unwanted functionality in the charcter class if possible (askin this cuz i need to spawn in a large amount of enemies with great performance and i read a reddit post abt the character movement could be a factor in the bad performance)

harsh storm
#

Don't read a post about it. Learn how to do #profiling

#

Then measure.

dense owl
#

Measure Profile twice cut once 🙂

modest token
dense owl
#

Session Frontend also had some decent functionality but that part was deprecated

gleaming hemlock
#

Im making a strategy game AI.
I need AI to recruit soldier every 30 seconds.
Build building every 40 seconds.
And build city every 60 seconds.
Should this all be in one task?
Or i create a new task for each one of them?

#

I think it be more organized if it was all in one task.

#

Though im not really sure how im going to do that

#

In blueprint its Set Timer by Event : 30 s , Recruit Soldier

#

Any tips, pls?

misty wharf
#

Yeah at least to me it seems timers would work if it's like that

#

I don't know if I would put the logic into a BT task though. I'd make it maybe in the AI controller assuming that's what you have

#

If you use BT you can then call that function from a BT task but the logic would be within the controller so it's easier to control the specific implementation I think

gleaming hemlock
#

So i can put those set timer in the Controller

#

but the behavior tree still checks for when to attack, when to defend and wait (boom)

#

And that is tied to the ammount of units the AI has vs the human player has

#

So, should i skip the behavior tree entirely for this?

misty wharf
#

I'm not sure why the BT doing those things would be a problem?

gleaming hemlock
#

then need to create a variable to control the time for each task, the recruitment, the building, and the build city

#

as you said, this would be easier with just some set timers in the controller

#

but then the controller wont be good to control the attack

#

etc...

misty wharf
#

Yeah I mean why is it a problem for the BT to control the attack?

#

You have some timers in the controller to build stuff and whatever, so what's the issue with BT making some other decisions?

gleaming hemlock
#

hmmm

#

wait

#

i think i got what you saying

#

yes will do that

misty wharf
#

I think you could potentially use a BT service for the building stuff since they can be set to tick at some specific intervals

#

But hard to say which approach would be best

visual sluice
#

do i need to always use a finish excute in an ai task node ?

misty wharf
#

if you mean BT Task - you need to call finish execute when you want the task node to complete

#

If you don't call finish execute, the BT will never continue to the next task

#

(aborts can still occur of course)

visual sluice
misty wharf
#

Usually by structuring your BT in such a way the task is only ran once

#

I guess you could use a decorator to prevent the task from being ran if a BB value is set to true or something, or some other approach like that also

gleaming hemlock
#

if not more confusing in the bt

oblique basin
vivid drift
#

If this behavior is a function of the state of the ai it makes sense to do it in a task

#

If it’s something the ai should always be doing you should probably just put it in the ai controller

#

Like unrelated to everything else

gleaming hemlock
vivid drift
#

This sounds like a side task to me.

gleaming hemlock
#

I thought of 3 tasks for this

vivid drift
#

You don’t want 3 tasks because you want to be tracking progress for each task simultaneously. You also want your ai to be doing other things in parallel while doing the spawning business.

gleaming hemlock
#

exactly

#

so its in the controllar right?

vivid drift
#

That what I would vote for personally. But it depends on the design. If it’s really a dumb do this every x seconds, then I would do it in the controller

#

If it’s nuanced and depends on state then do it in a task

#

Regardless of where you’re putting it. You’ll just want to spawn a timer for 60 seconds that binds to an event that spawns the thing and then restarts the timer. Alternatively, you could give yourself credits at a rate of 1 per second which will in turn build something whenever it hits 60. This is probably better in case you want to change the timing rules ever and don’t want to simply restart the clock when you do so.

oblique basin
# gleaming hemlock i dont understand how you do that in one task. Do you set a condition for the ta...

You should think of the BT as a kind of state machine. There should be a clear enter and exit state. The execute function should be used to perform the setting up logic i.e. which target to attack, do you need to move/turn. The tick is where your timing logic goes so e.g.
Execute runs a function to check enemy position and established you need to move first. You set bAttack to false, then set a callback that sets bAttack to true. Tick will checking if (bAttack) then perform logic when it's true. If this isn't what you're looking for, give us more info on what actions are happening simultaneously and how your timers are set up.

oblique basin
#

Tasks are for more complicated do X, wait, then y, wait, then z logic

gleaming hemlock
#

got it. thanks a lot for the help guys @oblique basin @vivid drift

#

i need to study better the BT

#

its a bit complicated

#

too many things at once

#

also another thing. i create what i call a sub ai commander.
basically when its time to attack, i create a new ai and a pawn, and that ai and pawn has a new controller. And give it some units. so this ai that is supposed to be a little commander that will perform an attack

#

so its like almost independent from the main ai

#

once all the units that are under the control of this ai dies, i destroy it

#

this is so the enemy faction can coordinate different attacks. given different units

#

so a little group is given to one sub ai, and he goes here ->

#

and another group is given to another sub ai, and he goes there to attack another faction ->

#

its working quite well. though i dont know if this is a good practice

vivid drift
#

Sounds fine to me

modest token
#

since im having a lot of Ai enemies in my game i needed to find out what is making them less optimized and fix that and i found that one factor is the tick function but i need the enemies to update every frame and not 0.1 per frame. is there any fix or another way to optimize tick?

vivid drift
#

what do you mean 0.1 per frame

#

you mean every ten frames? what exactly are you doing on tick that "needs" to be done

modest token
#

so every 0.1 seconds it fires a function to update where the players location is and go towards it also with rotating to the player

vivid drift
#

a "frame" is every time the game runs an update and draws a new frame on the screen. e.g. when people talk about games running at 60fps that means it's doing 60 updates every single second.

#

You do not need to be updating the player location and reorienting towards the player every frame or anything like that. You can just use built in functions to go towards an actor.

modest token
vivid drift
#

AI MoveTo's Target Actor pin

modest token
uneven cloud
modest token
uneven cloud
modest token
modest token
#

when u say built in rotation do u mean theres a function or a variable because when i search up "rotation" there isnt anything to change the rotation

modest token
uneven cloud
#

You still do not need to update the target's location every tick. .25 seconds should be fine.

modest token
uneven cloud
modest token
uneven cloud
mild bobcat
# uneven cloud No. First you need to get 3d navigation working. Then your own movement compon...

So right now things are rudimentarily implemented with MoveDirectlyToward, FloatingPawn.

For context, these are AIs floating in zero-g, and while I've added some ragdolling on bullet hits, they move a little too cleanly.

I'll probably update their Target of movement to include a predictive tasks that changes the target location to something offset based on relative velocities for an intercept (since right now they "orbit" in a circle if there's lateral movement), but how would you recommend adding naturalistic "bobbing" or imperfection in their floating?

upbeat hamlet
#

Hey guys, one question regarding pawn sensing. Sometimes when I just keep standing still it seems to stop working and doesn't recognize the pawn anymore. If I move slightly, it senses me again. Why is that happening?

mild bobcat
uneven cloud
modest token
#

would simulating physics for a pawn that uses addForce with 100 Ai's at once be costly or would it not be that expensive

mild bobcat
uneven cloud
modest token
uneven cloud
remote magnet
#

When my character is in their default, controllable state, I'll often need to activate individual sub-states via abilities. Would the parent state be a good place to put the event-driven transitions?

green stratus
#

Hi guys, what are your takes on implementing AI/NPCs/Monsters in Unreal (specifically Lyra)? Right now each bot gets spawned by its own AIController, PlayerState and Lyracharacter. Which is ok for a team deathmatch kind of game. But I need to all quite many roaming monsters across the map. What do you think is a better way to implement this (if any). Or should they also be spawned with their own AIController et'c within the proximity of the players? Because I kinda want them to be visible from afar as well.

upbeat hamlet
remote magnet
# green stratus Hi guys, what are your takes on implementing AI/NPCs/Monsters in Unreal (specifi...

I'm still rather new to Unreal, but from what I can tell the behaviour/state tree system seems quite efficient. Everything is structured in such a way that lends itself to good performance, only running code when it's necessary. So offhand I would think AI controllers would be fine.

I'm 100% not sure about player states though, but I would think those would only be relevant to players and NPCs who are actively playing the game, less so the ones who are just wandering about.

dense owl
#

4th pin video here goes over it a bit, among other things

green stratus
civic canyon
#

Hi! I am using smart objects in my game for slot machine logic and I'm also planning to use it for my NPC's collecting trash.

However, I was planning to place a smart object on a "cheater" gambler npc, so my staff AI can walk over to the cheater and interact with it. The problem is that the AI doesn't seem to care about me moving the smart object while playing. Is there a better way for me to do this? My idea was to use smart objects cause of their nice claim system to prevent multiple staff from trying to interact with the same cheater npc.

green stratus
obsidian igloo
#

so i have a question about making an AI manager, I want AI to see and hear for themselves but I want the decision making to be done via a manager bp. what is the best way to do this? should the AI process its perception or should the AI report its perception for the manager to handle? im not super sure if the tradeoff is worth it or not and if it is has anyone tried something like this?

civic canyon
misty wharf
#

I think the processing in pawn has the advantage of allowing pawns control over how they implement it but other than that it probably doesn’t make that much of a difference

obsidian igloo
#

I hear alot of companies use managers for AI, and they apparently can be better on performance, but im not really sure what should be handled by the manager and what should be handled by the individual. do you perhaps have any insight on this? i thought of condensing ai perception to simple traces from a pool of known world pawns and then doing "perception" calculations based on dot product, distance, and blocking traces instead of true detection, and let the individual AI manage attacks and such but would it be better for the manager to handle the navigation calculations, detection levels, EQS and other things like this? I would like to have quite a few AI on screen, anywhere from 20 to 30 but since its a vr game I need to squeeze every bit of performance I can out of it.

misty wharf
#

Well the perception system itself is already timesliced which could be an advantage for performance

#

I would personally start with the perception handled in the pawns, and the pawn sending "higher level" information to the manager about it, as at least to me this feels more architecturally sound

#

The advantage of doing more in the manager would probably be the ability to potentially coordinate things better between different pawns but I think you would still be able to do that for the most part even if the perception events themselves are mostly handled within the pawn

misty wharf
stark tangle
#

i have a questions about State Tree
looks like Evaluators works like a Blackboard of the Behavior Tree, am i right?
and how to get information from the Evaluators in the another blueprints, like Task?
for a Behavior Tree we have a Get Blackboard node, but i dont see a "get evaluator" or something

misty wharf
#

Evaluators are more like services

#

The way you get values from evaluators into tasks is you use the binding mechanism

#

For example you set a value of some property in the evaluator, and then you bind one of the properties of a task to it

stark tangle
misty wharf
#

Are you using BP or C++?

stark tangle
misty wharf
#

Check the section for "adding an evaluator"

#

the parts where it mentions adding the Output category on the variable and such should be it

stark tangle
misty wharf
#

the section after it should explain the binding

#

in finalize the state tree

sudden field
#

is there a simple-ish way to discourage AI from retreading the same paths as it roams around an area?

#

it's just one agent roaming around an area for ~5 minutes

misty wharf
#

I guess you could store a list of previous waypoints and use EQS to pick points to roam that are weighted to be away from the points previously used

gleaming hemlock
#

I have a cooldown on my task

#

how do i make this cooldown to be random in range everytime

vivid drift
#

write a custom decorator or just check make the cooldown a property of the actor that can be checked in the task itself without using the decorator

gleaming hemlock
#

🧠 ⚡

rare pebble
#

AI Perception Report Damage Event doesn't work on pawns?

#

I have tried adding to my player bp but seems like not working when debugged

#

also saw a forum saying should implement this in aic

vivid drift
gleaming hemlock
#

this works too

#

a Wait Blackboard Time

#

then have a variable in the BB

vivid drift
#

not the same thing

#

that is telling your blackboard to wait

#

vs. trying to activate the task and failing because the cooldown is still active

#

it might come out to the same place depending on your design but the difference is pretty important

#

like you had SEQUENCE(WAIT, USE SKILL, MOVE TO) and the cooldown was 60 seconds your unit would wait 60 seconds, use the skill, then move. if you had SEQUENCE(USE SKILL w/ COOLDOWN DECORATOR, MOVE TO) it would observe that the cooldown is active, fail to execute use skill, and not try to do the move to because it failed out of the sequence.

#

depending on your blackboard setup it might just rerout back into the the failing use skill sequence until it works though

gleaming hemlock
#

got it

#

yeah this is bad then

#

maybe need to implement some weird custom cooldown though cant figure it out yet

#

thanks though

wise sluice
#

Hello ! If i have a smartObject with a pending Gameplay Behavior
How can I finish the gameplay behavior externally?

gleaming hemlock
#

Why do we have to set up things in a blackboard

#

why dont we just check on the AI Controller where we can store the variables, and change them

#

Is there a reason for using the blackboard instead of that?

harsh storm
#

Because you don't have to have an AIController in order to use the Behavior Tree

gleaming hemlock
#

and these variables are limited

#

ex: no arrays

dense owl
harsh storm
#

BTComp is a brain component. But there is no requirement that it be on an ai controller. None that I saw yesterday when I was poking around in it with siliex

#

It might get/cache the AI Controller when it gets added to an actor. But I didn't check what would happen if it failed to be on an ai controller. Let me check real quick.

dense owl
#

Ig if you don’t need the perception system

harsh storm
#

Perception != BTComp

#

It's a different system altogether

dense owl
#

Yeah fair enough

#

I was just pondering on the potential use case

harsh storm
#

Looks like this is the only place in the Brain Component that does anything with the ai controller.

#

So that property would just be nullptr

#

And the BT Component doesn't use it at all

#

Now - there may be some tasks that Epic wrote that have the expectation that it is on the ai controller mind you

#

(And I'm also not saying that you should avoid putting it on the ai controller!)

dense owl
#

Haha ik, I was jw what you would use it with instead

harsh storm
#

I would also need to actually check the bt system to see if it has any ai controller assumptions

dense owl
#

And whether or not the engine just assigns the AICon for you like they do when you use AIMoveTo

uneven cloud
uneven cloud
uneven cloud
karmic pelican
#

why can't I select "Both" ??

spring inlet
#

???

#

you want to abort none AND lower priority or what?

#

how should that work out?

karmic pelican
#

both

#

if the cooldown is 0, we abort both

misty wharf
#

iirc selectors don't have the same options available so is the parent node that's just barely visible a selector?

karmic pelican
#

might be another way of doing this

misty wharf
#

I might remember wrong but I've definitely also seen this on occasion

uneven cloud
karmic pelican
uneven cloud
karmic pelican
#

BB Condition have, but not the cooldown.

uneven cloud
#

That's a sequence

karmic pelican
#

they come from selector

#

still don't.

#

what am I doing wrong

uneven cloud
#

Sometimes you need to close the BT or readd the decorator.

karmic pelican
#

didn;t work, even after restarting the engine

vivid drift
karmic pelican
upbeat hamlet
#

I'm using the default moveto task in a behavior tree. My actor is a flying drone tho. So whenever I set gravity scale to 0 or default movement mode to flying it's not moving anymore and the BT is stuck at the moveto task. Do I need to implement a custom moveto task?

dense owl
#

If you’re looking for 3D movement you need to either implement your own, get some plugin or fake it by adjusting the mesh height within the character rather than its whole location

deep bramble
#

What's the fix for when you have an AI chasing a target actor around the level (main character) but can't find a valid path to the target actor anymore for a move to whenever the target actor is jumping or falling?

vivid drift
#

Nav link proxies presuming you mean they should be able to follow

deep bramble
#

No I don't mean nav links, that's for making my AI agent jump from A to B, I'm talking about whenever my character jumps, the AI loses its path to the character and so the BT sequence goes to the next one

#

I need to somehow keep a downward projection of my character's capsule to the navmesh just so that the AI can keep track whenever the character is jumping or falling a sort of large distance.

#

For example, the character is jumping across a series of pillars and the AI is in the pit below trying to follow along the ground underneath.

#

But whenever the character jumps from pillar to pillar the AI loses track of where the character is. Sometimes the jump from one pillar to another might be a large distance because the pillars are positioned one much lower than the other.

dense owl
#

you could maybe cache the last location at jump, depending on how long the jump duration is

#

Can it normally navigate between pillars tho?

deep bramble
#

So the AI is never on the pillars in the first place, only the character is. The AI is on the ground trying its best to follow along wherever the player may go.

#

And it does, because it will temporarily lose track, then once the character lands it resumes but that brief moment causes the MoveTo on my BT to fail which rolls over to the next node in the sequence thus screwing everything else up because the nodes are in a very particular order.

deep bramble
#

Nevermind, I fixed the issue by adjusting my BT so it didn't get all screwed up when the tracking is briefly lost.

#

All good

clear linden
#

Hi everyone, got a pathing question. I have a project with multiple NPCs of different actor classes and different AI controllers. They all have no trouble pathing around my map. I just created a new NPC actor along with a new controller and new behavior tree. I can see in the debugger that the behavior tree is running, but when this new NPC processes the MoveTo action, it turns toward the correct location but then does not move at all. The MoveTo action lasts a little while, like its trying to get there; it doesn't fail immediately (like I've seen it do if the location wasn't reachable).

Any ideas what could be wrong here? I checked things like movement replication (I am running on dedicated server). The other NPCs don't have troubles pathing on the navmesh. I'm not aware of debug tools for MoveTo.

autumn sluice
#

Anyone playing with StateTree in 5.3.2? I have this simple test setup. This works fine, but when it gets to the Wait task it seems to call the EnterState function every single tick instead of calling EnterState once, then moving to Tick event. This means I can't properly use the FinishTask function to complete the state.

obsidian igloo
autumn sluice
obsidian igloo
#

I believe so, the finish task function to my knowledge has gone through quite a few iterations since state trees introduction, and most of them have been borked lol. its a shame cuz state trees are so powerful nyaaa

autumn sluice
#

I MUCH prefer the workflow of state tree over behavior tree. I've been trying to adopt ST since it came out but every time I sit down to do something I hit walls like this lol

obsidian igloo
#

same, i like how they are MUCH less spammy, and easier to flow between states over BT's lol. but same the walls are never ending, suppose its still in beta but hopefully it will be prod ready soon

autumn sluice
#

I thought I read that ST was ready in 5.3, that's kinda why I was going to dig back in. I will never emotionally recover from this

obsidian igloo
autumn sluice
#

Well...I guess moving it out of beta means it now has the same status as the rest of the Unreal systems - buggy and unfinished 🙂

uneven cloud
uneven cloud
uneven cloud
deep bramble
#

So I'd use some large value like say 10? I tried but didnt notice any changes.

uneven cloud
deep bramble
#

So more along the lines of something like this?

#

and then what's the 2nd part where I connect the TestAgent into an existing character? where does that happen

green stratus
uneven cloud
green stratus
#

It does a huge deal to immersion

#

Seeing flocks moving across swathes of land

#

The landscape is like africa, alot will be visible from afar

deep bramble
#

Nevermind I ended up sticking with the work around fix with my BT and won't bother with the Z height projection thing.

steel moat
#

I m trying to move characters but its not moving when printing the movement result its printing success

#

theres nav mesh too

#

im trying to move the black ones to the red point

#

and theres a door in between and navmesh is not breaking

steel moat
#

this is the spawn code for ai

#

when i put the ai class in the level instead of spawning it works the character runs to the point

#

but its not working when i spawn them

upbeat hamlet
upbeat hamlet
uneven cloud
upbeat hamlet
#

I thought that is the ai logger I have open in the screenshot. Sounds like it is something else?

uneven cloud
upbeat hamlet
uneven cloud
upbeat hamlet
#

No, just LogAINavigation (Error) Trying to find path to BP_Rover_Nanite_C_0 resulted in Error

upbeat hamlet
#

So if I scale up the capsule it will also move ai sense sight up, which is good. But scaling the capsule also scales my mesh as it is parented to it. Can I then scale down the mesh accordingly or does that mess other things up?

dense owl
#

Luthage would know

fierce carbon
#

Spawning multiple AI in the world seams to bug. It works fine on a single AI, is the behavior tree the reason?

misty wharf
#

Bug how?

fierce carbon
#

Like the sensing gets all messed up and they get confused.

misty wharf
#

That sounds like a problem in your sensing logic

#

Maybe they're sensing the other AI's when they're not supposed to?

fierce carbon
#

In the AIPerception component?

misty wharf
#

Yeah

fierce carbon
#

Ahh

#

I will check that as soon as my backup finishes

fierce carbon
# misty wharf Yeah

I should have AIPerception on the controller right? Or is it better on the AI character?

misty wharf
#

Controller is correct yeah

#

The idea being that the pawn itself could be used by player or AI, where the player wouldn't need the perception component at all so it's better to be on the controller

fierce carbon
#

Ahh makes sense

fierce carbon
misty wharf
#

No. All pawns get registered as stimuli sources by default

fierce carbon
#

Oh wow

misty wharf
fierce carbon
#

Oh wow that has to be the issue, almost backed up

#

Which is stupid if you ask me. It makes AIPerceptionStimulas useless

misty wharf
#

Yeah not sure why it's set up the way it is

fierce carbon
misty wharf
#

np :)

steel moat
misty wharf
#

There is a setting on pawns, called auto possess by AI or something like that

#

That's what Luthage is referencing

sour sphinx
#

probably a stupid question, but can someone tell me why trying to get the stimulus class here wouldn't work ? it will double up on me for sight and hearing ... every time it senses sight it works fine, every time it senses hearing it will ALSO sense sight..even behind the pawn/behind walls ect.

misty wharf
#

You are looping through the current perception data

#

You get a list of the last stimuli for all senses if you use Get Actors Perception

#

I would suggest using On Actor Perception Updated or whatever the other event was - that one will give you only the most recently updated stimulus value instead of the updated actors array

sour sphinx
#

ah thanks m8, that seems to work fine 👍

rare pebble
#

AI Perception Report Damage Event doesn’t work on pawns?
the sound and the sight sense works perfectly
but when tried to implement report damage event and if i click the "H" key, it doesnt create a sphere trace!

#

enemy base [only one enemy is there so getting it]

#

player BP

winged cargo
#

unreal 5.3

median socket
#

Hello! I have a question which might be very off-mark, since I'm not very comfortable with AI in Unreal, but now I'm forced to learn it -- any pointers in the right direction are appreciated.

We have a dialogue/scene system which enables Pawns to participate in graph-based dialogue, which play automatically. Now I'd like to extend this system with the ability to request simple AI behaviors from the Pawns. For instance, a dialogue scene might involve the Pawn moving to a lever and pulling it; or moving to a specific location and pointing in a direction. These are kind of fire-and-forget actions. Most of them will probably be something like "path to X and play this animation montage." Is there an appropriate subject I should research to achieve this?

#

I'm side-eying the "MoveTo" node because it's similar to what we want -- just a simple action that can be invoked without messing around with Blackboards and Behaviour Trees. I'm not uncomfortable with BT+BB, but it feels a little overkill for simple actions. But perhaps it's the best/only way to do AI?

#

I think part of my confusion is the AI Behaviors plugin. Its description "Encapsulated fire-and-forget behaviors for AI agents" seems perfect, but I'm having difficulties finding info about how it's used, due to the generic name.

#

I guess maybe the Move To and Use Smart Object with Gameplay Behavior node is what I'm looking for huh

misty wharf
#

Yeah it sorta depends. Smart Objects can be used for something like this I suppose, and the AI behaviors plugin is only really used by that for the gameplay behavior bits

#

It seems it would be relatively straightforward to just invoke the logic on the pawn via using a custom AITask for example also.

median socket
#

Yes, I think I'll take a look at the AITask logic and see if I can figure it out -- otherwise I guess the abovementioned node probably will suffice for our cases.

gentle lily
#

So, I've got a bit of a complicated and potentially unrelated question. If this belongs somewhere else, please let me know and I'll move it:

Basically, I'm wondering if anyone knows how exactly the Navmesh is actually generated? I'm looking to potentially do something similar for a system that generates "Climbing points" that players can use to climb from ledge to ledge, and I've been trying to use the Navmesh itself as a basis. But I haven't been able to find any good examples online or in the C++ code of how the Navmesh itself is actually generated. How does it figure out if a surface is flat so efficiently? How does it know when it's reaching the edge of a flat surface? Does anyone know where I can find this information?

misty wharf
#

Not sure if it's documented anywhere, you would need to look at the sourcecode

wise sluice
#

What is the cons of not using the PerceptionComponent on a Controller? I put mine on a Pawn.
I implemented the interface to handle perception in EQS and Sense but I have a warning telling me i could have API issues.

misty wharf
#

No cons if your pawns are only used by AI

#

If it's used by a player also then the component is kind of useless on it

#

But besides that, no difference. It might get the API deprecated in the future so it has to be on a controller, but who knows

wise sluice
#

The thing is having it on pawn allow us to specify Perception Configuration directly on each pawn.
But If i put the perception component on controller : I guess, i need a distinct controller per AI for the same result right?

#

Thanks for your answer!

misty wharf
#

Yeah you'd need a controller per configuration

#

Or I suppose you could add some logic to configure it based on settings on the pawn

lyric flint
#

I have a nav mesh that looks like this. It works great, but sometimes if the AI rounds the corner (from the top right of the image to the "bridge") too fast it flies off the edge (on the left side of the bridge). Should I account for this in the nav mesh or the behaviour tree or... somewhere else entirely? (I can't really alter the movement speed of the AI since it is intended to match the player.)

uneven cloud
steady phoenix
#

Hey, did you find a solution to this?

uneven cloud
cyan cairn
#

Guys how i can make pawn to use NavMesh ?

uneven cloud
obsidian igloo
# steady phoenix Hey, did you find a solution to this?

I did! I made an override actor rotation by comparing the actors current rotation and its control rotation and interpolated to the control rotation using a curve. it still technically happens but its much less noticable since the rotation is smoothed out, similarly to how ALS does it with Velocity and aiming rotation

uneven cloud
steady phoenix
gentle lily
uneven cloud
#

The rotation rate in the movement component.

obsidian igloo
steady phoenix
#

😮 oh shit nice

obsidian igloo
uneven cloud
steady phoenix
#

Yeah the rotation rate in the movement component just handles the actual rotation on it's axis, it doesn't affect its pathing at all.

steady phoenix
#

If you put the rotation rate all the way down to 1, you will have a super super slow rotate, but your AI pathing will still be linear and still Move Point to Point direct.

uneven cloud
#

It is the rotation rate. It literally does what ToasterMuffin did. Just in a more elegant way.

steady phoenix
#

No it doesn't, not at all.

#

Rotation rate does not affect the AI pathing.

uneven cloud
#

Neither does what ToasterMuffin did.

wise sluice
#

The DataAsset is an interesting approach, i'll try to take a look to that

#

Thanks for your advices

obsidian igloo
# uneven cloud It is the rotation rate. It literally does what ToasterMuffin did. Just in a m...

it definitely is a little different. rotation rate will make the AI turn very slow but it will still path to a T, which in some cases produces the jitter. mine has the character movemnt applied to the forward vector not the control rotation, so walking is smoother. its also multiplied by a rotation curve so the bigger the rotation difference from forward vector to control rotation the faster the pawn turns and will eventually settle once the rotations get closer

#

not saying youre wrong, but i can never get rotation rate to produce the same results hmmmming

steady phoenix
#

This is kinda what me and toaster are trying to achieve.

uneven cloud
steady phoenix
#

Location selection doesn't matter when all AI will (by default for what UE provides) a linear point to point pathing.

uneven cloud
uneven cloud
steady phoenix
#

idk, for me it literally makes 0 difference, this is with a super low rotation rate, the AI pathing is still linear.

obsidian igloo
# steady phoenix https://www.youtube.com/watch?v=CxCzqjOTwNE&feature=youtu.be

so i dont really use curves like that persay, the rotation rate is affected by a curve so its completely natural additive to the pathing of the AI, but its also not so harsh to the point it will make an AI miss its location target. i guess while it does smooth out the jitter its more for using a cubic interpolation over a constant or linear like rotation rate.

steady phoenix
#

Yeah im trying to get true cubic interpolation of the pathing, so that it goes around corners more natural.

#

have no problems with the actual rotation of the character

#

That plugin has decent results but it's limited (eg continous tracking) to the AI movement options you can do, and it's quite dated, author isn't fixing things XD

#

it does automatic spline movements without the need to pre-place your splines.

upbeat hamlet
#

what's the problem when the BT is flickering crazy like that? I'm using that movement speed task in the other trees as well and it works. VisLog shows no error.

misty wharf
#

Most likely as a result of the task node failing, which is then resetting the BT back to the start due to how you've structured it

uneven cloud
misty wharf
#

Ah true, it's a selector so it would be succeeding and not failing

upbeat hamlet
#

ah, so the second one is failing?

#

Thanks, I'll look into services. I'm following a tutorial which does it like that.

uneven cloud
#

It's a SELECTOR which means it'll try tasks until the first one succeeds. A SEQUENCE does all the tasks until the first one fails.

uneven cloud
upbeat hamlet
obsidian igloo
# steady phoenix

my characters only apply rotation if they have movement velocity and are on the ground, otherwise the rotation can be overridden, but its still relatively linear, its just a bit more smooth and inertial. they just dont jitter around if they get caught fighting a corner or something lol

#

a little bit of anim work goes a long way into hiding some of that jank too

steady phoenix
#

Okay i see, so there is a little misunderstanding, I have that solved with various stuff (avoidance, agent radiuses, and rotation rates with velocity), but yeah I'm looking for something a bit nicer.

uneven cloud
upbeat hamlet
steady phoenix
#

I checked out the matrix demo a while back and they have a new crowd system which might be a nice way to get around my issues

upbeat hamlet
#

Thanks for the help

obsidian igloo
steady phoenix
#

You can see in your video they all hug the walls, because it's the shortest path

#

Until a point to point happens that moves them away, such as 2 corners, but it would be diagonally set from A > B for the shortest path.

#

If you were to increase your AI count a bit, and view top down and sped up, you'll see they will always follow the exact same paths and eventualy look like they're walking in a single file line 😄

#

This demonstrates the problem with UE5's basic Move To pathing, it'll always, by nature of how short pathing works, have point to point pathing at the corners

#

And having AI move away from these lines will be rare, or not happen at all, without a bunch more work on

#

And you can be smart, or try use variance logic, so trying to figure out ways to get a more natural, spread out, and smoother walk rotation.

#

I built this no-spline, spline-like navigation system today after fumbling around with spline points trying to get what I want. This is part of my Stage Left system for NPC staging and blocking in Unreal, so it's using the same "smart" perform point data - meaning the NPC can stop at a point and perform any number of actions, trigger events, and...

▶ Play video
#

This is nice, but it isn't available and it's between points not for "random point in nav"

misty wharf
#

You could in theory adjust how the path is generated but ugh the code to do all the path points is so complicated lol

steady phoenix
#

Yeahhh

#

The MassAI does solve a lot of this, but it has other limitations, and isn't applicable in some places.

gentle lily
cyan cairn
#

Guys is it even worth to use Pawn than character for AI ?

#

I was wondering what is better in terms of performance if you have large groups of mobs

misty wharf
#

Well pawn can be used for non-character AI's

#

Character Movement Component is a resource hog so replacing it could be beneficial if you need to have a lot of humanoid type NPC's

fierce carbon
#

How would I let all AI controllers know something happened inside a single AI character bp? Would I have to use GetAllActorsOfClass or is there a better way?

#

Basically when my zombies kill me, the one that actually killed me loses sense of me. But the others don't.

fierce carbon
# cyan cairn Guys is it even worth to use Pawn than character for AI ?

If you AI has movement (like a character) you'd be a fool to go one class lower (pawn < character) to then have to create all the functionality for the character, when it is already built in for the character. Pawns are for things like vehicles, for characters use a character. Just add an AI controller.

#

A pawn is something you posses and a character is one class above a pawn so it's technically a pawn also, but with added character movement ability etc.

#

It's like this:

  • Actor: Something in the world
  • Pawn: Something in the world that can be possessed by a player
  • Character: Something in the world that can be possessed by a player and has character movement capability
misty wharf
fierce carbon
uneven cloud
misty wharf
#

Oh yeah for sure

autumn sluice
#

Does anyone happen to have a recommendation for an AI plugin that I can adopt and hook into the Gameplay Ability System pretty easy? I have been making my AI in State Tree but there are a number of blocking bugs Epic needs to work out. I'm going to pause my State Tree AI development until the bugs are worked out but I need some basic AI to slap into my project to continue some basic testing. I really don't want to go through and rebuild everything in Behavior Tree so I'm just looking for an easy, temporary solution to pop in.

vivid drift
#

What are you imagining it does

upbeat hamlet
#

Is there any way to move the AI Perception origin up to "eye level" of my drone?

misty wharf
misty wharf
upbeat hamlet
#

All the points are blue then. It only works with default capsule half height.

misty wharf
#

You shouldn't need to adjust capsule height, the eye height is a separate setting

#

Adjusting capsule height could potentially be affecting whether the EQS points are clipping into terrain or something like that which could cause issues with the path check

cyan cairn
#

Have a problem my Behavior tree is runing but my AI dont want to move

upbeat hamlet
#

the hearing circle is still on the ground, but maybe that doesn't matter

sour ice
#

hi, i just started playing with AI for the first time and began playing with sight perception first. i immediately noticed that there was issues, as in my AI is only capable of seeing my players pelvis and nothing else. i started looking for settings to adjust to fix this but there were none. then i started looking for answers online only to figure out i apparently need to extend the character class with C++. i wouldnt mind doing this if its the best option for me, but i cant help but notice discussions from people about avoiding this entirely and building a sight system from scratch.

i have some ideas of how to do it and thats not a problem (yet), but my question is, should i? will i be shooting myself in the foot in the long run? i plan on having a very large quantity of AI at any given moment, so performance matters, but flexibility and control also really matter, realism is the goal

misty wharf
#

Yeah by default the sight checks against the origin of the character. You can change it by using IAISightTargetInterface which as you discovered is C++ only

#

It's quite easy to do though, so unless you have some particular reason to avoid C++, it shouldn't be an issue I think

#

You certainly can build your own if you want, there isn't really anything in the engine that would require you to use the perception system for something else to work

autumn sluice
misty wharf
#

Do you happen to have multiple tasks in the state?

autumn sluice
#

Only one in this state, which is just a custom Wait task

misty wharf
#

Hmm, sounds kinda odd yeah. I haven't seen that, it works just fine and it won't end the state until the task actually calls finish

#

Do note that if a task lower in the state tree branch finishes, this can also trigger the child states to exit

autumn sluice
#

I made this for testing purposes essentially. I admitedly don't fully understand State Tree but I believe I am doing what I'm supposed to be doing. The enter Function is called over and over while the Tick function is never called

#

The result is that it keeps making a new TargetTime and tick never has a chance to check if the time has elapsed or not

misty wharf
#

Does the EQS Query task call Finish?

autumn sluice
#

It does

misty wharf
#

That's the problem then. It causes the PatrolRandom state to finish

#

I think... sometimes it's a bit confusing lol

autumn sluice
#

Oooooooooooooooooooooooooooooo man....Okay

misty wharf
#

In general, the pattern I've found useful is that tasks which get or load data should not finish

#

since that avoids the state from transitioning

autumn sluice
#

So, EQS queries are async. How do I tell it to move on to the child state when the query is finished?

misty wharf
#

I've not found a good solution to that. Due to how the state tree node selection works, it will always attempt to enter the child

#

It might be possible to set up a "wait" state as the first child, where you have another task which checks whether the data from the parent state's task is available or not

#

and it would only transition into the next state (which would be the actual logic) once the data from the parent has become available

#

but I've not tried this - my solution was to simply make a task which did both the query and the other logic in one

autumn sluice
#

Oh so you have a task that queries and performs a MoveTo?

Instead of having the EQS finish, I could try just publishing a bool and slapping a bool condition on the child perhaps. It might just keep looping until the bool was set. Then I can just switch FinishTask to only be called if there is a failure maybe

#

I didnt realize the parent success dumped the entire state branch, I thought it only mattered the state you were currently in

misty wharf
#

conditions are also a bit tricky because in order for the tasks to run, it has to find a leaf that it can enter

harsh storm
#

@misty wharf Have you had your bindings randomly stop working in ST? That was what finally broke it for me back in 5.1. Just not being able to select any bindings in the editor (like, from the previous task)

#

I always had to fix it by recreating the ST and hoping it would work

misty wharf
#

But that was ~reasonably easy to work around

#

But I only used ST's since 5.3 so not sure maybe it's an older issue that got fixed

autumn sluice
#

Oh man, I'm bookmarking this site. Thanks for posting. I can leave an open leaf in the branch so it has somewhere to go that can force a loop I guess. Seems a little messy to me so perhaps it's not the best solution. I will have to play with a few things now that I know a little more

vale bough
#

How do i stop behaviour tree when character dies?

#
GetBrainComponent()->StopLogic("Died");

i tried that but don`t work

autumn sluice
#

Instead of doing the enter conditions I put a event transition in the parent of the branch and routed it to the moveto once the EQS completes. Seems to be working fine from what I can tell

misty wharf
#

Hmm, that's interesting 🤔

#

I'm reasonably sure it would still attempt to enter one of the leaf states, but I suppose it could enter it, and then re-enter after the query finishes and it works

autumn sluice
#

Currnetly the MoveTo is not being called before EQS returns. Perhaps EQS is just returning fast enough that it can't move on in time. I will try adding a delay to EQS to test it

#

Ohhhh wait

#

I have the parent set to Try Enter

#

I'm pretty sure I read that this treats the parent like a Leaf

misty wharf
#

Ah, that would be useful if that's how it works. I haven't really looked at that part so much yet

autumn sluice
#

I'm just now diving back into all this as ST was a hot mess in 5.1

#

But I can work with this

#

Events are honestly better for me because I can get more granular in my transitions later

autumn sluice
misty wharf
#

Yeah, that's the binding issue I mentioned where you can't bind to sub properties. Try if it works, I recall someone said it still worked despite the nag, it never occurred to me to just ignore it

#

(The sub property binding seems to only work without the nag on the Context actor)

autumn sluice
#

Sometimes this does work. Doesn't seem to be working in this instance for some reason. I can expose the float in the global task and see if that works

misty wharf
#

Yeah it will work as long as you're not doing nested.property

autumn sluice
#

Okay got it, thanks 🙂

keen crow
#

Has anyone tried ConvAI or any other plugins for UE that allows players to talk with NPCs, ask them to do things, load up NPCs database about world, set up personality and stuff? I'm looking at ConvAI right now and thinking about using it for a single player action/rpg game. Their videos in youtube look cool but I'm concerned how configurable the ConvAI actually is for the gameplay, how well does it integrate with BTs, EQS, perception and stuff, and how performance-heavy it is. So can you guys suggest me alternatives/similar solutions like ConvAI or maybe share your experience with those kinds of plugins like does it even worth to get into that right now or is the current state of those things is only proof of concept?

cyan cairn
#

Guys how to have focus on the target for ai all the time even when moving ?

cyan cairn
#

So i just need to set focus in task for example and execute this along moving ?

upbeat hamlet
#

You call it once, and then call ClearFocus whenever you need to unfocus.

uneven cloud
solemn wasp
#

hi everyone ! I'm trying to spawn AI in mid air in flying mode and have it fly up, but my MoveTo node returns Fail all the time, any idea where this might be coming from ? They do spawn inside a Nav Volume, I set the movement mode to Flying right after spawning.

uneven cloud
uneven cloud
solemn wasp
#

So no Flying Mode for AI ? Only for players ?

#

I remember I had to hack the thing and use a Projectile system spawning my ai, homing to different positions, that was like a year ago

uneven cloud
#

There is no 3d navigation in the engine. A cheap way to get around that is to hover an offset from the ground.

solemn wasp
#

Is there a vertical navigation system ? Basically my AI climbs walls

uneven cloud
#

No

solemn wasp
#

Ah ! I'll hack my way through it then, thank you ! I'll try spawning with a gravity of -1 and work from there

upbeat hamlet
#

I've got a question regarding focus. For my "flying" drone this doesn't work 100%, because I want the drone to look down on the actor.
I tried playing around with setting the rotation on the drone mesh, but set focus is overwriting that.
Would that mean that I have to implement my own set focus task which does both?

solemn wasp
#

Never used Set Focus tho, sure sure what it does, but I didn't need it

upbeat hamlet
autumn sluice
#

Anyone using State Tree with GAS? I need to figure out a good method of detecting when an ability called by tag has ended so I can progress the State Tree

#

Right now I'm sending an event whenever an ability ends with a tag name and I'm just detecting that tag name. I can't really use this in all scenarios though, so I was looking for a more robust solution

uneven cloud
uneven cloud
lyric flint
cyan hemlock
#

Hey hey all, I've got a question regarding EQS. I'm using a Dot test to grade results which are in front of the player higher than the ones behind.

  • When I use an actor as the rotation context I get the result seen on img 1, as intended. The results behind the actor are scored lower.

  • When I use a vector (the location of the previously used actor) as the rotation context I get the result from img 2. The grading is all over the place.

Could anyone explain to me how or why these results are different?

solemn wasp
# upbeat hamlet Yea, that's what I played around with as well. What kind of event did you use so...

If I remember well, I did use tick because I didn't have so many drones spawning. But right now for a Turret I'm using the Pawn Sensing in combination with the Animation Blueprint, so when it sees something, I'm using the Look At node in anim bp to rotate a specific bone and aim at a target.

My new option seems better, because you can setup how often the Pawn Sensing triggers and sees something. But, with the Look At in the Animation Blueprint, there's an option to smooth the rotation and even choose how you want your smoothing curve to be (linear, ease,etc)

solemn wasp
uneven cloud
lyric flint
#

Thank you for the sanity check, I might just throw up some invisible blockers (or hand fix nav mesh in bad areas).

uneven cloud
cyan hemlock
uneven cloud
uneven cloud
sacred marten
#

Hey guys! Maybe someone can point in direction where I can look, what I'm trying to create is a sandbox game where you can build structures and you have monsters that attack them. Something similar to Fortnite Save The World. What I struggle with is that how AI should target structures considering that player can build fortifications for the "core". I've been trying to find out any technical details on how AI works in Fortnite STW but no luck so far and I can't even find something close to AI for sandbox games where you can build shelters etc so how AI should react to that, maybe someone have seen some info on that?

mild bobcat
sour ice
# uneven cloud Making your own perception functionality has a high probability of being far les...

yeah thats sort of what im worried about. i started playing around with a simple idea in BP just to give it a shot, but im gonna scrap it and try to extend the existing sight perception system in C++. i need the sight perception attached to the AI's head so they can turn to look at something when hearing perception is triggered, then i need the AI to be able to see the player's head, pelvis or feet (i use 2 traces for feet in my test but i could just use the root location instead) in that order. if the head is visible, the rest doesnt need to be checked

#

so uhh i gotta start playing with all that and figure it out. ive done a lot of object-oriented programming, but not C++ specifically. its time i learn

uneven cloud
sour ice
#

i guess my wording isnt the best, but i saw someone show how to attach the sight (cone? not really a cone) to the AI's head

uneven cloud
#

I use a socket on the mesh and override the function to get the pawn's viewpoint.

sour ice
#

yeah i think thats what they were doing

uneven cloud
#

It's not attaching anything. The perception component isn't a scene component that can be attached. It's just changing the logic of how it gets the view location and rotation to be a socket instead of the default.

sour ice
#

that makes sense

#

yeah it was this

steel moat
#

i followed this guide word to word

#

yet my state tree is not working

#

I feel state tree is not working on that actor

sour ice
#

alright, trying this again, im having an issue overriding CanBeSeenFrom on my characters

in my header file:

virtual UAISense_Sight::EVisibilityResult CanBeSeenFrom(const FCanBeSeenFromContext& Context, FVector& OutSeenLocation, int32& OutNumberOfLoSChecksPerformed, int32& OutNumberOfAsyncLosCheckRequested, float& OutSightStrength, int32* UserData = nullptr, const FOnPendingVisibilityQueryProcessedDelegate* Delegate = nullptr) override;

in my .cpp file:

UAISense_Sight::EVisibilityResult ACLM_Character::CanBeSeenFrom(const FCanBeSeenFromContext& Context, FVector& OutSeenLocation, int32& OutNumberOfLoSChecksPerformed, int32& OutNumberOfAsyncLosCheckRequested, float& OutSightStrength, int32* UserData, const FOnPendingVisibilityQueryProcessedDelegate* Delegate)
{
    if (GEngine)
        GEngine->AddOnScreenDebugMessage(-1, 15.0f, FColor::Yellow, TEXT("This is the pre-set text"));
    return UAISense_Sight::EVisibilityResult();
}

my AI has this character class, i set up a test screen print on the begin play function, that works perfectly fine, everything works perfectly fine except for this function specifically. its not being called. AI sight perception is setup on the AI as well, thats all working perfectly fine and the player is being detected, but the overridden function is still not being called. idk what im missing

#

any help would be appreciated

misty wharf
#

🤔

#

It seems that's all you should need to do unless they changed something

#

Note that if the target isn't within the sight cone that function is not going to get called to begin with

sour ice
#

i can debug the perception system, im being detected

#

but that function is not being called

misty wharf
#

You are on UE 5.2 or later right?

sour ice
#

5.3

misty wharf
#

Hm yeah, just checking since that overload was introduced in 5.2 I think

sour ice
#

it looks like they still use the function from 5.2, just within the new function

misty wharf
#

And you do have the interface set as a parent class for your class?

sour ice
#

unless im wrong

misty wharf
#

Yeah

sour ice
#

yes i do, anything that would create build errors has been done

misty wharf
#

No idea why that wouldn't be working 🤔 Maybe try breakpointing the code in UAISense_Sight which is calling this to check what's going on?

sour ice
#

how would i do that?

misty wharf
#

it should be in AISense_Sight.cpp line 539 or so where that gets called

#

just open the file in your IDE and set a breakpoint into the function

sour ice
#

its read only

#

or uh

misty wharf
#

that's fine, for breakpoints it doesn't matter

sour ice
#

yeah i wasnt thinking, its not code

#

lemme try that

#

sorry 1 min, first time debugging

sour ice
#

i attached and ran the level with the breakpoint set

#

i get this

misty wharf
#

Try installing the engine debug symbols from the epic launcher

#

It still might not give you the exact line, but it should at least break somewhere in the vicinity - you might need to try to breakpoint the first line of the function instead of the specific line also

sour ice
#

this might sound a bit silly, but when i installed 5.3, it never finished

#

every time it would finish, it would say resume

#

and when that would finish, it would say it again

#

it would just verify

#

in a loop

#

so i actually cant really do anything with my install

#

removing it says it'll uninstall it

misty wharf
#

:D

#

So it doesn't actually say it's fully installed in the launcher?

sour ice
#

its stuck here

#

forever

#

im not really sure what to do about it

#

i mean reinstalling would probably work

misty wharf
#

Yeah I would try reinstalling, not sure what else you could do

sour ice
#

i havent had any issues with the engine because of this except for 1 thing (might be unrelated but idk)

#

i cant set materials to translucent

#

lol

#

it crashes every time i try

misty wharf
#

That sounds kinda weird especially if it's in a new project

#

Seems you should try to do the reinstall, you won't be able to install the engine components like the debug symbols without that either I guess

sour ice
#

80gb for the debug symbols ?? oh man

misty wharf
#

I think there's some components that get installed by default like android support or something which you can uninstall to get some space back

#

Either way the debug symbols are almost must have if you do any C++ stuff because without them figuring out stack traces can be pretty hard

sour ice
#

gotta clear some space

#

might be a while

sour ice
#

then redownloaded to the same location

#

so it can run a proper verify

#

and it installed some small missing pieces

#

now i can set materials to translucent

sour ice
#

i debugged again with the breakpoint not showing the warning this time

#

but nothing happens

misty wharf
#

Try adding a breakpoint on top of the function instead of that specific line

#

It should at least enter the function I think

sour ice
#

on this line at least

#

if thats what you were implying

sour ice
#

ok this is why it wasnt hitting

#

its hitting the else

#

they're doing a custom trace test? ignoring CanBeSeenFrom entirely?

#

because Target.SightTargetInterface is null

misty wharf
#

That would seem to suggest that whatever it is detecting doesn't implement the interface

#

If the level you're testing with has any other pawns besides the one you want to be detected, maybe delete the others just to make it simpler

#

If it still does this, it kinda sounds like maybe your pawn class isn't actually extending your C++ class?

sour ice
#

damn, so thats what i was missing, i only gave the class to the AI and not the player pawn...

misty wharf
#

heh

#

Yep that would do it

sour ice
#

that was as dumb of a solution as i thought it would be

#

but thank you very much for the help

#

it only took many many hours and 80 gigs of debug symbols to realize im just an idiot

misty wharf
#

haha

#

well at least you have the debug stuff set up now

sour ice
#

thank you for recommending

sour ice
#

i also did the GetActorEyesViewPoint override so that the AI's vision follows the head location and rotation

#

and the plan is to use hearing sense to get the AI to look in a direction and notice the player (or another AI)

sour ice
#
UAISense_Sight::EVisibilityResult ACLM_Character::CanBeSeenFrom(const FCanBeSeenFromContext& Context, FVector& OutSeenLocation, int32& OutNumberOfLoSChecksPerformed, int32& OutNumberOfAsyncLosCheckRequested, float& OutSightStrength, int32* UserData, const FOnPendingVisibilityQueryProcessedDelegate* Delegate)
{
    FHitResult HitResult;
    FVector SightTargetLocations[3] = {
        GetMesh()->GetSocketLocation("head"),
        GetMesh()->GetSocketLocation("pelvis"),
        GetMesh()->GetSocketLocation("root")
    };

    for (int i = 0; i < 3; ++i)
    {
        if (!GetWorld()->LineTraceSingleByChannel(HitResult, Context.ObserverLocation, SightTargetLocations[i], GET_AI_CONFIG_VAR(DefaultSightCollisionChannel), FCollisionQueryParams(FName(TEXT("TestPawnLineOfSight" + i)), false, Context.IgnoreActor)))
        {
            OutSeenLocation = SightTargetLocations[i];
            OutSightStrength = 1;
            return UAISense_Sight::EVisibilityResult::Visible;
        }
    }

    OutSightStrength = 0;
    return UAISense_Sight::EVisibilityResult::NotVisible;
}
#

this is what i ended with

#

i could trace hands and feet but im kinda worried about performance and it doesnt feel necessary

#

as long as each major portion of the body can be visible to AI

sour ice
#

maybe something to add to this could be utilizing sight strength? im not sure exactly how it works or how to use it yet but i imagine if the players feet were the only thing visible, its less likely for the AI to notice them, but still possible

misty wharf
#

Yeah I don't think the strength is used internally for anything so it's up to how you want to implement it

#

btw you can use this GET_AI_CONFIG_VAR(DefaultSightCollisionChannel);

sour ice
#

yeah if i think of a reason in the future then ill come back to this and add scores per bone

misty wharf
#

it returns the sight collision channel configured in project settings

#

so you don't need to hardcode the channel

sour ice
#

works 👍 thanks

proven flint
#

Hi! I'm testing statetree again and i kinda don't understand what those logs mean:

LogStateTree: Error: BP_LostSoulController_C_0: FStateTreeExecutionContext::SelectStateInternal: Reached max execution depth when trying to select state Print from 'Reset Look at point:Succeeded'.  'BP_LostSoulController_C_0' using StateTree 'StateTree /Game/DesignData/AI/LostSoul/StateTreeData/ST_LostSoul.ST_LostSoul'.
LogStateTree: Error: BP_LostSoulController_C_0: FStateTreeExecutionContext::SelectStateInternal: Reached max execution depth when trying to select state Await Results from 'Reset Look at point:Succeeded'.  'BP_LostSoulController_C_0' using StateTree 'StateTree /Game/DesignData/AI/LostSoul/StateTreeData/ST_LostSoul.ST_LostSoul'.
LogStateTree: Error: BP_LostSoulController_C_0: FStateTreeExecutionContext::SelectStateInternal: Reached max execution depth when trying to select state Get Random Location To Patrol from 'Reset Look at point:Succeeded'.  'BP_LostSoulController_C_0' using StateTree 'StateTree /Game/DesignData/AI/LostSoul/StateTreeData/ST_LostSoul.ST_LostSoul'.

What is an execution depth? How do I avoid reaching the max?

#

Is it that i have a big hierarchy of leaves? I like to group stuff and make lots of nested States....but i thought it was allowed

wise sluice
#

Hey @proven flint

#

Effectively, you can only have a depth of 8 (including Root I guess)

#

Which means you have 8 states that got executed in parallel

#

Try to increase the amount if you want or be sure to have less than 8

visual salmon
#

Hi i am currently working on a couch coop local multi game .. i have 2 player character and i work on the ai.. I noticed, that the ai only sensing one of my caracter.. i looked in the behaivour three and noticed that the Focus node uses get player character 0 .. but i cant figure out how to use both 0 and 1 for the ai to sense both ..

Heres a screenshot how i use the focus node.. i already tried to add a sequence and duplicate so on the first run it uses get player character 0 and tha 1 but it doesnt really worrk ..

i wonder if anybody has any experience working with 2 sensable player character? how can io make the ai to be able to notice both..

the funny thing that the ai turn and shoot to player character 0 .. and it also shoots to player character 1 but it doesnt turn after it..

heres a screenshot from the behavior tree i am using its quite simple since i am really new to all of this..

uneven cloud
visual salmon
harsh storm
#

No. Pawn Sensing is deprecated. Use Perception.

visual salmon
#

so far i am using on perception updated event like this .. the sequence is what i added for player character 0 and for 1 but it doesnt go in to 1

#

on begin play i cast to both player character 0 and 1

#

ok after a quick google search it seems way complicated but thank you for all the help hoope soon i will figure out.. cD

lyric flint
#

@uneven cloud You mentioned in one of your posts in #gameplay-ai that you run a commandlet to build nav data. I was trawling through ResavePackagesCommandlet.h and noticed they have a bShouldBuildNavigationData flag. I was curious if you had tried this before rolling your own and, if that was the case, if there are headaches with using it?

uneven cloud
uneven cloud
#

Also it was when I was using 4 and world composition. Designers would often build navigation in a sublevel and just break everything.

lyric flint
#

Makes sense, thanks!

uneven cloud
#

You're welcome!

visual salmon
#

ok now on target perrception updated event i added these nodes so it should save the object reference as a blackboard value.. but how can i call this in the behaviour three .. i think i should use this reference in focus instead of the get player character am i right?

#

ok if i put it like this its work .. but i dont think its the right way to do xD

lyric flint
#

Have you looked at using EQS in your behaviour tree to get all perceived actors? Then you don't need to do anything on the controller. You just need to:

  1. Make a behaviour tree
  2. Call an EQS query
  3. In that EQS query, add the generator for Get Perceived Actors (or whatever it's called)
#

You can also call the Set Focus service in your behaviour tree once you've chosen a target.

#

Oops, sorry, you have a BT above. Just put Run EQS in your BT and follow steps 2 + 3.

upbeat hamlet
#

I'm playing around with getting my drone AI to hide. EQS is correctly finding a spot on the other side of the wall, but it's always getting stuck moving around the wall somehow. Eventually it will abort the MoveTo task and try again, and then it works. But it takes too long. How can I improve this?

visual salmon
lyric flint
uneven cloud
uneven cloud
cyan sigil
#

Hi! I am getting used to AI after doing pure gameplay for a while. All the tutorials I have found so far say to "Set Focus" on the AI if I want a character to turn. But I have behavior where I want them to turn more slowly or stop at certain points. Can I manipulat the AI's focus behavior? Some other option?

#

A good example is getting close to the player, using an ability (already set up) and having the rotation speed be slower at teh beginning of the ability and then not at all in the middle.

mild bobcat
#

Doing a Line Trace from within a Decorator to detect Line of Sight; does Ignore Self apply to the Pawn it's controlling? Or should I have it as a Pawn function?
edit: nvm, I see there's already a "line of sight to" blueprint

mild bobcat
idle kayak
#

Is there a way to get an ai to clear focus midway through an attack animation?

uneven cloud
uneven cloud
lost ferry
atomic minnow
#

Is it possible to "unregister" a damage stimulation like sight or hearing?

#

I can unregister a StimuliSource after a pawn died . But before it died, it did damage to the enemy, the enemy still perceive the pawn after stimulisource unregistration because the Sense_damage exist

wise sluice
dense owl
#

Iirc you need to turn on can forget actors or something along those lines

wise sluice
#

Ahhh this is the only one available in blueprint

#

Either you modify the perception component in c++ (or inherit from it to add this feature)

Or you can maybe set a max age to a low value for the damage (this will maybe cause issue later if you need to remember a damage stimulus for a long time)

proven flint
wise sluice
#
  1. They are all runing in parallel (possibly ticking if you have a ticking node)
civic canyon
#

Hi! Working with smart objects right now for my AI, and I need to move the object in runtime. However, when i do that, the smart object slot stays behind. it doesn't want to move with the object.

Is there a way to fix this. I know someone suggested turning off and on the smart object slot, but I'm not sure if that's possible to do in runtime

#

I seem to remember one of the examples of smart object usecases was a car with seats

wise sluice
civic canyon
#

Oh so they won't move until the next version of unreal eh... darn

proven flint
wise sluice
#

For instance for a car, you spawn the car so the smart Object is available at the car position
It won't follow the car so maybe have an extra actor that you spawn/despawn could do the trick ? 🤔

#

Nevermind, it will lose slot info if you do that

#

Yeah so i don't get the official unreal example... it sounds odd to have it if the SO are not able to move in their current state

civic canyon
#

Hmmmm. I mean, when i think about it, the main thing i need from the smart object for this particular usecase is the claiming part and the behavior part.
Cause I can just use normal AI navigation to get to the object that the smart object is attatched to.

For context, my idea was to have a smart object on casino cheater npc's for my game, so that my casino staff can find them and more easily interact with them without multiple staff going to the same person. So in theory, i can just claim the smart object, then use an AI move to function followed by a "use smart object" once they arrive

storm jacinth
#

Hi guys, quick question, My Ai can detect client or server stimulus, then i set an Attack target key in the BB get the actor that trigger the stimulus, but on AI moveto, If I pass the key, the AI doesn't move to the "Attack Target Actor", If I put "get player character it work fine but it only move to the server has the player index is 0. Anyone has an idea about what i'm doing wrong ? thx

wise sluice
proven flint
# wise sluice Not sure about that :/

Okay, so if I'm In state B1, when i want to traverse to B3, does this mean that Execution Depth is 6? (Root->A->B->B1->B2->B3)? Or 3? (Root->B->B3)? Or a different number?

wise sluice
#

1st step is find a state to select

#

Your tree tries to enter each state by evaluating their enter condition. Until it finds a State "Leaf" that has a valid enter condition.
For instance : Root > A ( ❎ ) - B ( ✅ ) > B1 ( ❎ ) - B2 ( ✅ )

#

2nd step :
We now execute the hierarchy that is valid
So Root + B + B2. Which means Enter in each state sequentially.

proven flint
#

Ohhh okay, so why is my execution depth too big here? The logs point that I reach max when Selecting this state (Print) After finishing "Reset Look at point"

Bonus Question : I don't finish latent tasks that aren't in leaf states of the tree, because i think when they finish, they try to trigger the transitions anyway, even if there's none, and break the flow, am i right?

wise sluice
#

Yeah that's strange you're at depth 5 maybe there is recursive call at one point that consider it deeper or something else.

#

Not sure i understood your bonus question

#

The only way to know is debug in c++ (for the first question about depth)

civic canyon
wise sluice
#

In both case, this is the AI that moves to the SmartObject

#

not the smartObject

#

If your NPC is not moving from its position, you don't even need to move the smart object

#

But for a car, the smart object should move with it, so yeah it's different

spring inlet
#

smart objects can't move (as of 5.3)

wise sluice
#

Yeah

#

I said it a bit earlier

civic canyon
#

Well, the smart object is going to be an npc that roams around.
The car was just an example I saw that made me initially assume that they could move.

Just trying to figure out some workarounds to this limitation

spring inlet
#

the best workaround is to wait for 5.4

wise sluice
#

Or we didn't wait for it :p
Firstly, we did our own implementation, that was quick
Then we saw that Epic did it so we fix our implementation

spring inlet
#

so the main changes merge fine in 5.3? (haven't tried yet as it's not high priority for me)

wise sluice
#

Not sure, we didn't merge it, we just fixed an issue with our code base
But it is essentially the same

#

I guess it should merge fine

#

Apart from that.

Anyone knows why we don't have a UEnvQueryItemType_Location in the unreal code base 😦 ?

#

There is UEnvQueryItemType_Point which is a navpoint and UEnvQueryItemType_Direction which considers the vector as a rotation

#

Maybe Point is enough for most project
But here, i got several navigation system so I need vector. Anyway, i'll implement it.

upbeat hamlet
wise sluice
#

Check your NavmeshBoundsVolume bounds ?
It looks like your world is so big that you didn't made your volume wide enough (considering the size of the gizmos)

upbeat hamlet
#

the navmesh covers all this space

#

I'm talking about this screenshot further up:

#

Why does it generate the tiny green path for the drone and make it get stuck?

wise sluice
#

The navigation mesh is definitely odd there

#

It should cover all the ground

upbeat hamlet
#

it does cover the whole area

wise sluice
#

Ahhh you just debug the path in the screen?

upbeat hamlet
#

yea

#

here's the triangle preview

#

trying to understand why it doesn't use the big tiles around the wall, but just the tiny ones

wise sluice
#

What is your agent radius?

upbeat hamlet
#

what's that?

wise sluice
#

The radius needed to compute a path for your agent
It restricts how your agent can navigate on the navmesh.
For instance if a corridor is too narrow.
And i'm suspecting your agent radius is so tiny that it goes through narrow nav meshes

upbeat hamlet
#

is it this nav agent radius setting here in my character bp?

#

nah, that alone doesn't seem to do it. I increased it, but the path is still the same width around that corner

upbeat hamlet
#

I increased Agent Radius on the RecastNavMesh, now it looks better. It was 35, but I won't have agents that small.

unkempt glen
#

hi everyone i've created a game with multiple playable character..when i switch character the AI controller still running the character conflicting with player controller..the way i did it is first to store all the controller in the game mode on begin play..then unposses all contoller on all character..then posses back all the character..the thing is when i posses character B or C or D their AI controller still running the function..tried a few thing like stop logic on brain component and stop using behaviour tree and using blueprint instead to drive the ai controller but i think the problem lies with ai controller not unpossesing the character..any advice?

misty wharf
upbeat hamlet
fathom sun
#

Hello, is it possible to get sense's config out of it? I'm in a sense method, and I need to get own config, but I don't have any reference to the owning AI perception component. Obviously C++

foggy lynx
#

Hey guys, what's the easiest way to check if an actor is on/inside the generated navmesh (in Blueprints)?

silent hamlet
autumn sluice
#

Hey all. I need to have my AI perform certain constant tasks while specific States are active in State Tree. An example would be needing my AI to face his combat target in State A, but needing him to face a friendly target during State B. While a state is active I just add the task I need it to perform and bind a target. This results in movement or rotation logic being executed on tick inside of the State Task. The workflow works well and is easy to use, but is this the best place to put this sort of tick data? I don't want to bog down the State Tree. I could offload this to a companion component I have, but I'm not sure if this makes any difference in terms of frame or tree performance. The comment for StateTreeTask tick seems to suggest that I might not want to put this data inside the task itself.

misty wharf
#

It doesn't seem like it would make any difference 🤔

#

Mostly just a question of how you want to organize the logic

autumn sluice
#

I think I prefer the task taking care of the logic itself. I feel like that's exactly what tasks are for.

echo locust
#

Hi,

I'm having an issue where my On Target Perception Updated event in my AI Controller is rapid firing true and false.

The situation occurs if my player is behind the AI when the AI is turning toward the player or whenever I run out of the AI's peripheral vision (either by running right by them, or running to the side where the peripheral boundaries are).

If I disconnect the behavior tree I can start the level out behind the AI and when it is possessed by the controller it will turn and see me normally, but once I hook up the behavior tree as soon as the AI is possessed, the debug shows line of sight to me (even though I'm behind the AI and out of it's peripheral) and then the AI snaps a little toward the player losing sight (the debug shows the age reset) then it immediately picks me up again and so on until it faces towards me.

Thanks in advance for reading this!

Here is a YouTube video of the issue. It shows the level start where I am behind the AI (there is a countdown delay at which point the Run Behavior tree executes), and during a chase sequence if I manage to run by him or out of his peripheral.

https://www.youtube.com/watch?v=zgOOlsEdQzE

I'm running into issues with the AI Perception in UE4. When the behavior tree is ran the AI can sense my character behind him even though it's outside of the cone of vision. Also when I go outside of the cone of vision while close, the AI repeatedly loses and gains site of me as it turns. Any suggestions would be appreciated.

▶ Play video
uneven cloud
uneven cloud
uneven cloud
sleek grotto
#

I'm having some issues with some "basic" ai. I have an AIcontroller with a behavior tree that goes through the following sequence. Move to player (with a stop range), turn to face player, fire at player (if in range still). I have a line trace that starts at the ai characters mesh but every time it fires, it fires from the meshes original location, not from the current location. I can't figure out why. The movement and look to work only the line trace is messed up.

uneven cloud
uneven cloud
uneven cloud
sleek grotto
#

Was just trying to get the screenshot.

#

This should be it. This is inside of the bp_enemy blueprint (which is a Character class)

#

The first linetrace works, but after the character has moved and fires again, the line traces start and end at the original location the mesh was, not where it's moved to. Pretty sure I am doing something wrong but I've never done AI before so trying to figure it out.

fathom sun
sleek grotto
#

The behavior tree logic

uneven cloud
uneven cloud
sleek grotto
#

Which actor?

uneven cloud
sleek grotto
#

Wouldn't that be 'self'? I am in the enemy character bp. Self cant connect to forward vector.

#

Oh, 'Get Actor Forward Vector'

#

duh

uneven cloud
sleek grotto
#

The move to just uses AIMoveto

#

and the FacePlayer just does a RInterp to rotate it towards the player

uneven cloud
#

There are built in tasks that do that. How are you rotating it?

sleek grotto
#

I just noticed there's a 'move to' task already made, but I haven't figured out how to pass the players pawn into the behavior tree yet so all I have available is targetSelf

uneven cloud
#

You pass it in via the blackboard.

harsh storm
#

Should probably go through the AI course on the learning site

sleek grotto
#

This is the rotate to.

uneven cloud
#

I highly recommend doing the AI with Blueprints course on the learning library to learn about the basics of the AI systems

sleek grotto
harsh storm
#

That's why you watch and do

#

Then you recreate it

#

Then you make adjustments

sleek grotto
#

Except I've not found a single course that actually explains to you what things do, it just says 'put this here, connect this, do that'. Not helpful.

harsh storm
#

Have you done the AI with BP course?

upbeat hamlet
#

Any ideas why this setting on the RecastNavMesh is not saved? Whenever I restart it's back to 35, even tho it saves the RecastNavMesh when closing.

uneven cloud
#

The AI With blueprints course will explain the systems and how to use them.

harsh storm
upbeat hamlet
harsh storm
#

Have you tried deleting and making the navmesh again?

upbeat hamlet
harsh storm
#

My next piece of advice is to pray to Tim Sweeny

#

¯_(ツ)_/¯

upbeat hamlet
#

Thought I found a fix, and then it always resets it when reopening the project, what the heck 😦

#

Found a fix in Dev forums

#

You need to create a supported agent here

#

Then RecastNavmesh takes it from there, it works

harsh storm
#

That's what I said 😭

uneven cloud
upbeat hamlet
copper glacier
#

Does AI Perception only work with Characters?

I'm trying to get my AI to perceive buildings (which inherit from Actor not Character), and it is never triggered. If I reparent the buildings to character, then the AI properly sees them, but that leads to a lot of other issues since the buildings are not supposed to move.

I couldn't see anything in the perception settings about what type of objects it should perceive, should I not be using AI perception for this and instead just use a straight up collision query in a separate task?

misty wharf
#

Easiest way to do that is to add a stimuli source component to the actor you wish to register

copper glacier
#

that works perfectly

misty wharf
#

Keep in mind that each source will get a linetrace to it from the perceiving AI if it's within the radius and sight cone, so if you plan on having a lot of them it may have an impact on perception speed

unkempt glen
uneven cloud
unkempt glen
#

my behaviour tree function is stored on the ai controller so when i possesed the first character back after i switch to other character the behaviour tree is still running even though i try to stop logic and set the behaviour tree to none

uneven cloud
uneven cloud
unkempt glen
#

i try many things in between so i cant really point out what come after that its just one thing broke when i try to fix the other

uneven cloud
unkempt glen
#

earlier

mild bobcat
# sleek grotto Except I've not found a single course that actually explains to you what things ...

I"ve been a big fan of this guy Ali Elzoheiry's tutorials. I'm only one or two videos in, but the clarity with which he's explained how and why it all works has been very helpful for my behavior tree understanding, so far.

https://youtu.be/WFV5IewGks8?si=jJ1qhBxzgHwG09Wg

As far as what things do, you also have to take what they've given you and just play around with them. I've just been using Set Focus, but I'll probably use Rotate to Face BB Entry now that I noticed it...

In this Unreal Engine Game development Tutorial you will learn the following:

  • Patrolling: How to make an enemy AI patrol along a spline
  • States: How to switch between different states in behavior trees
  • Priority: How priority works in behaviour trees and how to abort low priority tasks for higher priority ones
  • Animation Montages: How to se...
▶ Play video
uneven cloud
uneven cloud
uneven cloud
unkempt glen
mild bobcat
#

Not that I'm super familiar with State Machines, but the premise of as behavior tree led me to think that the behavior should flow through the tree based on tree logic and not have a state dictating which branch to go down

fathom dome
#

Can anyone share any resources on AI path finding on moving platforms?

uneven cloud
mossy bison
#

Does anyone know if there is a way to put a limit on the pathing cost an AI can have? Basically I trying to dynamically make areas the players can stay in and be safe from the AI with Dynamic Obstacles. All the dynamic obstacles do is raise the cost. If there is no other way to get to the player the cost doesn't matter anymore and they just path directly to the player. I've been working on this one for hours and hours, but I can't find a solution. I'm trying to avoid physically blocking them.

uneven cloud
#

Or you can do what most games do (including the AAA game I'm working on) is to tether the AI to their spawn location. If they get too far away from their spawn location, retreat.

mossy bison
#

Basically I have a zombie survival game (think pitch black movie mechanic). I have hundreds of zombies and I'm trying to the player the ability to carve out safe spots.

uneven cloud
mossy bison
#

Think turn on a light source (in realtime) and they Nav is removed around the light.

mossy bison
#

I've used the static ones.

uneven cloud
#

You can do that with modifiers. You need to turn on runtime generation to modifiers only.

mossy bison
uneven cloud
#

When a modifier is added, removed, moved or area class changed, the navigation will rebuild just that area.

mild bobcat
# uneven cloud That's pretty much it. The main difference between a state machine and a BT is ...

I think I just can't quite parse the nuance yet; if, say, I want an AI to be stunned before becoming active again, even with a behavior tree I'd probably have a decorator checking or a blackboard boolean dictating whether it goes down the "stunned" branch. But I'm unclear on if I am avoiding "state machine" pitfalls, because aren't the series of checks and booleans I do a "state" in the abstract? I guess I'm wondering what the guiding light or dividing lines in principle of design are for a BT versus a state machine.

#

I guess a series of booleans offers more unique combinations and behaviors than coding the same number of explicit states

uneven cloud