#gameplay-ai
1 messages · Page 36 of 1
Actually all I'm looking for is how to make the AI not being stuck in each other. I've been trying to make some simple movement for many AI character, still many of them that are behind get stuck 😔
any idea on how to fix the AI twitching (?
No clue. It seems to be caused because they're trying to avoid characters, but they're on both sides, so they firstly decide to go around one side, but after rotating they decide to go the other way around, and repeat it infinitely
hey guys! is there any documentation of a practical AI behavior tree and planning of implementation out there? i see that all the tutorials and docs about AI are providing that same examples every time and i find myself having really hard times understanding how to create my own AI behavior
that twitching thing happens with ai all across the board with either of the 2 avoidance systems in ue
there should be a way to fix that
Yeah, I hope so. I've seen games even on UE3 that don't have such an issue, still, I can't find much that would achieve it
@fathom sun i use a combination of RVO and Crowdfollowing
we use rvo for far away AI
have you fixed the stuttering ?
So you essentially toggle them depending on the distance from others? How do you determine it though?
thats crowd following right?
no not from other ai
but from the player
rvo is cheaper than crowd avoidance
but looks silly near the player
the twitching is caused by the big agents
and not configuring the crowd avoidance steering
Yeah, on the video I'm using crowd following
How should I configure it though? My AI capsule radius is 40, while the crowd manager's radius consideration is set to 100
AICrowdFollowComponent->SetCrowdCollisionQueryRange(150.f);
AICrowdFollowComponent->SetCrowdAnticipateTurns(true);
AICrowdFollowComponent->SetCrowdObstacleAvoidance(true);
AICrowdFollowComponent->SetCrowdSeparation(true);
AICrowdFollowComponent->SetCrowdSeparationWeight(2.f);
AICrowdFollowComponent->SetCrowdSlowdownAtGoal(true);
AICrowdFollowComponent->SetCrowdPathOptimizationRange(1000.f);
AICrowdFollowComponent->SetCrowdAvoidanceRangeMultiplier(1.f);
AICrowdFollowComponent->SetCrowdPathOffset(false);
AICrowdFollowComponent->SetCrowdRotateToVelocity(true);
AICrowdFollowComponent->SetCrowdOptimizeVisibility(true);
AICrowdFollowComponent->SetCrowdOptimizeTopology(true);
some of my base settings
we also dont update steering every frame
but this requires engine changes
btw ours is configurable
i just put in the default values here
Oh, that's the component settings, apparently those aren't exposed to details panel in BPs. I was talking about crowd settings in project settings. I'll give your setup a go
let me check ini stuff
I hope that this applies only to steering, not the whole crowd avoidance thing 😄
+AvoidanceConfig=(VelocityBias=0.500000,DesiredVelocityWeight=2.000000,CurrentVelocityWeight=0.750000,SideBiasWeight=0.750000,ImpactTimeWeight=2.500000,ImpactTimeRange=2.500000,CustomPatternIdx=255,AdaptiveDivisions=5,AdaptiveRings=2,AdaptiveDepth=1)
+AvoidanceConfig=(VelocityBias=0.500000,DesiredVelocityWeight=2.000000,CurrentVelocityWeight=0.750000,SideBiasWeight=0.750000,ImpactTimeWeight=2.500000,ImpactTimeRange=2.500000,CustomPatternIdx=255,AdaptiveDivisions=8,AdaptiveRings=5,AdaptiveDepth=1)
+AvoidanceConfig=(VelocityBias=0.500000,DesiredVelocityWeight=2.000000,CurrentVelocityWeight=0.750000,SideBiasWeight=0.200000,ImpactTimeWeight=2.500000,ImpactTimeRange=2.500000,CustomPatternIdx=255,AdaptiveDivisions=7,AdaptiveRings=2,AdaptiveDepth=3)
+AvoidanceConfig=(VelocityBias=0.500000,DesiredVelocityWeight=2.000000,CurrentVelocityWeight=0.750000,SideBiasWeight=0.750000,ImpactTimeWeight=2.500000,ImpactTimeRange=2.500000,CustomPatternIdx=255,AdaptiveDivisions=7,AdaptiveRings=3,AdaptiveDepth=3)
MaxAgents=300
MaxAgentRadius=50.000000
MaxAvoidedAgents=8
MaxAvoidedWalls=2
NavmeshCheckInterval=1.000000
PathOptimizationInterval=0.500000
SeparationDirClamp=-1.000000
PathOffsetRadiusMultiplier=1.000000
bResolveCollisions=False
AvoidanceTick=0.125000```
AvoidanceTick=0.125000 is our custom tick speed
ah
its not steering
we do thje step avoidance
{
LastTickTime = CurrentTime;
SCOPE_CYCLE_COUNTER(STAT_AI_Crowd_StepAvoidanceTime);
DetourCrowd->updateStepAvoidance(AvoidanceDeltaTime, DetourAgentDebug);
}```
I'll give it a go
const bool bUpdateAvoidance = CurrentTime - LastTickTime > AvoidanceTick;
const float AvoidanceDeltaTime = CurrentTime - LastTickTime;```
if your modifying the engine
its UCrowdManager::Tick()
this fixed the twitching
and boosted performance
saved around .2ms for 100 ai on avoidance
btw avoidance isnt perfect
if they are all coming from the same direction to the same point
then they will eventually clump up
we dont send them direct to the player
but instead we produce a donut around the player
once they are near the donut point, then they push to the player
That's interesting
we try to disperse them around the donut, but always choose a point in the rough direction they are coming from
else it looks weird if they take some weird path
So, I've tried to use exactly your setup, and it got worse 😔 Now they form like a line they're stuck in. Like that
yes
but these are base
you now tweak them
(which i recommend you expose these in your custom AI bp
so you can tweak and play in editor
do they still twitch
What settings should I be tweaking though? Or should I just try all of them?
Sadly, yes
I cannot find this in the unreal source
?
CrowdFollowingComponent.h
thanks
is this meant to go here (?
yes
UPROPERTY(config, EditAnywhere, Category = Config)
float AvoidanceTick = .25f;
float LastTickTime = -1.f;```
we customized it ofc
to .125
it still jitters, does it need any other changes ?
Are you sure that it has been compiled into the engine even?
yeah
is it working for you already ?
Nope 😔
I'm wondering how it's going to work using a random point on a donut around the target rather than the target itself as a destionation point
should I try mass AI avoidance (?
No clue how it works 😔 Try to investigate perhaps
Is there a way to set the timeout for AI Move TO specifically before Blocked triggers? Right now my chars are walking in place for 2-3 seconds before Blocked gets triggered
Check the path following component. It has some values that you can adjust. It might be C++ only though
Most games use BTs, for good or ill. FSM are fine for simple behavior, but because the transition logic is within each state, the complexity explodes exponentially the more states that you add.
Gotcha, that makes sense then, because my AI is usually simplistic so it never encounters that problem
When would it be a bad idea to use BT?
When one of the other architectures would work better. It depends on a lot of different factors.
Not really, just the most common. Fighting games are typically FSMs, because they don't have a lot of states. Other games makes sense to use Utility. Then you have hybrids.
There's a pinned GDC talk that goes into picking the right architecture if you want to learn more. Flame retardant AI is the name of the talk.
Would anyone have any idea as to why the AI aren't stopping exactly where they should (the red arrows)? I have made sure that the RVO Avoidance isn't the issue, the move to location or actor node does not accept partial paths, and the acceptance radius is set to 0.
The red arrows are the debug showcasing that the math is calculated correctly. At this point I am running out of solutions to try.
All of them also clearly report that they have reached the location they were given in the blackboard
Perhaps an even cleaner example:
Ah, the stop on overlap setting was the issue 🙃
Stop on overlap was set to default (which is yes), meaning as soon as the AI capsulecomponent reached the move to location by its edge, it would succeed. Turning it off allowed all the ai's to keep going to the exact location.
Is there an advantage to using runbehaviordynamic besides it being dynamic 😂
Oooo and tag injection so maybe nm cause I just answered my own question
hey guys! is there any documentation of a practical AI behavior tree and planning of implementation out there? i see that all the tutorials and docs about AI are providing that same examples every time and i find myself having really hard times understanding how to create my own AI behavior
Did you watch the vid in the 3rd pinned link?
why does it say it's aborted but still going to the location??
is it a bad idea to have one main service ticking on the "root" selector to detect all sensed actors, sort them by how they were sensed, then escalate behavior approtiately? All logic in one tick function that bypasses checks if possible. I hope this is a good idea lmao
no more EQS on the sensed actors. It just pools them by priority, then selects a random one from the priotized pools. Usually there would really only be one or two actors in each pool on a given tick
BTW this is coming up in like ten minutes Livestream channel 3
trying to figure out how to get enums from the actor as a compare but it throws a red triangle.
i tried getting it from the context actor and from an evaluator that saves it to and output variable as enum.
but this state tree any enum eludes me
I am living in the future it's not noon yet lmao time to put away my lunch shhh u didn't see nothin
so my ai move to is always aborted, like everytime i try, the second one works fine but when i try to use it again, then it doesn't work, there maybe something wrong with the function for the first move to but i don't know
did you check that all valids are valid?
Use the Gameplay (AI) Debugger and Visual Logger to find out what’s happening
Yes and this is the basics as far as I’m feeling it, I’m trying to create more complex Ai and that’s where my level of understanding is limited….
i don't know what's going on
I really hope they come out with a new Learning Agent course that is more in-depth. I made a single change to theirs and it imediately fixed the issue I had with them all wanting to drive backwards
It says user abort, new request. Are you calling it twice or something ?
Well it entirely depends on your definition of more complex AI, if you have a specific problem, ask in here, someone might know
Btw to fix the issue with them driving in reverse I just added a conditional reward that rewards them if their velocity is > 0
I guess that the things I still cannot figure out is creating my own stuff.
I get the meaning and use cases of tasks, it’s pretty simple. But decorators, services, the abortion, the correct logic of the eqs and its checks to create the necessary path for the ai, this are the things I cannot understand alone.
And following a tutorial is fine, but the deeper understanding of that is what I’m looking for. Currently my player side of events actions mechanics and everything in that side is pretty fine, Ai tho 😪😪😪
I honestly watched that video several times and applied things in practice to get the gist of all of those things you mentioned. With help from some of the legends here too 🙂
Hello, i need an EQS to generate some points around an actor that i have on a BB.
i've been told to use a context to "pass" the bb actor to the eqs. but im really struggling.
some ppl say doing that is not good https://forums.unrealengine.com/t/how-to-make-a-uenvquerycontext-that-allows-you-to-pull-data-from-the-blackboard/361240
can someone help me?
ive seen this question asked here but no answer beyond "make a context" #gameplay-ai message
it seems unreal doesnt really allow you to specify parameters on a context, do i need to hardcode the bbkey and such?
i tried with query params which seems almost ideal, BUT, that field doesnt have a bind option (generate around). im confused how to connect these systems.
well, it seems i found a way. here's for posterity: https://forums.unrealengine.com/t/right-way-of-passing-parameters-to-eqs-after-running-it-from-run-eqsquery-node/473470/2?u=nande
putting this here since is the 1st thread i found, and found nothing else to help. i really really wish epic could improve this. apparently there are two ways (at least). binding a property to a query param. then setting the query param on the behavior tree. this seems ideal but not all properties allows binding. (looking at you generate aro...
I'm a bit confused about the behavior of this Simple Parallel node
I know the right side will get aborted once the main task is done, but it seems to never get called at all even though the main task is actively running
The main task "fails" for a few frames, which should reset the tree, but shouldn't the right task also get re-executed each time?
Did you set the breakpoint that the right one was truly not get called?
And would you like to show the whole BT graph?
Yes, the right one is definitely not getting called (I did set a breakpoint)
Hello there, I'm new to Unreal and I have some questions about AI.
I'm trying to make an enemy for my game. I want them to chase the player, switch to an encircling logic when they get near enough, get stunned when attacked, and attack when the enemy manager tells them to attack. I also need this to be inheritable so I can have different enemy types.
What engine features should I use to implement this? In other engines I would do a custom FSM implementation and just use that, but I'm not sure if Unreal has it's own way of doing things. I've been looking into behavior trees but I'm not convinced that it is what I need. For example this post is saying that I shouldn't jump between branches. Does that mean that behavior trees are not suitable for something like a stun state? Should I be using StateTree instead? The documentation says that it's an experimental feature and that I shouldn't use it in production. What am I missing here?
For example this post is saying that I shouldn't jump between branches
I wrote that post
Problem with BTs since you manage the control flow by prioritizing, sometimes abstracting away states into prioritizations with decorators get difficult. And most common pitfall starters fall is trying to bruteforce their way into jumping to desired node in BT - which then you abuse how BTs are meant to be used
For things like getting stunned I usually handle this outside of the BT by temporarily disabling or locking braincomponent from AIController and enable it back once stun effect is removed. Using GAS also helps here a bit
But depending on the case you can prefer to keep this on BT too, but since you mentioned this happens everytime AI gets attacked this is more like a "responstion" or "reaction" to an event rather than a "behavior" that should be prioritized so I wouldnt want this to be on BT personally
StateTree could be used for this but it's not a complete FSM solution either, I didnt find it convenient enough. Its also buggy af
Yeah I'm getting more and more convinced BT is not what I need. I also need special cases where enemies shouldn't get stunned so just disabling the whole controller is not ideal.
I think I'll give StateTree a try since I'm not expecting any complex behavior from it, just a way to switch between states. If it doesn't work well I might just write my own FSM in C++ and extend it with blueprints.
Thanks for the reply
Was it possible to change the NavArea Class of a NavModifierComponent runtime?
I can see the color change of the NavMesh during Editor but not during runtime
Ah I didn't enable runtime stuff I think
Yap that was it, nvm me
if you're fine with limited functionlities or willing to pay for pro version check LogicDriver out - but for this specific case just disabling AI on damage callback and enabling again seems more than sufficient tbh, since your description seems suitable for BT already
But then what if, let's say I don't want the enemies to be stunned while they are attacking? These workarounds feel dirty.
read this
I'm stacking BTs/tasks/other and adding another layer of behavior deciding to smoothly solve this
What's the deal with Nav Paths going from "EndLocation" to "After the NavArea"?
I generate Paths from the current Agent Location to some End Location.
If there is no NavArea in between it properly generates a Path from Start to End, with Index 0 being Start and n-1 being End.
If there is a NavArea (Cost 0) in between it generates a Path from End to "After the NavArea", with Index 0 being End and n-1 being "After the NavArea".
Am I missing some setting?
Path with no NavArea in between
Path with NavArea (green) in between
Start Point is the same as the first image, so should be on the left side.
FPathFindingQuery Query(NavMeshSubsystem, *NavData, NavAgentLocation, TargetLocation);
Hm, the also seems to have to do with the length of the path
Made a small test actor to generate the path
It seems to break as soon a I reach a specific Nav Poly
Tried with custom Query Filter, same result. If I exclude my Area (so they can't use it) it will generate a path over a different part of the map, which is even longer, and that one works fine.
I'm smelling an Engine bug
Hey i'm spawning a lot of same AI in a map but only the 50 first of them fire the behavior tree, does anybody knows why ?
Has anybody dealt with issues with AI losing connection to navigation when using World Partition? I have a 1.5X4 map and when I go from one side to another the AI enemies work, but on the way back, the AI will only attack if you get close; they stop moving/patrolling). Appreciate any help!
I hope that eventually they add a Graph for the Learning Agent logs so that you can visualize them on a chart.
How can I tell when an AI has reached it's destination when using State Tree? I can't figure it out. I tried to use the AI MoveTo node, but it doesn't exist in functions.
It feels like I'm missing something
The "Move To Location or Actor" node is probably better to use if you want any kind of custom functionality.
Alternatively, you could use the blackboard move to task, that will handle arriving or not arriving automatically
If anyone is familiar with the Detour crowd avoidance system, do you know if the only way to make use of it is to create child bp's off the standard class in bp? Or is there a hidden checkbox under a different name?
Alright, this seems to be the case. Thank god that you can reparent bp's quite easily, otherwise this would have been way more effort
Unfortunately that node is a child of AI MoveTo and also cannot be used in functions.
May I ask why you are trying to use it within a function? Are you using Behaviour Tree tasks to make the move to logic, or are you doing it directly in the pawn bp?
I'm using State Tree tasks, not Behaviour Trees
Ah I see, this is something I have never worked with as it is also an experimental feature at the moment. Sorry about that 😊
No problem. Also, I believe they are no longer experimental but may be wrong
Yea could definitely be. The documentation still says experimental, but we all know the state of the UE documentation 😅
Just looking at your question again though, and reading up on state trees. You should be able to use an evaluator (which runs every frame) to check whether the AI has arrived at your specified move to location
If it is, then you could activate a transition to move to the next state
is it ok if I refer to my behavior trees as behavior logic trees so that I can call them blts? Goo ok so finally I got my blt workin on a basic level lmao. I think I am ticking too much in one service... or my MeatHuman NPC are clustering.
I think so, you should be able to test
ok, so im stuck here. THis wasnt an issue with my first enemy, only the copies.
It’s saying they’re not on the mesh
well. its an issue for my first enemy too now. it seems my mesh is busted
Try removing the mesh and adding it again
Also, just to make sure, your enemies don’t have can ever affect navigation on, right?
That’s good
ok, well now P properly shows that no mesh is even being generated
but I have no idea why
Restart your engine for sanity check
ok
idk if you saw but my lighting build failed horribly. is there anything about having the engine open for hours on end breaking things?
Does anyone have a good suggestion on lifecycle methods to use for UBTService instances? I was using OnBecameRelevant and OnCeaseRelevant to bind a listener, but am having doubts based on delegate adding related crashes I'm seeing
Unless perhaps I'm not able to bind delegate methods in a service?
Usually fixed by restarts
neight were fixed by restarts 🙃
Try building paths, not sure what’s wrong with your navmesh there
Maybe make sure it’s at 0,0,0, I think I’ve seen people break it that way
so should I move my whole level to fix this? or just make it bigger?
the whole level is offset from 0,0,0,
this didnt help either issue sadly
Idk tbh, odd that your navmesh just broke. Maybe try to retrace your steps before it stopped working
it worked one time
i did a lot lol
wait
That looks like it’s working
can it only see the player when theyre NOT on the mesh????
Sounds like opposite to what’s supposed to happen. Is the player affecting nav? Also are you using pawn sensing instead of AI perception ?
oh no
yes
im using pawn sensing
stupid tutorials bro
time to switch to AI perception
Are we able to use delegates in services or are there multi-threading considerations?
I’m not certain that’s the actual issue but perception replaced pawn sensing so yeah
ok we'll see
i think the reason pawn sensing was used is bc it AI Perception is meant for behavior trees?
alright, i made the switch and it works, its just time to figure out why they cant move
Prly just an old tutorial
so I started from the ground up using an AI system instead. The new enemy only has the code to move to the player, but cant. So the only thing that can be wrong is the nav mesh
aww man
i cant even save my level now
it works on the base level, but not on my new level
You should be able to use a delegate in a service.
It was so odd. I kept crashing around unsafe access exceptions in those initial methods.
I tried putting the bind into on tick, with a guard to only add it once... and it works.
What are the chances that the delegate adding fails because it's all running too early in the AI characters life cycle?
I'm pulling the delegate from an actor component on the ai
Unlikely to be happening too early.
It's my first experience with BT in general and was working on pre-spawned characters, but crashes when I try to spawn them into the world
It has me thinking I'm approaching the problem wrong.
Is a service a good place to put logic which updates a BlackBoard based on a delegate callback? Is this better suited to live in an AI controller or another construct?
It kinda depends on how you want it to work I think
Services can be used for that, but sometimes you need to wait for it before moving onto the next task. I think in cases like that, a task node may work better, since you can actually have it only finish after the delegate has fired
Why is ai move to returning "aborted" yet my AI seems to move to the location perfectly fine?
It works, but the engine is telling me it's not?
Is this just an engine bug I can ignore or what's up?
Does it return the same result if you plug an actual location into the destination?
Yes
Tried both location and actor, same result
My AI moves though
Like, visually speaking I don't see any issues tbh
But the abort error is bothering me
I feel like something isn't working as intended
Yea that is strange, if you ask the AI to move to multiple locations one after another, does it consistently produce the same result too?
Yeah afaik it does
That is strange. I suppose as long as the functionality works as it should, you could cautiously move forward. I do wonder what happens if you attach the print string to on success, and then see what the movement result outputs
Prly not an engine bug, assume it’s something you did, but end the assumptions there. Use Visual Logger to find out what’s happening
You might be calling the move twice
I’ve seen someone have that show up in their log when presented with this issue
Yeah indeed I think it's constantly retriggereing the move to node
Which then would make sense that it aborts, because a new move to is requested so it aborts the old one
Yeah pretty sure this is the problem 🙂
how do I fix the issue where the ai perception can see their target through backface culling?
currently "TwoSided" is disabled
In this case I'm listening for a health change delegate, that lives on an actor component of the ai, which writes the updated health % to the black board. Service feels appropriate since I'm not waiting for anything...
It's just puzzling why I'm getting access exception crashes when calling AddDynamic on it. It doesn't happen if the AI is already spawned when the game starts, only after new ones spawn in.
I'm starting the behavior tree from the ai controller's begin gameplay method
I don't remember for sure but BeginPlay might be sometimes called before the AI controller takes possession of a pawn
A service is not a bad place for that. You need to debug why it's crashing.
Hmmm ok that sounds interesting. Do you have any recommendations on a good place to put the BT start?
There is your problem. Do no start the BT in begin play. You need to start it on possess.
Aha
You need to wait to start it until possession so that you have a pawn.
iirc the way I have it set up is that I have a function to start it, and it gets called both from begin play and possess
Ok sweet I'll try that out later today when I'm back at my computer, but I think it's all making sense
and the function just checks that both the begin play has occurred and there is a possessed pawn
Also, if you are crashing in your BT nodes when you don't yet have a pawn, then you aren't checking your pointers.
In this case I have guards around all the pointers I'm accessing
Or at least I thought that I did, pretty sure I checked that
Well I just figured out you can't add Observations to a training model without reseting the Neural Network Data Asset. Apparently they haven't added the ability to Transfer weights yet.
I'm just assuming that's a common practice in training Ai models becaue CoPilot seemed to believe that I could Transfer the weights to a new model with more input nodes
But after investigating it's claims there didn't seem to be any way to do that in Unreal
o.o Copilot pulling a ChatGPT
Yeah, but they are useful if your familiar with their antics. I wouldn't have figured out that adding observation to the training model would require me to start training over if It hadn't given me enough information to go on.
Yeah, Copilot can be a useful assistant
The error it was giving me wasn't even related to the correct BP, it was pointing me to another one lol
Yeah, as long as you understand it gets confused easily
It's really good at finding stuff though. It helped me find a video that didn't pull up in any of my Learning Agent searches on YouTube for some reason
Here is the guys channel in case anyone else wants to look into Learning Agents: https://www.youtube.com/@swordclimber
He has 2 videos on it, the only source for Imitation Learning I have found
Is this for a companion type of AI?
He is training his too block sword attacks in his game
But Learning Agents are specifically for NPCs
They have quite the learning curve though, the Epic Games tutorial doesn't go into enough detail in my opinion.
But I understand they are only teaching people to use it, I'm assuming with the assumption they have experience training Ai models
You don’t always want your AI to be super smart either, so prly less popular
Yeah, if it's too good it makes the game too difficult.
Something like driving a vehicle would probably make sense though
I've been trying to train it to drive and man does that take a while, the Epic Tutorial said it will only take 2 hours but using their setup it never seems to figure out how to steer
or maintain consistent throttle or steering. It seems to be just randomly trying stuff without ever picking up on anything
I managed to get it to maintain the throttle for long enough to reach 40 just before stomping on the brake though lol
I have to reward it for maintaining it's gear at or higher then 1 though
If it's current gear is equal or higher then it's last gear, I reward it
Before adding that the best I could do was crash the engine after training it for 1.5 - 2 hours or if I trained it about 1 hour at a time I was able to get it to roll backwards at 1-5 mph until it rolled off the track lol
So Idk why they say it should be fully trained after 2 hours, because from what I've seen that's a very un-realistic number
Yeah I can see how that would be necessary here
@uneven cloud @misty wharf Thanks so much, it was definitely because I was starting the BT in BeginPlay instead of the OnPossess.
Now that my service works - I have a question regarding the safety of holding on to references inside of them. The service itself is set to instance, I have the delegate working great - since I need an instance of the blackboard and ai pawn (which I save inOnInstanceCreated OwnerComp and clear in OnInstanceDestroyed - I presume there shouldn't be any issues with holding references?
Those are so easy to get that it's unnecessary to hold onto
yeah
Sweet, I see in BTService_BluePrintBase.cpp they have something like UBehaviorTreeComponent* OwnerComp = Cast<UBehaviorTreeComponent>(GetOuter()); which seems to work. Wouldn't have figured that out otherwise since it's such a weird syntax but it works so 
damn this interests me a ton. Do you give it any idea beforehand about how to approach the track? Could you cut out a lot of the learning time by giving it a race line to try and hit? Or does it already have a race line?
Because if u train it on a known race line, then it can maybe try and adapt that approach to new tracks?
I mean sure it is interesting to try and teach it from the ground up but who's got time for that? lmao
Yeah, that's a likely approach. I was looking around and it's common practice to try them out on simple tasks and then work them up to more advanced ones
Just having it hit the race line at any speed will be learning enough for it
So it's fairly likely that If I start them off on a simple track that it would be much more likely to pickup on it. Might be something I break down and test out this weekend
trying to figure out that racing line is too next level
it should do that AFTER it is trained
lik put a spline and highly reward it for staying on it
Yeah, the Episodes though are fairly short. It trains all 32 of the cars at once for about 10 seconds or so and then resets it and starts over
every time weighting stuff. The longer the episodes the more resources are required and the longer it takes to train
can u link me the epic tutorial/docs u used?
Yeah sure give me a sec
so are you training 32 cars at once on the track colliding with one another?
thank you
They walk you through disabling collision with other vehicles
to simplify the training
lol
oh i see so it is 32 agents to reduce training time
yeah the more agents the faster
gotcha I was like oh fuck no
u can't try and train them all hittin each other
lmao
that would be WILD
I could probably add more without crashing but idk
You could, but the course aims to simplify the tutorial as much as possible
haha yeah I know I just mean woah
Honestly they probably should have started off with something simpler
I mean I guess it is cool for the AI to do it in the ML way
I wouldn't think so....getting the handle on training and setting this stuff up is difficult enough
the easier the better for beginners
but like in real life and other systems it is easy for biological organisms and algorithms to pathfind lmao
doing it in a natural manner tho would be neat
like not borign straight lines
Yeah, reinforment learning is pretty old though. I think it was first successfully used in the 90's
it would actually be really cool to somehow train the agents to walk in patterns that seem more human
I'm sure you can. The learning agent plugin supports reinforcement learning and imitation learning
that YouTube page I linked earlier touches on the Imitation Learning side
he has a 45 minute video on what he did and how he set his up
I wouldn't recommend that until you've followed the Epic Guide though
Yeah np, and good luck
i am too busy with a game idea lmao I am sharing this with my brother who is looking for a project and is into this on an academic level
don't think he has used UE like this before tho
Btw leave feedback on your experience in the forums https://forums.unrealengine.com/t/course-learning-agents-getting-started/1283836
Get familiar with Learning Agents: a machine learning plugin for AI bots. Learning Agents allows you to train your NPCs via reinforcement & imitation learning. It can be used to create game-playing agents, physics-based animations, automated QA bots, and much more! https://dev.epicgames.com/community/learning/courses/M3D/unreal-engine-learning-...
The more attention this gets the more likely it will be that they improve and update it
Ah I see
can u take the trained AI and use it in a game or is that ridiculous?
It's setup for that yes
how does the resulting data look? how does it move the npc?
You just have to make a slight alteration to the training manager after your satisfied with it
the results are stored in a Data Asset
you switch over to Inference when you want to test it or use it in the game
can it be called from a behaviour tree? lmao
The guy in that video I listed does that yes
ok this is wild lmao
He trained his to block attack from different angles
do u think it is feasible to have like 64 agents goin all at once?
for a multiplayer scenario server runnin all the bots for clients
Possibly, I only use about 50% of my 3090 utilization
in-game probably
is the inferencing gpu nased? right
that makes sense I am an idiot
I was thinking cpu
training will be significantly heavier
this is great actually a way to use the gpu for npc
right yes I meant afterwards
inference will simply run the data through, training is more intensive
keeping Observations to a minimal will make it less intensive, but you can also control the number of nodes used too. By default it's 128 I think
Yeah it is
The training doesn't happen in Unreal
wow
It passes it off to Python
I bet the performance could be better then
I'm not 100% it's specifically using Pytorch but it's likely
i've heard of some ML projects making c++ native spin offs that use no pytorch and they are very fast
Yeah, Python isn't efficient
whisper c++ for example
Yeah, but the actual Inference in-game will be running on C++
only the training will be in Python
yeah
Hey guys, I would love some help on this issue. Been stuck for a while.
I have been trying to set up a simple jump/lunge attack for an ai. Thus far I have been using LaunchCharacter and it has been working, but I want to increase the speed of the lunge without the character way over shooting the target.
Is there a better built in function for this in game? Essentially having an AI get player position then jump to that position. I was thinking of alternatively having it just use a transform and a lerp to get it there while having the animation convey the actual jump motion but then I run into issues of what if the player is behind cover.
My level geometry also isnt flat, there are hills ,bumps, and stairs; LaunchCharacter can help clear these obstacles or bounce off them, but the transform will just cause it to phase through hills and such.
I almost feel stupid for spending so long getting a regular BT working but lmao I doubt I can just plug and ply some trained agents into the game. WIll take work
It's called Motion Warping
At least that's one possibility
You can use them on behavior trees, I don't think it's that difficult
Yeah I know but just things are moving so fast with ML it feels so weird to not be using it but then there is always a double edge sword
Like I said the guy in that video only uses it for 2 different things and he is firing them from a Behavior tree
gotta find that link
I haven't watched the full video
https://www.youtube.com/watch?v=NwYUNlFvajQ @unborn sphinx
Learn how to use the new Learning Agents Plugin to do real time reinforcement and imitation learning and see how I am using this in Swordai: https://store.steampowered.com/app/2321890/Swordai/, my upcoming multiplayer slasher.
This video assumes you are familiar with the Learning To Drive tutorial from epic here: https://dev.epicgames.com/commu...
He made a follow up video to that one too
make sure to like and subscribe to his channel, he has the only video covering It I believe
Motion Warping essentially conveys movement through animation montages yeah?
You set it up on an Animation Montage, but you drive it from the Blueprint
you have to set it up for it in the blueprint I mean
like the variables have to be set from there such as the position of the target
Wouldn't this run into the same issue as transformation where if there is a wall or a hill then the ai would phase through it or slide against it until it reaches its target?
ML is too much of a black box to give good and tunable NPC behavior.
That would be my first instinct. And now that I have spent a few weeks working out my own BT from scratch it is starting to give fantastic results. Don't see the need for ML at this point really. But it will be neat to play with to see how it could be used.
When should I split a BT into two? I am using it for opposing teams, and decorating certain sequences or parts of sequences away from one team. Most of the other behavior is generally shared. When do I split them into separate trees? I feel like it's less work having them all on one and catching the few differences
I guess when I feel like it is more working maintaining the different behavior needs than it would be maintaining the shared behavior changes across them hmmm
I guess at the point I would just make subset trees that I can run based on team
Same as when you normally would break things down into functions so you can reuse them and avoid repeating yourself
No Motion warping won't ignore collision
You will need to perform you own calculations though, tracing for obstacles.
Nothing in Unreal is Automated, everything requires a setup and extra logic
Maybe not on a large scale but I think it's worth learning how Ai works and becoming familiar with it since it's on the rise and I'm sure if your creative enough you could come up with some decision behavior that makes good use of it.
This Learning Agent plugin isn't designed to replace behavior trees by any means, it actually works with behavior trees and can be used as a leaf on it.
It could be fun to take just like the bare bones lyra starter game and train the bots. They are pretty rudimentary as is so u miiight have to do some basic bt work but it would be wild as a test setting
Or like wat if u could train an agent to select the correct behavior tree to run... 😐
Is there any decent combat AI tutorials out there because im seriously at a mental cap. im exhausting myself trying to make my own AI. learning nothing from it either 🙂
is there a way to make an EQS trace ignore the querier that owns it?
my whole system has just fallen apart with that single omission of what I thought was a universal feature
What are the needs for your game? I just figured out some cool combat/patrol/civilian behavior tree and I don't mind sharing what I learned lmao.
I mostly need melee combat ai to challenge a first person melee game play. My struggles have mostly been with state tree and mental fatigue or burn out related to reverse engineer it with progress
what drew you to use state tree?
Appeared cleaner to approach. Also I was afraid BT would be deprecated soon (my mistake)
I'll go with BT and take extra care to formulate broad actions via the subroutines
Next week
Just forgetting ST will ease my mind
Good call. See what you can accomplish using BT and then maybe adapt that approach to ST if it feels right.
please help
Hello, I want to create a Zombie Horde System in Blueprints. So basically I want Zombies to move together in a specific direction. My first thought was:
If 2 Zombies are in a specific range to each other, one of them gets assigned the group/horde leader, and the other zombie follows him. That would work if there's only a small amount of zombies in that specific range. Theres many edge cases I don't currently know how to solve, like what if there's a constellation like this one in the image. If Z2 is in the range of Z1 and Z3 the "Who gets the group/horde leader role" decision would happen twice, if Z2 gets the group leader role in both cases, everything would be fine, but if Z1 and Z3 get the group leader role, then who would Z2 follow?
So I wanted to ask are there any approaches you guys would recommend me for a zombie horde system?
The decision would even have to be made three times since Z2 is also in the range of Z3 😄
Has anyone encountered a bug where in the editor itself, when you start a game NPCs walk on the navmesh just fine, but after shipping the game and playing it outside the editor, they all stand stuck in place?
yes the navmesh can be problematic to build and save. I have found that I have to manually build paths, save the level, then it will work. The paths will be built automatically every time in editor but they don't always get saved. OFPA can complicate this too.
Pretty sure I told you what to try already
But maybe you need to be using smart objects
You want a manager to make those decisions, not the individual zombies. How you handle it depends on the behavior you want. Do you want Z2 to become the leader of Z1 and Z3?
To say ML for game AI is on the rise is incorrect. The vast majority of attempts have led to failure and research on the topic tends to find that player experience is diminished. There may well be potential in this area and one day perhaps paradigms will shift, but nothing yet suggests that will be the case and brave pioneers should be experts in the area.
You seem to have a fundamental misunderstanding of how BTs and decorators work. You have a decorator for a blackboard value that is changed via a task beneath it. This is not going to give you the behavior you are looking for.
ML isn't new. There have been a few interesting use cases for it in games, but not enough for wide spread adoption. Primarily because of the inability to tune the behavior to create player experiences.
the AI just wants to demolish the player 😄
on a side note, just wanted to take a moment to appreciate the irony that a user named @slow sphinx is trying to make an AI that uses ML
My main roadblocks have been the actual computing costs of running ML being prohitibitive, especially when games already want to capitalize on your entire GPU
Behaviour shaping is very fixable, but making it cheap is something that we're still struggling with in the community
There's the extra problem that if your network has a latency of like 400MS to calculate, you end up also being very restricted in application
Yeah, so depending on how close zombies are to each other, one of them always has to be the leader, if a horde comes by one single zombie, he should automatically be "picked up" by the leader, so he follows him around.
I wanna add stuff like a small chance that a zombie doesnt follow his leader around anymore after some time, so the horde will get smaller as time passes, but thats something else.
No one has yet solved the problem of ML being a blackbox where you can't craft a specific player experience. Cost doesn't matter when you can't get the behavior you are actually looking for.
As a general statement that's just not true, ML is a function aproximator and you can easily converge the behaviour
Large network convergence causes mode collapse so in larger networks the bias-variance tradeoff for convergence and modality is a craftable thing but it's "solvable" with enough time
The idea that ML is a black box is mostly just romanticization
You have real world examples of this being successfully used in a game ?
There's a stanford project using a giant language model that is pretty cool, but in my cases the cost is easily the most limiting factor
Should I repeat the question ?
I've seen what ML researchers consider tunable behavior. They clearly have never worked with a designer.
The question is if it's successfully used in a game, stanford has a game that's using a giant language model yeah
It's turn based and everything is done via a massive server
What’s it called
the cost isin't practical for real games right now imo
How much is it?
Oh, so not a real game gotcha
Well depending on your definition of a real game
It's playable
You just walk around talking to NPCs and they have dialogue with eachother and you
I don't think it's practical to use ML for games either right now for large networks
That's not a real game. LLMs being used in games is unlikely to happen, because you want to control the narrative.
You want to control the narrative, some people want interesting free expression and dynamic stories
different applications
it's unfortunate but smart AI != fun game. The goal is to make AI that seems smart
otherwise you end up having to do what TLOU did and roll it back
it's not dissimilar to most things that "make sense" IRL but in game development they're trickier
Yeah I think the applications of AI for the short term will mostly be difficult to simulate decision making and cost tradeoffs, maybe also dialogue but that's so expensive it seems unreasonable right now
things you can do cheaply and don't have a huge scope
what we need is ML for our own brains first, then we can maybe design smarter AI 😄
The goal of combat AI is to make the player feel like they are ABOUT to lose, but can actually win.
What spell to cast, for example, is a pretty approachable problem that is something realistic to do right now based on some point cloud data, a few spells, and some metadata about surrounding npcs
but like the full EA dynamic combatant simulation seems yeah, totally nuts
took me forever to dig up, here's the game https://www.convex.dev/ai-town
A virtual town where AI characters live, chat and socialize
it's something xD
https://github.com/a16z-infra/AI-town it's a pretty interesting project
Designers want to control the narrative. There are a number of examples of ML being used, but they don't add to the player experience outside of being novel. AI Dungeon is interesting at first, but gets boring really quickly.
There's room for both things surely, and AI is a big thing with many possible avenues for applications
I wonder if ML could be used for small tasks like just walking to a goal. The minutia of it, how a human veers off course but still does find the desired path
Much easier to just use nav costs, see GDC on Death Stranding
can u add noise to those costs?
like different for each calculation?
but that still relies on dense nav mesh right? what about smaller deviations?
does the cost typically alter the movement speed dynamically?
Imagine an MLMoveTo node all it does is use a trained... uh... floating point magic box... to move along the typical found path. Like it's not doing pathfinding, just path altering.
Maybe, tho that might be handled by the phys material, but the cost is there for the AI to decide to go around it, path of least resistance, if it can
That post-mortem is worth a watch
yes, the cost of a nav poly alters the CMC movement speed?
or is typically set up that way?
It's really hard to structure these kinds of networks, and then it ends up just being a much more expensive A* usually
Back to normal stuff: what would be the difference between an EQS generator returning an actor vs the actor's location vector, when using the result for a test in an eqs query.
Shoul I just use the location? Will it not work if I test against an actor context vs a vector context for distance?
I could just try it but I always like to know what the right approach is regardless if whether something seems to work or not
???
Could you please quote me where I said 'ML for game AI' is on the rise? because I looked for where I said that and I'm not seeing it. Also, @uneven cloud could you quote where I said it was new? Because the only thing I could find was a reference to me saying that Reinforcement Learning was first successfully used (referring to games) back in like the 90's. After doing a quick search I see that was actually the 80's, but you could say the early 50's if you count that maze (Marvin Minsky).
But hey if you guys have a problem with it take it up with Epic Games, they are the ones that added it not me. I'm just experimenting with it and personally I don't see anything wrong with that.
What I do see a problem with is people openly trying to discourage the use of Ai. They are fighting a losing battle. Ai is inevitable.
I also never said that using it in a game was a great idea. I did mention that if your creative you might be able to find some use cases where it makes sense though
Also, @oblique basin what I said was that Ai is on the rise and that it's worth becoming familiar with how it works. I never referenced Machine Learning, or specifically said "Machine Learning is on the rise specifically for games and so everyone should jump on it"......Such a statement was never made
The difference being that one returns an actor and one returns a vector. Which one you need depends on what you use it for. Using it for a context for a distance check, it doesn't matter.
When I said Ai is on the rise I'm talking about next level stuff like what Nvidia is working on.
https://youtu.be/8oIQy6fxfCA?si=F3NdjJT14r02KVUO
With adversarial reinforcement learning, physically simulated characters can be developed that automatically synthesize lifelike and responsive behaviors.
A character is first trained to perform complex motor skills by imitating human motion data. Once the character has acquired a rich repertoire of skills, it can reuse those skills to perform...
And that demo was released a year ago
Lol, yeah I'm really just experimenting with it. I think it's a good way to become familiar with how Ai works. You really have to approach training it in a different way. I'm sure there will be more advanced methods later down the road, perhaps far more user-friendly.
Is it the best practice to put all the detailed attack logic for enemies inside a custom Task or to put it into the enemy actor's blueprint and just use the task as a way to start the event inside the Actor blueprint? Eg this:
Is it better to test pathfinding length from querier to generated items (from custom generator, gathering all actors of class with custom logic) or from those same actors/locations provided as context and testing path from context to querier? Lyra seems to do the context to querier method. Is there a reason?
Build paths manually? How does one do such a thing? 🤔
build menu in the editor. build paths
@unborn sphinx Oh. It saves the navmesh better? I'll try. And what does build do btw, I never did it. Like Lumen light for example can be so odd, turn around from lightsource and everything goes dark, or it illuminates everything in wierd patchy spot like way. Would building light fix it? (sorry for off-topic, will ask just once)
Traditional animation techniques tend to produce stiff and unresponsive behaviours
。。。proceeds to show a video of the worst example they could find 。。。
*・・・➜ shows their own work which looks a lot worse than traditional animation・・・➜ *
(Its cool tech tho)
Also this channel isn't for the type of AI you're referring to, its for coding AI behaviours in games, ML/generative AI is unrelated
no lumen does not need to be built but there are settings u can change to make it less... uh... transient lmao
or more transient. less persistent
I think there is some kinda error with things not realizing they need to be saved but yeah u have to save the level after specifically building the navmesh with the build menu sometimes, ime.
I did tried it and yes. the navmesh was saved, they can walk. Thank you very much!
np
Lol proceeds to talk trash about cutting edge Animation.....I guess your saying that The Last of Us 2 also has sub-par animation? Since they used Ai to drive their Locomotion System?
Why are you so angry? This isn't the place for it
No ones attacking you
I didn't say anything at all about TLOU so I'm not sure why you're claiming I said that
#generative-ai is the channel you want
I would argue these learning agents kinda are a little bit in the right place here.
this is not generative ai really
Your passively aggressively ganging up on me like people on Reddit do
And yes it is an attack when 3 people all start pouncing on me
I'm not sure what server you think this is, but if you're likening it to Reddit then that's a pretty good indication that you're misunderstanding it's purpose
I'm not sure what your on or what provoked you but either way I'm blocking you. I'm not going to sit here and let people do that. From now on It's an Instanct block from me, I'm no longer even going to give you Trolls the time of day
Motion Matching is a Machine Learning algorithm so I find it highly ironic that people would say Machine Learning isn't feasible in game development
I think we're going to have more and more people trying to discuss generative AI in here due to the misunderstanding with the conflicting name
Especially since it's used in The Last of Us 2
https://youtu.be/QiY5VZGcDEw?si=mxbdZ3UX88ssJIt-
original video : https://vimeo.com/474306261
the last of us part 2,
the last of us part 2 trailer,
the last of us part 3,
the last of us part 1,
the last of us part 2 gameplay,
the last of us part 2 review,
the last of us part 2 ending,
the last of us part 2 walkthrough,
the last of us part abby,
the last of us part 2 all collectibles,
the las...
I am deeply familiar with most locomotion systems including motion warping
Familiar enough to know that it has nothing to do with this channel
Please take it somewhere appropriate, #animation is a better fit
I don't know who you think believes that motion warping or machine learning isn't feasible in games, but its used in UE5 already for various purposes
would be nice to have an #machine-learning channel with things like chaos cloth and whatnot
probably going to see more like it soon
There are already others such as ML deformer for character skin deformations
You can ask in #969360633386655744
can someone pls pls pls help me.
I'm trying to making a ai ship in which ai ship 🚢 chase enemy ship 🚢 but im not able to make it after spending 3 weeks in it. Can u pls give me a overview of how will do this if u wanna make a ai ship chasing system. And i used ai move to node it doesn't work. It is made for characters so it doesn't work on vehicle properly
No it’s not
It works with floating pawn movement component too
All things you’ve been told before sadly
Im sorry😔. But i tried all those things it's not giving proper orientation/rotation when moving .
Ai move to node doesn't really work on that.
And what I'm doing is controlling ai ship by calculations. And so far I'm making a mistake at a point because when both ship ai ship and enemy ship are in same line like parallel side by side. Then ai ship keep going forward without turning back because enemy ship is in the same direction. Ah basically both forward vectors aligned so ai ship keep moving straight but i don't want that behavior I want to make it always look at enemy ship without considering the x y components. And that's what I'm trying to find of how to do this
Check this out
Yes, you’re showing another game. You want your ships to move in parallel to the ship or not?
Not when the enemy ship is at rest or is left behind (too far away)
I have a GAS gameplay ability for setting the CMC to running speed. Walk is default. Players hold shift to run. Should I feel bad for adding a one second delay to the end ability, and using a service to constantly retrigger the ability to make the ai run? 😐
I should definitely feel bad for that right
Hello, I'm wondering whether it's possible to add some custom steering to the AI to the existing UE tools? How should I go about it?
sounds like a custom movement mode
Not really, as steering can be easily combined. It manages the path rather the way a character moves
oh I don't know for sure, but it just sounds like the CMC custom movement mode. I don't know tho maybe the default one works.
never used anything but walk mode lmao sorry
well it works so I am doing it and it's only ticking like once a second. Players just have to run for min 1 second at a time lmao.
is there any way to set how frequently my AI is running its behavior tree?
Do you guys do autotests (or integration tests) for AI features? How hard was it to setup and does it worth it to support all possible situations to test in the end of the day? 🤔 I'm just thinking about it because I'm about to fix something, but the AI logic is so complex at this point that I'm afraid by fixing one issue I can introduce 3 more
We do functional tests.
I just did a functional test and I think I am done my first playable NPC behavior logic tree. damn that feels good what a whirlwind lmao
functional test meaning u just play it and make sure it works right? lmao
The BTTask Blueprint Base's aren't populating in the target selection, also, if creating a variable for it and trying to set it there, they also don't populate there. Any ideas what is being overlooked? Documentation on this is severely lacking.
Where did you find that?
the picture is from the docs, but @river hare is the one with the problem
Maybe an old picture? Because I can't find that function (in the way that it is written at least)
It definitely exists in BTT BP Base though
This is the only place I found it
if he creates a variable by promoting the input pin to the node, and tries to manually set the variable to his BTT Task Blueprint Base, they do not show up in his list of options to choose from
He needs to pass in an actual reference to a BTTask.
One that is actually instanced
Unless he selects the class option
But the class option won't allow him to call that function because it expects to be called on an instanced task.
So, much like you couldn't select an object reference for BP_Character in the dropdown (because it needs to be instanced), you can't do it for the BTTask either.
gotcha, that makes sense, he can't quite figure out how to get a reference to it
I don't know why he wants one, but you can create a field in the blackboard, and then set that field on Execute AI in the task
I'm assuming he wants the reference for one task, inside of another task
unsure as well, just trying to help ^_^ this isn't my field, so
(Which is weird honestly)
one, sec i'm gonna drag him into the channel so he can give better information
I can jump in voice when he undeafens himself
word
Thank you for that
For your info, problem was he just forgot to actually set the value.
sigh, lol, he'll be kicking himself in the butt for a while for that one
happens to all of us, but it sucks worse when someone else points it out to you lol
versus wasting a day and discovering it yourself
It do be like that sometimes
Just wanted to say thankyou one more time for your assistance. I know I kind of rushed out on you, wasn't trying to be rude. also thanks @hot compass for posting for me. Yall's help is much appreciated.
I have a question, I'm trying to stop AIs from using the same nav link for a certain amount of time so it doesn't look like they're looping. Is there a way to stop a specific nav link from being considered during pathfinding without an engine change?
just found this https://docs.unrealengine.com/4.26/en-US/API/Runtime/NavigationSystem/UNavLinkCustomComponent/IsLinkPathfindingAllowed/ which seems like it is what I wanted
Check if link allows path finding Querier is usually an AIController trying to find path
Anyone familiar with StateTrees? For some reason the Actor context property on my evaluator is comign out as nullptr and it just started happening randomly
It gets it via Context.GetInstanceData, and there is a GetInstanceDataType function defined on the evaluator... it used to work just fine and now it just stopped
I created another evaluator in BPs which just prints out the Actor context value and it works just fine... ugh why is this so poorly documented as to how exactly this is supposed to work
I dont even complain anymore
Started working after I removed/recreated the evaluator in the ST.
Hope this is not a sign of things to come lol
I dropped ST because of stuff like this and editor bugginess. BT still works fine.
I'm trying it out in a small project just to see how it works. The basic idea seems good because a lot of my BT logic ends up being kinda stateful
there isn't a decorator to repeat a task until it finished with success?!
There’s a service
You can use a decorator to abort out of the branch when your bb key set by the service is set to something
fwiw, custom decorators written in C++ can do stuff like that
yea guess so, just didn't want to reinvent the wheel (and i don't like to have another blackboard key just for "flow control")
Hello, im having an issue where my enemy will path towards my enemy on a base level, but on my custom level the enemy will not move at all. It seems like the enemy is inactive when on this level, but works on the base third person level. I have replaced the character and the navmesh. Any ideas why this might not be working?
In my decorator, How do I check if a float is set?, I believe it returns zero if its not set, But I need to differentiate between a value that is set to zero and one that hasn't been set at all
You store it into a bb key when it’s 0 and check if that key is set
Some global question. My game uses a basic A* algorithm for navigation. Would it be somehow possible to use BT and tasks with it?
What does how your game manages navigation have to do with the ability to use behavior trees?
Hello! I'm currently working on a multiplayer game and in client ), if the player moves a little, the AI Sight perception of my enemies can sometimes see the player in a location in which they are not... has something similar happened to anyone? I don't know if its a question of my player's movement replication, or maybe it's the AI Sight replication.
I would greatly appreciate any ideas 😅
Actually i want to use BT for doing tasks, and then use my own navigation to perform e.g. a MoveToLocation .
However i found that BT might require a PlayerController/AIController. I do not have these cause of optimisation perposes.
Sounds werid but my AI currently are plain actors (not a pawn) and do not have controllers.
BehaviorTree and Blackboard needs an AIController
They are not expensive 🤔
Thought so
What can be expensive is having everything made in blueprint (behavior tree evaluator ticking for instance)
I dont mind coding in c++ though yeah
However i'm talking about like 1 to 10k of AI
So you should use MassEntity
That's impressive then
I was just looking into a way to use BT on my custom AI, like the graphs only
Actually Mass issnt a very big deal, not much code
Are you kidding? 🤣
I mean, compared to my AI system it might get the same frame rate on lots of AI
I am currently evaluating it and there is thousand of lines split among 20 modules
Are you using ECS architecture?
I don't
And do you use Actor / ActorComponent
Every AI is its own actor
This is expensive
I know, but only actors in view are being updated
Same as MassEntity 🤔
It does not really matter to have 10k of actors in world, when they do nothing 🙂
The thing is you got them in memory + you spawn them
Yep, true
But you will need AIController for each of them since you want Behavior Tree
Indeed, yep, that's basically what i needed to know. Might be a no-go
Actually 10k of active AIControllers does not sounds really good
What is your AI API only navigation?
The one that you told was more flexible than Mass?
Its a custom A* pathfinding system
You make your own Fragment / Trait / Processor driven by your A* system
The more flexable i think is that my code is really easy to read, compared to Mass
And you can go with thousands of Agents (that can be actor at some point if you're very close)
Its a few lines of code to just calculate positions instead of actually moving actors
Mass is easy to read if you dig into it
But the whole architecture needs a bit of time to comprehend for sure
Mass is handling way more than just navigation
Yeah i found Mass a bit hard and perhaps not needed if my own system runs good without it
But you need behavior?
So either you use BT with 10k actors or you use Mass with 10k agents that run using StateTree
Actually the only reason i thought is not the background of BT But just the ability to use blueprint to create tasks etc.
Writing the tasks in c++ is boring
However so since BT just needs a AIController i dont think it will work well
Actually BT even needs a pawn instead of a Actor right?
Yes since they are controlled
Yup
With like 10k pawns instead of Actors even, i think it's not performent
I should move over to #mass now, but well 😅
Try it and you'll see
The idea is that my system now does the same as Mass does with a few lines of hacky code
Then i'm informed badly
MassNavigation is just one sub fragment of the MassGameplay plugin
Does MassNavigation uses anything like A* or its navmesh?
It's zone graph based but you also have navmesh in the community sample project
Aha okay
The problem is that my entire level is procedurally generated, ive been looking in the past to add zone graphs without any luck
Not sure what suit for PCG content
But there is definitely a way to make something working
The navmesh solution works smoothly on my side with 1k agents
My game would be 1 to 5 or 10 max
The MassNavmesh processor 1.5ms for 10k agents on PC
Yeah since PCG is hot, mass might be somehow improved, not sure
So basically, i can generate my A* navigation grid in a second. I think Navmesh is obviously (way) much more expensive
Navmesh is basically a no go in either way
Yeah so it is definitely something that you need to link with Mass
You can drive your agent by giving next location and speed
And you get info from your algorithm
For navmesh solution
I have a task that compute each step of the path (so you could do the same but using your A*)
Then Mass just read step by step the path to move the agent
So yeah i assume Mass does actually handle tasks aswell? does it use the Tasks System?
it use StateTree
Okay yeah
StateTree Tasks are fully in c++ for now
You're welcome!
Anyone tried tweaking Cell Height in UE5? Whenever it's different from 10, no navmesh is generated ...?
Do people use pawns when having a lot of actors in a game that need an AI controller?
Or do they just use the base actor class?
Im a bit confused with how that works.
Im trying to have a decent amount of entities (like villager NPC's) in my game that will have their own behavior
It's a preference, Pawns do not have CharacterMovementComponent, which is considered heavy on performance especially if you have plenty of characters spawned. So it's not related to AI.
Ah gotcha. Reading between the lines I think you're saying its safe to use pawn but if I want any kind of replicated movement etc for a large amount of entities.. I'd need to write my own movement component for that pawn.
Yes, it is safe to use pawns. If you want a decent movement capability, you can add one of the built-in movement components to your existing Pawn actor manually, or create your own from ground up.
Also for the performance, there are workarounds to keep using Character class, such as reducing tick rate of CharacterMovementComponent when they are not relevant etc. (out of sight for example)
I see. Thanks!
does someone know if nodememory resets once the node gets executed again? yesn't
I had the same issue, made some minor changes and mine works great now, in 15-20 mins its able to navigate the track. DM me if you are still facing this issue, i would be happy to share the changes with you for you to try.
AI systems only exist on the server
Yup yup, but it's weird that when testing on client, the AI Sight is sometimes detecting the player waaay far away from it really is isn't it?
It's detecting where it's at on the server.
yeah but, when I test this is a listen server mode, it doesn't happen...like, the correction shouldn't be that far off when playing only as client right?
It shouldn't be. But it's not an AI problem. You might want to ask in #multiplayer
oki, thank you!
Did the AI controller spawning and controlling change in 5.0?
I have a character, auto possess by player is false and I set an AIC on spawn/placed.
When playing in editor, the AIC spawns but when I debug, it says that my controller is my player controller... what's going on?
And I can fix most of it by manually spawning an AIC and possessing
Is this char placed or spawned currently?
spawned
Are you using spawn actor or spawn AI from class?
And did you set the default AI controller on the pawn
I’m asking about the node you’re using
no node, it's the player start
You’re not using a spawn node?
Ah gotcha so it just defaults
yeah but if i use that player start it fizzles
A pawn can't be possessed by multiple controllers. If you are using the player start, then it's being possessed by a player controller
Why is StateTreeTaskCommonBase not visible in the C++ class wizard?
Should Ai that use behaviour tree be this impactful for performance?
No AI's 120 max fps
Two Ais that use behaviour tree to move to random location
75fps
even dragging one ai to scene without game on it reduces fps about 10
Does someone knows how to avoid AI flickering when going into each other while using Crowd Avoidance ?
Seems not related to the tick since you got +7 ms in game but not that much in tick 🤔
I mean it is related to game tho ...
Can you try using Unreal Insight?
Testing in pie is not very reliable in general
Yeah it's probably something related to logging / visual logging
anyone use new StateTree pls help? How i can debug this system?
i mean how i can see states
visual logger
where i can find it
anyone knows why the simple move to node doesn't work for this path?
the hole is a boolean result on the dynamic mesh
and the actor that is controlled by the node is a player character
and I'm only setting the X and Y vector values
leaving the Z value as 0, so it shouldn't be much of a problem, right?
this might be a dumb question, is there a way to somehow tell the ai if the ai see an entity with `` Entity.Player"?
you could give a tag to the player actor
and then get the stimulus Tag result from the ai perception
I don't know here, never worked with c++
UGH
figured out the issue with the simple move to node
the darn target location was above the void
so the simple move to node couldn't validate the goal location
You need to expose the gameplay tag interface to bp
The EQS system has tests for specific gameplay tags
It depends on what the goal is
EQS could be used and its builtin tag checks require IGameplayTagAssetInterface to work
But if it's "sight" or some other type of perception, it's probably better to use the AI perception system. For that you would just write your own logic when perception is updated to check what tags the perceived actor has. This could utilize the interface, or it could utilize something else
🤔
Adding to this, there’s an Affiliation feature to that system, which uses GenericTeamInterface if you’re going for friend or foe detection
Fwiw, if you're working in blueprints, the easiest way to do this is to just add a gameplay tag variable to your actor. You can then cast to your actor type and check the tag in the perception logic
But the interface is also very easy to implement in C++ if you know how to use C++
IGenericTeamAgentInterface is much more "fun" to implement lol
You can get pretty big performance benefits from using the team agent interface also - say all your enemies are trying to perceive the player... if you don't use the team agent interface, they will linetrace to every single other character in your level to determine LOS
but if you implement the team agent interface and set them to only perceive hostiles, they will just need to linetrace to the player
Hehe, always print the goal location first 😀
yeah.... 😓
Hy!
Is there any article that goes into detail about how exactly Unreal calculate a path to be the default navigation system?
I don't think so. Is there something in particular you want to know about it or some specific reason you need to know this?
I actually have the exact same question as posted here. I have the issue that the AI is very 'uncertain' on the path it needs to take around the other AI's in the same crowd. No matter which settings I change (one at a time) there seems to be no difference at all.
Based on everything I find online is that any actual customization for the detour crowd avoidance is exclusive to C++ :/
Damn thats interesting info
Question about state trees: Let's suppose that I have a state tree with some tasks, one of them has some instance data (in this case, a timer handle), now:
- The timer starts during that task/state
- Before the timer runs out, the state changes (for whatever reason, such an event etc).
- When the state/task with timer is active again, is the instance data reset?
From a bit of debugging it seems that the instanced data constructor is hit every time the task is re-entered, so I'd not rely on it to store long-term data 
smells of navagent radius being bigger than the corridor
Anyone know if there's some way to have child state trees similar to how you can run a child BT?
I'm noticing that I'm ending up building fairly similar state trees with only a few differences so it's a lot of duplication
problem already solved 😄
since yesterday
hey devss i got a pretty dumb question but i am confused if my decorator 1 returns false then execution will move to 2nd node or abort from the sequence ?
You have to understand the composite nodes you are using
If you hover over the node it should give you a little description - but basically Sequence nodes will abort if one of the nodes under it fails, and Selector nodes will execute nodes until one succeeds
So in your case, if the decorator on 1 fails, the owning sequence node will also fail
But also why is it the same decorator twice
I wonder how exactly is the StateTree Enum compare supposed to be used... Literally any enum value that I try to bind it into errors out because it's not of the "State Tree Any Enum" type...
Don't think you can. I recall that being a complaint siliex had.
I saw some random mentions on the forums that someone had managed to create a task to do it, but of course they had posted zero details as to how that was achieved
The way the state tree component manages the tree it runs seems extremely complicated to just abstract away into a task
I wonder if there's some magic used for this... I already found that there's some meta value for it :|
Wonder what else is lurking hidden in the code that's not been documented anywhere
Well I went through the entire thing and all I can say either it requires some FProperty knowledge I don't have, or it's infact incomplete and never worked
Yep... "Moved StateTree out of restricted folder"
Never been touched since it seems so who knows if this actually even works
🪦
I guess I'll try gameplay tags, that probably requires less janky support since it's just one type
I miss MieszkoZ, he left us for #mass , mind you he gets more intelligent questions there 😅
lol, yeah I noticed there's been state tree Qs there so I posted it there as well :P
When calling MoveTo on an AIController, the navigation system only successfully projects the destination to the navmesh when the destination is within the default agent query extent. Is that correct?
GG
Good system. Works as intended.
In general StateTree seems pretty nice but also ugh
Has any of this been tested at all?
They said that they use it pretty successfully for internal projects.
I can see that if I add a parameter of type gameplay tag container into the tree itself then it happily binds into that
So it seems maybe the binding to object properties aspect is broken or something...
Or it needs some kind of additional magic metas in the UPROPERTY but I got no clue
I wanted to swap ny custom system for ST but seems theres some issues with it
As long as you're not trying to use the tag comparisons or enum comparisons it works lol
I like using tags 🥲
I think it will probably work as long as you expose the tag values directly and not as a member of another object
It's supposed to let you bind to like.. Character->SomeValue, but this aspect of it just seems to not work at all for me
Binding directly to Character itself works just fine
Currently im using a bunch of uobject Tasks and calculating their value for selecting what to do
But i lack any sort or visual for it
Biggest reason i wanted to swap to an existing system
Yeah
If you mostly want it for debugging purposes or such, visual logger is good for that
Easy to just log a bunch of stuff into it
Hmm never used that
Damn looks handy
And its so old!? How come ive never used it
Thanks! Ill try that out 😄
Maybe i can avoid refactoring to much lol
Yeah it's very useful for debugging AI issues since the systems generally log a lot more into it than otherwise
@short aurora do you happen to know how to make StateTree bindings work correctly when using actor properties? Eg. I try to bind MyActor.Tags as the tag container in a Has Tag condition, but it just refuses to work "binding source type '' does not match property type Gameplay Tag Container"
Okay I'm starting to get fairly convinced this doesn't work at all because even using the builtin tasks this just doesn't work lol
I guess this needs a task to pull the property out of the actor as a workaround...
Hm, well, it works on the Context actor but nothing else...
Is there an easy way to troubleshoot a Behavior tree? Its never going to the next sequence, but I caint find why... Troubleshooting BT is always a challenge for me, still new to it....
the part in red just keeps going between MoveTo/Wait never goes to the next sequence
CustomerOrderStatus = 0
Pause during gameplay it will allow you to step through the BT
Visual Logger also shows more details about BT execution steps
Visual Logger? Will check into that
I would start by pausing the tree and using the arrows, then gameplay debugger, then VisLog
Stepping through it usually helps if it works - you step backwards, and usually it will display a red line or such which indicates which node failed and reset the execution
but if that doesn't work, the visual logger should have the output from the BT and why it is executing what it is executing
Ok, thats aweome, I have never used the pause here.. Thanks folks, thats a gamechanger
Likely, the moveTo is failing
Usually you want your first node after the root to be a selector so you have a fall back behaviour.
With a sequence, if one branch fails, they all fail
Same applies for lower level branches, having selectors and waits on the right branch allows you to see what’s happening better
Yeah, its pretty ugly now, need to get it way more efficient later.. Thank you for that
Found the problem.. where I was setting the BB key I use "Make literal" and it was the variable name plus the default 'none' behind it... damn you CTL A, failed again
Yes. That's correct
You're using a bunch of sequences. Sequences stop when a node fails.
Been a while since I touched statetree so I don't have a good answer for you. I will say that I made my own task for retrieving tags from the asset tag interface or w/e, so I never really ran into that situation.
Yeah I was trying that as well but it just became a huge mess because the property access bits seem to be buggy as hell
Oh well, it seems promising but it's not quite there yet it seems
Thanks tho
Hi all I hope your well🤗 Im looking for some help please. Im trying to make a basic flying NPC. Ive set up all the logic and the Nav mesh as well as the location I wish for it to go too, and made a component which turns of its gravity. If the Actor/capsule is touching the ground it moves to the location fine, but if its in the air even slightly it doesnt move at all and I can't figure out the reason why.
Any helps appreciated👍
You might have left the channel before we said this but AIMoveTo works with the navmesh and that only works when the actor is on the mesh
Thanks. Is the mesh only detect the ground then?
does
Yeah. If you don’t need to worry about any obstacles you can use move directly toward
That node doesn’t use navmesh pathing it just goes in a straight line
If you want it to avoid collisions though, that’s a bit more involved
I cant see an option for this. Does the node run off of something?
Yeah it sounds like it's a navmesh issue
If the actor is not on the navmesh then it won't pathfind
Depending on how you need it to work, you could keep the actual actor on the navmesh and just have its mesh "fly", so effectively it's still walking for the navigation to work
Otherwise you'd need to come up with some other solution I think
What kind of AI would be best for fish in an underwater environment?
Navmeshs, patrol points, etc
We plan to have multiple types of fish, friendly, hostile, environmental etc with a fairly complex equation for skittishness, sensitive to light, etc.
Want it to be somewhat optimized, but obviously ai pathing in a 360 environment can get expensive.
(Trying to go for similar fish ai to a game like subnautica, where they mostly free roam within a confined environment)
Seems you could just have them move in random directions tbh
If they collide with something they can just go into another direction
Definitely, I just dont want it to have awkward jagged movement, like moving straight to one point then abruptly turning to the next point
movement like the left, not right
You could use EQS to generate a set of points that are valid to move into within a certain area and then have them move on paths along those points or something like that, then smooth out any corners
with the EQS generated points you'd effectively have a point grid of sorts, and you could have it stored somewhere so you don't need ot keep regenerating it every time someone needs to move
EQS is exactly what I think I needed, my team was already planning that as one of the solutions but we were jsut gonna make all the points ourselves manually but good to know this could work too
Thank you!
If you have the points , just mapping them to a spline goes a long way
Thats a good suggestion thanks👍
Im looking into eqs system for making my fish AI, Im wondering if there is a way to write it in code so I can just use a state machine AI and use eqs to choose where it goes in a designated area. Is this even possible or should I find another way to do it?
this is for Mass + StateTree but might be a handy starting point? https://github.com/Megafunk/MassSample/tree/main/Plugins/MassCommunitySample/Source/MassCommunitySample/Experimental/Navigation
thank you this will be a nice start 🙂
You can call EQS from code just fine, it isn't limited in where you can call it from
thats good to know
ah maybe not, I think I misunderstood the relationship between FPathFindingQuery and EQS, sorry
oh alright
still just looking at it will help me figure out how the eqs system works
its my first time using it
Look at the existing BP nodes, they should give you the basic idea on how to call it
alright
does the eqs system work in a 3d space? all the stuff I can find only uses a floor, I would want it to move on all 3 axis
Yeah it's just a question of using a generator that generates locations in 3D
perfect
is there a dynamic way to assign behavior trees in an AI_Controller? For instance, i have 5 NPCs that could reuse the same controller, but they each need a different BT. I tried using gameplay tags, but OnPosses fires before the tags get added. Any ideas? 🙂 I'm just trying to increase reusability and cut down on the number of files i need to make
https://www.youtube.com/watch?v=iY1jnFvHgbE&pp=ygUKdW5yZWFsIGVxcw%3D%3D this video is jam packed with good info about AI, and EQSs
In this presentation, Epic's Paulo Souza uses Unreal Engine's built-in AI features to build smart enemy behaviors for a game with stealth-like mechanics.
By relying on the Gameplay Framework in Unreal, we're able to quickly create convincing AI using Behavior Trees. Behavior Trees are great for creating complex AI that can be presented in a way...
thank you so much 🙂
Put the BT on the character, when the controller possesses them, get the BT asset and then plug it in.
That's the straightforward way anyway
Some people might complain about architecture, but meh in this case.
yea i'm trying to approach things the "correct" way when possible, but im also just trying to get things done haha
Hmm so I'm trying to make sense of the EQS system. I have a EQS query to find a path. but it seems to run repeatedly and causes the pawn to run around the nav mesh, without any particular goal, instead of going where I click.
basically I should be able to click on the unit (works), and then click to direct them across a grid (bork'd)
this is the logic calling the BT, which is run by InputAction_Click (on completed)
and this is the simple BT
Why run an EQS query to find a path?
idk i thought the idea was stupid too but a colleague was insistent on it so i ended up listening to them lol
I'd rather implement some form of a* since im using a grid anyway
The navmesh is what helps you find paths around stuff
EQS can help the AI choose where to go tho, see 3rd pinned link video it has a section on EQS @royal mist
i see
I am that colleague and I just said the EQS could find points on a grid and that there is a pathfinding grid aka the grid is on the navmesh, right? So i guess that gets me thrown under the bus lmao
sorry PathingGrid
I also told him not to implement pathfinding himself lmao I am not completely stupid*
*maybe
As Duro likes to say, keep things as simple as you can and not simpler
lmao yeah I have been thinking about that saying when I heard it here it's great
A good way is to data drive it using a data asset.
Hello anyone here know how to integrate ai to a click team game??
What exactly is a click team game? And what's the problem integrating AI into one?
Is that like... click team fusion?! 
Yeah that's what it made me think of also but that has nothing to do with unreal right? 🤔
They might just be lost ... very lost 🤣
Always a possibility
Can you add and remove things from a StateTree at runtime?
"things"?
Tasks, states, actions?
RIght now, we don't have many options with StateTree 😔
Subtrees is that a thing?
It's within the same file
No separated file as you think compared to BT
Anyone already inherited from GenericSmartObject, the actor is hidden by default 🤔 ?
Does that mean, the SmartObject is intended to just be an Empty Actor without visual?
Interesting, I hadn't even noticed there was a GenericSmartObject actor
My SO's are just regular actors which have meshes and things on them
UPROPERTY(EditAnywhere, Category = SmartObject, NoClear)
TObjectPtr<USmartObjectComponent> SOComponent;
This seems wrong. Since when is EditAnywhere valid for components?
I was under the impression using it on components was a quick way to break your actors
Ugh, this state tree really is nothing but trouble... lol
This is so full of gotchas in how it works
Now it's just randomly refusing to trigger a transition
Or maybe it's invalid for it to transition to itself to repeat the state? I don't know
Although if I make it transition to its parent state it also refuses to transition to it so I guess repeating itself is not the issue... but it tells me absolutely nothing that would help me figure out why
If it goes back to root, and re-evaluates the whole state tree, then it happily reactivates the same state again
So this makes very very little sense :P
that sounds rather strange
How do you prefix your SmartObject Definition?
In fact the NoClear prevent to mess up with it
Oh that's the magic word? Interesting 🤔
The Wait State will move execution to itself indefinitely on success or failure until its parent State selects a different State.
This part in the ST docs seems to suggest you certainly could make a state loop over and over
But why does it refuse to do that then...
would like to move this topic here too to hear folks here suggestion
hello, so im not very knowledgable in this topic so please corret me if im wrong.
So im in the process of making my ai and my game designed to have tons of AI's.. for player controlled pawn, if you want a replicated custom movement, you have to use character movement component but i remember i read that is not the case for AI.. do i have to built AI equivalent of CMC from the ground up? I dont mind trying to attempt to build one. i know it will take months and i have to see of CMC do it..
I dont want to go this route but if i have to, anyone have attempt to do this? if so, can you advice me on things i need to do / donts? any pointers?
any technology built in unreal you can suggest me look into?
Hey !
CMC is very expensive even using the NavWalking logic especially if you're using DetourController.
What kind of movement do you need @woven bobcat ?
If you want less than hundred AI moving all together, i guess a pawn with a basic movement component should be enough
If you want more than one hundred AI, you will probably need ECS architecture handle thanks to #mass (which support Network replication but is a whole universe to understand)
You can get more than 100 without ECS btw.
You just need to optimize for it. Because UE's skele renderer is heavy, animations are heavy, and CMC is costly.
You need to define "tons" to be honest. But if you're lookin' at over 1k, CMC is definitely not going to work.
Heck, even 500 would be quite the challenge.
Thanks for the clarification
I had only 15 characters and I was getting huge cost ^^'
So my guess was 100 would be expensive as well
I've done like 300 fine.
Just need to know how to optimize it.
Which most people don't. By most, I mean a vast majority.
But CMC is costly
Definitely, I investigated UnrealInsight and i had no idea how to optimize my AI (it was only parallel task animation and CMC bottlenecks 😦 )
If you have resource about CMC optimization, i would love to hear about it
Or pawn locomotion in general even if i'm fully focused on Mass right now
I don't have any specific resources. Just things I've picked up over time.
Also, yes, UE's transform system is total butt. So some things are just slower because of that as well.
Something that we can't fix easily ahah
Animation sharing, navmesh movement mode, logic LOD, and animation budgeter are things that help a lot
If you have resource about CMC optimization, i would love to hear about it
Simplest trick is aggregating its tick calls
Second is making sure FindFloor is called in sequence inside of that aggregator, separating this from CMC tick gives you huge benefit on caching the instructions
Third is altering MoveComponentImpl directly, also known as "vblanco trick". You can search the keywords on server
I didn't count obvious ones like scaling CMC ticks based on visibility etc. but if you need those too search for KaosSpectrum's messages on this channel
When you combine all of these things, you can do more than what people think. It's just laborious to set up.
Hopefully the thing their working on to make the CMC stuff a bit more generic could improve this. But I have my doubts.
@shadow furnace also made async CMC possible recently iirc
waiting to finish BP2CPP annoy him about how he did it
@dawn schooner Also seems to have gotten vblanco trick to work on multiple threads
@dawn schooner how many loops you have in a single code block? (i.e. how do you handle mark render dirty on another thread - or do you at all?)
Funnily enough, vblanco actually talks about it in this channel. Here #gameplay-ai message @wise sluice
maybe yes because I didn't need to update the render scene
