#gameplay-ai
1 messages · Page 61 of 1
I didn't do that part, so I don't remember how it was determined.
count the lights the player can see and add their brightness together x_x 😄
I've always been curious how people have gone about it. But I also haven't worked on a stealth game, so haven't put too much effort towards it.
there are 4 lights.gif
It also checked distance to the light, if I remember correctly
Now, divide by a magic number and add another magic number. Don't comment it.
yeah i mean if you want to calculate light fall off as well as intensity
It was the graphics programmer who wanted to do it, so it wasn't as simple as I would have gone
its hard to not be tempted by crunch puzzles hehe
Turned out being really cool
im sure!
sometimes high work cost stuff is also pretty valuable
Weird thing to do for basically an in studio game jam, but he had fun with it.
oh thats different imo! O_O like those are totlaly the times to crunch on those sorts of problems
then when it comes up later in production you can be like "it was terrible" or "well i have a thing that does this..."
That studio would do 2 week game jams to generate ideas for future projects and to help with burnout
Sounds fun honestly
last studio had "do stuff" kind of jams.. lots of folks did games, but like i would do things not in my job, usually go do art, etc
It was good and bad
usually around winter holiday since lots of people were out anyway around that time
it was nice doing like sculpting or blender or something tho
People could pick their roles, so you could do things outside your job title
I guess it depends on the person.
The last one I did the team's designer wouldn't do anything
thats why our jams didnt rely on teams i think, like you could go off and just paint, or just make whatever on your own
lots of table top game designs popped out too
He'd sit there all day playing video games, so we were blocked on him all the time.
This was structured. Anyone could pitch a game, a handful were chosen, and the teams formed by leadership.
nodnod i guess if it was to plan new projects it would be
To be fair we did get to prioritize the projects we wanted to work on, but leadership had the final say.
What's even worse was that our project lead did nothing about that designer. It was a stealth puzzle game and I'd made a bunch of systems on the first day, but he never made a puzzle or tried out the systems. It was the first time I made a smart object system, so I did learn some things.
i dunno if i'd enjoy that as much as just jammin on whatever heh, it was a nice break to just not do my focus you know? heh
Yeah, that's why I said it was good and bad.
nodnod
I'd feel tired enough doing my day job not sure how people can just do game jams on top of the stuff they have to get done
game jams in studio are during normal hours typically
so you arent doing it on top of your normal work
Doroxinger my godfather how you
hello please how do i make my ai face where it is going to while shooting ...
because mine just faces the enemy does not straf atall
but it moves
Hello. I'm struggling how the decorators work in BT.
What I want (can be seen in the image), is for the decorator to always check the distance between NPC and Target.
If the distance between NPC and target is below < 5000, run the second Sequence, else run the ChaseEnemy task.
Atm, the decorator is closing the root selector and jumps to the second selector (GetLastKnownLocation)
It's possible to check inside the decorator the distance between my NPC and target?
move the decorator to the chase enemy task
the decorator failing will exit that branch of the selector, which then will try to look for another branch to activate
Indeed. This solves my problem 🙏
Thank you
Hey, I just started using EQS recently.
I have multiple NPCs running the same query, and often times they'll choose the same "winning spot" when chasing the player.
Any way to get spots "reserved," or otherwise mitigate the problem? As of now, they're basically fighting each other to get to the same spot.
Im following the smart object quick start guide... but this "claim node "never appears when I drag off of the subsystem node
Any ideas?
I've tried the other claim nodes and they are different than this one
Different how? It's possible the docs are outdated since they are updating the SO stuff
Different as in it doesn't match up at all with the docs. Different inputs expecting different data types that don't match up with the docs. The outputs were different as well.
I figured it out
I had to split the node and use "Mark smart object slot as claimed". I think this is correct. I'm on the latest version of UE.
I didn't have to reference the subobject system for this node either. I think that's handled internally now?
My guess is turn on controller rotation
yes surely
am also curious which delegate i should bind to when i want to be notified immiedietly out of radius and come in radius again
because i am testing and when i come into radius everything goes fine but when i go back out and come back in ai dosent start fireing me
jsut stays dormant
thats the deleagte am currently bounded to
This is an animation thing
your animation bp needs to support strafing movement and the character has to be configured to do so.. def out of scope of AI tho
Yes thanks a lot ur great
how do i set the" forget stale actors" variable in ai perception component since it is private
and am not seeing mutator function
int the class
Its in project settings
lol 😂 why is it there?
¯_(ツ)_/¯
Are you setting the focus to override the movement focus?
How I solve this is to make a context to get the ally move to locations and add a distance test (item to context) with a filter of 50uu.
So people can change it without changing engine source.
honestly ultimately in a bigger game you probably want to define the target lost behavior anyway, which i guess is why its off by default
granted i would kind of expect that option on the perception component
Truth I was in the source searching like bat man
Can smart objects not be objects that are moving?
They can be moved as of 5.4 I think but not sure if they can actively be moving
It was always (I think) possible to create and destroy them at runtime, at least that's what I always did and it worked
The reason I ask is I have a bunch of items that spawn midair that I want my AI to interact with once it reaches the ground but it looks like the smart object box thing isn't traveling with those items as it reaches the ground?
oh I think I might see what to do I need to update its interaction point, maybe? Not sure if thats even a thing haha
Not sure how it updates itself, if this is physics based it's possible it doesn't know how to deal with that. Iirc SO's are assigned into a space partition for fast lookup, maybe try using SetActorLocation to move them and see if that makes the SO update
If this is a problem you could create your own "smart items" thing I guess - you can use Gameplay Behaviors reasonably easily'ish with some custom system where each item has a behavior assigned to it and the using actor just runs it
Tried it and it didn't work 😦 guess Ill go back to my dumb object system
At least in C++ you can trigger gameplay behaviors for non-smartobject purposes so you can utilize a similar "framework" for it too. I use them currently for my NPC task system since it gives me an easy way to run BP graphs that determine how the NPC needs to behave when working on a particular thing
btw you were asking the other day about the claim node being different - I was looking into it as I'm working on SO stuff today, and I think the reason it's changed is the system now differentiates between claimed and occupied. Claimed is when an actor is saying "I'm going to use this slot" and Occupied is when the actor is actually in the slot interacting with it. The system didn't use to allow querying for claimed slots, so it looks like you can do that now, but it won't let you query for occupied ones now.
I don't know why they keep having these weird limitations to it, I can think of usecases where occupied slots might need to be queried
Is it possible to have dynamic ai pathfinding?
I believe unreal ai agents navmesh have to be pre baked?
With focus on procedural generated maps I thought it would be a feature
I think you can set your navmesh generation to dynamic in the project settings
I'm trying to have my pawns be able to find objects as they spawn in the world at runtime but I'm having some trouble getting it to work. I thought that would solve it but I think I'm missing a few things.
Does anyone know how to do AI locker search with behavior trees?
What is an AI locker?
AI search through a locker or hiding space in horror games mostly
What is the actual behavior that you want?
The ai to open the locker and deal damage to the player
You could use smart objects for the AI to open the locker and have some follow up logic to damage the player if they're present or not. It's pretty easy to implement.
This guide shows how to create and use Smart Objects with an AI Agent.
is it possible to make a vehicle ai using blueprints only? i have a tank blueprint which can aim to specific direction and can be driven using moveForward and moveRight axis variables
i wanted to make it navigate a map, doing objectives, fighting enemy tanks and so on
Hello, does anyone know how to fix my AI switching tasks before finishes an animation which causes it to slide
Could someone please explain what's wrong with my Blackboard decorator?
I'm trying to catch when the "Interlocutor" BB object gets NULL and I wanna abort other nodes to re-evaluate the tree, but it doesn't trigger
You can see that 'Interlocutor' gets None approximately at the 2nd second of the video, but the tree doesn't jump to the "Just stopped communicating" decorator, what am I doing wrong?
That right branch would need to abort entirely for the tree to re-evaluate from the top
Hi guys! I'm using Simple Move to Location. Something ingame happens and I need to stop movement and make the character immediately face somewhere.
I'm using Set Actor Rotation but the character's rotation rate is "still active that frame" and so the character doesn't face the exact place, but an interpolated direction.
Any suggestions?
Shouldn’t node 8 abort everything else with higher node number? Including everything in the right branch
In my understanding observer is some sort of delegate which fires on result change and aborts any lower priority nodes, is it wrong?
Does it highlight the other nodes when you click on it? My mental model says it shouldn’t abort anything that would have required it to go up the tree
Just right or down
The decorator that matters is the one you’re not actually even looking at
You keep clicking on the just stopped communicating one
That left decorator can only abort once it’s been evaluated
Is the task triggering the animation waiting for it to end?
What you are doing wrong is trying to force the BT to arbitrarily jump to different branches like that. A BT might not be the right choice.
You can use the visual logger to debug what is happening.
Why are you using set actor location to set the rotation?
Oops, typo
Does that mean you are calling set actor rotation? Are you cancelling the move to? What do you mean by the "character's rotation rate is still active that frame?"
I'm trying to get a clear understanding of timing in the BT
If a Blackboard decorator is set to observe some change and abort lower priority, it's not correct to expect it to fire as soon as the requirement is met is it? What could stop it from doing this?
Using the visual logger to debug will tell you what is stopping it.
Okay, I'll try to tinker with this
Yeah, I'm using set actor rotation! Before that I've already called stop movement. It sets the rotation to the desired one, but then on character movement component's next tick, it still has acceleration and overrides that rotation with one based on character rotation rate cause I have orient rotation to movement on.
I'm working around it by setting orient rotation to movement on/off, but it's a bit clunky.
Anybody using StateTree know what the Category "Parameter" is for?
Solved. It's the default for if you don't specify Input, Output, or Context. In short, don't worry about it.
I recommend using control rotation instead of orient rotation to movement for AI.
is there any possible way i can implement formation ai to pawns without c++ or purchasing something on the marketplace?
Hi everyone! Is there a way to set the RNG seed for EQS (environment queries)?
Just wondering, is it possible to use AI perception with Statetree or is there any other node in blueprint to use within statetree to achieve the same thing? If so how do I do it?
What's the problem with that? Perception can be used in pretty much any way you want
Having trouble at first, but managed to find a solution now. Thanks for the info btw
👍
I'm a bit confused by how Composite decorator aborts nodes. If I combine two Blackboard decorators using AND and want it to abort only when both conditions are met, is it enough to set up "Observer aborts" only in the first Bb decorator?
when I test it, it seems to discard any settings I make in the second one
Regarding my yesterday's problem, it seems for such observer abortion "checkpoints" it's better to have a clean chain of checks. Either a sequence where everything guarantees to to success, or selector with each node 100% failing, sorted in priority ascending order
My previous setup was a little messy
Hi, so I spawned multiple zombie and once the state of one zombie changes the state of all the other zombie changes as well, does anyone have any asnwer
Yes. Formation navigation typically has a leader and the rest of the group finds a location based on an offset from that leader.
You would need to write your own observer aborts functionality.
Not enough information on how you set things up.
That sounds incredibly hacky
Don't worry I got it working, the "synced up" wasn't set to false in blackboard
does eqs work with dynamice nav mesh?
Of course. EQS works without a navmesh as well
State Tree question.
I am trying to write a simple C++ task (STT_SetValue) which would set a desired float value to a selected float property.
I jave a value to set property like this:
UPROPERTY(EditAnywhere, Category = "Parameter")
float ValueToSet = 0.0f;
And it even allows me to bind this property's value to any float variable of my Conext(Actor) class.
However it reads from that property and I need to write to that property
I found a new class FStateTreePropertyRef and defined the reference like this
UPROPERTY(EditAnywhere, Category = "Parameter", meta = (RefType = "float"))
FStateTreePropertyRef FloatVariableRef;
However when I click to bind that property nothing happens.
This should help https://zomgmoz.tv/unreal/State-Tree/StateTree-InstanceData
I saw this - it allows to write data into InstanceData of the Task, but I want to reference to arbitrary property of the Conext object (AIController in my case) and write to that property from the Task.
I thought FStateTreePropertyRef is exactly for this purpose, but it does not seem to work.
Ah 🤔
Never tried that so not sure if that's even possible to do
Looking at it it does seem like FStateTreePropertyRef would be for a purpose similar to that... but I've had some issues with nested props even for reading where the ST editor won't let you bind into them correctly
One workaround is to make a task which sets the value in the actor you want. You can bind the value from the other task's output into an input on that one
Yes, it's possible. I just wanted to make a single reusable Task class, that could set different values in Context object.
It's kinda weird that you can easily bind and read different properties in evaluators (and you don't need to write a custom evaluator for that)
but you can't write that easily.
I'm guessing it wasn't intended for you to write stuff out of them
Or if it was maybe there's some way with the property ref but like every other slightly more advanced usecase it's up to you to figure it out :P
My nav mesh isnt generating anymore and i have no idea why
i don tthink i changed anything
~~I'm trying to back up from state machine-ish form of my tree but don't know how to properly interrupt actions
It's pretty clear how to instantly enter "retreat" sequence when an Enemy BB value gets set, but unclear how to setup as instant check for leaving that state when the Enemy becomes None
Same problem with "communicate" sequence, I need to instantly reevaluate the tree when Interlocutor gets None
Here I tried to rework the tree using conditional loops and more goal-oriented structure, but there's no instant backup when the BB value gets None. Or this still looks like wrong thinking?~~
oh damn, it seems to work when I abort both instead of lower priority only
Start by actually connecting your BT and seeing what happens at runtime.
every which way i connect it nothing happens. I tried a sequence and a selector to connect both and they dont move
and i tried moving Is On Fire to the left side
because of order of execution and what not
it only functions with the root straight to the Sequence with the service
Sorry, i should have provided that context
You can actually hit alt+P while viewing the tree to make the game run and see the nodes fire. You can also pause and go node by node
There’s also the gameplay debugger that’ll show you the BB keys in use and whether they are Set or not
alt P thing is so useful thanks
Been working on complex Nav Area Modifier shapes that work at runtime (shapes on the left are with actual PCG nodes)
In the above screenshot the following is happening:
- Use StaticMesh simple collision
- Use each StaticMeshInstance simple collision
- Use spline points as polygon shape
- Use spline as path with width shape
- Use PCG Static Mesh Spawner output with respective StaticMesh simple collision
- Use PCG points as polygon shape
hi there! What are the reasons why a behavior tree is "inactive"?
You didn't start it or it was ran in single run mode and it finished
Anyone else having issues with AI Perception?
Works fine with 1 AI in the level, but the moment I add 2 AI everything seems to break down...
The AI seemingly randomly sense the player again, but then lost is just as quickly. I have no clue what the issue is here..
The MoveTo task in my Behavior Tree is failing constantly.
-The actor is a Pawn with no movement component
-There is a NavMesh
-Both the Pawn and the target Actor are within the NavMesh
-The Behavior Tree is running and only fails on the MoveTo task
-The target Actor is valid
What am I doing wrong?** I need to fully debug the PathFinding**, sometimes works, sometimes is incomplete, maybe is a basic logic that I am droing wrong? maybe is my for each loop?
did you check visual logger, ai perception debug visuals, etc? my bet is that there's some bad logic in how your ai track targets rather than the perception system itself
AI Debugger just won't show for me for some reason, but I figured it out.
The perception was being triggered by the other AI, so I gave them an AI tag and made them trigger 0 logic.
Further in the code it had a "lose sight buffer" so to speak which the detected AI triggered which made the AI lose track of the player after 2 seconds
After creating a character and having it use the same AIC it works as expected.
What would I need to do to have a pawn move properly?
Just figured it out, turns out that I needed to use DefaultPawn instead of Pawn since it has a movement component
You don't have a movement component, so it can't move.
Yeah, figured that out and that's why I swapped to the DefaultPawn `which has one lol
There are already tools that debug the pathfinding. Gameplay debugger and visual logger. Why do you need another one?
I need it to trigger the materials of the grid slots, thanks I willgive a check
if your default pawn has a movement component, something is very wrong
oh, nevermind. I guess "DefaultPawn" is a specific thing
hey guys, I have a custom C++ ACharacter, from which i derive. I'm currently adding the AIPerceptionStimuliSource directly via blueprint. But the AI won't perceive it, but if I create a new Character BP and inherit from ACharacter directly it works fine. What could be the issue? My custom Character does not have any speacial things i can think of, that would change this.
how are you adding the stimuli source on your custom character?
Fwiw, if you don't want the AI's to see each other, I'd recommend turning off pawn auto registration for sight. If you have lot of AIs and they are trying to perceive each other, this can have a noticeable impact on perception speed as it does a lot of linetraces which get timesliced. https://zomgmoz.tv/unreal/AI-Perception/AISense-Sight#turning-off-pawn-autoregistration
(a similar but more flexible result can be achieved by using IGenericTeamAgentInterface but it sounds like you're not using C++)
Interesting, I'll check it out. Thanks!
any one?
EQS works without any navigation whatsoever
If you are using one of the features of it that project points to navigation, yes, those do work with a dynamic navmesh as well
Has anyone encountered issues with AIPerception debug lines not showing? I activated the debug in play, but the lines for sight vision is not displayed.
#gameplay-ai message I replied to you way back then.
GodFather sorry i missedd it ....discord dint alert me
i have done it works fine now thanks
if the ai isnt on screen when you open the visual debugger i am pretty sure it wont activate for that ai, just look at them and reactivate the display
so i'm trying to find something in crowd following component that returns true/false if an NPC currently has an active MoveTo task. And I stumbled upon this. Is this even legal - just return true no matter what?
can you gain performance by handling ai behavior yourself instead of using a behavior tree?
I want to have like upwards of like 100 enemies, but when I spawn in about 50 some of them just don't move or anything and the ones that do start moving slow
and I have a feeling it has an issue with the behavior tree ticking or something, but idk. I don't lose any fps performance, just the ai itself having performance issues.
use Unreal Insights and actually find out what's up and stop guessing
BT's can have an impact on performance, but it depends 100% on what you're doing in them
There are various ways of optimizing it as well, such as using C++ to write custom nodes instead of BP's
However without using tools like Insights, you're just poking in the dark and it's going to be difficult to fix any issues
ok I will look into trying that to see what could be wrong, but all my ai does is move to the character, if it gets there it attacks.
so that's where I figured performance was taking a hit, constantly getting the player's position and updating their destination location or whatever, but I will have a look at insights
Is it choosing where to go for that via perception?
ime in shipped games, perf cost of enemy units is often in the assets
I see, yeah was just guessing since perception can impact the speed of reactions if you have a lot
animating 100 dudes is gonna be a bad time
I looked into Mass, but didn't rly get it, and was attempting to do Niagara with static meshes and someone said in general it's bad and just meant for like birds and stuff
so then I just swapped back to a BT
Hi everyone, not sure exactly which channel to post this but I have a simple "chase the player" AI powered by Blueprint/BT, and C++ controlling everything else, I'm trying to apply an impulse to an actor hit by one of my projectiles, but I noticed for my AI it only gets knocked back if it's idle, if it's moving at all the impulse does not affect it.
I am moving the AI in BP using "AI MoveTo"
fwiw mass can easily do this stuff
It's more likely the movement component than the BT. BTs are actually very performant, depending of course on what you are doing. Far more performant than someone without perf experience scripting AI.
However, you need to profile with insights instead of guessing.
If you're using BTs, then why are you using AI move to in BP?
I recommend cancelling the move before applying reactions. Preferably locking logic until the reaction is complete.
I followed a tutorial for setting up BT and it used BP for the tasks?
I will try to stop the movement from the AI controller before applying impulse
There's a built-in move to task that you lose a lot of functionality if you make your own. Especially aborting the task.
AI tutorials are very bad. It's highly recommended to do the intro to AI with Blueprints course on the learning library. It's pinned in this channel
I'll see if I can use the built in MoveTo method, thank you
I'll go through the course at some point, but skipping forward to navigating the mesh it looks like they are making the exact same kind of custom event I have except using Simple Move To Location
The above is the one from the course
Except I use a wait event outside my random move instead of putting a timer inside it
behavior trees have a built in move to
which is what luthage is probably referring to
from epics's docs
I'm working on implementing the built in one now rather than the custom one I have, hopefully that helps
Okay so I updated to use built in Move To for chasing, and also in my C++ where I'm launching the actor I got the controller and called StopMovement() and now I am able to always knock back 🙂
Only issue I ran into using the built in Move To is I can't reset the HasLineOfSight variable if the Move To fails, but in a custom task I can easily branch off the failure. This means if I jump onto a platform the enemy can't path to they just stand there (or push against the bottom of the platform depending on setting), where before I had it reset the variable and they would return to roaming.
ie idk if there's a way to do this with the built in move to
abort the branch the move to is in if line of sight fails and do a different branch
honestly its all in that example above heh
def familiarize yourself with how behavior trees work as this can be solved with how your design your behavior tree
#gameplay-ai message how all new people try to do behaviour trees
😦
insteadof how they are meant to be used
Watch the pinned video on BTs so you avoid doing these counterintuitive designs
unless you're this guy https://www.youtube.com/watch?v=X5NxmiZcnOI&t=77s
Quick update on my Niagara GPU Compute Zombie game. All bullets, enemy, AI, collision detection and response occurs in a single persistent Niagara Compute shader. I decided to go with Synty assets which are awesome. Also started to utilize a "height map cache" inside compute to help with map collision.
well there are options to do it just fine tbh, clearly 😛
what im saying is that understanding the performance metrics of your game and optimizing those hot paths is really the way to do it
but also that BTs are usually not the thing that costs
There was a vid on twitter recently where someone got like a million skeletal meshes with IK working in UE smoothly
Inverse kinematics (IK) for 16 million animated units on the GPU. I raise the terrain with the mouse for more IK. #rendering
There it was - the guy doing this used to hang out on #cpp , maybe he still does but don't recall seeing him much
Always had really really obscure questions about changing something because he's doing crazy stuff like this lol
The lad is mad, for sure 😅
I'm a bit confused as to how to get the AI to aim similar to a player.
At the moment, i'm using interp to gradually rotate (pitch and yaw) towards the player. However, there is this code in the AIController, which seems extremely restrictive and is stopping the AI from being able to aim downhill:
// Don't pitch view unless looking at another pawn
if (NewControlRotation.Pitch != 0 && Cast<APawn>(GetFocusActor()) == nullptr)
{
NewControlRotation.Pitch = 0.f;
}
I've tried setting the player as the target, but the AI instantly rotates, which is not good enough. How are you meant to implement this without modifying the engine?
Unfortunately, thats not the case. Currently, it shows everything else except for the "tracing lines" of the vision range etc.
morning peeps, interesting issue I haven't seen before. I have a spawn point (actor that just spawn an ai) that is generated (not placed) in my level when a trigger occurs (a door opening). So it goes trigger >> Actor spawns >> AI spawns from actor. They all spawn without issue. But the AI doesn't update its rotation to 'face me' when it starts moving. It just shuffles sideways or runs backwards while maintaining the rotation it was spawned in. But if I spawn the AI separately, they update their rotation just fine so it isn't the ai but rather something is getting lost in translation between when the Actor is spawned and it spawns the AI. Any suggestions?
Are you setting the focus actor when you spawn when you spawn it from the trigger?
not seeing a node that would do that... what is it called?
simply typing in focus doesn't yield anything
it was, the profiler showed it. It was not taking too long to process it, and wasn't really a big contributor to the game time size, but it was being called like 200 times. I then discovered the plugin that is free for the month currently, and it's sorta like lightweight mass I guess. I also created my own move to task. Anyways I now can have like 80 or so enemies on screen before I drop about 10 frames or so, which with the tools of the plugin having 80 is more than enough to fake thousands.
and that's way better than having no frame drops but half the enemies don't move past 50
profiled in editor or in build?
I have been working on adding cars to my game for NPCs to drive.
However, my current Behavior Tree will have the car turning instantly instead of gradually.
I have been trying to think about how I will have the AI make turns and driving like a car instead of 'walking' to the target location, but I haven't been able to come up with any good way to do it.
Does anyone have any suggestions on what I could try to get it to behave properly?
This is how it currently looks
the simple non carlike solution would just be give the ai's pawn a rotation speed that isnt instant
but car like steering is way different than bipeds, so you probably would have to approach the problem differently if you want that
like cars move in circles right, turning the wheel creates a circle in which the car moves, and changing that steering changes the shape of that circle
That's kind of what I was thinking however, I don't know how I would change the logic for it.
What I was thinking is that I could have certain actors in the world to use as check points of sorts. So that when the car decides on a path, I can use that path to tell the car how it should drive. But I don't know how I would be able to find the path the AI is wanting to take in order to do that. I am thinking that I will need to make my own MoveTo task but I still don't really know how to get the path that the AI should take.
I could just be overthinking it but yeah
So I have found there is a node that is called Find Path to Actor Synchronously
It contains an array of vectors for the Path Points. So I should be able to use those to line trace for a certain actor between them and then go from there.
does the ai even need to steer really? the BT should set destinations and you can use a "path follower" component that understands car steering to do that work
just like the default path follower stuff drives biped agents down a path
what does biped mean?
literally "two feet"
biped
noun
- an animal that uses two legs for walking
Example: the iconic predator Tyrannosaurus Rex was a biped
ah ok, goctha
Does anyone know why my AI is not moving outside of PIE mode? it works fine while in the editor but when packaging or running standalone the AI does nothing?
.. why not use the built in move to
what am I using then?
the reason is I want it to stop at a certain radius
its working now I needed to place a new navmesh. I am not too familiar with using the built in stuff that's why I did it this way
(what im saying is it doesnt make sense to make a new node when the tools out of the box already do this heh)
makes sense
the tutorial I followed a long time ago did it this way so I am just used to it
apparently there are tons of wrong tutorials out there 😄
yep
so realistically will my method mess with performance?
cause replacing it seems easy enough
its more that the bt node version is probably functionally better, you're more or less duplicating work that it already does
i think what a lot of new folks to BTs dont realize is that the tree itself is kind of like a big function, some nodes control execution flow, selectors, sequencers, decorators, some execute singular tasks, move to, etc So you end up with what more or less would look like a big if then else if you were to write it straight .. with a lot of convenience functionality built in, and easy reuse to help you be more descriptive of the behaviors you want
generally too BTs themselves arent usually the perf sink, but everything that an AI touches is a potential problem because unlike with a player where its like, just one action for one actor, if you have systems that dont expect 10s or 100s of ai to hit them at the same time and do it repeatedly over many frames.. you'll have a bad time
ah okay
my trees are rather short otherwise it was just this one issue which I thought was caused by my move task and or the auto posses behavior
glad it was just generating some navmesh
yeah I am glad too haha, I am a little too deep in this project to be rewriting entire systems or my enemy base lol
which setting decide the amount of offset of the navmesh to the border of my ground?
afaik its just a visual so you can see the navmesh, the actual navmesh is more tightly bound to the ground, if thats what you mean
why do you need to change it
it was the cell size and the Agent radius
is the ai navmesh system able to calculate the "route" based on how much some tile will slow down the character?
based on the friction for example
or the ai will go in "straight line" only unless an obstacle that changes the navmesh
is it possible to add "weights" of areas to the navmesh?
for example an area would be with snow so characters will go slower, is shorter distance but maybe take you more
or is with clay etc
you can use nav modifiers to change the cost of the area within the volume
This guide covers the preliminary steps needed to learn about Custom Navigation Areas and Query Filters.
?
yeah that works
Is it just me or all AIMoveTo functions have a major issue in HasReached check?
The issue is that HasReached is adding Target Actor's Capsule Radius * 1.5 to AcceptanceRadius which is by no means is a good behaviour, its conflicting and counter intuitive.
Scenario 1: AIMoveTo Target Actor, Acceptance Radius - 600. Distance between actors is greater than 663 (600 + 42 * 1.5).
Result 1: Function works as expected, the AI will move to a distance of 497~ or other close value to 500.
Scenario 2: AIMoveTo Target Actor, Acceptance Radius - 600. Distance between actors is less than 663.
Result 2: No move at all. Not until the distance increases to >663.
What I'm trying to make is a very simple thing - Right Mouse Click should make Character move to exact distance to the target, which should equal to Attack Range (standard behavior for top down games).
But this AIMoveTo behavior completely ruins it. Has anybody found a good work around? Really don't want to download source code just to edit one line.
(which is this as far as I could tell (the GoalRadius thing))
const FVector::FReal UseRadius = RadiusThreshold + GoalRadius + (AgentRadius * AgentRadiusMultiplier);
You can turn off using the goal radius as it's a parameter.
In the source code? Yes I can, but I don't really know how to properly do it (afaik I need to download source from Git and then build it and use it as a new UE version for my project, thats a lot of work for an experienced user).
I've submitted a bug report. I feel like thats an unintended behaviour. It doesn't make sence for the very same AIMoveTo function to use different AcceptanceRadius under different conditions, resulting in dead zones.
Tbh chances are that isn't going to get changed because that's such a fundamental node and if its behavior changed a lot of stuff would break
I'm not sure if I fully understood your issue with it so can't really say - but either way, you can write your own logic to replace AIMoveTo
AIMoveTo from Self Actor to Target Actor. Acceptance Radius = 600 (the Self Actor's "AttackRange").
Scenario 1: Distance between Actors is >663.
Result 1: Expected behaviour, no issues. Self moves exactly to a distance of 600~.
Scenario 2: Distance between Actors is 600-663.
Result 2: Unexpected behavior! Self doesn't move as if its already there.
Scenario 3: Distance between Actors is <600.
Result 3: Expected behaviour. Self doesn't move as it is in fact already there.
I wouldn't mind AIMoveTo to take target's capsule into consideration, thats totally fine. The problem is that it only takes it to decide whether to start moving or no ("if >663"), but doesn't take it when it moves to ("to 600"). Its conflicting behaviour, they both should be identical.
The whole purpose of the function is to move to the target actor with exact distance acceptance. Which it does, unless you are in a dead zone. I don't see any reason for this dead zone to exist.
Hmm, I feel like it has actually moved up to the radius and not up to the exact coord for me 🤔
Which was infact something I kinda disliked - I would rather it treats the radius as the "acceptable range from the point" in the sense that it would always try to go to the exact point, but it would only count the move as failed if it couldn't reach at least radius distance from the point
Instead of moving up to radius and calling it done
I'm fine with anything as long as its consistent. Problem is that it isn't. AcceptanceRadius works completely different for when AI decides whether it should move and for when AI moves to. Both happens in the same function call.
To me that effectivelly makes AIMoveTo (with Target Actor) completely useless and I don't see any apparent reason why it was made like that.
Made an ugly, yet a working solution where I just use low Acceptance Radius and 0.01 check to see if the target is in range.
Anyone knows why the thirdperson character can walk outside the nav mesh when you hold move? When i only click once it doesnt path there, but when i hold it just walks over everything thats not too high even if its not part of the nav mesh
This depends on how you're moving it. If you're not specifically using nav based movement of course it will move without a navmesh
I'm having a slight issue with figuring this out, but is there any way to have an AI not only able to path find through a certain direction.
For example, making a one way street and not allowing them to go the wrong way while still allowing them to go the correct way
Not sure if there's any very good way of doing that with the builtin navmesh stuff at least
You could in theory set it up so that at the start of your one way street you have a nav link which connects it to the end, and you would only allow navigating through the link in one direction
but if your pawns can for example stop along the way for some reason and then need to continue navigating, this might not work as they can't re-enter the link from the middle of it
Hmm I will take a look. I hadn't thought about nav links
That looks like it will work. Many thanks.
👍
It's working much better now, just need to make the turns smoother
hey, i'm trying to get a UAIPerceptionComponent to detect a vehicle, but the vehicle needs to be a lot closer than it should be to be detected.. i'm pretty sure this is because the vehicle's origin is basically at the floor level so the perception system's linetracing is easily blocked... is there a way to offset the origin for perception system? possibly on the actor the has the UAIPerceptionStimuliSource component?
hmm something to do with IAISightTargetInterface.. guess its source code readin time
Yep that interface should do it - you just need to implement the one function it offers and it allows you to choose how the trace is performed against the actor https://zomgmoz.tv/unreal/AI-Perception/IAISightTargetInterface
What is the most optimal way to have 100's of simple AI actors on screen at once?
awesome, nice and simple
That's a very broad topic and depends largely on how your AI actors work
I want to have animals reproduce and multiply over time. I've set up a basic Behavior tree for them to look for food, move to it and eat, and also logic for the reproduction. When I get to a large number of actors the behavior trees start to lag really bad.
You need to use Unreal Insights to find out what's actually causing the performance impact
It could be character movement components, skeletal meshes, BT tasks, and various other things
Okay I will look into that, thanks. Generally speaking though, is it possible to have highly performant simple AI's with just Behavior trees?
Sure, it can depend somewhat on how you set it up though
Awesome Ill check it all out with Unreal Insights, thanks for the help and awesome site too
Would this be more efficient as a State tree?
No. It's a parameter of the move to functionality. How to change it depends on which function you are using.
You are incorrect. It's purpose is not to move to an exact location, because it can't actually do that. It uses velocity to push the actor to a location. If you try to go to an exact location, you'll likely overshoot it between frames.
Oh you mean Stop on Overlap. No, that won't work. If true, it will add some other unkown value (which is not Capsule Radius*1.5) to the Acceptance Radius value.
BUT the new Acceptance Radius will behave just as conflicting as before, just with a new value. It will not remove the dead zone if true nor false.
I meant it in a more abstract way.
Depends on what your tasks are actually doing.
You need to profile what is causing your perf issues instead of trying to guess.
Im really just trying to figure out best use cases for different AI systems. Ive got a firm grasp of BT's and like using them, but I'm just worried if they are less optimal in general for a large number of actors. Sorry if I'm asking really basic questions here, but I can't find a lot of info on best practices with AI. Also I'm quite new to UE and this discord (obviously)
State Trees are very well optimized, so it may be the case that ultimately the performance with that could be better. However, I think the choice here should be done at least initially based on which of the system fits your needs better.
If BT's initially look like a better fit and you take care to encapsulate logic in a good way, so that you don't put too much of it into your BT tasks and services, it should make it reasonably straightforward to replace it with a State Tree if it turns out that it would give you something you can't achieve with BT's
Yea I think I'm going to stick with what I know and keep experimenting with BT's. My main take away from this is to better utilize Insights to find perf issues in the moment
Yep. Insights should tell you if there's a particular BT node which is being slow, or if it shows "BT Search" this usually means your BT is spending a lot of time trying to pick the appropriate node which also has various solutions
only profiling will reveal where your bottlenecks are. That being said (not in UE) i've run around 120 full blown agents off BTs just fine in shipping games
and in incredibly prototypy grey box levels with simple "move on a patrol path" type behavior with non rigged meshes, i've run 500 with no significant frame drops. again not UE, but the point here is that behavior trees themselves arent super expensive. The cost usually comes from elsewhere
or poor tree design (as in how you arrange nodes in the tree)
Why do it this way? Personally i set the acceptance distance to somewhere in the default range (10? i think) and then pick destinations that meet my positioning requirements... you are doing this backwards. Use destination picking to get the precise place you want to go, and then use a small acceptance radius to tell the move to when the ai arrives
Tbh the acceptance radius seems kinda useless most of the time because of stuff like this lol
It really should work the way I described it I think... Eg. the radius is how close it must get for the move to be considered successful even if it can't reach the exact goal point, but it would always at least make an attempt at reaching the exact goal point
it exists because of how moving works...
in basically every game i've ever worked on unreal or not, you dont know if you are there to a pin point precision, you have some velocity, you are going toward some destination, your speed may cause the point you want to get to to happen "mid frame" (your position this frame and your position next frame cross the destination point).. and it takes some moments to stop
so you detect when "you are close enough" and begin the stopping sequence
like the CMC uses breaking to stop the character, so if you stopped precisely when you arrived at the point (assuming that was possible anyway) you would then over shoot because the character has to apply the breaks
in general this is fine ime. the only times it really becomes a problem is if you live in a tile based world and need to stop dead center in the tile... which at that point you have some stopping mechanic that lerps you to the final point
if you really wanted perfectly accurate movement, use a lerp 😛
thinking acceptance radius is how you should stop "around" your target, is probably a mistake, you need to have a system that picks destinations and it uses that radius instead to decide destination points
the advantage of that too is now you can have a more complex destination picking logic rather than purely just distance based.
what's a good AI architecture for RTS?
Yes I thought about that method, using MoveToLocation and Vector destination instead of MoveToActor and then setting a low Acceptance Radius of 5-10. But that would work only if the Target won't move. If it will move while Self is moving, then the destination will not be incorrect. The biggest advantage of MoveToActor is that it will allways follow the actor until AcceptanceRadius is reached.
Imagine League of Legends. If you right click an enemy unit, your unit will first run in range of attack (close for Melee, far for Ranged champions) and then proceed with an attack. MoveToActor with AttackRange as AcceptanceRadius actually works perfectly for this task, if only there wasn't a conflicting deadzone behaviour.
My best solution so far is 5.0 acceptance radius and 0.01 sec interval check for custom made HasReached. Works as intended, but will have to examine profiling now, since low-interval functions are never good for performance.
why my RecastNavMesh-Default is duplicated and says "(Unloaded)" and I cant delete those (they are grey out)?
ok so in case anybody needs a "fix", is not perfect but works:
I am using perforce, so I went to the Unloaded assets in the outliner and check their version history on perforce, check their names and the changelist, went to Perforce, found the changelist, click to Edit (to see all the assets inside), order by name in the folder column, found them and Undid that Changelist for them
Hey guys - I’m running into a major issue with my navmesh not working with only three days left in a game jam… Can anyone help? I’m desperate at this point!
I’m having an issue where the navmesh doesn’t do anything at all because it’s loading in with level streaming. I’ve tried all of the fixes I could find online, with no luck:
- Setting runtime generation to dynamic didn’t help.
- Unchecking the box to unload sub level nav data didn’t do anything.
- I can’t just make the navmesh part of the persistent level because the location of the streamed level that needs it is completely variable (randomly placed).
- Just making the navmesh massive in the persistent level isn’t an option due to the distance from the origin at which the streamed level with the enemy ai could be placed.
- I even tried placing a navmesh in the persistent level and teleporting it to the location of each new streamed level, but that also has no effect.
How? Just recalling it?
iirc it's only when using Target Actor, calling it again I think makes a fresh movement request
well ye, for Target Actor its always updates, thats why I use it with Target Actor)
I think Acceptance Radius 5.0 and 0.01 peridodic check for IsInAttackRange does the job. Just gotta make sure that the check isn't tanking fps.
I think for my project I might make a custom AIMoveTo at some point which actually behaves the way I described earlier because I have a lot of cases where that behavior would make more sense :)
It's thankfully very easy to just copypaste the moveto C++ code and make your own mods to it lol
Bumping this because I’m short on time
Curious, would you reccomend adding a brief moment of set velocity/accell = 0,0,0. In order to guarentee consistent navigation or nav link outcomes?
Hi, is there a way to make a state active as a condition trigger in StateTree? I Could db it by adding that condition to all the states Transition but I want a better solution I want to cancel any active tasks and go to the task I want
You mean no matter what state you are in, if condition X occurs you want to go to some specific other state?
exactly
Hmm, I think if you have the condition on one of the parent states, then it should trigger on all the child states as well. I don't remember if you can put conditions on the root of the state tree though
thank you I will try it, and I thought about using StopLogic(); from UStateTreeComponent but I don't know what could happen I need to test it.
Hi everyone, I am trying to get my AI to sense damage and having some trouble. When my AIPerception perceives I have it set to print the type in On Target Perception Updated - I am seeing the "AISense_Sight" printed when sight perception triggers, but when damage happens I don't see that coming up.
I have added AISense_Damage config to the AIPerception component on the enemy BP, and in the C++ for my projectile I have added a damage report event below where I apply damage in the projectile's OnHit like this:
UGameplayStatics::ApplyDamage(OtherActor, Damage, MyOwnerInstigator, this, DamageTypeClass);
UAISense_Damage::ReportDamageEvent(GetWorld(), OtherActor, MyOwner, Damage, GetActorLocation(), Hit.Location);
The damage gets applied (I am logging that), but the report damage event is not causing the AI perception to pick up in On Target Perception Updated
I have a workaround for this where I can just set some blackboard keys in C++ to make the enemy AI "see" the player when the damage happens and that works, but I feel like the proper way to do it would be with the damage sensing in the AIPerception
hi guys
so am having a minor issue with my eqs the contect is to return a single actor but for some reason it doesnt work any one has any guid regarding EQS here?
maybe am missing something
I fixed this, AIPerception component needs to be on the AIController and not the Actor, I noticed a logger message warning that they are designed to work with the AIController and so updated that now it's good!
this wah my eqs looks like lol am just trying to get a comfortable distance away from enemy ship
dont know if am doing it right
Does it do what you want ?
it doesnt even execute lol
the thing just stays there runing
are simple grids only to be generated around quarieres?
honestly in 17 years and 19 games of doing enemy ai, i've never needed this except in one case, a tile based movement, in which case we just lerped the final distance during stopping
are you running the EQS task anywhere ?
Is it outputting any results? Are you using the gameplay debugger with EQS toggled on?
Good to know. I was just curious if most physics outcomes are akin to Ice Hockey.
its not out puttng the move to loation
generally yeah 😄
if you need prefect stopping lerping does the trick, though cant say how friendly that is to multiplayer
What are we lerping exactly
I have basic 3rd person template character & ai. But i added nav proxies to enable jumping across gaps & up/down ledges. I have to toggle "can fall off ledges" during parts of the nav proxy navigation to prevent too many self deletes. Lol...
If i dont make the ai pause and lose momentum before and after jumping across/up/down, they fall off a lot. But this slows down the ai speed and its not challenging at all when you can outrun them easily across gaps & verticality. No ledge grabbing or vaulting mechanics btw.
Hi, Can someone tell me how i can get the Sight Sense from the AIComponent as I am trying to set it during runtime please
When i drag off the AIPerception Component Reference it doesnt give me an option to get the Senses Array
i just do this in c++, but the main thing is you just apply new sense configs to change the behavior of the sense
no idea how thats done in bp
Ahh ok thanks, Maybe its something i,ll have to look at C++ to do as I know some things arent possible within Blueprints.
Iirc the sense configs and related bits are not available in BPs to read or write
They are fairly easily accessible in C++ though
Hi, Can I create blackboard and behaviour tree but in c++?
I want to create the entire my AI in c++
so ultimately the structure of your bt is just data, and the blackboard too.. im not super sure what the advantage of making either of those in c++ is (in UE anyway)
the nodes themselves can be c++ and that's what ultimately is doing your work anyway
so if its a performance thing, thats where most of your savings would come from
i guess, what problem are you trying to solve
No, I'm just masochist and want to create the everything harder and always in c++
maybe you should just write your own engine then?
😄
like UE is definitely designed to do some of its work in editor
yeah, I know, but I really like UE5 and writing my own engine will take me a lot of time
but thx for response 😄
Hello guys, I've an issue with State Tree that I can't understand, I've this really basic setup where ST tries to find the Closest Patrol Location, and then MoveTo Task (Join Closest Patrol Location). My Task FindClosesttPatrolLocation has a FinishTask node at the end, like all task should have I guess ? But when I add this one, my tree just keep repeting, if I do that, I need to explicitly setup the transition "OnTaskSuceed" to go to the child state or I'm just looping over the FindClosestPatrolLocation
As soon as any task within the state branch you're in finishes, the transitions trigger. Usually these get data type tasks should never finish, because they're used in combination with something else that does like in your case
At least this is a pattern what I've found works reasonably well in my state trees
Oh ok thx... there is no way to make sure that let say a parent group test has it transition "Succeed" triggered, when every child got executed without a fail ?
iirc if you don't have a specific success trigger on the state where the task is, it would trigger its parent's success
alright OK, I just need to be careful that basically only the very leaf node has a succeed or fail basically so right ?
Yep
As mentioned at least for me, splitting tasks into ones which get data and those which perform actions generally makes this easy to do, where only the ones which perform actions call Finish Task :)
There's usually no reason to use the get data type tasks without a task which uses the data to perform some action so they pair up well
Yeah indeed, amazing thx 🙂
Hi ,in behaviour trees , is there any way to execute a specific task as the execution enters or leaves a branch? Suppose , if there is a sequence that is looping continuously , I want to perform a task just one time when it enters that branch and a task if it stops looping that sequence. Any ideas?
Use a service and then there are two methods. OnBecomeRelevant and OnCeaseRelevant - or something like that.
Put the service on the branch.
Where are those methods? I can't find them in the service blueprint when searching for the nodes
heyu guys i have a minor issue so i implemented a behaviour tree and put two ai in the level one is executing the tree properly the other is not
For BP, you'd use the Activation and Deactivation AI ones.
@harsh storm any idea?
Can't know without more details. Share more info rather than less info.
Just saying "it doesn't work" gives nothing to go off of
i have identical behaviour tree for two ai ainstances in a level
No one can know what "properly" is in your case
one is executing the BT right
the other one doesnt even move
infact i duplated the ai in the level
But they are being fired each time the sequence is executed. I have a chase sequence for my enemy. I want him to change to a particular form when he is chasing the player and he maybe in whatever form he wants when he is not executing the chase sequence. The problem is that the Shapeshift function is being called everytime the sequence loops giving undesirbale results. And I want to call the "Unlock Form" function as the BT leaves that sequence entirely.
When is the BT supposed to run? Does it have a controller? Is it being possessed properly?
its Ai so yes it has a controller
i duplated same ai in the level
one is working the other one isnt
Just because it is AI doesn't mean it has a controller
Are they placed on the same navigation mesh? Is the nav mesh big enough to cover those two AI?
yes!!!!!!!
Don't need to yell
What does the "Auto Possess Ai" dropdown point to?
Well, looks like the loop decorator just sets the next child to be executed directly. This will cause the branch to be executed again I guess. Could just make a task that runs before the loop and a task that runs after it.
And have that do your shapeshifting stuff.
i dont understand
In your pawn class
There is a dropdown that determines how the spawning works with ai controllers
place in world and spawned
Can you once again check if the 2nd AI you just duplicated has the Same Ai controller ? In the world , click the 2nd AI instance that doesn't move and search for AI Controller Class in the details? @visual dawn
I don't have a loop decorator
Did you do a custom loop? How are you running this in a loop?
yes one runs
the other one just stays at a flow
i dont knw the reason
Just the Blackboard condition for the Chase Player boolean. It moves to the player and attacks him . Then once again starts from the start i.e move to the player and then attack him.
I have already asked 3 times now. How are you starting the BT
from the ai controller
Are you using "Run Behaviour Tree" node in the begin play of the controller?
Why not run set some break points and run through the debugger? Or use print strings to check the flow at the cast failed pins.
or the visual logger
The usage of your booleans looks like you're using this like a state machine. Which is bad juju. If you want a state machine, use a custom state machine, State Tree, or Logic Driver plugin. Behavior trees are priority selectors more or less. Read Luthage's pinned post about the differences for a quick summary.
For your immediate problem, the service is working as expected. Your BT design is the problem. There isn't anything in the BT toolset that only executes one time in the lifetime of the branch. If you want the character to shapeshift, essentially when it becomes aggressive, you can do it when you make it become aggressive (most likely through perception). Could also have a ticking service on a branch above the Chase Player sequence I guess. So the selector that is right after Root.
Honestly the "don't use as state machine" never gets any clearer no matter how many times people repeat it lol
I feel like there needs to be some actual solid example of this - eg. a state machine like behavior tree, and then a discussion or example on why it's not a good design and how to design it better
Like I kinda get it but also I'm not sure if I do? :P
Thanks , I was doubting that I am doing BTs wrong. I will do the "calling shapeshift" and other logic in the Ai controller as you advised because it looks like the best option as of now.
I think its pretty clear? like if you want a state machine.. use a state machine?
But even when designed around behaviors by priority or whatever they are effectively state machines :P Eg. the canonical BT example of idle/move to target/attack target
i mean BTs are essentially very specific kinds of state machines
Yeah hence the confusion as to what kind of design is suggested as poor for them
but i think most people are after the more traditional "here's some state" and "here's the transition to other states" and this isnt how bts work
My understanding of it is that forcing a transition from inside the BT is poor BT design
I don't know why the service isn't sufficient for you honestly, as it will do what you want. When it enters chase - shapeshift. When it leaves chase - change to a different form. I'm guessing the problem for you is that in your mind, they're still "in chase" as long as that ChasePlayer bool is true. But in the BT's eyes, it is only when you enter that sequence.
behavior trees dont have state transitions, instead the arrangement of nodes dictates what gets executed.. if you are done with some task, the BT just starts back at the root
and the arrangement of nodes dictates what task gets done next
You could argue everything pretty much boils down to a state machine. The key difference is the transitions.
State machines transition logic explodes in complexity
yeah state machines are really unweildy on complex behavior
Right so I guess the point on "forcing a transition from inside the BT" being poor makes sense for this then
The reason I said it looks like they're using the BT like a state machine is because of their booleans.
there are so many tutorials out there that try to apply state machine logic to BTs and it just falls flat
We only have one branch, so can't say definitively, but it happens often enough with that kind of setup that it was worth pointing out
and thats where this comes from im sure heh
granted at some point bools are going to dictate which branch you go down 😛
Absolutely
I've been using ST+BT in my game for some new stuff I'm adding. Seems to work alright so far
It is natural to gate a branch based on a boolean.
nodnod
The ST runs as the "root" of the system to choose the state the NPC is in effectively, and each different "task" the NPC can have comes with its own behavior tree
But naming conventions and other booleans in the example image can allude to how other parts of their system is designed (just based on experience with helping others)
seeing enums in there is a give away x_x
Absolutely that 😅
i seen that tutorial x_x
But there are still people who do FSM's with bools as well.
I love HFSMs. "How do we solve the explosion in transitions?" "Simple boss, lets wrap this FSM in another FSM!"
FSMs all the way down
HFSMs are just design recursion.
hehe
all i can say is that it wasnt very modular due to the complexity of the transitions
but subtrees of a BTi can just jam wherever and its generally fine haha
i so bounced off HTN planners tho x_x
I honestly think most people using BTs in UE would be better served using STs.
Why is that?
i think thats what most of them are looking for
might have just been our engine at the time and the game type vs what HTNs would actually net us
they just werent reactive enough
which yeah they arent haha
but our games generally had no need for long term planning either
but might have just been the situation and the tools we had at that time (late 2000s)
i generally go for BTs and some extra stuff around the edges .. like some kind of manager that coordinates AI
Sorry , reading this message made me realize my mistake. I replaced blackboard based condition decorator with the conditional loop decorator. Now in the BT's eyes , it is still in chase and the service is working as expected. I should have thought about that before. Looks like we summoned this entire AI discord channel with our conversation 😆 . Anyway , thanks 🙂
Well that kind of sounds like just the wrong architecture then 😅
Yeah - so it was your BT design 😛
Errr - maybe not. I might be using that term too liberally 🤣
Just a missing step
As for using your BT like a FSM, take what I said with a grain of salt because we don't see the rest of your AI setup. I was only mentioning it due to how your booleans were named. Because this kind of naming often means people are using it like a FSM.
You mean animation FSM?
No problem 🙂
Sort of. Think that, except with logic instead of animations.
definitely 😄
we never really used it, tbh
and i replaced it with BTs some time later.. i dont even think it made it to that version of the engine
basically it was someone's pet project in 2009, and then video game recession happened and they got laid off.. soon after i built BTs around our new engine language and that was that until that studio closed hah
I’ve always heard this but its always a seemed strange in the sense that BTs are just “subclass” of SMs in that that you can always just construct your SM like a tree but not vice versa
I think that statement applies to state machines - as in, in the strict definition of it, where you only have states on one level
unreal's own StateTree is a hierarchial state machine for example, as it allows you to build a hierarchy of states, which alleviates the transition problem
Well sure generic SFMs are like the linked list of AI designs
Do state trees have any other functionality that makes them different then HSM or is StateTree just the class name
No idea tbh :) I think it's more or less a HFSM but I've not really used these so much in this context to say
Hi, I'm trying to create a like game runescape where i either click on ground location or an interactable object. I used the topdown preset which for the most part works however I can't get the interact with object part working how i want it. I'm trying to get what i clicked on, determine if its an interactable if it is it should get the actor and move to it. I can't get that part to work. It only works a little bit when i use "simple move to location" but when i click the middle of the object it doesnt work. 😦
this is the result of just using simple move to, however this makes it so my clicked object tells me it's clicked rather than the controller knowing what it clicked on and also i cant get it to work consistently
You probably just try to move where you do a trace to but there is no navmesh there so moving fails. You'll need to get a valid location nearby to move to instead of just moving to the clicked location.
Like noted earlier the biggest difference is behavior trees don't have transitions. The order of the tree dictates logic flow not arbitrary transitions to other states.
Even hfsms aren't totally a solve for complex transitions. You still have a tangled web of lies eventually.
And its not easily portable/modular
if you press p in editor you should see where the nav mesh can move to
I have a full green mesh, and there is a slight boundary around the object (I assume clicking inside the collision box which doesnt have navmesh causes it to fail then?). I thought AI MoveTo had a radius which i tried in order to stop before the mesh ends but still navigate to the object. How else would i interact with in game objects that have collision. I need to navigate to them somehow. Same with move to actor, are those not meant to be used for static meshes? Or what am i missing sorry i have been stuck on this for 2 days 😮
The point you move to has to be on navmesh, else a path won't generate
You can use an environment query to get a valid point, or your interact object can have some predefined position on the navmesh, etc
hmm okay thanks a lot, I got kinda misled by the function i guess. Expected walk to actor to be able to do what i wanted but i get there are also a lot of actors that do have navmesh under them and the function is meant for them
In reality you probably want the interaction point to be on navmesh. The physical object doesn't have to be but the place you move to does
Yeah, i will probably use the query system since almost every action in the game will require this function. Feels like it would be easier to build it into the click functionality than to make sure every object is on a navmesh
Since the character can already can get close enough to the tree for an animation, I don't think i need to update the navmesh just need to make sure the character know how to get there
Nod
Cool thanks so much
Yep!
Why cant I change avoidance group at runtime, you guys have any idea how to do it?
I tried the set avoidance mask node but it does nothing in terms of changing the group
You want to be running a trace to figure out what's being clicked. You can leverage different collision channels to find different things:
I break the mouse hit into logic like this:
e.g. move to order location goes to the collision point found on floor:
If you want to do interactables where they go to a specific point to interact with it then make sure it's on the navmesh. If you want it to be an arbitrary point then you want to be using:
Thanks this is very detailed, I have almost all of what you show me. I just realized get closest point is a standard function and that might be the key. Cant believe there was a function for it.
something like this? (will clean it up once it starts working)? @vivid drift
This seems to work 90% of what i want so il keep it for now, problem is it uses the blue line when clicking on the box because aspparently thats the closest navmesh to the white box. Would like it to follow red line
What I do in my game for this is I calculate a few points around the object I want to navigate to, then project them to navigation, and pick the point out of them that's closest to the actor who's moving
tbh i'd just use an eqs that listens to path length.
I spent like 4 hours on EQS yesterday and i got nowhere :D. Maybe I come back to it later but for now this works okayish
But then if the player was on top of the ramp already he would still try to interact with the box
What do you want to happen in that case instead?
its pretty straight forward, define an area, favor points closest to the ai, cull unpathable positions, and then take the points with the shortest path
It should move to the same level as the box, but i guess you can create points only on the same level and that would work
If you don't want the npc interacting with it from a position that's noticeably higher than the object itself, you could compare the Z value of each position and consider ones too far as invalid for the selection
also I think when you project points to navigation, you can specify how far it's willing to project them in terms of the Z axis which might help with this
Just to clarify the npc is the player it's a topdown game where the character is controlled with mouse inputs the AI then controls pathing
this also gets back to just predefining the point on the interact the actor should move to that is on th enavmesh by adding a FVector or something to the bp.
Ah right, yeah it doesn't matter whether it's an AI-controlled or player controlled pawn for this :)
its the least amount of work way..
At least in my game sometimes objects can be interacted with from any direction, although some of them also use smart objects for it with a specific slot :)
makes sense thanks for the ideas I think i might try it because it's the easiest to me at the moment
I would want this implementation because it seems the cleanest but i tried for a very long time and nothing happened. here this is what i tried:
no i mean the easiest way is to give an interaction point to your interaction object that is on the navmesh
and path there when you click on it
Yeah i agree, but i feel like if there are problems later on with that system and i want more control i have to use EQS anyway?>
depends on how your interacts work
if they always have a "spot to operate from" then this works, but if it doesnt matter, then you need something like an eqs
For something like a smithing table etc i could have interact points but it would be weird to have them for trees
and I can definitely see myself needing to operate something from any angle so thats why i think i might need EQS
eqs fits pretty well imo, but i think yours there is a bit too mcuh
are you using a eqs tester pawn to see what its results are like?
No, all honesty i couldnt find any resources that matched what i wanted to this is all made by Claude and a bit of my own ideas
My problem mainl;y is most tutorials are talking about NPC's and given my character is the NPC i have a hard time trying to translate that information to my use case
I added the test pawn and circled an object which the query looks for when it is clicked
the query isnt looking for an object...
its looking for a place on the navmesh the player can move to
Okay so it needs to get as close as possible to the object when it is clicked
yeah so generally its center point will be your interact target, the querier is the player
you want destinations scored highest if they points are close to the location and filtered out if they dont have a valid path.. then you can take the closest path
so you dont go up some ramp
Yes, will i still need to get the point closest to the actor on the mesh? If i set the center point to be in the middle of the object with no mesh. Will that still generate a path closest to the object?
no just get the actor's location
the center of the eqs doesnt have to be on navmesh
youll need to set up an eqs context so you can place the eqs toward your clicked box, but in the pic above you can see the box cut out of navmesh and thats where my eqs context target is
so it would move to the green point when the context is the box, it is clear i just don't know how to set it up in the engine, so i will take the time to learn the system and implement it. But for now everything you say makes a lot of sense but i don't know how to actually implement it because i'm not used to the EQS system
Do you know any good tutorials that are relevant to my usecase
at the core of it the idea is to put a grid of points (ideally as few as you can manage) and test the points for various conditions that validate the point, or score the point, then you can choose the highest score
i.. dont heh
this just behaves like other systems ive written in other engines hah
I get the idea and logic, i understand pathing algo's. What I don't understand is where to click in the engine to get what i want. Just following the tutorial yesterday made me create 5 seperate files, how it all adds together is complicated. It will take some time
oh yeah i only created 2 files here (the actual eqs and the context, 3 if you count the test pawn, but you can reuse that to test other eqs
BTs are not state machines. State Machines have the action tied to the transition logic. BTs do not. BTs are however stateful which is what is confusing you.
Yeah I think there's sufficient vagueness in how these terms are being used across different fields in programming
The explicit transitions aspect seems to be what is the main distinguishing factor
almost. Get Closest Point returns the closest point on the collider to the input point. You probably don't want it to be where you clicked, but rather where the actor is currently (which is fine outside the niche cases where a unit needs to route around something to get to the interactable and would actually end up arriving at the object on the opposite side (but maybe that's fine)) or trying to do something clever with routing towards it first but I think that's kind of unnecessary
Consider using the get random navigable point in a small radius too in case there's collision issues with the particular point you did.
That should work for 95% of cases on the first try, imo, and you can do some backup traces from different "closest point" origins if the navigable point request fails to find anything
AI tutorials are really bad. There's an introduction to AI course on the learning library that has a section on the EQS. That will work the same for the player.
Well i'm way down the EQS rabbit hole now, I was having issues with the fact that I can't really use a player controller and AIController at the same time and the method of using get closest point etc gave me some small bugs that i might have been able to fix but i felt like the options were limited if i went that route. So now i have detached my player controller from the character and let the AIcontroller take full control i then pass the instructions to the character via a ref. Also If i manage to get it to work i have better control over the pathing
Yeah that's what i figured, especially since my use case is a bit more niche where the controlled character is also the main AI consumer
You should still have a player controller. It's just that the player contoller should be doing something like sending orders, in the form of structs, to the ai controller
Yeah that's what i'm doing, it also controls camera now etc. It's sort of working i just cant get the query to actually return something
This kinda depends on how much AI stuff you need on the player. Pathing can be done without AI controllers, but some of the builtins for that stuff assume one so it may require a bit more work without one
But in general having a separate player controller and an AI controller in control of the "player" pawn is probably a decent solution - and you don't necessarily need to have something as elaborate as structs to pass info, you can just have functions on the ai controller to call
Yeah that's what i was saying, I wasn't able to have more control over the pathing without seperating them and using EQS
Also, the whole game i'm making (for fun) is kinda like a runescape type thing where the whole game is you clicking and the character pathing it felt like i needed to bite the bullet here since it's such a core part
Yeah that's a good plan
how do i catch a payload from state tree event?
@vivid fern Well i kind of figured it out, it seems like i'm close but for some reason the get query results as locations always returns an empty list. I have had prints all over the place to confirm no garbage goes in. Any ideas?
I DID IT, HOLYYY Thanks all
Why do you think that you need an AI controller?
^
Is there an elegant way to check if an AI agent has left the navmesh/become unable to move?
My fallback plan is tracking the time since the last successful move result and triggering recovery behaviour if it's been too long, but just want to check I haven't missed some OnFallenAndCantGetBackUp event somewhere.
I don't remember i tried so many different things trying to get it to work. While trying I ran into the issue that I couldnt give AI instructions because I had to obtain the AI controller to do something and when i tried that it was always empty because the player controller possessed my character and not the aicontroller.
You can project the pawn's location onto the nav mesh.
iirc ue only lets one controller control one pawn
Hi , My nav agent Enemy is a bit big with a radius of 200. While taking turns near an obstacle such as a door or a wall , he is ramming into the obstacle and therefore taking slower turns. After the turn is completed ,he is returning to his full speed. Any ideas how to fix this?
You need to change your navmesh so it has the appropriate agent radius which should prevent them from hitting obstacles when navigating
Hello everyone,
I'm having issues with the landscape not being recognized as a navigational path. How do I make the landscape recognized?
I tried , no matter whether I increase or decrease the agent radius , he still bumps into the walls when taking turns at them. Also if the agent radius is higher and the player goes very near to a wall then he falls into the No nav mesh region (the gap between the wall and the nav mesh due to higher agent radius) , and the enemy stops going at him. Any help ?
Increasing the agent radius made a smaller enemy take smooth turns but a bigger enemy still bumps into the walls or doesn't move through a door at all. Moreover, as I said a higher radius is causing the player to go out of nav bounds into the gap.
Hm, it should fix it if the navmesh settings match the agent's, and it should even be visually noticeable when you generate the navmesh that it leaves larger gaps.
One way to have multiple different sizes of agents is to have multiple navmeshes where they get generated with different agent settings, not sure if there are other approaches to this
Yes , I can see it leaving larger gaps. But if the player is standing in that gap , the enemy just stops moving until he comes out of the gap into the nav bounds
Right - then you have to add some logic to project the player's position to the navmesh so that the enemy can navigate to the closest point
Is this required? The tooltip of the agent radius says "Radius of the smallest agent that navigates in this nav mesh" . So I guess it takes into account of all of the agents. But I don't seem to get my problem fixed at any number of that variable.
I can't say whether it's required, but it's one option that could help in your particular scenario, if you have different sizes of agents that need to be able to navigate
Hmm , Is it possible in the EQS? Suppose if the EQS generates say some 3 points around the player , how do I check if they fall in the nav mesh and score them accoring to that so then I can move the enemy to that highest scoring point?
You can do that with EQS yes - you can use the generator that projects the points to navmesh
So it can recognize nav mesh? Thanks. Also if an EQS query fails to return a valid point i.e all the points are filtered out then the Behaviour Tree execution just stops/stucks at that EQS query forever and never steps out of it . Should I just use "Force success" decorator on it?
Hard to say, I think it should count as failure if the generator returns nothing so you could use a selector to choose a different action in that case
but try it and see I guess - note that you can run EQS queries in BT tasks also, so you could make your own task that handles it in the way you want
Good Idea
@misty wharf Hey I got one more problem! Whenever I enter play mode , the recast nav mesh - default settings are reverting back to default. After I ended the play session , they revert back to what I have set them to!
Not sure but could be if you changed the settings in the navmesh actor directly
You need to change them in project settings
What setting that could be?
I mean any navmesh setting. The values in the navmesh actor in the level are generated from the settings in project settings, it's under navigation or something like that
I changed the agent radius setting to 200 in the project setting but weirdly it still reverts to 35.
🤔
Have you tried manually running Build->Build paths or whatever the option is called?
You might also want to try just deleting the navmesh actor entirely from the level and regenerating from scratch
Yes, I have tried. I have also opened a completely different project and this same thing occured. The values just revert back to normal.
Can you please check if you can also change the agent radius and the other settings and see if they save on clicking Play?
Yeah it works for me
Weird that only agent radius and agent height aren't working for me. Remaining works
Oh, have you tried changing it in the agent settings of the proejct settings menu?
I vaguely recall it has two places where you can configure it
Some values keep having the default values while the other ones change to whatever I set.
Yeah I mean some of the agent settings have two places to configure them and one of them gets ignored
There's a separate list of supported agents which might've been the place where you need to set them up for it to work
1.Project settings and 2. Recast nav mesh - default. You mean these two?
I don't remember what they're called
It should be in the same place as the other navmesh settings, it's called supported agents or something I think
Yes, I can see a dropdown to add supported agents in the navigation system section @misty wharf
Lets test it\
Now , what to do with those ?
Right so you should just configure this to reflect the agent settings you want
I recall these values will then actually get used
We made some custom traversal mechanics like ledge grab, pipe climbing etc.. You think making AI do the same is possible or too hard? Because its like making a custom path manager, since it has to understand which path (on ledge grab situation) it can do to reach certain points faster and I dont have idea on how to make it, if its too hard I just make them do something else or they might just not be able to do it. In the situation of zipline and pipe climbing I thought I could do it with nav links but im not sure. Any help on tips?
I've not done anything like that myself, but navlinks is what I would consider for it because that works directly with the pathfinding system
Hey how can I get my AI to use "turn in place" animations? Seems the AI is turning itself when I use the setFocus node on the AI controller and its rotating but not playing animations. "Use Controller Desired Rotation" is enabled on the actor.
So it's not possible to get an AIController in a Character when it's being controller by player controller? Or let me rephrase can i still send EQS queries to my character when I'm also controlling the player with a player controller?
EQS doesn't care who's controlling what
So what move command do i use then, because when i tried earlier the only one that worked required an ai controller?
What does moving have to do with EQS?
The main character in my game is a topdown character that moves using the mouse, each mouse click is an EQS query to determine how to get to the location because players can click outside the navmesh
EQS is just a way to find a point in space
thats all it does
you get a FVector out of it
you pass that into whatever moves your character
Yeah i'm understanding i'm just confused because it works now and didnt before, but i'm starting to realize that maybe i did something else wrong and i don't need the aicontroller
You would only need the AIC if you use AI MoveTo or possibly the BT MoveTo task
since AI MoveTo requires an AI Controller to function
basically i have this in my AIController, you are telling me that i can just do that in my normal controller and forget about the AI controller
The EQS parts of that should work just fine yes
all EQS needs is the Querier, which can be any actor whatsoever
omg why do i do this to myself
have you looked at the top down template
the player there moves around via clicking the world
thats where i started from
kk
Well ill report back
Not with that little of information.
if i want minions follow a path like league of legends what would be the best way? can someone tell me?
probably not that different from a patrol route/path/points tbh
spline?
they need follow eactly they path
with curve
exaclty. in a line
spline ist the only way? or is there some better ways?
Spline sounds like the way to go
but how can i handle minions that they dont lbock each other?
how do you would progrmam minions follow there path exactly? and then dont block each other
for example 20minion wave vs 20 minion wave...
i mean LoL dosent follow the line exactly.
they def have a route they want to go down but follow it via navmesh pathing
what are you trying to say
if you want them to walk in an exact line and not block each other then you would have to make them not collide with each other
in lol they follow excatly on line???
they follow excatly they curve
in a line
or im wrong?
you are wrong
and then the fing the path and dont block each other
they do not follow the line exactly
did you play lol?
they will also move off the line for a bunch of reasons
the follow exact the curve
they do not
they move around obstacles, wander off the path to get targets, and then return to the route and move down it
if they folloew a path they dont go curve on toplane adn botlane?
they do not follow it exactly but they want to be moving down it in their base most state
thats why i said: they follow a route but they dont follow it 100% exactly
i have no idea what you are trying to say.
its only work with splines? o.O
there are tons of ways to do this
how do you would programm minions exactly like in lol?
how do you will handle this?
not block each other follow path etc etc
i already said
with pathpoints? o.O
i'd use something similar to a patrol route
and how do you would handle this
they dont block each other and find exactly way to attack
with navmesh
yeah but the ywill block each other
if there are 10 groups
They keep stopping and don't know where to go
? you pick clear destinations to move to, you nav around others via navmesh or crowd type logic, i cant write your game for you
yeah i know
but you dont understand
if you use path pint avoidance and crwod... they will block each other
they stopp and dont know where to go
in leaugue of legends they dont stop... they exactly know where to go
you didnt listen
i said its a combination of finding clear destinations, using the navmesh to find a valid path to those places
ai have to pick a target, then figure out where to stand to attack them, then move to that location and avoid obstacles
you actually have to write that code yourself x_x
they arleady know where to go
with avoidance and crowd ai controller
they block
and dont move around each other -.-
which code? which node will handle this?
I don't play LoL so my thoughts might be wrong but as Allora said, it'll have to start from some form of Nav Mesh / Crowd Logic. To spell it out in a bit more details.
But to achieve Navigation without avoiding each other, they need to be managed together so I imagine,
- There is a grid of some sort (nav mesh), that is shared by all AI.
- Maybe each AI would pick a particular path. (they write a custom path picker) and then another would. The next AI will pick it and hence no crossing over.
- Possibly re-evaluate the path at some point.
In that way, they don't avoid each other.
tbh the agents in LoL also have pretty small colliders
they can squeeze around eachother pretty easily
idk how to programm this
i thought avoidance and crwod would do that
but that doesn't help at all. not even close
you actually have to do work on top of that, you cant just "drag drop" a solution without any specification to your use case and expect it to work
AI is highly game specific so you wil probably have to write stuff that helps AI pick destinations, know when to pick destinations, and move to those destinations to attack while moving around obstacles
I'd suggest googling for tutorials, it'll be on YouTube or UDemy. They are good at How To. A skill you'll need to develop for future challenges.
there is no tutroials
every where the same
ai move to thats all
ai move to stop anim montage
or avoidane and crwod
thats all
ai move to that and that ...
ai move to or behavior tree
but how can ai know which way to to find... and know where is the other ai
maybe you should follow tutorials in the pins tbh
ist there a node? idea? or something that i miss
there are no tutroials?
no oen can say me a idea? how can i do that?
then you didnt look in the pins
like an EQS can help you find locations, that would help set up destination picking logic for example. You have mentioned move to, which would help find a path to said destinations.. and you already noted crowd tutorials you found.. that alone is enough to make a simple implementation
it doesnt -.-
It's hard to help if you dismiss suggestions tbh.
It may be how you view development cycle as I don't know about your experiences with game dev. With development, you need to piece together many moving parts to create a bigger system. It requires you to sit down, try things out, fail and learn bit and pieces.
Anyways, I did a few searches and the base of what you need exists out there, have you followed through with any of these?
A few quick searches
Car Navigation: https://www.youtube.com/watch?v=3999HeBJ6K0.
Crowd AI Controller: https://www.youtube.com/watch?v=iYcDyJUByJg
this tutorials iw atched many times
lol
all you said me i know after working 1month with unreal engine lol
i tested all
and splines work well for pathing!
you tell me splines wrong
i sit down and testes everything
but they will block each other
or stop sometimes and searching way..
in lol they never stop they exaclty know where to go
yes because they have a system that picks destinations and manages where they go
in this tutorial they run into each other too
in lol they never run in each other -.-
yeah how ths system work?
which nodes? which idea
literaly already said but you dismissed it
you tell me waht every people know after 1 week with unreal -.-
clearly not if you cant do it
The tools are there: EQS is a good place to start to look for destinations around targets or your self (as the ai) to see where you want to go, attacking something? maybe you need to pick a position around your target that isnt occupied.. maybe you need to manage how many things can be around targets, etc
once you pick a spot, you can use move to to get there.. maybe you will have to use crowd stuff to make sure they move around other ai, or use a customized path follower or custom path generation. really depends
you track ai as you create them so you can easily query where the others are, or you can use a cast or overlap or something
one thing that's important when building any game feature: break it down into smaller and smaller parts until its more easily understood how to do that work
then you keep building up the small easy to understand parts and together they'll build up your feature
The issue from my POV is you want an answer for a full AI system (to work exactly like LoL) without building it, that's close to impossible unless such tool exists already.
A close to complete system can look like this if you break down its components
- Be able to go from A -> B using Path Finding A* -> Learn how to tell an Agent to move to a location
- Agents has ability to avoid. -> Learn how to enable / disable crowd avoidance
- Agent Coordination-> Learn how you can coordinate their paths so the don't overlap. This is a layer on top of the foundation which is #1 and is often very custom to the game.
Some of what you mentioned, honestly sounds like a bug / problem for you to solve as a developer and moving past / understanding why they occur will give you a good starting point for further implementation.
but they will block each other
or stop sometimes and searching way..
It absolutely will take research and time as well these sorts of things are not instant you have to try things and see if they fit your needs
maybe zone graphs are better for moving down the lane, for example
lol you should’ve seen the similar nonsense in #ue5-general earlier from that user
Kept asking the same question 5x expecting a diff response
i mean i get it some folks just want an automatic solution that they dont have to work for
but this a isnt realistic take for making a game
making games is some serious work.. researching, teaching yourself new stuff, trying stuff and failing and trying different other stuff and also still failing
Yeah, hard to convince people of that sometimes
With today’s tech we’re trained to get that instant-gratification so anything that takes time is inconvenient, speaking from personal xp lol
uuuggggghhhhh - work
bleh
I am from the users that put time, so the Car Navigation video you shared is fcking amazin!
Im for some days implementing a type of fake AstarPathFinding, but I will check this plugin from the video
Thanks!
is there a tutorial that is purely using that plugin for a topdown type of game? or maybe just following the first part of the video is good to go?
Does anyone know how to get the size of a specific navigation mesh chunk/tile/area?
Is there any way to visualize the nav mesh in a packaged build?
If that's a non shipping build (Development Build for instance)
Open the console command
And type "Show navigation"
Does that work when you're possessing a pawn though?
I vaguely recall that's effectively the same as pressing P in the editor, and that doesn't show anything unless you detach from the pawn first
Hi , has anybody gotten the nav supported agents to work for multiple agents? My enemy is always using the agent radius and height of other agent that isn't made for him.How to assign nav agents to the actors correctly?
@misty wharf Since yesterday , I searched through many forums and tutorials and found that if we modify the agent properties for the recast nav mesh which is there in the level , it will indeed never save and On clicking play , it will come back to the default supported agent . So we have to make the nav agent with the desired properties and it will act as default since it is the only one that will be there in the list. So that new agent will be used . But the issue that still remained is that if I make multiple agents for characters of different sizes , all of them keep using the same agent which is wrong for them. Any way around this ? I have 2 enemies , one smaller and one bigger .
@wild storm I don't remember the specifics but there's some way to specify which agent type each of them should be using and there's a way to generate separate navmeshes per agent
Is there a way to avoid patterns like this?
Like I want to be walking towards the nearest enemy at all times. So I have a decorator that resets the node whenever the nearest enemy changes
and a service that continually updates it
but this node can't be entered uinless the followed target is already set, so I feel the need to make a task (A) that sets the blackboared value initially. I'd love to not run (A)
edit, probably solved my own issue but curious if someone knows more specifically:
looks like receive search start fires in a service before a downstream node actually activates?
How can i update the nav mesh in runtime?
Project settings has an option for this, it's called runtime generation or something like that in the navmesh settings
Thx
Dynamic navmesh generation. You can also do dynamic modifier only
This sounds like what you're wanting to do. You don't need to regenerate the navmesh for an obstacle that moves, you just block that part of the navmesh with a dynamic modifier that is optimised for moving
Maybe a stupid question, but I can't find how to do it:
I have an "Attack" task, but there are different parts of the BT that attack different targets. Is there a way to use the BB to pass an Actor into the Attack task instead of mimicking the target prioritisation logic from the BT in the task itself?
It seems to only allow me to pick from the scene or viewport, not sure why that would ever be useful.
Yes, passing the actor via bb key is the intended way
You need to expose that variable so you can use it from the drop-down
If you have multiple agent sizes, you do really need to set up the supported agents in the project settings. The agent radius must be > the pawn's radius.
If you have a lot of different sizes of agents, it's recommended to bucket them into things like small, med and large.
So I should set the agent radius > pawn radius in the supported agents section in the project settings and in the nav agent properties of the character as well?
Actually, my case is a bit different. The same character dynamically changes his size at runtime. Will the supported agents bind dynamically too ?? 😅🥲
There isn't 1 node that will make your AI for you. And no one is going to walk you through exactly how to make your AI.
You need to figure out exactly what behavior that you want, break it down into smaller problems and learn the systems to solve those problems.
Be careful about giving advanced ideas to people who are super new to game development and UE.
fair
I guess, "update agent props with the character collision" bool is supposed to do this but it's bugged, isn't it?
The navigation system automatically finds the best fit nav mesh based on the agent properties on the movement component. By default the radius and height are the capsule settings. The only way to change that is to either change engine source or subclass the navigation system.
Multiple supported agents will make multiple nav meshes.
No. The supported agent radius must be > the nav agent radius in the nav agent properties in the movement component. By default the latter is taken from the pawn's capsule.
You'll need to update the nav agent properties anytime you change the size at runtime.
It's just makes things harder for you. 🤣
you are absolutely right hahaha
If I remember correctly, this only happens once when the character is created.
So if we can change the nav agent properties at runtime, the correct supported agent works for them? But how do I change the nav agent properties of the character at runtime? I can't find any nodes related to that in the blueprints.That is the only final piece of the puzzle.
Oh, so that bool doesn't work at runtime.
That might need C++.
Can it surely be done in c++? Have you ever found a way to do it? Can you give me some starting steps like how do I approach this in c++?
I believe there is just a function you need to call. The easiest way to do it would be to make a blueprint function library class. In that class make a function like OnAgentSizeChanged that takes in a character.
In that function, you get the movement component of the character that was passed in. Then call the function to update the agent properties.
Wherever you change the size in BP, add a call to your new function.
I will try this when I get to work and I will update it here.
I don't have access to the source code right now, but the function might be UpdateNavAgent
I found it in the UNavMovementComponent.ccp . It seems it is not what we thought it would do.
Why do you think it's not what we thought? That function looks correct
And the NavAgentProps struct which we set in the editor is being declared as private here.
So , UpdateNavAgent() sets the NavAgentProps according to the CapsuleCollision?
BoundRadius and BoundHalfHeight means Capsule Dimesnions??
Correct
Ok , I will try that. And what if we have to manually set some numbers in there?? (I am fine if it works with the capsule for now.) And it expects to set the "Update with Owner Collision" to be true.
You can get the agent properties ref, but in my experience you want it to match the capsule.
Can we edit the source file UNavMovementComponent.Cpp itself to better access those NavAgentProps or shouldn't we touch it at all?
I don't recommend changing it unless you know how to do engine integration. There's a function to get the agent properties ref, so you don't actually need to
Ok. Getting is already fine 🙂 I was just hoping to set it. Ok I will go with the capsule dimensions. But one thing that itches me is that there is a Make Nav Agent Props struct node in the blueprints. But I don't know where it will ever go because that struct seems so useless 😆 🤣
Getting a reference means you can change it.
Wait. You are right . Let me check it.
Any struct that is exposed to BP automatically has a make function.
FORCEINLINE FNavAgentProperties& GetNavAgentPropertiesRef() { return NavAgentProps; }
It is not a reference . It is returning a Copy. Isn't it.
It's a reference.
& means it's a reference
Ohh yeah. I didn't see it. Although I know C++ syntax , I didn't practice much. 👀
I wanted to show some fix in case anybody is having Frame Drop in turnbase-TopDown-BaseOnGrid games:
I am doing a game like AdvanceWars and I wanted to share my trick so far to avoid frame drop (Players dont possess, they are only PlayerControllers, and the "pieces in the board" are Characters with "Ai Move To" logic, that are selected on leftClick). I can be around 100fps, thanks to:
-Auto destroy when no navigation
-Dynamic Modifiers Only
-Observed Paths Tick Interval is 10
I tested so far and no bugs, if somebody think it could be problematic please let me know.
anyone worked with AI and spline movement in behaviour trees?
Guys im running a state tree inside a state tree, how do i get back to the root state tree?
I have a AI behavior tree setup where once the AI sees me music starts playing but the issue is, the music does not stop playing even when the player is no longer seen by the AI. I been trying at this for hours and I simply can't figure out how to make it work. Help would be amazing.
Have you considered using a service instead?
You can place the service on the part of the tree involved in chasing, and it will trigger when that part is entered, and it has another event which can trigger when the part is exited, where you could then turn the music off
No I haven't cause I am very new to unreal and tbh have no idea how to work services lol
You can think of it as something that sits on a particular node and can do stuff when the node activates or deactivates, or ticking while it is active
So in this case, you could put the service on the sequenc called Chase Sequence, and it can activate the music when it becomes active, and stop the music when it becomes inactive
That way as long as the BT is executing nodes within the Chase Sequence, the music would remain playing
as in like this?
Yep
now what about inside the service should that be setup in any special way
It should have events you can override similar to how you override receive execute in tasks, but the ones you want are called something else, I forget exactly what but the names should be reasonably obvious and if you hover over them, it should give you a description also
I am assuming I use either the receive activation ai or receive activation
Yeah, and the deactivation one for when it no longer is active
I have it setup like this so far the music does play I just dont how to add the deactivation still
If you use spawn sound 2d instead of play, it will give you the audio component that will play the sound. You should be able to use that to turn it off later
Ok I put the spawn sound 2d instead, do I need to add another service/task to cancel the sound?
No, you can just override the receive deactivation in this one and turn it off there
how does one do that lol, I am sorry I am still learning
Same way as you overrode the other event
Something along this line, still very confused
I don't remember the exact way to turn the sound off, but if you drag from the pin in the spawn node, you can probably do it on that object and just connect it to the deactivate part