#gameplay-ai
1 messages · Page 44 of 1
Thanks you
Idk tbh, haven’t tried it. What did your tests show?
it seems my blackboard gets misteriously wiped out at some point and I am pointing finger at the fact i may be running the tree multiple times
I have subtrees that get run from the main tree and haven’t had that, so idk if that would be it
The main tree should prly only be run once tho (other than when you use stop logic)
even if I call RunBheaviourTree multiple times?
I mean if it’s your main tree you prly should only call it onPossess in the AIcon once. Unless you’ve used StopLogic somewhere
Yeah right now i'm calling it in begin play of controller as well, i'll remove it i think unless i had some weird reasons to put it there that i can't remember
Should calling MovetoActor() on the AIController rebuild/recalc the path to the actor (especially if the actor we already being moved to, from a previous call to MoveToActor(). or is there another way to do this?
Forcing a BT into acting like a state machine is really not recommended. You lose the benefits of a BT by doing that.
Calling Move To should automatically cancel any current moves.
yeah, I saw it do that in the code, but then the 'new path' (I'm rendering all the points on path), came back exactly the same, even though its obstructed.
looking into perception system now, guess that may be a better approach anyways.
Is the thing obstructing the path actually affecting the nav mesh? If not, then navigation can't do anything about it.
Not entirely certain why you think the perception would help you navigate. It's too expensive to work as probes.
!! right, I there is setting on actors 'affects navigation' forgot about that!, digging into that now 🙂
nope, that was not it, they are configured to affect navigation (its the blue cubes atm in the ThirdPerson template), it does in fact initially route around them on the first path, but when I push them into the path, it never re-reroutes.
well, now I'm not sure, I see if I turn on the navmesh ,during sim, and move the blue cubes, the nav mesh does not adjust, even though the blue cubes have the 'can effect navigation set'
Is your navmesh set to dynamic?
dynamic, is this a setting on the NavMeshBoundsVolume?
No it’s in project settings
If changing geometry doesn’t affect the mesh at runtime it’s either not set to dynamic or you’re missing collisions/can ever affect navigation is turned off for said meshes
ahh, ok I found the setting, and that did indeed make difference. I guess..my question is, typically is this enabled? (my world is static), but there will be other actors moving around, hence an actor may block a path, and the actor needs to 're-route' around another actor...I woudl think the 'can effect navigation' would be all that is needed in my case.
can affect navigation = will it be considered by nav mesh generation at all
if it's not enabled, it's as if it doesn't exist at all as far as navmesh generation is concerned
ok, so..it seems like using NavMesh to go around dynamic obstables is not the solution, I suspect regenering the NavMesh each time an actor blocks a path/los on target would be too expensive in my scenario.
Yeah not really sure what is the go to method for that sorta stuff - how expensive it is depends on how often it happens at least in this situation
I think crowdDetour AI is more inline with what I need, but that is mostly designed for actors that are deisgned to turn in place, which will for some of my stuff, but not for vehicle type actors, at least not with out modification
Hey guys, I'm trying to use the SmartObjects to create some eating zones around the map but the subsystem cannot find any of them, this is my blueprint code. Can anyone help me a bit, please? I followed the tutorial from the UE5 page to set them up (except the part where the map should be based on the ThirdPerson Template, it's based on the FirstPerson Template
And what is the correct way to make it change states? With the AI Controller?
BT's aren't supposed to be stateful
They're priority selectors
Behaviors with the highest priority go on the far left in Unreal
And you gate the behaviors based on conditions
IE - can we see the player? do we have enough ammo? etc...
As much as people say "not stateful" usually the structure is very stateful lol
can we see the player definitely sounds like a state to me
Are those other actors other AI? If so they shouldn't affect the nav mesh and you should use detour instead.
yeah, working on the detour logic now.
BTs are "stateful" but that doesn't mean acting like a state machine.
The problem is that you are trying to "change states."
If they didn't want BTs to be stateful they should have thought about it when they made it impossible to run ST's and BT's at the same time without massive amounts of work lol
Anyway yeah I mean I get the point, I just think they do work for states, you just gotta keep in mind it might not be the ideal way to use them
(which could certainly mean that if you do understand how it works you can build the states in a more BT-compatible fashion into the BT itself)
This is what I meant. I used poor terminology 😅
The problem isn't being stateful. It's trying to force the BT into acting like a state machine. Tasks in the BT are stateful, but the structure is not a state machine. If you want a state machine, just make one or use the ST.
I highly doubt not being able to use the BT and ST at the same time has anything to do with being stateful. Likely assumed most people would pick one or the other.
And how do I make my DAUGHTER have different behaviors without changing the states? For example, if you look at someone while Patrolling, you will kill them (From Patrolling to Chase)
You don't make your DAUGHTER do anything.
The BT is a priority order sequence of actions that are gated by conditions (decorators). You use the STRUCTURE to get the behavior that you want.
If you remove the behavior class, does it find any smart objects? Are you in BP only?
i managed to fix it, it was actually working but i forgot to call MoveToAndUseSmartObject 😄
and i have more AI actors than SO slots and the majority was resolving to none found since all of them were already claimed
I want my ai to either push the player to the side when the player stands in the way for pathfinding, or make the ai pathfind around the player. How should i go about those things?
I think i found out how to push with add impulse. But how would i pathfind around player if i want to do that?
Use either DetourCrowd AIController or RVO
What is RVO?
RVO (reciprocal velocity obstacle) avoidance uses forces to push characters while they are moving to avoid each other. Detour works by updating the path to do the avoidance.
Hey, is there a way to get AI to move across a body of water? basically trying to make an AI ship, but cant find much on it
Does someone knows what happened to the Brain Component logic?
It seems that the StopLogic function (in the c++ files) is empty 🤔
Now there's no way to stop the logic in the behavior tree
Are you looking at BrainComponent or BehaviorTreeComponent?
The stop logic function in BrainComponent is probably empty since it doesn't do anything I don't think. You would need to look at BehaviorTreeComponent because it extends brain
Well it used to work, maybe they changed it in the last UE version.
The BehaviorTreeComponent doesn't have any trigger function, is there a way to trigger it?
There should be a RunBehaviorTree function or something lik ethat
Oh, So you need to use the static function RunBehaviorTree and the BehaviorTreeComponent is just to control that specified BT ?
It's not that your running the BT from the component, because that function doesn't exists.
You can probably just use start logic on the component also
although the run behavior tree function does do some setup for the bb and such
in any case, stop logic should stop the BT
Yea that's what I thought, but the StartLogic does what it says, just starting the logic. But it won't run the tree from his root.
You can test that and see that only the RubBehaviorTree has the C++ function Trigger which start the logic from root.
Use run behavior tree not start logic
Yep, after that I cant get the BrainComponent and cast it to the BehaviorTreeComponent.
Thanks guys!
is there a way to draw a sphere when using report noise event to debug hearing zone?
you can use draw debug sphere to draw one manually
What influencing factors do we have on a basic ai when it comes to generating path points? what I'm looking atm, is I have 2 pawns next to each other, and they are both headed towards the same point. (they both have a direct line), Agent Radius is 35, the pawns are over 160 apart. The very first points generated force each agent away from each at a hard angle, really those points should not even be there, I don't understand why the path points would be here, as they both have direct line to the target. If I turn on Draw Triangle Edges I do see that points line tend to line up the intersections of the triangles...do those represent the only nav points that the ai can use for path plotting?
I tried adjusting the cellSize from 19 to 18, nothing works after that, setting back to 19 it works again, maybe I'm adjusting the size incorrecly?
Hey all, haven't posted in here before but I was wondering if anyone had any resources on AI that can fly / move up walls, similar to enemies from games like Deep Rock Galactic? Currently looking into enemies with spider-like movement and is procedurally animated. I'm just not quite sure where to start on something like this in terms of how it pathfinds since it wouldn't really use a navmesh (or maybe it does? not sure). something like the enemies in this video here: https://www.youtube.com/watch?v=iNXzOuc9UWo
Thanks for watching :)
Alpha Sign-Up: https://forms.gle/rfsHEwXTuyyXSUJW7
Reddit: https://www.reddit.com/r/SyntheticSelection/
Discord: https://discord.gg/vG3cSEx
Patreon: https://www.patreon.com/SyntheticSelection
Twitter: https://twitter.com/Makan_Gilani
Game Twitter: https://twitter.com/SynthSelection
@cinder nymph For the 3D navigation, i got this resource http://www.gameaipro.com/GameAIPro3/GameAIPro3_Chapter21_3D_Flight_Navigation_Using_Sparse_Voxel_Octrees.pdf
And this plugin made out of it : https://github.com/midgen/uesvon
In Unity, Navmesh is enough for wall navigation but Unreal doesn't support vertical / ceil navigation with Recast so you need your own implementation.
Would love to hear about any existing solution if anyone did custom Unreal navigation for such purpose
thanks for the info! ill look into that github plugin. at the studio i used to work at there was a plugin we used called Mercuna (https://mercuna.com/) that allowed for flying AI and 3d pathfinding, but it's rather pricey for a personal project
And what about Kythera which supports Surface Navigation? https://kythera.ai/products/surface-navigation/
havent heard of this one before, ill give it a look
I found both while looking for solution
I finally ended up with https://www.unrealengine.com/marketplace/en-US/product/dynamic-surface-navigation for my prototype
ah nice, yeah this one is much more affordable. I might pick it up for my prototype 😎
You could get away with some simple custom ones too depending on how smart you need it to be
I dont recommend Kythera
They're very cheeky and slow
their ai solutions are great though, almost everything is out of the box, from simplest things to very specific and complex systems
but then the price is insane 😄
Thanks for the details 😌
Is there anyone in this thread who can help me with this situation? I am getting this error: "PIE: Error: Blueprint Runtime Error: "Attempted to access AIC_Enemy_Base_C_1 via property AIC Enemy Base, but AIC_Enemy_Base_C_1 is not valid (pending kill or garbage)". Node: Set State as Attacking Graph: EventGraph Function: Execute Ubergraph BP Enemy Base Blueprint: BP_Enemy_Base"
I have an enemy melee AI that uses an enum to determine the state in the behavior tree. I have it set for him to flag "interruptable" as false when he does an attack animation montage and, upon completion, back to true. At the end of the animation montage of hit response i, I use a function on the AI Controller to set the state back to attacking using the last known target.
Nothing to do with #gameplay-ai , you’re trying to do something to an instance that was marked for destruction and is waiting for garbage collection, like the error says
You need to stop doing any logic once the AI controller has been unpossessed. You also need to check all references before using them.
I'm using AI perception for my enemies. They work perfectly, however, on a shipped build they won't detect the player at all...
Their behavior trees are working - they still patrol etc. They just won't detect the player, which was the duty of the AI Perception's sight sense.
Heya folks, this is more of a generalized or I guess theoretical question about behavior trees: is it possible to have too much of a bloated behavior tree for an entity?
On the side in my free time, I've been working on a cartoony sandbox game that's almost like Slime Rancher + The Hunter. Player can upgrade their gear and hunt the wildlife, lure different species into pens instead, sell goods, etc. I'm up to the point now where it's time to start working on the AI and behaviors of the various wildlife creatures and I was going to approach it through blueprints, but a buddy of mine said that the best way to handle that is through behavior trees and blackboarding.
I've looked into it and it seems fairly straight forward, but my main issue is I'm worried about bloating a behavior tree with a million things the pawn has to work through to figure out what to do. Not expecting perfection, but the pawn would have to keep track of variables like hunger, thirst, sleep, etc. and act accordingly. Including edge case scenarios like what happens if the pawn is sleeping but is also thirsty. Or very specific situations like the pawn detected other pawns of its species and joining the pack.
So is it possible to bloat a behavior tree with all these different situations the pawn's brain would have to constantly navigate? Still new to the subject so the performance aspect of behavior trees is just something I'm a tad worried about
Does it fail in standalone? Often things that work in PIE don't work in standalone, but it's very rare for something to work in standalone and not in a packaged build.
If I had to guess, you have a collision problem that is blocking sight. You do need to debug and figure out where it's breaking at.
It is very possible to bloat the BT. It's actually incredibly common for people new to AI to do it. People often try to overcomplicate it, when all they really need is simple behavior. So start simple and only make things complex when it's actually needed.
From a perf standpoint, it's certainly a lot cheaper than BP
any and all enemies in the whole map
I tried searching about it before, I'm not the only one affected by this (so it's more likely an engine thing), the other people didn't get conclusive answers though
it works in standalone too. Just shipped/packaged that it stops
That's fair, I'll def keep it narrow in scope for now then and if I notice quirks (or I really need a specific situation for the brain to work through) I'll build up the tree based on it and keep it to a minimum
If it was an engine bug, everyone would have it.
I can't really test it out without knowing anything;
- in the IDE, it works. Get within their sight radius and they switch to attack mode, get away, they go to alert then back to patrol.
- in standalone, it works as well. Can check prints traces etc. Same behavior
- when packaged, regardless of it being a shipping, development or debug build, they can't see the player anymore. They perform their patrol routines as usual.
Hi, must we always clear memory nodes when aborting or finishing a Task/Decorator/Service?
or is it fine if we don't
What is a memory node? (New to BT just curious)
I am also curious as to what that is
C++ based BT nodes have a node memory thing but I've never really looked at it enough to say whether it needs resetting or not
Its a plain old type struct that is suppose to hold your variables instead of letting UBTTaskNode keep them
since UObject spawning has noticeable amount of overhead you put them into memory struct
this spawn spawning overhead reduced to allocating a raw struct
if I remember correctly you dont have to
though its been around 1 year since I touched BT
There are lots of things that you can do. Development build still gives you debugging tools. Have you used the gameplay debugger to verify that it's perception that is not working?
Nope but I inferred; everything else about the pawn (terrain line traces, overlap collisions, behavior trees) works. How could I test? Only trying to print stuff when the pawn is detected comes to mind. Does pressing ' + numpad work in the development build?
Ah okay thank you for the explaination. any chance you could point me towards a resource to learn about it? I can’t find documentation for memory node, it is probobly hiding in another page tho.
any stock BTTask in engine
You cannot infer anything. When you are debugging you must verify all of your assumptions.
Yes the gameplay debugger (apostrophe) works in a development build. You should also be able to use the show collision console command.
Hello, I'm making an EQS which gathers all the actors around the AI, and navigates towards a random one that is at least 2000 units away from the character. I wonder how I can make so that the actors inside the 2000 units would be in the list, but with a lower score, which should be the same for every item inside the radius. In other words, I want all actors outside the 2000 units have constant score, like 1, and all the actors inside the 2000 units to have a lower value, like 0.5,
Does anyone know how I can combine the two behaviors? So far I've been using one distance test with a "minimum" filter type with a value of 2000 so that everything inside that radius would be discarded.
Is there some stat or other info that lists Actors that are causing Dynamic Navmesh to be rebuilt?
Haven't seen one but you can call show navmesh while playing if you are trying to narrow it down generally, usually you can see ah over there something is regenerating because of a physics object moving or similar
Yeah I am familiar with that, but its not a feasable approach.
There is nothing built in. You can add your own by hooking into the function that is called in the navigation system when the nav mesh is dirted.
You would need to make your own test, which is only available in C++.
Do you know if there is a way to make an EQS ignores/filter out the point that has been picked by other actors? Or do I need to make one in C++ too?
You can make a context to get the locations others picked and do a distance test to filter.
Okay thanks a lot I’ll try it out
Thank you
@dense owl you two, additionally you can read about it here too https://docs.unrealengine.com/5.0/en-US/behavior-tree-node-reference-in-unreal-engine/
How would I make one like that?
I've looked into EnvQueryTest_Distance, still I can't find out how to give arbitrary score values. As I understand, there's FEnvQueryInstance::ItemIterator::SetScore() that takes query data, and computes the score using them, i.e. it doesn't allow you to tell the score manually. For instance, I can't do something like
SetScore(Distance > MinThresholdValue ? 1.f : 0.5f);
Hello! I have this sequence that I use for interacting with heard objects. First, character walks to the heard noise location. Then StartSoundInteraction checks if there is an interactable at that position, and if that interactable tag matches the heard sound tag. It then runs a dynamic subtree associated with that interactable, which executes a pre interact reaction (eg. act surprised when finding coin). After the reaction is done, I interact with that object (pick it up in this case).
- I want to move the interact nodes (last 3) in a sub BT. But it seems that dynamic subtrees do not get injected unless they are run from the same BT. I am getting this warning: BTTask_RunBehaviorDynamic node ("Run Behavior Dynamic") executed with no BehaviorAsset
- Is using dynamic subtrees a good way to do this kind of thing?
Check that your subtree is using the same blackboard asset
It must be the same as the BT's that runs it
It is the same
You make a new test that uses float values and set the value. The distance test is setting it with the distance.
Where are you setting the BT for the subtree?
I do something similar in my game so it should work. I have a task which sets a subtree, and then after that task, the run node. Have you verified the gameplay tag matches correctly?
Yeah, the tag matches correctly
Have you checked visual logger? It has more BT debug info
what should I look for in vs log?
Not visual studio, visual logger
vis log*
It should have logs for each BT node execution
So look for when it executes the run behavior dynamic node and see if it says anything about its status
Idk man... I tried setting a breakpoint inside UBehaviorTreeComponent::SetDynamicSubtree and SetDynamicSubtreeHelper. It searches all nodes from the instance stack for a RunDynamic task and then injects the subtree if it has the matching tag... But the BT_Interact subtree is not even on the instance stack at the point of calling it
And it doesn't actually take RunBehavior nodes into account. It doesn't also recursively step into its asset to check for dynamic nodes
https://forums.unrealengine.com/t/run-behavior-dynamic-not-work-in-behavior-subtree/229000 this guy has the same issue
yeah
Yeah never tried with main tree -> sub tree -> run dynamic subtree
main tree -> run dynamic is what works ok for me
yeah that works for me as well
Fwiw, I'm using smart objects in addition to subtrees in my case - it sounds like your thing is kinda like smart objects also
the smart object in my case is using a gameplay behavior smart object definition, so it runs a gameplay behavior on the actor to do the actual SO behaviors instead of a behavior tree
yeah, i've looked into them a little bit
they seem to handle really simimlar things to what im doing
but dont wanna commit to learning them right now since I just want to play really simple reactions and it seems kinda overkill\
I kinda wanted to use the BT's in the smart object but I ran into a bunch of issues with it so I couldn't
I think what happened was that it would just fully swap my existing BT to the BT for the SO, and then afterwards it'd swap back to my BT but start from scratch which would obviously completely mess up the actual behavior flow
You could potentially consider using a "lite Smart Object" type solution maybe? Eg. instead of the fullblown SO system, create a custom one where you could define the logic and run that from the BT
At least it would avoid the issue of nesting BT's
Do smart object inject subtree or they run everything in one task?
So in my case, I would inject the reaction into the interact task?
They have two kinds of smart object types by default iirc, behavior tree based and gameplay behavior based
the BT ones have the aforementioned issue, but the gameplay behavior ones don't... the GB can just be a regular blueprint, so you'd just define your logic with regular blueprint nodes
when the GB finishes the BT continues as normal
Yeah the SO+GB works pretty well for me at least, but it does have a bit of an initial setup/learning curve due to the SO system's complexities
So if you don't think you need all of it, you could pretty easily roll your own "gameplay behavior" of sorts as just a custom blueprint that can be executed to do the logic
Sorry to interrupt, but I could do with some help with Blackboard Key Selectors. I'm following the UE5 Behavior Tree Quickstart guide, and I've promoted a PatrolLocation variable as in the diagram, but for some reason it doesn't know to use the PatrolLocation entry in the blackboard. I put a breakpoint on UBTFunctionLibrary::SetBlackboardValueAsVector to see what's happening and it's got "SelfActor" instead as the Key.SelectedKeyName, which isn't even a Vector.
Any idea what I'm missing here? Does it just try to match the variable name to the blackboard key name? Why could it get completely the wrong name and type?
It doesn't work like that
The name of the key selector is entirely irrelevant and you can call them anything you want
You need to mark the variable as instance editable, which makes it visible in the BT editor. Then, in the BT editor, select the node, and you should get a dropdown where you can choose from your BB keys
Wow, that is entirely missing from the guide. But it's good to know - I didn't think it would really just match based on name, but couldn't find any way to make the match explicit.
Next question - what do you mean "visible in the BT editor"? This is a variable inside a Task implemented in Blueprint, but I don't see where I would edit it
If you click the BT node look in the details panel
Instance editable variables should show up in there
Ah, right. I see it.
It's kind of amazing they don't document this at all.
Yeah that's a bit of a weird omission from the guide
I definitely don't recall it ever working in that it would automatically match the name
No, I didn't think it did, and my memory from having used BTs years ago in UE4 told me that there was somewhere I needed to assign it specifically, but I couldn't remember and I thought following the guide would work
Thank you, I think it all works now
Why does my recastnavmesh settings keep getting reverted? We have tiny characters that can fit in smaller spaces than the default allows but it seems like every time I open the engine the navmesh volume resets the area to default. Even if I save and output the change to source control.
Using world partition
before and after.
Did you change the settings in project settings, or in the navmesh settings in the level?
This was auto generated in the level with the navmeshvolume
Yeah so where did you modify the settings? Project settings or in that actor's settings?
Project settings governs the overall generation settings, so that's where you should be modifying them. The actor that's in the level gets its settings from there when it gets generated
I figured the recast actor acted as an override. I'll try in project settings, didn't know it was there. first time doing AI. Thanks!
hey guys, trying to learn AI and struggling quite a bit. This is a test environment I made to remove any contextual issues with my actual project, so the names are a bit of a rush job. Regardless, i have 3 pawns, default straight from the "Create Blueprint Class" for pawn, in a singleplayer blank project. They have the following code, which would hopefully move them around a little on the navmesh. The console is printing "True", and currentdestination is updating as expected. However, the agents don't move! We also have a NavmeshBoundsVolume, as you can see painting the previewed navmesh in the last screenshot. any thoughts?
wanderdistance is about 1000, the delay is about 10 seconds long
those are both working, so it seems to be that "AI MoveTo" doesnt seem to know how to actually move the pawn
<@&213101288538374145> scam ^
sorry for @, not sure how to deal with that
Exactly like that
yaaaay :3
Don't apologize for pinging them. That's what they're here for
then this is a nicer discord server than some
who would ban me just for waking the dragon
Sounds like you don't want to be in that server anyway
anyway this 🙏 i am dying
If I recall, it relies on a movement component. Do your pawns have a movement component?
You can't make it smaller than the default without making your own supported agent setting in the project settings.
we also have this which also notifies the mods 
unless one was there by default, no
Pawns don't have one by default, no
Sure
Oh I see in the nav settings I can do that. I tried making a custom nav data bp and it crashed the engine however
, If I add one with "npc name" as an agent within the recastnavmesh default does that work also?
Check the logs or check the visual logger. They might tell you what's happening.
annoyingly, nothing useful seems to be coming out of it
Yeah gameplay debugger and visual logger will take you a long way. I guess now it’s printing true?
it's printing true, yeah
Ok
You have to click on the frames until you find the one with the right info. Often times you’ll see it highlighted in red if something went wrong
fair enough
what i'm trying to do is so simple and basic, though. anything i've done is something i feel everyone would've done
it's baby steps
It is yeah
But you can’t guess at what could possibly be wrong, it’s too complex a system
there's a template that uses AI, "Top Down" so i'm gonna analyse that one
All you need to do is add a supported agent and make that the size that you want.
thanks for trying, all!
Simple in theory, but lots could go wrong
agreed. i've been developing for a few years in unity
You need to learn how to debug. It doesn't matter how simple you think it is, you need to learn how to figure out exactly what it is doing.
that's not my point
debugging is always good yes but i don't understand how there aren't more tutorials or documentation to get the most basic aspect of AI navigation set up
Just a warning - that AI MoveTo node is not very reliable when used in a normal Blueprint. The MoveTo node inside a Behavior Tree is more reliable.
Looks like I added it in successfully. I have the logic setup to get the characters to walk already. On beginplay, I call AImove and set their enum state to walking. NPC stops on an overlap to look at the player, and resumes move ai on end overlap after a short delay. But after the recast went back to default even putting back in the same settings the npcs dont want to move out of their corridors. It looks connected to me, wdyt?
AI with blueprints on the learning portal and the 4th pinned link video here are prly the best ones for AI
There's a lot going on - I'd remove all the other logic and just hard-code a destination outside the corridor as a test. If that works, you know the problem is elsewhere
And, to be fair, in my experience the navigation does pretty much just work out of the box if you drop a Character in, like the Basic Navigation tutorial suggests. If you have a bare Pawn then you need to add the MovementComponent and I think that Just Works as well. Basically the Navigation requires a PathFollowing component, which I think gets added automatically if it doesn't already exist, and that then moves via the Movement component
Yeah it’s designed to work pretty much out of the box but for example I was trying to show them how the visual logger works and had to stop and fix my AI not pathing because of a rotation issue causing a line trace to fail. 😀 also engine didn’t want to print anything to screen even after restarts but that’s another story
Tried, set its destination to worldlocation +100 on x and just fails without additional logic
its something to do with the navmesh bc the logic for everything was working but at specific , currently unsure and not yet replicatable, the ai realizes it can walk along it or not. no other changes were made aside from adding in this new agent and allowing for the height to pass in
This makes no sense as it's literally the same functionality.
Show your navigation supported agent settings.
The bear is 80uu btw i set the navmesh to allow for heights of 20 which had worked previously
You have a radius of 0.
It was part of an earlier test bc the default radius didnt fit in the corridors. It worked at zero before, does it need a little bit of padding?
Underneath it is, but it's not wired up very well. Hence having an unlabelled exit pin, for example. There's a post from UE's main AI developer about it on their forums.
this message also comes up, new to the partition system. When I search for how to do this I just see docs about the compiler script. Is there somewhere i can access this in editor?
You need to make the corridors big enough for the NPC to fit, not force the nav mesh to ignore it
they are big enough tho?
its primary capsule is not touching the top of it or anything. the larger one is just a overlap trace for looking at the player
Unlabeled exit pins is how gameplay tasks work. I think you misunderstood whatever you read, because they are "wired up" the exact same.
Just looks for assigned targetpoint which I have checked , the bears are assigned to one in each level. On its way to the path it runs into an overlap volume that teleports them back to their original hallway. They go in a loop
Runs on BeginPlay and re-triggers when called to resume movement after an overlap (endoverlap)
the logic for it to stop is currently not plugged in, for testing so its definitely not being called to stop right away. its state is set to walk
test targetpoint which is assigned
Have you tried using the visual logger to see what path it's finding? Or any errors it might be logging?
First ive heard of that willlook into it
I think the path shows up in the gameplay debugger output as well, if I remember correctly
Documentation for visual logger redirects to Unreal Insights which doesn't seem relevant 🤔
Visual logger docs don't exist in the 5.x urls, so just use the 4.26/4.27 ones. They're still relevant.
Okay just wanted to confirm. In the meantime it does look like its movement mode is set to walking but 0's and idle
i also have a bunch of these, which cant be deleted
bruh I don't get it. I literally go to revert what I just changed in source control and start over and did the exact same steps and it works 
but heres all that was changed was the radius and updating the recast.
now its just a matter of it retaining these changes bc every time I opened the engine up previously it just ignored it, which is why I would think setting this default and adding new agents going forward will make the changes apply
yep. after merging changes into my work branch it just reverts the defaults. I don't get it I'm literally telling it to choose what I just did. It's definitely not in gitignore
i think it has something to do with worldpartition and these unloaded nev meshes
Yeah. Sometimes you need to delete the recast nav mesh, because something weird has gone wrong. I believe you can delete them if you load the cells they are in.
Luckily with it being parititioned per folder although I couldn't locate them in engine I just deleted the uassets pointing to it and it seems to help. Still testing but it seems to have the settings be more permanent now
Hi there. Quick question - I'm struggling with having my AI walk to a location that's far away from player. I use World Partition and dynamic navmesh.
In my BT I have a simple MoveTo node, and I supply the target location vector to my blackboard, now here's the issue:
- When I follow the ACharacter, it walks thrugh the world just fine.
- When I leave it be, to cover the path on its own, it fails to find a full path to target. It only gets partway through and can't seem to pathfind any further (Observed in ediotr with the
F8freecam mode. The tree exits the task, and treats it as completed. The task is immediately dropped if I un-check "allow partial path". The navmesh is still displayed further along the path, at least if theshow Navmeshdebug is to be belived, it's just that the AI refuses to use it)
Could you please help me figure out, what kind of settings might prevent my Navmesh agents from finding proper full paths if the player is far away from the goal?
EDIT: Upon closer inspection it seems to me, that the pathfinding is reaching an early stop, due to the non-linear nature of my path to target. (Targets that start closer to target seem to do better.) Are there any parameters that I could bump, to prevent Unreal from aborting the pathfinding too early?
I don't see how 'non-linear' would factor into this. But I can also imagine that the pathfinding is not designed to work over arbitrarily long distances, or to work on parts of the level that haven't streamed in yet.
Have you read this page, and made any necessary adjustments?
https://docs.unrealengine.com/5.0/en-US/world-partitioned-navigation-mesh/
-
You can't navigate through unloaded levels.
-
There is a limit to how many nodes can be searched during pathfinding. This can only be changed by editing source and will affect your performance. The more complicated the path and the further distance you try to path, the more nodes you'll need to check. Changing the cell size might help.
Thank you kindly 😄
I have a Blackboard variable called Location which is a vector representing where the AI is moving towards. I want to run some logic in the behaviour tree that is essentially: if Distance(CurrentLocation, Location) > 500.0 then MoveTo. Is there a way to encode this in decorators so that I don't need to create another Blackboard variable to store CurrentDistance as a float?
You can create custom decorators, and I believe you don't need one? I'm sure there might be settings in moveto or in the pawn/ai where you can change the acceptable distance of moveto
anyone know a good way to deal with killing ai through behavior trees?
What do you mean by killing an AI? Usually this is not handled in the BT.
Nvrmind fixed it
I worded it badly, I meant having a condition to have the ai not do anything when killed
You really should turn off logic when the NPC dies
You can create a custom decorator just like bt task and services
How to derive from UBlackboardData? Its too tedious to copy my common variables over and over again
Unnecessary. There is a built-in decorator.
If you did that, you'd need to do a lot of work for it to be usable. I would avoid this.
Found parent property in blackboard already
That doesn't change the answer.
can you tell me the name of that?
initially i though of CompareBBEntrie, but it just check for EqualsTo or NotEqualsTo
Is at location
You mean disable ai entirely?
Yes. They are dead.
oh got it...
if we set the Acceptable Radius of the Decorator to 500 or anything it is working ...
its something i didn't know about and till now i was creating custom blackboard ...
thank you for this ...
Is there a function for that?
Always look for built-in functionality before building your own.
Yes. You can stop the BT.
Ok thank you!
Brain Component -> Stop Logic
Has the node "Run Behavior Tree" been reworked in any way? Inside my character controller, it does not show up unless I untick Context Sensitivity. And when I add it to my AI controller it complains.
I don't think so
Sounds like something's funky about your BP's to me 🤔 What is it complaining about?
This is what it complains about. I have tried nodes like "Get AIController" "GetOwner" self. (this is in my player controller)
What is the parent class of this blueprint?
I made it with the base controller, thats why im so confused.
player controllers aren't AI controllers
that function works only on AI controllers
BTs kinda require it to be an AIC
I actually am mad at myself.....🤣 🤦♂️
is there a way for navmesh to consider the Height of the capsule when pathfinding ?
as of now only the radius of the capsule is considered but not the height .
It does consider the height.
Why Blendspace not working when using MoveTo node in behaviour tree??
Character is an ant btw
Are you using acceleration to determine if it is moving, like all tutorials for the player tell you to do? If so you either need to turn on use acceleration for paths in the movement component or use velocity.
Is that your transition logic?
No, just to get the speed
What are you using to transition to the walking state? How do you have your anim BP set up? Is the pawn moving, but not animating?
it is moving as intended, but the 1D blendspace idle/walk does work when I am 'MoveTo' node in BT, I have turn animations that works fine.
Also the walk/run animations when plugged directly to output doesn't work
Sounds like an animation problem that #animation can help with.
alright, I'll ask there
I was in here a few months back when I was workin on my NPC logic and it was tremendously helpful. Would anyone want to/be willing to playtest the project and provide feedback on the NPC behaviour? It's a learning project, not any commercial project. It's free on itch.🙏
Got a wierd thing happening. Even though the distance won't be within the 150 for some reason it still gets in and runs that code
anyone got idea why that would happen. Like there can see target but distance to and I've see it so unless both of them are true well it can't go in that
but it still seems to
so I've sorted it by well removing the can see target
Hi i just want to ask if there is any way /or tutorial on how to do proper avoidance for my units:
nope not sorted it it's like when can see target is on that sequence it bypasses the other decorator
You really should use Is At Location. You should however use the visual logger to step through the behavior to verify that distance to is not < 150uu.
RVO (movement component) or Detour (path following component) are the 2 built-in solutions for avoidance.
Got to debug it now, the issue is when I spawn the AI enemies
the behavior trees work, but the AI perception is nowhere to be seen
this is also slightly spotty (sometimes they do spawn with AIP) but I'll desconsider that cuz it's so rare
I tried placing a "spawn default controller node" to no avail
Auto Possess AI is also set to "placed in world and spawned"
nevermind everything, this was all it took to fix it. Changing it to "on possessed" though
I don't get what you mean sorry
Also I've verified the distance thing. It's when the can see target is there as well it seems to like ignore distance one and Purley got my can see target which is wierd
The task won't initialise unless both decorators evaluate to true so something is happening that you're not aware of. I'd put some debug value prints in the decorators themselves.
Also it looks like your blackboard key is a float value. Shouldn't this be your player? How are you telling the decorator which object it should be evaluating distance from?
So there's a service node further up
That takes in the target and gives out float
Which decorator checks against
With the information I have, I'm not sure why you need a service node. You'd use ai perception to register when the player comes into view, set a variable, then have a branch activated by IsPlayerSet, then have a sequence. The first task would get distance, the next would be a selector with two tasks under it. Each task would have the same decorator node that checks if the player is in range, with one inverted.
Is there something like batched AI systems on detour and such ? I see there is a max agents number, shouldn't be there something like a max agents on move per batch movement ? so can handle bigger numbers spliting the logics ?
Is there some entry point to check this ?
what node will stop an AI moving even during the middle of an AIMoveTo call?
stop active movement
seens like that node stops it until further notice.
is there an allow active movement node to play when I want them to move again?
u dont need to, that just stops whatever u have going, u can just move it again after
apparently not.
This stops the AI, but they dont patrol again after.
The visual logger is a debugging tool. It is highly recommended to use for AI.
Using a blackboard for distance and setting it via a service is really unnecessary. There's a built-in decorator called Is at location that takes in an acceptance radius that is a better distance check.
but I still need to provide it with a location
the distance thing I've put in specifically does a check between enemy and player
Your version is unnecessarily complicated and likely having issues, because the check is happening before the service can set it.
so the change I made was the service now runs before the decorator does the check
You need to actually start the move again, it doesn't happen automatically.
i got it working it seems
does anyone knows why if I set team ID to FGenericTeamId::NoTeam the perception system won't detect the actor?
Although I have configured it not to detect friendlies but only to detect hostiles, it still detects both friendlies, hostiles and neutrals.
Sight->DetectionByAffiliation.bDetectFriendlies = false;
Sight->DetectionByAffiliation.bDetectEnemies = true;
Sight->DetectionByAffiliation.bDetectNeutrals = false;
I'm so confused
I've changed my grab thing on behavior tree so it's using bool and I have a service before the decorator else where effectivly doing the check and setting the Blackboard key accordingly
some how though even though the value is false so is not a pass it's still seeing it's a pass
any ideas here cause I'm not on this one
I'm trying to use the visual debugger thing but never used it before so not finding it easiest to understand
thats mu graph
the visual logger
AI move to node is failing and I dont know why, what are some reasons why it could fail?
This AI MoveTo node is running but is failing
I don't get it...
this code is running on spawned AI character, is there additional setup required other than just spawning them?
Your service is not before the decorator. That is not how services work. Services tick WHILE the task below is executing.
If you Google the visual logger, it will get you the documentation. The screenshot of the visual logger cut off all the information.
Your AI could not be on the nav mesh. Your destination could not be on the nav mesh. It could also be that you don't have navigation set up.
I haven't figured it out yet if anyone can help
Have you defined attitudes? https://forums.unrealengine.com/t/how-do-i-use-the-ai-perception-teams/120837
I’m trying to implement AI Perception in C++ and I got to the point I always get stuck with and do workaround, the teams or affiliation (friendly, neutral, enemy). How do I assign different teams to different controllers? I know this was asked before, but I can’t really understand how to do it, and some stuff is outdated. The AI Controller alrea...
I don't remember if I used this thread to get it working but you basically need to define attitudes (friendly, neutral, hostile) to the generic IDs set in the controller classes.
yes I did
and for testing I'm checking it like this
ETeamAttitude::Type TeamAttitude = OtherActorTeam->GetTeamAttitudeTowards(*Actor);
switch (TeamAttitude)
{
case ETeamAttitude::Friendly:
UE_LOG(LogTemp, Warning, TEXT("Friendly"));
break;
case ETeamAttitude::Neutral:
UE_LOG(LogTemp, Warning, TEXT("Neutral"));
break;
case ETeamAttitude::Hostile:
UE_LOG(LogTemp, Warning, TEXT("Hostile"));
break;
default:
break;
}
I set
Sight->DetectionByAffiliation.bDetectFriendlies = false;
Sight->DetectionByAffiliation.bDetectEnemies = true;
Sight->DetectionByAffiliation.bDetectNeutrals = false;
but Sight->DetectionByAffiliation.ShouldDetectAll(); returns true
So what my service needs to be on same node as my decorator ?
Cause that's what I did before and I understood it I was still doing it wrong
Also I have my service on a bode before that one in screenshot that the decorator is on as you see
Thank you I figured it, the IGenericTeamAgentInterface must be implement on both AIController and the Character class in order for Detection by affiliation to work, I only had it on the Character
it depends on your implementation of GetTeamAttitudeTowards
https://zomgmoz.tv/unreal/AI-Perception/IGenericTeamAgentInterface#ai-controller--only-implementation You can for example use an approach like that to avoid implementing it on character, although personally I have it on my character also
as I understood if it's on the controller it doesn't need to be on the character but if it's on the charater it must be on the cotroller too
Yeah I think that's the case since the implementation for the sense assumes it's on the controller or something along those lines
I actually think I ended up removing all but generic id getters from the character and retaining a functional system.
And also repurposed the generic interface for hostile/friendly identification beyond the perception system, for traces and overlap events.
I don't have it on my player control only on AIController and BaseCharater, and I assume if I need it to have more functionality I'd inherit from it and and extend it then implement my custom IGenericTeamAgentInterface on controllers only
true it can be used for anything team base friendly fire allies etc...
When you view it as a standard, overrideable interface, it starts to become a pretty powerful tool. Anyway, glad you got it working 🙂
thank you and @misty wharf for help
So I looked on Google on documentation for services and I can't see where I'm using it wrongly
So still none wiser as the why the decorator is looking at the bool see its false but still allowing passage through the sequence
If you click the decorator what does the details panel show
It's a bit weird it says "IsWithinGrabRange is"... is what?
Target is within range
I have a service slight higher which sets the is within range bool like the blackboard key
Yes I mean the thing that's weird is that it says "is".. not "is set" or "is not set" or whatever
which is what it should say
and that's why I wonder if there's some problem with how it's been configured and wanted to see the details panel
The decorator looks at the key and only let's it so stuff under it if is within range is set
Oh sorry not at my pc at moment but details for it if I remember
Abort self
And is set
Blackboard key is within range
Yeah it looks correct other than that so I'm not sure why it would let it pass into the node if it was correctly set up otherwise
So once you get back, maybe try just redoing the decorator and make sure it says "Blackboard: IsWithinGrabRange is set"
because I'm 99% sure the blackboard decorator should show that kind of message on the node when it checks if the value is true
which it doesn't seem to be doing in your screenshot
Also if it still behaves seemingly wrong after that, try using the BT debugger to verify the variable value. If you pause the BT, it should allow you to step backwards to the point where it would run the decorator, and you should be able to see the current BB values
How do I access the BT debugger ?
Never knew there was one
Just use the pause icon in the BT editor when you are playing
Arr right okay
That isn't even remotely close to what I said. Your service is not going to tick before it checks the decorator. There is a check box to tick it on search start that you need to use.
The visual logger will help you to debug it. It's a timeline tool that will show you the flow of the BT. You can also add your own logging by using the vis log nodes. If you Google visual logger, you will find the documentation and a bunch of videos that goes over it.
What is the Visual Logger in Unreal Engine 4
Source Files: https://github.com/MWadstein/UnrealEngineProjects/tree/WTF-Examples
Note: You will need to be logged into your Epic approved GitHub account to access these examples files. https://github.com/EpicGames/Signup
I'll have a look once home
so
I've looked at my code
This is the service and the points where it's running, it's says player in range false
This is what the blackboard Decorator is looking for to allow the stuff under it's sequence to be ran
That is the BT setup, Distance to Target service ran whilst combat branch is being done and the decorator on the grab target sequencewith the details above
still for some reason the BT or something is ignoring that decorator and still allowing it self throw
if anyone can help at all that would be awsome cause I'm confused what could be causing the issue here
Put a print into BTT_GrabTarget which prints the value of IsWithinGrabRange
The first thing we really need to do is to establish for 100% certain that the decorator is letting it through with the wrong value
If it prints false in BTT_GrabTarget, then we've at least established that
so when I do the vis log on BTT as well
it only shows it's hitting once
So just after I press Play and it shows the value being false
for iswithinrange
can you show the bp for how you printed it out
An then just where you have the last two on the BTS one of the is false which is correct and the black blue showing true which is correct as I walked up to the bot to test something else I've been having issues with
Thats the BTT GrabTarget
would be printing each time that task is ran
And thats the BTS
so where I'm doing my distance calculation and spitting out the bool to the blackboard
So it sounds like it is actually passing the decorator with false as the value 🤔
yeah
Try deleting the decorator and recreate it
Shouldn't make any difference for the actual bool check
so
it's not doing the grab anymore like it's going to the patrolling stuff which is right cause I'm not in range of grab
Let me guess it no longer says "IsWithinGrabRange is" in the node's description and instead it says "is set" ? :P
Oh I meant here
Yeah, guess the decorator was somehow screwed up
thats wierd in terms of why it would say is
got another question
so when I'm in range of the enemy it seems to bug out and the bot walks off and it's bit touch and go if he'll actually grab, what abort would I need to use there to like just abort what ever it's doing ?
just thinking obvs common sense would say your in range of it to grab so it would rather then bugged and it walks off and gets wierd
Maybe abort lower priority would work better since it would prevent it from aborting this branch once it's entered even if the value was to change
so just checking here
how would I determine if I should have it just abort lower or both so obvs self and lower ?
would I do both say if it's something where I done want it to either do or not do it's own task as well as others ?
Yeah it just depends on how you need it to behave
If you want it to abort itself when the decorator's result changes, then you'd use the self options
But as said when that is appropriate depends on how you want it to work
fairs just be trial and error I guess as I build more into it's behaviors
Hello, does anyone happen to know why the MoveTo node might make the AI walk towards the target sideways?
For instance, if the AI character is walking towards the player position (not the actor itself), it might be walking sideways instead of facing the velocity vector. However, when the player stops, the AI character turns perfectly towards the velocity. This does not happen when I use the actor as a target instead of a vector
Make sure the skeletal mesh is facing in the direction of the root (the arrow you see in the viewport). Often you have to offset the mesh yaw by 90 degrees.
If not this, then it may be some settings in the class default or movement comp such as Use Controller Rotation Yaw or orient rotation to movement.
The CMC is set to Use Controller Desired Rotation. The controller rotation is updated anytime the AI is using certain AI related functions, such as MoveTo or RotateToFaceBBEntry, so I would imagine it to rotate towards the player position it's running towards it. The weird thing is that it only happens when player stops moving
Get print outs of your yaw and make sure that it is the root that's rotating strangely
The only yaw that matters here is of the control rotation. It pretty much prints the same thing it shows on the scene. Anytime the AI is walking sideways, the yaw doesn't change, unless the player doesn't stop. btw one thing I forgot to mention is that the AI has the sight sense, and if the player leaves the FOV, the AI will rotate just enough to get them into the FOV once again. Here's what it looks like
Video isn't playing my end
Your rotation rate is too low on the CMC.
It's 720
Do you have allow strafe turned on?
Nope
Just to mention again, it doesn't happen if I use an actor instead of a vector in the MoveTo node, however I need to use vectors
I would use the visual logger to debug what is going on.
If you switch off the FoV rotation offset, do you get the same behaviour?
for some reason my character Ai just wont move its stuck in this one phase
#include "BTTask_FindRandomLocation.h"
#include "NavigationSystem.h"
#include "NPC_AIController.h"
#include "BehaviorTree/BlackboardComponent.h"
UBTTask_FindRandomLocation::UBTTask_FindRandomLocation(FObjectInitializer const& ObjectInitializer)
{
NodeName = "Find Random Location in NavMesh";
}
EBTNodeResult::Type UBTTask_FindRandomLocation::ExecuteTask(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory)
{
//get Ai Controller
if(ANPC_AIController* const cont = Cast<ANPC_AIController>(OwnerComp.GetAIOwner()))
{
if(auto* const npc = cont->GetPawn())
{
//obtain npc location to use as origin
auto const Origin = npc->GetActorLocation();
//Get navigation system and generate a random location
if(auto* const NavSys = UNavigationSystemV1::GetCurrent(GetWorld()))
{
FNavLocation Loc;
if(NavSys->GetRandomPointInNavigableRadius(Origin,SearchRadius,Loc))
{
OwnerComp.GetBlackboardComponent()->SetValueAsVector(GetSelectedBlackboardKey(),Loc.Location);
}
FinishLatentTask(OwnerComp,EBTNodeResult::Succeeded);
return EBTNodeResult::Succeeded;
}
}
}
return EBTNodeResult::Failed;
}
i cant figureout why it wont use Move To
nvm i just added sequence it works now im idiot
-.-
It seems to be related to the new phone Discord version. It wasn't playing on my phone either, but it does play on the PC.
Yeah I figured. It's a weird problem. As long as your character is set to use controller rotation, the character should face the direction the move. Usually if I get problems like this, it's some logic I've implemented months ago and forgotten about. Are you using set focus at all? Any other rotation offsets anywhere else in code?
I'm not using the focus explicitly. There's no rotation offset in my code what so ever, everything rotation related is handled by the native AI functions (MoveTo and RotateToBBEntry)
I remember you mentioning that you rotate the ai if it leaves pov.
Is the rotate task definitely not being called while move to is executing?
It's not me doing that explicitly, it does it itself automatically, using the very same MoveTo node it is using to chase me
Double check this and also draw a debug sphere at your move to target vector. Also check to make sure this value is consistent from move to begin to end.
I've implemented a dummy actor that would move around the AI, and also added some drawing in the SetFocalPoint like that
void AMTH_AIController::SetFocalPoint(FVector NewFocus, EAIFocusPriority::Type InPriority)
{
Super::SetFocalPoint(NewFocus, InPriority);
FDebug::DumpStackTraceToLog(ELogVerbosity::Warning);
FVector Location = GetPawn()->GetActorLocation();
DrawDebugLine(GetWorld(), Location, NewFocus, FColor::Red, false);
DrawDebugSphere(GetWorld(), NewFocus, 10, 12, FColor::Red, false);
}
You can see that the AI tries to walk both forward and towards the target only when it's on the edge of the FOV. Using the DumpStackTraceToLog to see what actually changes the focus, it turns out that nothing but UPathFollowingComponent::UpdateMoveFocus() uses the method. I'm attaching the related log just in case https://pastebin.com/ZHaVDhfH
Using "Advance a single frame" feature it turns out that it alternates the focal points. It means that frame A it tries to focus on the forward, while on frame B it's focusing on the target location
Yes, that's what I suspected
Did you figure out why and where the alternation is happening?
Why -- idk, where -- UPathFollowingComponent::UpdateMoveFocus(). That method uses this one to get the vector
FVector UPathFollowingComponent::GetMoveFocus(bool bAllowStrafe) const
{
FVector MoveFocus = FVector::ZeroVector;
if (bAllowStrafe && DestinationActor.IsValid())
{
MoveFocus = DestinationActor->GetActorLocation();
}
else
{
const FVector CurrentMoveDirection = GetCurrentDirection();
MoveFocus = *CurrentDestination + (CurrentMoveDirection * FAIConfig::Navigation::FocalPointDistance);
}
return MoveFocus;
}
It should be going straight to the else branch as I'm not using strafes
So the only suspect is the CurrentDestination vector, which is most likely is becoming fwd or the direction towards the target
Anywhere you're calculating a vector, draw some debug lines from the origin to try to narrow it down. May be that the move to destination is changing between ticks which would affect the output of the above as it's using move direction.
It's not the issue. The blue sphere is the one I'm assigning to the BB
Can't see the video dude sorry
That's fine, it just shows that the location the AI is told to move by my code is always on the sphere
But drawing line would confirm that you're only setting one location. Could be that some sphere is being drawn in Narnia.
Next step, I would manually get your move direction and draw a debug arrow to confirm the issue is related to multiple move direction spitting out different focal points.
Ie Get velocity and normalise
I already draw my move destination. I also tried to draw the move direction the CMC makes use of at the time of a tick, and it's always pointing the target, not the fwd
And it's never a zero vector?
Very weird issue
uh, I'm not sure whether it's zero at some point as I normalize it to draw the line. Will check
Yeah, it's never 0
I was wrong about the method. Since I'm using PathFollowingComponent, it overrides it to
FVector UCrowdFollowingComponent::GetMoveFocus(bool bAllowStrafe) const
{
// can't really use CurrentDestination here, as it's pointing at end of path part
// fallback to looking at point in front of agent
if (!bAllowStrafe && MovementComp && IsCrowdSimulationEnabled())
{
const FVector AgentLoc = MovementComp->GetActorLocation();
// if we're not moving, falling, or don't have a crowd agent move direction, set our focus to ahead of the rotation of our owner to keep the same rotation,
// otherwise use the Crowd Agent Move Direction to move in the direction we're supposed to be going
const FVector ForwardDir = MovementComp->GetOwner() && ((Status != EPathFollowingStatus::Moving) || (MovementComp->IsFalling()) || CrowdAgentMoveDirection.IsNearlyZero()) ?
MovementComp->GetOwner()->GetActorForwardVector() :
CrowdAgentMoveDirection.GetSafeNormal2D();
return AgentLoc + (ForwardDir * FAIConfig::Navigation::FocalPointDistance);
}
return Super::GetMoveFocus(bAllowStrafe);
}
Apparently sometimes the ForwardDir is either MovementComp->GetOwner()->GetActorForwardVector() or CrowdAgentMoveDirection.GetSafeNormal2D()
And yeah, sometimes the CorwdAgentMoveDirection is 0, so it uses the fwd instead
When it works correctly, i.e. the velocity direction is towards the sphere, the CrowdAgentMoveDirection is only edited here
void UCrowdFollowingComponent::UpdateCachedDirections(const FVector& NewVelocity, const FVector& NextPathCorner, bool bTraversingLink)
{
// ...
if (bIsNotFalling)
{
// ...
else
{
CrowdAgentMoveDirection = (bRotateToVelocity || bTraversingLink) && (NewVelocity.SizeSquared() > KINDA_SMALL_NUMBER) ? NewVelocity.GetSafeNormal() : MoveSegmentDirection;
}
}
}
i.e. it just normalizes the velocity, so that the character keeps moving along it. The method is called each tick.
However, the frame it gets wrong another method is called, which is the UCrowdFollowingComponent::SetMoveSegment. It's pretty big, but at some point it sets it to zero vector, with this comment just above the line // not safe to read those directions yet, you have to wait until crowd manager gives you next corner of string pulled path. There's nothing that can set the CrowdAgentMoveDirection in that method after it was set to 0, but, as the comment tells, the crowd manager should assign the direction at the next corner or something (even though I don't have any)
If I can't find any solution, I can always try to use RVO instead of crowd manager unless multiple agent navigation becomes a problem 😔
In my case there aren't many agents, yet they're more than one, but I guess RVO could make it in certain cases
I didn't pay attention to the stack trace at the moment of the SetMoveSegment that sets the direction to 0. Apparently it's called because I set a new destination value in the BB, which makes it call a new MoveTo. Up until the SetMoveSegment it's does everything correctly as it's not using anything crowd management related. So I guess using regular PathFollowingComponent would work just fine, but the crowd one won't, as it might not been designed with this way of using it or something.
In fact, that's the reason why the character faces the target correctly when it stops moving at all, as the BB doesn't update any value, and no SetMoveSegment is called
It largely depends on how your game will scale. I generally use RVO but so far, I've rarely had more than 10 AI at any given time. I can't say it's given me any grief so far.
Unfortunately, I think the only solution if you stick with crown following would be to init your own component that derives from the crowd comp and overwrite or reconfigure your own functions that bypass the limitations according to your use cases. It'll be quite a bit of work so trying out RVO may be a better use of your time but that's your call.
Either way, well done on tracking down the problem. It isn't always easy picking apart epic's source code.
I have at most a few smaller enemies along the big one, so it should be fine using RVO. Modifying the crowd component would be error prone since there're reasons they do that, I just don't want to get in more troubles down the road. So yeah, I'll switch to RVO, and it should work fine
GL
so have a new issue where this branch still seems to do stuff even though AI can not see me anymor
I think my issues is the parrallel
Also the AI does as well
Did you make it forget the target anywhere?
Don't believe so but shouldn't matter
The can see target should break it out of that branch
I might just have to debug again tommorow
That’s what I mean. Are you making that Not Set at any point?
Yeah sorry in ai controller
After something like 5 seconds
I think I might know my issue actually.
I delay setting can see target to false. What I'm thinking is due to that it's doing wierd stuff
For the fire weapon I think I'll have to have like a inshootingrange bool instead
Along side the does have ammo
I want to make formation AI on unreal engine
what should be the way to approach
think there is a big army in a formation
now i want them to work from a parent formation pawn which handles all the army
what should be the way to deal with it?
Set a leader, determine an array of directional vectors (V) and distances (D) that correspond to formation positions, then add V*D to the leader's location every tick, with some temporal offsets if you want it to look a bit more natural.
what about AI Controller of AIs?
is there extra calls or something?
i need to think of performance too
In your leader ai controller, keep an array of army units and feed them the locations
So calculation is only being done by one class instance
You're welcome
are other NPCs ok without AI Controller?
also how what's the better way to move NPCs to dynamic target?
like target which changes constantly
an NPC targetting other NPCs?
i did all these in my unity days but wanna know how things would be in UE
since it follows some architecture of sort
If all you want to do is move them around, you can just use actors and lerp them to their locations. If they eventually need more complex behaviour, they'll need their own controllers and either behaviour trees that move them to locations or just to move to location in their controller class
Move to has the advantage of pathing along the nav mesh
that's what I wanna know how navmesh works in UE
for starters in UE if I wasnt careful then I would've been calling many things just to set destination to target and thus lagging the game in process
wonder how that plays out in UE
Move To seems a bit buggy
if I set to specific actor then it tends to go out of navmesh????
Not sure what your question is. There are plenty of tutorials on nav mesh and ai movement around. Move to isn't buggy and setting destination isn't much of a relative performance hit.
Hey,
Does anyone knows how to disable the slow down / slow movement when using the crowd manager?
When the AI near each other they will slow down their movement and I would like to disable that
Isn't that part of the whole avoidance thing? Wouldn't they start bumping into each other if you turn it off?
Right, but the all slow down kinda takes the fun away.
Imagine that an enemy is attacking the player and you both standing still, then another enemy rushing toward you and then because there is another enemy nearby, his starts walking slowly... not thrilling.
I suppose... maybe take a look at how the avoidance system works, there could be something you can tweak in there. You could potentially allow your enemies to overlap, and adjust the crowd agent interface implementation so that the agent's cylinder size the interface reports is smaller than the real cylinder on it, which might allow them to still avoid each other but not be affected by it as much.
Does anyone knows why the AI move to breaks his path all of a sudden?
It happens in specific small areas.
I keep holding the mouse for the character to always move to the mouse location.
And sometimes it just breaks to a certain direction where there's nothing on the path, no obstacles or any object that can affect navigation.
Can’t really guess these things, use the Visual Logger to find out what’s failing and why
I did moveto to an actor
it goes out of navmesh and stucks outside
reminder that I was using floatingpawnmovement
Howdy there, just messing my hand with AI and did a BP_Hostile Base and intending on making Child BPs that use the same Behaviour tree but with Decorators that will work off whether a certain boolean is ticked.
Now, i just simply wanted to ask how to actually create a custom decorator that could do this.
So as an example:
Standard BP_Hostile doesnt have Melee Ticked, but its child will.
Boolean Melee in a child actor, it'll pass through the Decorator selector for Melee Behaviour.
I sorta got my head round Tasks, but Decorators seem to act as Big booleans so thought to ask.
For decorators you have to override a function instead
Your logic is otherwise correct - if you override the function, you will get a return node for a boolean value
I forget what the function you need to override is called, but it should be fairly obvious if you check the list of available functions
Oh i see, thank you for the response, and yes i do believe i see it:
Condition Check AI.
I want to make navmesh without any collision stuffs
what should be the approach to go for?
Something similar to Unity
What do you mean without collision?
In unity, we use to add simple navmesh component and its internal set destination to move units are around
Not seeing the same case with UE
Its integrated with pawn
Or idk maybe AI Controller
If you want to use the built-in path following functionality, you need to have an AI controller. The simple move to node can work with non AI controlled pawns. You can also do your own path following, but I wouldn't recommend that unless you know what you are doing.
yeah but looks like separate AIController is another Actor with its own thing spawned on Editor?
Controllers are actors used to control pawns. I don't know what you mean by "separate AI controller" and "spawned on the editor"
I was referring to something attached directly to Pawn Actor itself. Not separate....
anyway doesnt that cause extra overhead?
in my case I want tons of NPCs on scene
It's not attached
Depending on what you mean by "tons" the AI controller is likely to not be the problem. It will be the movement component. You might want to look into mass instead
mass not done
very premitive...
Primitive is not a word I'd use for it
AI works directly with it?
Probably some Physics, etc?
It has it's own AI functionality called mass ai
supports Navmesh?
The nav mesh doesn't care what type of object used it. Whether or not there is some built-in path following solution for the nav mesh is a better question for #mass
I looked at it and it seems its just spline following?
Do some tutorials to understand how the engine work. Spoiler: it's not the same as Unity. All your questions are answerable with some mild Googling.
i asked it after googling. Also not much talks out there about mass
Your questions about controllers, pawns, NavMeshes, general navigation and collision are all covered in introductory tutorials. Mass isn't something you'll need to think about for a while. Those of us helping on these on these forums expect you to have taken the time to get up to speed.
In this video tutorial series we will going over everything regarding AI in Unreal Engine 5; including some examples of AI behavior typically seen in commercial video games.
In Part 1 we do some basic character setup to prepare a character for use as an AI character.
SUPPORT ME
Patreon I https://www.patreon.com/ryanlaley
Buy Me a Coffee I buym...
#mass is still very new but the people and resources in that channel will help
'Use Continuous Goal Tracking' makes my enemy AI's movements significantly more fluid, but the task doesn't seem to stop even when the target has been reached and prevents my successor logic (use: swing sword ability) from activating. Is there any way to tell this task to stop so the Behaviour tree can execute the other tasks?
'Stop on Overlap' doesn't seem to do anything
This is completely untrue.
Why did you make your own move to instead of using the built-in? Why are you adding the capsule radius to the acceptance radius?
Hey Luthage!
- Why did you make your own move to instead of using the built-in? - So that I could add additional gameplay logic and error handling (setting the player to 'InCombat' State etc.)
- Why are you adding the capsule radius to the acceptance radius? - So that the movement and distance checking will be independent of the 'size' of the enemy. There are some big boys in my game
I think I might have found a way to fix this, I can add a distance check on tick which will cancel the move and let the logic move to the next one
Why is the AI setting anything on the player? That sounds like a recipe for disaster.
You need to implement cleanly aborting the task if you don't use the built-in task. Since you lose that.
Stop on overlap already takes the capsule radius into account. Both the NPC and Target.
That's not a real fix, because the path following is already doing that. Does it stop appropriately when not using continuous goal tracking?
Could you elaborate on why 'AI setting anything on the player' is a recipe for disaster? It seems like an unavoidable step for a hostile AI character.
I already implement a 'receive abort AI' event which cancells the task, same for the tick that finishes. It seems to work fine.
I didn't notice the overlap triggering on my tests... But in any case I need NPCs to always have 'some' distance to the player, so it probably isn't the solution that would work for this situation.
Without using CGT, it does work OK but the rotation is very jittery and it doesn't follow the player well
Have you tried debugging it with the visual logger? I don't use move to actor, because it gives bad behavior.
No, I just assume the 'MoveTo' without CTG is moving to the previously cached location an actor was at, and it updates with the new position when it reaches it.
With it on, it chases my player very fluidly and rotates well
The AI should not decide when the player is in combat. It's a recipe for disaster, because if you want to change what defines when the player is in combat, you have to remember that it's the AI making that decision. Also if you have multiple AI, how do you unset it? There's a big difference between "the AI tells the player it's attacking it" and "the AI decides when the player is in combat".
I can see what you mean, but its ok 🙂 It's a part of the game design, and handled by a GAS GameplayEffect with a Duration, which so far has been reliable in not bugging out (e.g. permanently setting the state for a player)
What do you mean you didn't notice the overlap triggering on your tests? It's just a distance check and not using actual overlaps. Have you debugged it using print statements or the vis log for the distance?
Yeah it didnt trigger for me, the character was locked in the moveto command
Are you suggesting the 'moveto' command takes into account distance between capsules? So I don't need to compensate for it?
That's what stop on overlap means
Hi! I'm working on destroying actors that have a StateTreeComponent attached. I'm facing a crash related to the component tick function and reading instanced struct data. What I'm not sure is why this error happens, since previously I have disabled the component's tick, and also manually called Stop() on the State Tree execution context. This is the callstack of the crash:
Maybe I am stopping/disabling the state tree incorrectly, but I don't really know what else should be done with it
Are you forcing the delete? Maybe try set it to 'Pending Delete' or whatever flag the GC uses and the engine should clean it up properly?
If you can reproduce it in a fresh project, fire a bug report to the epic team, its a golden ticket for them and they can put a fix in
Yeah I am basically calling "destroy" on the actor. Before that I tried both manually destroying and stopping the component, and also not doing anything with the component
Sure, I'll do a bit more of research on my end (to make sure it's not a mistake on my end) and try to reproduce on fresh repo else
if anyone can vc, help would be appreciated as my behaviour tree is acting a tad bit broken
decorators seem to not want to work
nvm they do, just the behaviour tree tasks seem to not wanna execute
got some other issues as well
Hey all, I got a question: Is there a node to find the nearest reachable point to a location?
GetRandomReachablePointInRadius
not the nearest though
nearest point would need a lot more work
@fading field I think if you use project point to navigation this should get it
oh wait yeah
That seems to work, thank you so much! 😄
so got an issue thats confusing me
when my AI looses sight of player there still shooting
I'm currently using CanSeeTarget for the check going into the shooting behavior
would people say maybe I should use another bool that work more with the behavior then doing generic CanSeeTarget
I’ll reiterate that you might want to look into the forgetting actor feature
Not sure what can see target is, is that part of perception system?
no I'm using my own custom pawn sensing that I made
Oh, well, not much we can say how to fix that then I think 🤔
Sounds like your target data isn't being updated correctly when sight is lost
this was before I obvs found out I can actually put the Sight perception on the mesh like so it follows specific mesh bone etc
Maybe add some logging into it to see whether the variable values are what you think they are to help debug
so from what I could see it was like even though it should abort out the behavior it wasn't unless the parrel had finish
*finished
Ah.. Yeah tbh I never bothered dealing with simple parallel, I could never decide what was a good way to use it :P
Anyone here create a State Tree Task in C++, then assign it put a break point in the code to debug the task and it never enters the task?
I got it, I was using a custom schema and a function that made the state tree run was based on me using a specific schema
So got this issue I have my AI on a nav mesh
However it seems to be failing on projecting to navmesh
It can't even find itself either tbf
like it don't seem to be able to see itself in world like if I do debug sphere at it's location
if I tell it like to move to patrol points its fine
so bit confused why random point wouldn't work or why it could get it's own location from what I could see
I need an NPC that walks over, sits in front of and starts interacting with a slot machine. Would smart objects be a decent solution to this? Where i give the slot machine a smart object, the NPC finds it and then uses it? and then i just do the slot machine logic in a something like a gameplay behavior class?
Hello I have some question
I'm making an rts game in it each unit is ai pawn control by individual ai control
Now I wanna create enemy npc factions
I was thinking of creating ai controller to act as the faction "brain" and have it to issue orders and commands to its unit controllers
Is this the best way to go about doing it? Are there other ways more efficient to achieve it?
First you need to clarify what the problem is, you initially said “it fails to project to the mesh”, then you said it can patrol fine, but get random point isn’t working, but the code seems to be firing so you could very well have not properly setup the bb key that you’re getting. Start by watching the video in the 4th pin here if you haven’t already. Then learn to debug your code using breakpoints and hovering over input pins, gameplay (AI debugger) and visual logger
yeah so if I try have it just roam around it for some reason doesn't find it self on a nav mesh to be able to get a random point.
however if I tell it to patrol a path I create in same area where it's positioned it'll navigate fine on the nav mesh it's on
when I was bedugging from what I could see if wasn't able to see where it was on the nav mesh to be able to get random point within it's location
the bb key as well i removed and attempted to simply do it from the controlled pawn pin and like I say that was working either. Very strange issue I will have to return back to at some point
Yes. Smart objects is what you should use for that behavior.
In what ways have you tried to debug this? Because it doesn't sound like you have at all.
so first ensured it actually is on a Nav mesh which is it
ensured that it is runnning the behavior tree selected which it is
I would not use an AI controller as the faction brain, because it will not have a pawn to possess.
checked the location in terms of both it picking random one from either it's own location on the nav mesh
and also from a target vector on the nav mesh
What do you mean by you ensured this?
How did you check it?
well literally placed it in an area that has nav mesh and checked the debug thing
What do you mean "checked the debug thing"?
had behavior tree open and selected the pawn using that behavior tree and could see it was spassing between finding a random point and moving to. Also have a branch on the random reachable point function and could see it was failing that
As you can see here it's failing
The controlled pawn is valid as you can see
fixed it now
I saw my error
has anyone run into issues with EQS traces before? the trace to the player is failing even though it's obvious the points can see the player pawn
I already checked that the Visibility channel is set to Block for all pawns, which I thought was the problem at first
I would check the basics
like for my issue it was simple wrong vectors going into the select
even though you can clear see something, depending how you've programmed you actually may have introduced some incorrect stuff
yea, I'm trying to isolate the issue, but I wish there was a way to visualize the EQS traces
I suppose I'd have to write my own custom trace in c++
I would need a NavMesh chad that could help me with a problem (AI getting stuck)
I figured this one out; in short I'm dumb and accidentally switched the "trace" test from "require not hit" to "require hit", and then reading it made sense to me because I thought "require hit" meant a hit on the player pawn (it doesn't)
thanks to the EQS testing pawn built into unreal for helping me debug, it's pretty handy:
https://docs.unrealengine.com/5.3/en-US/environment-query-testing-pawn-in-unreal-engine/
What is a nav mesh chad?
I know you already solved your problem, but I prefer making my own visibility test using the Has Line of Sight To function in the AI controller. Another problem with the trace test is that it doesn't put the start location at the eyes location. With the location on the ground, a small rock can block visibility.
A person that know something more than a devil about nav meshes ahahhaha
Go ahead and ask your question. Lots of us know about nav meshes.
Also, I recommend you not ask for an "alpha male".
What does that statement has to do with what I said? 🤣 🤣 🤣 🤣
That's the definition of a chad
I'm here to learn and program not to fight about human rights or other stuff I'm sorry.
All of this time wasted because you didn’t just ask your question
Don’t ask to ask, present your issue and ask your question, it saves everyone time, and possibly nerves
I already told them to ask the question and it was ignored. 🤷♀️
I'm sorry 😔
Hey everyon. Quick question, does anyone know if the detour crowd works with a Pawn or does it have to be a Character? The reson I ask is because I have a pawn and I made a movement component class that inherits from pawn movement component and I'm overriding the RequestDirectMove(const FVector& MoveVelocity, bool bForceMaxSpeed) method from it.
When I just use a navmesh volume and I call MoveToActor it works fine but when I add the crowd following component to my controller the MoveVelocity I receive is just a vector 0. Am I doing something wrong or its just not possible?
I also have implemented the crowd interface on my pawn and registered but I still only get vector 0.
that's a really good point, thanks for the tip!
I don’t rmbr trying it on pawn but I usually just extend from the DetourAIController class, idk about adding a component
So what would u use?
^tbh this seems to depend on what you want to do with the "faction brain"
If you wanted to use behavior trees for the logic, then using an AI controller would be kinda required
The faction head act as an npc faction in the rts it should be the one who decide how to spend resources, build units and direct those unit
Because of this I thought of using an ai controller with bt or goap to make decision and play but @uneven cloud did not suggest it because it will not posses a pawn
To be honest I don't plan on it possessing anything just directing other ai unit controller but I was wandering if mabye the is another way I havnt thought of
I don't think there's any harm in having an AIC without a pawn
Certainly curious to hear what Luthage thinks about it though
did they remove the "claim" function from the smart object subsystem?
Don't think so, that seems fairly integral to how it works
They might've renamed some of the functions though
seems like they changed it to "mark smart object slot as claimed", which now accepts accepts a slot handle.
"use claimed gameplay behavior smart object" has also been cchanged to "move to and use smart object with gameplay behavior"
Having a new problem where I'm unable to find any smart objects for some reason. It just prints out the "failed" string even though i have two actors with a smart object component placed right next to my NPC.
Nevermind, i flipped min and max in the "make box"
That entirely depends on the behavior you want, how you want it to function, the scalability of number of entities, how you want the workflow and your experience level. That could mean scripted, Finate State Machine, HFSM, state tree, utility or a planner.
BTs are really great as a priority order looping sequence of actions. They aren't so great at high level decision making. Using an AI Controller with a BT without a pawn you'll lose out on most of the built-in functionality and spend all your time fighting it.
Lose most of the builtin functionality? 🤔 In an average game that's probably MoveTo and some stuff like distance checks
So not quite sure if that's a lot of stuff lost :D
But yeah tbh not sure what would be the best approach for something like what he's proposing. Might not be BT's
Hmm bt might not be what I need so what should I use instead
The idea is to make the faction be able to manage resources and create unit choose groups to attack and so one bt might not be the solution cuz it's falls down to priorities and conditions and I need more of a decision making
So I may go about doing a combination of utility and goap
You have not given enough information to give a recommendation. See the first half of my last response.
I would however recommend against GOAP. No idea why people still think that's a good idea, when HTNs have better performance.
Hey guys I have a question and it help fitting to ask it here, is it possible to train/run an LLM model in UE5/UE4 as maybe an NPC or something? I have average experience with LLMs and UE but I don't know how to bring them together, any help will be appreciated Thanks
Probably because of FEAR
People still reference that for AI design
I get that, but I see it recommend as the pinnacle of game AI, when it actually won't benefit most game, especially solo ones. It's like using a tractor to garden a 2' x 2' plot. It'll just get in the way.
HTNs give you way more control as a designer too. It also more naturally integrates with EQS etc. No I’m totally not biased when I say this 😛
Oh snap - your plugin is on sale?
Yes it is 😄
I've had it favorited for years now. Back when you were selling it for like $150 or something like that. Price has went up. Get it while its hot people!
Till Sunday, December 31 at 11:59 PM ET
Might wanna hurry in that case 🙂
I now own it
Happy New Year 🙂
I have absolutely no reason for this though 🤣
BT works just fine for my zombie game, lol
But I swears it - one of these days....
it's one of the few plugins i consider to get one day, too
@brittle lynx Because reasons - have you benchmarked your plugin?
I never made an “official” one since somebody posted a stress-test where they easily got 750 bots to run a relatively complex HTN with EQS and recursion: #742371547783888990 message
They later upped that to 19000 characters with tickrate manipulation.
#742371547783888990 message
All I can say is. wtf
I don't have access. DM?
You need to join the server first. There’s a link on the marketplace page.
ughh - work 😭
IDK if I’m allowed to post invites to other servers here directly 😅
Ahh - are these actors, pawns, or characters though 🤔
Pawns that are just cubes to minimize the cost of everything but HTN for this test. Even then the fps only got below 60 for them due to rendering cost.
What's the high level concept behind creating AI NPC task based lifestyle? I already have a basic ai system. I want to scale it. I want my AI NPC to wake up in the morning then go to work then come back to sleep and repeat.
What do you mean the high level concept? You define the high level behaviors and then figure out the best way to do it for your game. There is no RIGHT way to do it.
i don't know where to begin.
Do I create task that AI can do? Then AI with free time will look for these task. How do I make AI go to sleep and wake up in the morning
I don't know if I should use MassAI to do that or even doable.
You begin by writing out the behaviors that you are looking for. And then breaking them down into separate problems. Such as how do they find a bed? Do you want to use the smart object system for it? Get sleeping in a bed working before you move to the next problem.
You'll need some kind of schedule. How you set that up is going to depend on how you want it to work. Again, there is no RIGHT way to do it.
You only need to use Mass if you want to have hundreds of AI going at once.
So it's doable using MassAI. You can create schedule and make AI go to location then play animatiosn and such.
It'd be a really shit system if it couldn't do that.
Well I'm trying to make 2 ai actually: each with a role
The game split into a planet map in which a combat occurs the ai get a fleet of ships pre chosen ( usually not bigger than 30 -50) and manage the combat in the zone directing movement setting targets for ships according to pre made behavior variable that make " presonality" whether the ai prefer to engage more or defend more and so on
The second ai is in the galactic map there there is more decision making
The ai here again with diffrent " presonality" goals and objectives will decide how to spend resources if to build defense or create a fleet or research upgrades and where to sent a fleet to attack
If it was me, I'd go with utility. You can adjust things easier based on a personality. Then a BT for the individual ship actions.
hey..
i am trying to project the EQS points(Using EQS test Project) onto the navmesh and then check if the path exist still exist to those point(using EQS test PathFinding)
the projection of points is working fine, but still the PathFind test is ignoring those projected points
Any solution for this?
kinda solved it...
i created a new class from Pathfind test, and added some new code, and that worked....
What's the best way to get my AI to avoid bumping into eachother. Got a bunch of AI navigating in the same area, but they tend to just bump into eachother all the time. I tried enabling RVO, but that didn't seem to do much
Using both an "AI move to" and a "Move to and Use Smart Object with Gameplay Behavior" (in different scenarios ofc) to get the AI to navigate
Detour Crowd AI Controller tends to help
Wow, just swapped my AI controller with the Detour Crowd one and that did wonders! Thanks a ton!!!!
Not sure if this is the right channel, but I'm curious about the feasibility of building a kind of open world strategy game through Blueprints. It would have lots of NPCs acting autonomously in the world and changing the world's condition over time (Imagine 8 ai players battling it out in an RTS free for all, but it's a much bigger playing field.) I'm assuming this would be quite complicated to build the systems to drive the AIs and resolve their interactions, but as a starting point, I'm curious if there would be any hard limitations of using Blueprints, or things I should avoid.
You can start in bp but eventually you’ll need to use some cpp, for performance if nothing else
Should I use game play tags for an ai to move to situations, like for example like a npc moving towards a food source because I want to reference objects but a way that doesn’t make it so I have to reference every single actor but a category that’s it in
Gameplay Tags work quite well for identifying things yes
Should I do over using a enum with interfaces cause I have to do tht with the tags idc
Sorry I didn't quite understand what you mean
Like With using tags but with enum
I mean you can use an enum if you want sure
They serve similar purposes, enums just can't really be edited from the editor, and they don't have a hierarchy
Are there any example projects anywhere that show how to use state trees?
I've had a look at the matrix city demo but that particular implementation is heavily coupled with mass so it makes it quite hard to understand the core concepts independently.
Hello guys, do you have any recommendations for a starting point in AI ? I really want to do an complex AI in UE5 but dont know where to start since there a so many tutorials online
The beginner AI tutorial on the unreal learn site
AI With Blueprints is the name if I recall
Somewhat surprisingly the unreal docs have a decent state tree quickstart guide
Looking for some suggestions as I think this has been solved before. I'm trying to setup a behavior tree that can move and shoot at the same time. I'm using a parallel node, with the main task as shoot. The parallel node is set to delay finish. The problem I'm having is the shoot task only executes once. Is there a way to make it loop? I have tried to put a loop decorator on the shoot task, but it does not have any effect.
Oh figured it out. Had a cooldown with the loop, removing the cool down worked
There's something wrong with my learning agents blueprints somewhere, or a bug in the framework
LogLearning: Warning: BP_FlyingInteractor: Observation Goal_10 for agent with id 0 has not been set (got iteration 0, expected iteration 1) and so agent will not have observations encoded.
LogLearning: Warning: BP_FlyingPolicy: Agent with id 0 has not made observations so policy will not be evaluated for it.
LogLearning: Warning: BP_FlyingInteractor: Agent with id 0 does not have an encoded action vector so actions will not be decoded for it. Was EvaluatePolicy or EncodeActions run?
I've done everything right I think, where to look?
Nvm solved that problem,
But when it comes to the scales used when setting rewards and actions, do I just use trial and error to create these scales? I want the output of the network to be normalized so I just tune the scale down until it always fits in -1,1 but I'm sure there must be a way to know what scale i want ahead of time right?
I'm not sure you can figure that out beforehand, because there's a lot of variables at play.. things like the discount rate and whatnot. One of the main problems of RL seems to be the need for reward shaping, which is essentially fiddling with the reward maths. This is worth a watch: https://www.youtube.com/watch?v=Dw3BZ6O_8LY
I trained an AI in Trackmania with reinforcement learning, until I couldn't beat it.
I just opened a Patreon page, where you can support this YouTube channel with a donation (link below). Between research, programming and editing, these videos take a long time to produce. Any support will help me to spend more time on that in the future ! This...
I'm looking at the research on this right now, because I don't like the idea of having to do lots of reward shaping, which feels like just moving the problem of BT's being too complex to RL rewards being too complex 🙂 I had thought that behavioral cloning with human feedback was a good approach, but still not 100% sure for games yet.
ok, this might be a 1/100000 rare question but it is seriously important.
is it possible to make specific ai not account for certain ai as blocking the nav mesh
Is the Blackboard essentially state?
I think BP is really downplayed
AI shouldn't be blocking the nav mesh. RVO or detour is used for obstacle avoidance. Both use avoidance groups to determine who they should avoid.
Hi Guys.
I have this AI Animals that walk around in the very large Map with sublevels.
Everything works fine in the editor but when Packaged some Animals randomly stop moving and never move.
(Im using GetRandomPointInReachableRadius)
Question is : what is the best way to debug this kind of issue in a packaged game?
A question: Should this BT first execute the task, and then set the cooldown? This is from a fresh 3pp project, and it waits for the cooldown first before executing the task for the first time.
5.3.2 latest
@shell gazelle Cooldown decorator for some reason immediately waits for a cooldown. It's confusing, I would expect it to run once and then cooldown, but that's not how it works
You'll have to make your own if you want it to behave in the expected way
Yeah, the description is quite deceiving there
dang
makes no sense either
nobody ever wanted an ability that doesn't work on the first use
So I have a ai service node task that gets all actors with interfaces including the npc with a for each loop with a enum ai state switch on complete with a set value as actor but the thing is, it picks up on the npc actor and nothing else. Is there nothing i can do and i have to separate the interfaces.
It gets the actor i want if i remove the interface from the npc
Are you sure the problem isn't that the npc happens to come out first and is being set as the value?
As in, have you tried to just check if the value you're iterating is the npc and ignoring it if so?
I was thinking about doing that
But I don’t know how I would go about doing it
Doesn't the service have access to the pawn same as task nodes do?
so you would just compare with that
Oh
Is there anyway to get the Size of the Navmesh bounds volume the AI is on top of?
Because when I run this and the radius is much bigger than the area. The AI stops moving
I realize the problem my god I’m stupid
I use it for my Attacking executing attacks, I want it to wait a bit and then execute so yeah
Hello! I have a flying pawn, and it seems to only work when fairly close to the ground, can I somehow change that? It is using "FloatingPawnMovement"
Why are you giving that such a large radius? That is a really bad idea.
You can change the nav agent settings for projecting to the nav mesh in the supported agents array in the project settings.
Sorry, like this:
what's wrong with the condition?
as far as I know, "is not set" = false, "is set" = true
but the decorator doesn't care the variable's value, it always executes the "is set" condition
I'm a little bit lost
any help is appreciated
alright, nevermind, it's my stupidity
when I replaced the move task with this, it goes perfect
I don't really know why I tried to make my own move function, sometimes it's easy to get lost while learning stuff :p
Your screenshot is unreadable. You need to increase the nav query extent in the Z axis.
Sorry.. Wrong screenshot. But thay sounds good, it's not what I did but I will try it. Thanks!
You shouldn't lock logic with the move to.
Yeah, at first I thought it would be better to lock the ai while moving, but may result with some absurd actions
Could try setting the peripheral vision angle to 180 maybe
Or hear noises box myte work ill see if I can test
ok thanks
the peripheral vision where can i change it? sorry im realy new with unreal ...
im mean i now that i can make a bigger or smaller vision but change it to 180 is new for me
It's in the details of pawn sensing but after testing one sec mine runs to me but doesn't go down to attack stays in the air
yeees thats waht i want
Perfect should work then
i dont want that the unit goes down ok wow let me try it out
but can you please just send me a picture of the
Section where i can change it excatly to 180
If i search for "peripheral vision angle" in detail i didnt find it but i look more
aaahh sorry ok
i got found it 🙂 i try it out now
thanks i found it but look waht happend now xD
first duplicate your bp enemy so we dont mess up anything you have set intentionally for x reason. with the new enemy open the bp and lets try this way of pawn sensing.
from pawnsensing component get event as my cursor shows Thatll be the top event then before making the call back function make your next custom event( So it can make the refrence)
okok thank you very much i go for it now
this simply grabs the sensing component and if it activates fires off. so if it can see you, should run.
Also don't forget to replace your enemy with your new copy(if you made one)*
okok i go for it but can u tell me where u get the "Follow Player" or you mean that i need cast to my Play BP? because i dont get Follow Player from Bolean
It's custom event I named fallow player add the nodes and then on the top pawn sensing function
Attach whatever you name the second one.
So of it senses calls your new event(mines named fallow player your can be named track player or even custom event1 but easier to track with good naming)
It's all good we all start somewhere ❤️🐛
okok 😄 i try it out now
ok i done it change the bp also and vision on 180 + use your BP but still the same it just looks at my direction and turns but dont move in the air but in ground it works... why -.- do you think maybe its how i set the gravity off on the unit i mean did i something wrong in the flying component?
In variables did you make a reference to your charachter? And off ai move to attach get player charachter?
Or show your new BP so I can browse and be sure you swapped the old ai with the new one in your map
No rush hopefully I can spot something
yes im 1000% sure that i change the ai in the map i mean it works with your BP also but just in the ground...
i made no reference to my character because i try it out on the ground and its worked with your bp but the problem is still in the air
Gotcha that's alright not a needed variable for this part actually just thinking
hmm okok where can be the problem 🤔
It's not colliding if it can move on the ground
It senses you, run the program with the enemy blueprints open but with a small window so you can see the lines fire off you'll see it go orange when it sees you
But you'll at least know if the move to isn't activating
no everythin stays white but i cant understand why also it staysw white when he is on the ground and trys to catch me
Imagine not using an outdated system 😀
Are you sure you swapped them in the map keks
let me go for it again
Neo send halp I'm nub
but im sure
Even just placing a new one in the map next to you to see if neither move
Use the AI Perception system instead
Is perception the line of sight?
Sight, hearing, smell, etc
It replaced pawn sensing
Just project settings or?
Nah, you have to set it up. There’s decent docs on it
The gist is you add it to the AICon and add stimuli sources to stuff you want to detect
Open a second BP window and show your other fish graph and see if it fires, but I also gotta look into Neo suggestion
ok let me see
I just know your in game fish is activating somewhere
yep now its orange
So yeah in the map details
Drag your new fish in from the content browser into the scene and check lol
Happens no worries
We've been testing your old fishy 
Can also test your original coding this way*
yes its the same white lines but the fish is following me on the ground
It should highlight if it's fallowing you 
Like it did for your other one only other thing I could think of is making sure you have the same box's checked. The code should be going off though if the new ai is placed in the scene and chasing you
But now I must be off to study the new method as suggested by neo, if it's more efficient better sooner then later
Thanks a lot mate for your healp 🙂
i made a last video so we are sure xD
Hopefully you can square it out soon its gotta be something simple we are missing 🍀🐛
yes i will work for it and dont giiiiivvveee uppp AHHHHUUU!!!
Your sensing radius seems diffrent can you click pawn sensing and show me a few pics of your details I got a few mins while I get some more coffeee
okok
This what we are aiming for im guessing something isn't triggering the same
ok i just somoke a cigarette and check the differents out then
Trying to remember what my blue circle is xD
All good lad you'll get it eventually and have that aha moment
I really don't want to take up so much of your time, you been trying to help me for almost 40 minutes, thank you very much
I believe in you!!!
OK, I've now tried the same settings as you but it still has the same problems. Unfortunately I have to get up again in 6 hours, thanks again but I think I'll try the thing again tomorrow and ask about the whole thing here again, maybe it'll work out again one way...
Sounds good lad I myte be missing something as well tomorrow I'll drop you a video that sets it up step by step and see if there is something we didn't square
thanks mate!!!
It's not the greatest method but gave me my foundation at the moment https://youtu.be/xm-7m5Fw1HU?si=PAgq9Gzg2eXwjmxc
Hello guys, in this quick and simple tutorial we are going to make a simple enemy AI, which will follow the player, have its own vision area, and attack when it's near the player in Unreal Engine 5.
Follow me on Twitter: https://twitter.com/GorkaGames
Subscribe to the channel: https://www.youtube.com/channel/UCv_n9oioNF6OpzR2dt6E4xg?sub_confirm...
ok thanks i saw that video in the past 🙂 let try it tomorrow again
by the way before i go to sleep another mate means this maybe i try it also before i post something tomorrow again here
"Hello again. You're going to need to trust me on this. Characters are for things on the ground. They come with a character movement component. You do not want this.
You need to make your thing a subclass of pawn, not actor. A character is a type of pawn, which is a type of actor. You need the properties of a pawn and not the properties of a character.
The pawn needs to have a floating pawn movement component. This is the component that will be used to move your floating pawn.
The nav mesh volume is not related to anything you are doing. For one, the volume is not related to the units. The "volume" is the space in which the nav mesh gets generated along the ground. It is not related to flying things. It's a volume because you might move up and down along stairs or something. But the nav mesh is on the ground. Flying units don't use it at all. It is only for Characters that walk on the ground."
Just watch the 4th pin video here and use AI Perception
You need to change the nav agent settings for projecting to the nav mesh in the supported agents array in the project settings. You also need to turn off affecting the navigation in your NPCs collision components.
Please don't tell people to continue using the deprecated pawn sensing. It's extremely bad advice.
Gorka Games tutorials are not recommended.
Your friend is partially correct. You can use the character and the character movement component, if you know enough C++ to work with the CMC. It's a better solution, but the pawn + floating pawn movement component is easier.
3d Navigation is really hard. A simple way people do it is to use ground navigation and float above the ground. Depending on the world geometry this may be fine for your game.
It's just all I knew but once I get the new way down I intend to use that one
Also just my only reference haven't messed much with it
hey y'all, I have a UE related AI programmer interview soon-ish, and I'm trying to prepare. Any UE specific things I should focus on? Obviously I've worked with the behavior tree, I've used EQS a little, decorators, services. Haven't used the StateTree, nor Mass. I'm pretty much just wondering if anyone has anything that comes to mind, something specific that you think anyone who is programming ai specifically should know about. Appreciate any advice/tips. Otherwise I'm just going to continue studying and refining what I already know
Why there are only videos about reinforcement learning on YouTube? Is it impossible to train model inside Unreal engine?
#career-chat might be more appropriate
You should have a deep understanding of C++. Vector math. Debugging. Profiling and optimization. Understanding of all the AI systems: perception, navigation, BT, and so forth. Should know what the state tree and Mass is, but with how new they are it shouldn't count too much. Should understand the controller vs character. Know about the anim state machine, GAS, and the character movement component. You should also understand the pros and cons of C++ vs BP.
Most importantly you need to have good soft skills and the ability to work with design.
Where is exactly the code which deals with Pawn moving with path when BTTask_MoveTo called?
I want to modify physical movement of AI
is this the one should I looking for or something?
Had to time to test this today! Thank you! That fixed my issue! 🙂
how would you make an enemy that tries to reach the player WHILE trying to avoid the player FOV?
Hey !
I discovered an issue with the EnvQueryGenerator_PerceivedActors
It seems wrongly implemented right?
This should first get the currently perceived actors and in complement append the KnownPerceivedActors right?
It seems to be either one or the other exclusively 🤔
Ahhh nevermind, "known actors" include all so it's useless to go through CurrentlyPerceivedActors 😔
What's really the difference between detour ai controller and normal ai controller?
performance difference?
or improvement
crowd avoidance will add some overhead, I don't know how much
If you don't need avoidance there's no reason to use it
ok thanks i try to go for it 🙂
Use the EQS to find locations to move to.
So i guess instead of just moveTo towards the player i simulate a path by finding intermediate points with EQS?
Does anyone have any ideas on how to globally swap states in a state tree based on the game's state. For example I have a basketball game and I would like my AI to swap between defense and offense depending on which team is in possession of the ball. I've tried to use a global task to resolve this but It crashes the engine every time. The only other way I can think of that will work is to put a transition in every single state that is waiting on an event and that event will trigger the state tree to return back to the root. But I have a pretty complex state tree and doing that for every state will be tedious. I don't mind it if its the only way but would like to know if there is a quicker way to go about it.
I would start with just using the EQS to find a destination that passes the tests. Then ONLY IF YOU NEED TO do tests for avoiding the FOV on the way. Unlikely you'll actually need to simulate a full path.
Thx for your help first of all!I'm trying to understand better your suggestion. My goal is to make the enemy reach the player (so that should be the final destination) but with a path that avoids their FOV as much as possible. So, say I run a query with dot product tests to avoid the FOV and get a point between the enemy and the player, I'll moveTo to that intermediate point, and run EQS i guess until i reach the player?is that what you are suggesting?thx again!
That is not what I'm saying. I said to start with the destination. See where that gets you. Then if you still think that you need them to avoid the FOV on the way, then do intermediate points.
You need to stop overthinking it. Usually the simplest way is the best way.
Hi! I'm hoping anyone could help me out here. I've tried setting up an AI character that roams around and follows the player on sight. However it seems to get stuck in an infinite loop between finding a point to move to, and moving to it except it's not moving.
I've debugged the blueprint class that finds a spot to move to and it seems to be outputting a correct X, Y and Z position.
Does anyone have a suggestion on why the character is not moving?
You said to use EQS to find a destination first, but I already know my destination (the player's position), so why should I even run EQS if I'm not going for the intermediate points?excuse my ignorance but I don't understand what you are saying
The player position should never be your destination. It should be an offset from the player position that satisfies some tests, such as dot product, distance and has a path.
Use the visual logger to debug. The navigation system will log out any issues there.
Does anyone know why I'm getting this behaviour? using AIMoveTo
The doors are using smartlinks that update after opening/closing
@uneven cloud Thanks, such an useful tool!
I see, that's what I meant in my mind with intermediate points. since with just the first EQS alone it won't reach the player and i'll need to move again to eventually reach them. Thx for your help!
Just getting started with AI and was wondering what the difference is between EQS and AI perception. Should I use both?
That's not at all what I said.
Use the visual logger to debug.