#gameplay-ai
1 messages Β· Page 9 of 1
it should be get instantiated in UGameInstance::Init
yeah capsule drives the collision in characters
you can try wrapping other body parts with other collision shapes
and attach to bones
or use a modular mesh and set collision params properly
this is what it looks like when its moving to another point, the legs just clips to the wall, even with collisions setup.
Does it autoregister with every form of gameinstance? Or does it have to be a specifically interited one? my understanding was that it would auto-register and call initialize whenever ANY gameinstance was created
seems that aint the case
it DOES auto register if I set it as an EngineSubsystem
erk.. I meant UGameInstanceSubsystem
I've got a UGameInstanceSubsystem derived class and thought it should auto register when the game instance was registered
i.e. for the lifetime of the UE execution
are you sure ShouldInitializeSubsystem returns true?
is it just me or.. mech is invisible in the screenshot? π
ahahahaha its a placeholder for now xD
just imagine those 4 big ass cubes are the legs ahahaha
you can debug the SubsystemCollection.Initialize(this); (in UGameInstance line 120) part maybe, if ShouldInitializeSubsystem returns true but it still not get instantiated you probably only can solve this by debugging it since it goes through a few checks to ensure subsystem will be created properly
I guess best you can do either properly setting capsule size or using IK or something else to cover this up
or just have bigger doors π
hahahh forgive my bad paint skills
https://www.youtube.com/watch?v=H09N1ccIWPY limitations demonstrate fundamental beauty
Created using Midjourney
Are Gameplay Behaviors created to be used only with Smart Objects?
If yes, behaviors could use a bit more context (like used slot and its definition) than just SmartObjectOwner.
If not, then having there SmartObjectOwner parameter feels like unwanted dependency.
not sure I understand "Sensing Interval" on Pawn Sensing Componrnt, I emit a noise event and it should trigger once every time it hears a noise, but instead it's hitting once every sensing interval, why does it even have a sensing interval? shouldn't it only fire every time a noise is emitted from the pawn noise emitter component?
Don't use the Pawn Sensing Component. It's a part of perception solution predating the AI Perception System every cool kid is using nowadays. Pawn Sensing Component kinda seems like it works, but that's only because it was wide(ish) spread and we wanted to ease the transition. Actually, it totally slipped my mind it existed, otherwise I would have cut it for UE5.
5.1 it is then π
too late for that π’ But 5.2 definitely!
@crystal hatch Completely unrelated to AI honestly - but is there anyone I can ping for a PR? I did a simple PR last week and can't imagine why it would be rejected to be honest. (All it does is add a templated version to get the world settings π ) Maybe ping the bot to trigger a notification? (I recall you mentioning sometimes the bot just doesn't work for Github PRs)
You need to resize the capsule to fit the mesh and set up agent settings in the project settings.
Post a link.
Note that some teams are not as opened to PRs as they should be, that's why I encourage anyone to post PRs for AI, we're very open π
I'll see what I can do
This was just my first forray into doing a PR for UE. It's nice & light. I haven't dug as much into the AI module as I want to (I work on zombies 95% of the time), but that phase of my project is coming up soon!
That's awesome! I didn't mean to put it on your plate specifically π
the problem with your change is that it's a convenience feature that (some would say) pollutes global API. You can just as well have a helper namespace in your project that supports the same functionality, it doesn't require engine changes. I'd expect gameplay framework folks to say the same and reject the PR. I'll ask around regardless.
Don't get me wrong, it's a nice change. But maybe focus on AI changes from now on (and post as PRs!) π
Fair enough!
Well, that was quite the journey.. implemented a bunch of different speech-to-text models today..
not a fan of websockets π spent ages trying to debug a connection and it was a parameter being passed wrongly.. I mean why not just give decent error messages!! π
But at least I have voice control back in the engine.. not sure I prefer the commercial services or my own deepspeech hacky server
nevermind, fixed it.
is there a console command for me to view the hearing radius of the AI Perception's hearing sense?
use Gameplay Debugger
Hi! π
Does anybody know why i don't see the EQS Scores above the debug spheres is draws in the world when using the Gameplay Debugger? Example of what you used to see:
The visual logger is a lot better than the gameplay debugger for EQS.
Never heard of that until now π
Just opened and it looks really good actually. Is there anyway to have it run in realtime though? Seems the only way i can actually see the information is by scrubbing back through it?
No. It's actually the benefit of it, because you can walk through the information at your own pace. You can also select which categories you want to see.
I guess yeah. Thats nice to debug an already happened situation but not that useful when you're trying to see what's happening in realtime :/
You record it doing a thing in real time and then walk through the decisions it makes. It's far better than in real time, because it's way too much information to parse while trying to reproduce functionality.
I agree to some extent but stopping and starting the editor to try and debug why my thing isn't working isn't that ideal sometimes π
Either way, thanks for the tip about the visual debugger, going to be really handy moving forward
What do you mean start and stop the editor? You record while playing. You can stop playing if you want, but you don't have to.
Never mind I just figured out what you mean π
how can I make actors that block navigation but don't allow navigation to be generated on top of them
throwing null nav modifier volumes around the actors works but I wonder if there is a more elegant solution
Hi! I'm probably missing something very fundamental here but why would this cast succeed when the character is placed in a map but not succeed when the character is spawned from another blueprint (via "spawn AI from class")?
casting is also an IsValid check
AIController may be invalid
how should I go about making sure that the cast is successful when I use spawn AI from class?
there are lots of reasons it wouldn't be valid
- You might be running your code before the aicontroller actually possesses the character
- Your character isn't set up to automatically be given an aicontroller
how do I know if the ai controller actually possessed the character? is there a check I can do?
Something like this?
Just tested it and it looks like its working! Appreciate the help!
NavModifierComponent or if your actor has a static mesh mark it as an obstacle and pick Null area.
Is there any way to make navigation mesh has less 'border'
so it could include smaller area?
yes, kind of. The border size is a function of AgentRadius and CellSize. If you lower AgentRadius (ideally done by adding a supported agent in the navigation system's project settings) you risk you agents getting stuck on corners and such if their actual radius is larger than AgentRadius used.
and cellsize affects how the geometry of the level is voxelized before generating the navmesh
smaller cellsize means the voxels match with the actual level geometry more accurately
Ahh..
So in my picture before! It was stair like platform. Does changing the cellsize it would give navigable mesh to the first platform?
and where can i access those function? Or is it a variable i can change in navmshbounds?
I suggest you tweaked the navmesh generation values and see what happens. Those are RecastNavMesh actor properties.
I am very new to these. Where can i change the values?
is it like project settings or is it possible to 'make' my own navmesh like blueprint child?
RecastNavMesh actor is already in your map, just find it in the Scene Outline. Note that if you want to change the AgentRadius and keep the change you need to add a SupportedAgent to the navigation system's project settings. If what I just said is confusing I suggest reading up on this stuff .
Roger!
Is there anything I can do about these gaps in the navmesh? Happens in a few places on our map. π¦
it's just a visual thing, shouldn't affect pathfinding.
has happened a few times that my AI would get stuck here. Maybe coincidence?
I'd definitely investigate those cases. What you shown on the screen shot shouldn't affect pathfinding.
thank you, I'll investigate it deeper π
Hey everyone. I have a quick question.
I have this BT here.
The goal is to have the enemy chase the player and attack when the player is within reach.
The issue I have is that if the player is not within reach, the enemy will move right to the player, even if during the movement, the player gets within reach.
How can I make it so when the player enters the enemy's reach, the enemy will abort the move command and go to attack?
For the decorator on the move to, have it abort when the observed value changes
Just click on that decorator and in the inspector on the right, change it there
So is state tree supposed to replace the current BT?
Or is it just another alternative to solve a different type of AI problem
no, BTs won't get deprecated. ST is an alternative that's also usable for other things (animation, game state, etc).
Oh dang - city sample had 35k state trees running?
not all at once, but yeah, 35k ST-driven agents
I do like the changes that I saw with the ST in the release notes. Looks like it is shaping up nicely.
yep. Under active development π
ST is, yes
Well... it's "production ready" in terms of "stable API" - if stuff changes the old stuff will be deprecated and kept around for at least two engine revisions. It doesn't mean it's done.
Yeah. Understand that part. Didn't mean to imply that it was "done".
Just making sure it's clear π
so, looking at 5.1 release notes I see Smart Objects and State Tree. What is Smart Object and what are the use cases for it ? What are the benefits of State Tree over Behavior Tree? Is State Tree replacing Behavior Tree ?
The release notes also explain the use case for a Smart Object
It's an object where you build all the interaction stuff in the object itself.
So a bench for example.
The bench would be a smart object. When someone interacts with it, it's the smart object that tells the actor what to do. Instead of the actor telling itself what to do. More or less.
interesting
Noice
so, how does one use ST with BT ?
no, BTs won't get deprecated. ST is an alternative that's also usable for other things (animation, game state, etc).
So say I have AI implemented with BTs. Can ST complement existing AI in some ways?
not really. It can however be used to implement smart object behavior that would be executed on top of (ideally paused at that moment) BT. Just an example.
if BTs work for you then you don't need STs
Don't use something just because it is new and shiny
I wish Epic had a new AI training stream to cover practical use of new features π
The BT one is still very relevant and super good.
Smart Objects in particular
We don't even know how this stuff works ourselves! π We figure it out as we implement stuff π
SO literally just moves the area of responsibility from the interactor to the interactee
Also, we have away more docs now than in UE4 days, give us some props π
I was surprised when ST's released with docs π
yeah, that's definitely the first for the AI team π
it's great though! now I can complain about lack of visibility culling docs for UE5 π
maybe I should start asking for documentation PRs π
@crystal hatch Any particular reason EQS is still in "beta"? Any plans to remove that tag? π
Wait - we can do this?
I just came up with it.. And I'd say it's worth pitching to the right people.
Yes. The reason is the editor's UI. The core is solid had except for like 3 or 5 bug fixes it hasn't changed in 5 years or so. Maybe more π But I don't think EQS will ever leave beta. We don't have resources to work on UX for the EQS editor, and I'm already thinking about EQS 2.0 π
I have two reactions to that:
- π
- π
In that order.
But how do we even PR docs? π UE website is not on github
though some people went mad about absence of docs and wrote their own websites to provide better docs to community: https://benui.ca/unreal/uproperty/
ah alright, i misinterpreted the sentence
Back in the day when I added UE4ML to the engine I made the docs a part of the code, kind of - I've added a readme.md (or something like that) in hopes it would be easier to find and maintain. Then when we started working on AI for UE5 I've tried to do the same, but ended up writing more code than docs (sucks to be me π ). But maybe it's not such a terrible pattern?
Thoughts?
It'd be less accessible for people not interacting with engine code i guess
and image/video sizes in the repository can cause issues, without being sure of that
that could be code-focused, for programmers.
But yeah, it has its own issues π¦
but when you accidently find it, it is a hidden gem like these:
https://github.com/EpicGames/UnrealEngine/tree/ue5-main/Engine/Source/Programs/UnrealCloudDDC
https://github.com/EpicGames/UnrealEngine/tree/ue5-main/Engine/Plugins/Runtime/NetworkPrediction
is Unreal Cloud DDC's docs real? 
i was just going to write how awesome was NPP's docs back then, and how community oriented was the developer, then clicked that and.. dayum
For me it would be most beneficial to read there intentions, motivations and possible future plans. These things are many times missing from official docs as it is too.. unofficial. Network prediction did/does it well.
One thing that would be nice for EQS 2.0 is more granular testing of items.
Suppose you have an EQS query that has a bunch of score-only tests and then a filtering test. If you run that in ReturnSingleItem mode, there's a neat optimization: it'll run the scoring tests for all items, sort them descending, and then only apply the filtering test until it finds one item that passes it (instead of running the test for all the items). Because it just needs to find the best item that passes the filters. This is really great for performance if that final test is expensive (e.g. traces or pathfinding).
However, this doesn't work if there are multiple filtering tests like that in the EQS.
It'll run the scoring tests and the filtering tests on all items (except for the last filtering test, to which this optimization still applies).
I'd expect that if there were a bunch of scoring tests and a bunch of filtering tests, that it would only run all the filtering tests until it finds an item that matches them all and then stop.
I'd expect that if there were a bunch of scoring tests and a bunch of filtering tests, that it would only run all the filtering tests until it finds an item that matches them all and then stop.
Iβm not sure I understand what you mean. You mean testing individual items with all the tests, one item at a time, until a match is found?
Yes. If there is a list of items and you want to find the first one that passes all the filters, youβd run through the list one item at a time until you find the item that passes all the filters.
It does work that way in EQS if thereβs only one filter, but not if thereβs more that one.
Thatβs not really something that can be done in EQS 1.0 because of all the overhead each test has before iterating through the items: resolving aidataproviders and whatever other setup.
I will be finishing initial smart objs & gameplay behaviors implementation in my interaction system and I collected a few (not big points). It is nothing critical, so I am not sure if it is important enough to post it on UDN. Do you think I can just post these here and it might possibly reach Mikko or whoever is working on these things? π No need to answer questions mentioned there as it might happen I will eventually find out anyway when it will be further developed.
I mean, I'm pretty sure Mieszko will tell Mikko, lol
in that case
- Gameplay Behaviors have no GetWorld() override therefore have no access to funcs like SpawnActor.
- Are Gameplay Behaviors meant to be generic objects used also by other AI systems than Smart Objects?
o If yes then having there Smart Object owner reference feels a bit out of place (would maybe fit more into Config as a behavior parameter which is dynamically set)
o If no then it would be nice to have also used SO slot accessible:
- In my case I have a GameplayBehavior which starts a gameplay ability by tag. I would like to use used smart object slot activity tag for it but there is no way how to access it. As a workaround I had to add tag parameter to behavior config and configure the tag also there.
- How do gameplay behaviors compare to AI tasks? I sometimes wonder whether it would make sense to allow creating AI tasks in BPs rather than have a different generic AI behavior/task object.
- Some objects can be interacted from multiple places (slots) but allow only single interaction at the time. Like a door opening from both sides, fence cutting from both sides or even something like a lever. Would be nice if it was somehow possible to enforce out of the box. It could be something as a "smart object resource which slots claims and other slots using the same resource are automatically deactivated.
- Would be nice if there is a way to hide gameplay behaviors (or even old BT tasks) like PlayMontage or PlaySound. From my past experience these were always a trap for designers on multiplayer projects.
About to port my AI behaviour trees over and learn VisAI. Should I instead be looking at state trees?
I'm working on a RTS style auto battler. So 200 units with basic AI like auto attack behaviour, NOT directly controlled.
As someone who's only worked with Behavior Trees so far, I'm not sure I understand the use cases for State Trees. Do they simply run faster than BTs?
That won't get confusing π
Interesting - state tree doesn't require a pawn. So no controller necessary. @celest python
yes, state tree is cool and generic. You can use it for anything. It is GameplayStateTree plugin what make it easily usable by pawn by creating UStateTreeComponent derived from UBrainComponent.
The compile button doesn't have a setting where it auto-saves when successfully compiling π
BT also doesnt require a pawn btw
You one of those weirdos that actually puts the BT component on your actor?
Not me, but I've seen a few people came up with creative solutions like that
not the worst idea tbh
its just not decoupled.. or not intended to be decoupled from controllers so it just looks ugly
Would it make sense to combine behavior trees with a state tree? Or is one meant to be used or the other
Honestly, I reckon for engine stuff, documentation should be at least as important as writing the code. I find it a bit weird that there's the possibility of doing one without the other when there's potential for tens of thousands of people to use it (and be confused without the docs). That said, docs take forever to write and are a pain to maintain.
Been looking at NBDev as a sort of strange middle ground for some data science stuff
jupyter notebook that self documents into a doc site
Sure. Post it here or IM me.
It's either this or working on it myself π (will end up being a little of both I guess)
Ok, I see you did π Thanks!
I'm not sure they do, depends on the set up. What StateTrees can do is a superset of what BTs can do, and it's an implementation utilizing new language and Unreal features (our BT implementation is at least 8 years old IIRC). ST is the tech of the future, but BTs are solid and it's very well understood how to use them. I suggest using BTs until you understand STs well (and we supply more actual AI tasks for ST).
Or better yet: Literate Programming π
My jr brain thinks in theory ST should run slower since evaluating state conditions should be slower to evaluate decorators on large scale 
In our defense, source code is the ultimate documentation, so it's not like there's no documentation π
thanks a lot! I will be soon converting our BTs to STs (it is a hobby project) and from what I read about it yesterday It looks really great. I will write down any rough edge in case I find any. But from the first look it looks very nice, It feels like a behavior tree but it allows you to jump between branches however you want. That was often tricky in BTs when you sometimes needed a bit different order of evaluation of things.
What I find somewhat confusing about ST, is the lack of graph visualization. Not even editable, but at time where you can jump from one state to any other state in tree, it can get confusing, especially in deeper ST hierarchy,
Yeah the graph can get spaghetti quickly, but with some mouse over highlighting connected state, it cloud make figuring out what are possible outcomes easier.
why does my navigation link cylinder changed size after i resized my cell height in navigation mesh?
For UE 5.1, State Tree received significant improvements and is now considered production ready.
^^^according to patch notes of 5.1 release
BUT the 5.1 docu (https://docs.unrealengine.com/5.1/en-US/state-tree-in-unreal-engine/) states the following
You can try out this Experimental feature, but we do not recommend shipping projects with it.
Docu bug?
@crystal hatch I just read about EQS 2.0 and I was wondering if any form of Multi Thread is being considered? whether it is for running not-codependent tests or the entire eqs in a separated thread so we can run several at once outside the game thread?
Extra question for @crystal hatch too: any plans to get rid of the FPImplRecastNavMesh? Would make our life much easier when it comes to custom-string pulling implementations or nav generation logic.
I'm referring to this
* This is a pimpl-style arrangement used to tightly hide the Recast internals from the rest of the engine.
* Using this class should *not* require the inclusion of the private RecastNavMesh.h
* @NOTE: if we switch over to C++11 this should be unique_ptr
* @TODO since it's no secret we're using recast there's no point in having separate implementation class. FPImplRecastNavMesh should be merged into ARecastNavMesh
*/```
iirc it will likely be built on top of Mass and Mass does multithreading automatically
yep. I'll escalate this.
I just read about EQS 2.0 and I was wondering if any form of Multi Thread is being considered
definitely!
Oh man, don't get me started. I wanted to cut the recast pimpl for years now, and for the longest time I've been putting new stuff directly in RecastNavMesh rather than the pimpl. But I never found time to just go ahead and cut it.
Care to make the change and post as PR? π (ideally against the Master branch)
Let me deliver the current game and I probably will try. Maybe. XD.
Thanks for answering! I was really curious.
Gonna abuse your patience @crystal hatch and ask one last question:
I read this in the 5.1 release notes (image referring to Dynamic Nav when using the new World Partitioning) and I'm bit confused.
When I first heard about this I read the documentation available and checked a bit of the code, some early tutorials in youtube etc and I was under the impression that Dynamic Nav was a must when using WP, because nav should always be generated around invokers.
Was that not the case? Was the system intended to have baked nav, whether fully static or semi-static (modifiers only)?
Or does that text mean that it can be combined now?
I don't know, to be honest. I've been so deep in Mass codebase that I lost track of most of the AI features.
that's fine, no way one person can stay on top of everything, specially for the new stuff.
Thanks for your time! Keep the good work!
My BlackboardKey Value changed event won't get triggered in my Behavior tree Decorator class.
void UBTD_AbortOnBlackboardKeyUpdated::OnNodeActivation(FBehaviorTreeSearchData& SearchData)
{
if (UBlackboardComponent* BlackboardComponent = SearchData.OwnerComp.GetBlackboardComponent())
{
BlackboardComponent->RegisterObserver(BlackboardKey.GetSelectedKeyID(), this,
FOnBlackboardChangeNotification::CreateUObject(this, &UBTD_AbortOnBlackboardKeyUpdated::OnBlackboardKeyUpdated));
}
}
EBlackboardNotificationResult UBTD_AbortOnBlackboardKeyUpdated::OnBlackboardKeyUpdated(
const UBlackboardComponent& Blackboard, FBlackboard::FKey ChangedKeyID)
{
const bool bIsValidKeyValue = Blackboard.GetKeyRawData(ChangedKeyID) != nullptr;
if (bIsValidKeyValue || bAlsoAbortOnKeyGettingCleared)
{
bAbort = true;
return EBlackboardNotificationResult::RemoveObserver;
}
return EBlackboardNotificationResult::ContinueObserving;
}
```Does anyone can know / guess why?
Edit: OnNodeActivation flag is true
Have you solved it?
no
In state tree; is there a difference between having an evaluator vs having a task on the root node? Are evaluators just sugar for the latter?
Has anyone come up with a way to store navmeshes offline for moving platforms? I donβt want the performance hit of dynamic generation or the limitations of a static environment.
I'd start by making sure BlackboardComponent != nullptr and BlackboardKey.GetSelectedKeyID() is a valid key.
The improvements on the StateTree look really good. I am excited to try this feature out because I really like to use finite state machines for AI in general. I do understand though that this is not a FSM, I assume this is to make an improvement over regular FSMs by sharing common behaviors and therefore removing the finiteness, is that right?
WP has had support for streaming nav mesh since preview. Invokers are expensive and cause a lot of bugs, so not sure where you got they should always be used.
Hey there guys I was wondering if anyone could help me out. I am creating an augmented reality tower defence game where AI must run towards a castle the player needs to defend however the AI move to always seems to be failing when I test it on my tablet. The AI move to never fails in the editor so I am wondering where I am going wrong. I have attached a screenshot below of the AI blueprint. My AI is only spawned in when the player clicks on the screen to place the castle with a plane attached to it. The AI spawn on this plane. So far I have checked that the locations are correct and that a nav mesh is included within the scene. However I am not too sure if the nav mesh could be causing issues when packaging to android? Any help is appreciated!
How do I keep the loop in combat while there is a target available? Now it attacks and then pauses
you can add a loop decorator, but I don't think that's your problem. The "then pauses" part is somewhere in your tree, I suggest you identify what that is first. Because, for example, if that's the "Idle" node then that means the combat branch fails for one reason or another. I suggest using VisLog to investigate that.
Oh god, changing brain component from BT to ST can get really tricky with Unreal's component serialization. Behavior Tree Component is still serialized inside the blueprint even when I change BrainComponent to a different component name and class. It leads to just empty Brain Component details panel.
Normally I would solve this by renaming the variable but I can not do so now as it is BrainComponent of AIController
ah nevermind, I had to store it in custom variable like this. I am not sure why it actually worked with BTComponent before. Maybe Behavior Component has been separate var in the C++ class in the past and then removed.
StateTreeComponent = CreateDefaultSubobject<UStateTreeComponent>("StateTreeComponent");
BrainComponent = StateTreeComponent;
I think you can run StateTree without component
it is now contained within single struct
btw. I don't get why is every AI system in unreal or marketplace bound to that component. What I want to run StateTree/BT and HTN within single actor ?
I mean when I was implementing Utility AI i totally skipped BrainComponent just for that case
yeah, I do so too for my own system (you can see my utility reasoners in the component list). For now I will try to stick with it and see where it leads as some AI Tasks have a checkbox for locking AI logic and brain components are reacting to these
but it is quite cool that the component is now only a thin wrapper around the struct
How can I debug a state tree to see where an agent is at in the tree? (Not using mass) UE 5.1
Why doesn't Behavior Tree have a Collapse Graph? X_X
It's called Run Behavior Tree
What do you mean?
There's a task to run a subtree, called Run Behavior Tree.
Oh snap
how do i add the experimental state tree
The Detour Crowd AI controller causes enemies to move reeeeally slowly when routing around each other, any way to fix that slow speed issue?
I debugged it and they are valid :/ I'm gonna compare my code with other decorators listening to BB key change..
did you resolve your key
nvm if you debugged selectedkeyid it must be resolved already
It's a convenient abstraction. Most of the rest of AI doesn't care what given agent's brain is, as long as it has one. And it's also possible to use stuff that's not a brain component, like you've proven yourself, so stop complaining π
i started working with ai perception
What's a good way to get the closest enemy from hundreds without going through all of them?
The best I can think of would be to implement a KDTree to host all the pawns and rebuild it on a regular basis π
Or you can reuse TOctree2, UE::Geometry::TPointHashGrid3, THierarchicalHashGrid2D, TBVTree or any other space partitioning structures.
We don't have an efficient way of spatial Pawn lookup in the engine. Never needed it I guess.
Finally I learned a usecase for TOctree2. The /** An octree. */ comment was a meme in #cpp π
But anyway another idea from my jr brain for BP context if you dont have access to C++:
Do sphere trace by incrementing radius each time in a loop until you hit an enemy pawn, and when you hit any enemy, get closest one among hit ones
After googling that seems perfect, is T0ctree2 something i can only utilise with CPP?
FNavigationOctree is a TOctree2, pay attention π
Haha I'm so lost
and it has no comment π
Are you sure you are not prematurely optimizing btw?
I'm looping over 100+ FVectors to find closest one pretty frequently in my game, and so far never saw it in profiler
how do i add the experimental statetree?
or is it 5.1 only?
I think I am over optimising yeah
especially in shipping compiler optimizing it to moon and it gets very fast
in 5.1 it became stable API, it exist in 5.0 too - but today i just enabled plugin in 5.0 and project didnt open π so i'd recommend an update to 5.1
My first iteration was foolishly looping over 100s of actors per actor
i just want to have a look at it
But just having each actor already in an array will probably save me 90% of the performance
so its a plugin?
aah makes sense, ty
god damn you all, now I want to write a generic Pawn spatial lookup feature!
is it a plugin in 5.1 as well ?
Lol please do
most features are plugins now in UE
i see
are you in C++ or BP context
dont tell me you were using Get All Actors of Class per actor 
To be fair I started with a marketplace asset and it was implemented like that
It was actually initially doing that each time the behaviour tree ticked
if your agents are using perception you can just pick among the pawns given AI agent is aware of. It's going to be a significantly smaller set in practice.
and less cheatty π
I figured that perception in a 100 vs 100 rts type environment would be overkill. They are pretty basic, just move in range and attack unless given 1 of 2 other commands
Is perception performant enough for something like that?
no, I wouldn't use AIPerception for an RTS
if you have 200 actors to loop and if its happening on BP it will drain some nice amount of milliseconds btw
BP loop is a node sphagetti macro
Yeah think I'm going to have to get a clever programmer to replace I down the road
i have one on my function library if you ever want to copy paste to your project: https://gist.github.com/intaxwashere/cb95b903966b6b8bf77d5620729af59e
but unless you have a gigantic map i guess incremental sphere trace method would be faster because traces are so cheap to execute in CPU
it should be slightly faster to do compared to 200 actor loops i guess
I've made them with the octree for a couple of gamea now and it works really nice.
Wow thanks @celest python ! I'll try both methods
I'm not sure which spatial struct would be best for "constantly (potentially) moving actors". Octree is not bad, but I feel we can get better update times. But I guess it's way better than "loop through all things" π
I'd like to see profile tests that back that up.
Yeah you're right, I'm mostly assuming
Though I'm confident at best scenario sphere trace should be faster -- but always gotta profile
We've never had problems with the octree update to need to optimize it, but also they don't move around unless a player is nearby.
By the way I'm still working on this issue, went through almost every stackoverflow post and other game engines to see how splines are handled, yet couldn't understand the trick UE's USplineComponent/FSplinePoints doing. If anyone has any experience with how UE handles spline points can enlighten me about how can I calculate ArriveTangent and LeaveTangent based on bezier spline algorithm?
From what I can see SplineComp calls AutoSetTangents when curve mode is set to Auto and it does something like this:
(1.f - Tension) * ( (P - PrevP) + (NextP - P) )
which I is similar to things on the web I've seen
but then it starts to insert new elements to ReparamTable (seems like a float only curve?) which confuses me a lot, because seems like "interpolation" part is happening on that thing. Do I need to write a custom spline component? because I remember Kythera mentioned UE's spline was too designer oriented to work with AI paths

Dont you just need to use the custom tangent mode and provide your own results to it ?
yep but the algos I could find on the web requires me to insert new control points -- which seems to be working for the examples they provide on the articles etc. but UE only takes arrive/leave tangents as input and process the spline internally. I'm having difficulty to make algos compatible with UE's method
especially that ReparamTable confused me a lot
First hit π
whats a good way to separate characters from items when i want to use find nearest actor
via get known perceived actors
i want to find the nearest item in a specific task
How do I check if a Blackboard key value is cleared or not?
probably misconception derived from early docs and tutorials. Ok good good. I prefer to use baked nav rather than anything dynamic if possible. Thanks!
That's how if somebody is interested:
const FBlackboardEntry* EntryInfo = GetBlackboardAsset()->GetKey(BlackboardKey.GetSelectedKeyID());
const uint8* RawData = Blackboard.GetKeyRawData(BlackboardKey.GetSelectedKeyID());
const bool bHasData = (EntryInfo->KeyType->WrappedIsEmpty(Blackboard, RawData) == false);
Any help with sorting actors in perceived actors function?
i want to exclude something
the more details you give the better answer you'll receive.
for sure hang on
I have a task setup for looking at known perceived actors and finding the closest one.
I want this actor to be of one specific type. More specifically a weapon
UEnvQueryGenerator_PerceivedActors does that, you can look at UEnvQueryGenerator_PerceivedActors::GenerateItems for details.
ok im pretty fresh so what are these in terms of bp nodes?
see, that's the detail I could use before answering. That you're using BP exclusively.
now i learned that π
call GetKnownPerceivedActors on the AIPerceptionComponent with None sense and you'll get an array of all actors. Then you can use a cast to filter the array.
ok im looking into it like this
thanks
@crystal hatch it appears to be working i just have to untangle my mess and make sure
of course it works π
yeah yeah i ment in my spagheeet
π
i have to work with this to be able to have the AI not steal my weapon
i had to sort even further to make sure the item was available but i learned a lot from this
I quite like sphere trees instead of quadtrees, easy to implement, good for moving and updating things, simple maths and reasonable representations
are there any examples of state tree used for a regular game ai? so far all i've been able to find is how to set up mass ai with zonegraph, etc
trying to build a combat bot that i think could benefit from the state transitions - just not sure how to wrap my head around the tool yet 
siliex was working on something and sharing his progress on twitter: https://twitter.com/siliex01/status/1583265508492660737
thanks! i'll take a look
Anyone who would know why a StateTree Task will be executed constantly even though its current state is set to running, on the tick ?
I am trying to set up a MoveTo type of function for my AI in statetree, but after it gets to its initial first random location, it then starts to execute the same task over and over and over before it managed to get to its location (seems like its just flat out ignoring that it is still currently running?)
having an issue with subtrees not running - any ideas what i might be missing? the "run behavior" task appears to be called, but the referenced tree isn't actually executing
What does the vislog say?
haven't used the vislog before - noticed a warning in here, is this helpful?
the Combat blackboard uses the Behaviors bb as a parent
well, it tells you exactly what's wrong π
i suppose i don't understand why it's wrong - is there no way to run a different BT if it uses a different BB, even if its BB inherits from the one the initial tree is using?
The way we run subtrees ensures there's no blackboard memory reallocation, so the subtree is required to use the same blackboard or one of the parents of current blackboard. I know it's limiting, but that's how it works right now.
I need some help. Why my focal point is what i want, the actor focus is cleared where i want it to be cleared, but the get focal point on actor change. I'm trying to make my ai rotates but it rotates back mid montage
Then i just play the montage and launch the character to make the ai dodge
Anyone had issues with the AI not caring about the acceleration property in the movement component when moving ?
Does not appear to be set at all when using the Move To function - and also looks like its current speed is just being set to max instantly
You need to turn on Use Acceleration For Paths in the movement component
its already turned on
What acceleration value do you have?
I just tested rotation rate as well, set it to 20 - and turn on the other settings required to use it, does not appear to respect that either
I set it to 200
Originally it was 1500
just tried with 50 acceleration.. same thing
You might need to dig deeper into why that's happening, because I've never seen that not work.
For rotation, you need to turn off use control rotation in the character and turn it on in the movement component.
Yeah I havent experienced that either tbh.. first time :/
Works fine in my 5.0 project, but a fresh 5.1 - nope xD
And like.. this ? for rotation ?
ah yeh that worked
ty
So its just the acceleration that isnt working then :S
I did try and check the acceleration of the AI, and it just doesnt move from 0
i have it b0oth off and it still turn on iut's own
ai controller
character
Look at my picture above, works with those settings π
make sure to reduce the actual Z Value to something lower
what does the z value do?
i found the problem. Seems like launch actor resets the focus for some reasons
i think i will have to use move to instead of launch
witch is a boomer for me but at least i found out the problem
And now.. out of the blue.. acceleration on my AI is now working.. wtf lol
@shrewd violet You can just set focus again after the character lands on the ground if needed. - unless it needs to focus the character at all times, then just set focus right after its been launched
I've been trying but it's like bugging. I'm trying to do some trouble shooting. it's giving problem even with move to location node
Have you tried clearing the focus first, and then setting it again ?
Ah
Instead of setting focal point, try set focus
Unless it doesnt have a specific target, then idk
to dodge behind it doesn't have any actor behind unfortunate.
i think at this point could be or a bug or a thing that i'm missing at all
Any idea how I can apply a sort of 'inertia' to my navmesh movement? Even with turning boost set to 0 and acceleration set very low, my pawns always perfectly adjust their speed to track a moving target.
When the target changes direction suddenly I'd like my pawns potentially overshoot it, with a more gradual change in acceleration.
Does the procedural mesh component support navmesh?
I have a simple terrain procedural mesh and the navmesh seems to be ignoring it entirely and idk why
Hello, I'm new to unreal and I'm having trouble making an ai do what I would like it to, I'm basically trying to make a cod zombie type ai where it always knows where you are.
hey is there any good documentation to start working on AI?
Question: looking to make an AI character lead a player character through an obstacle course, a lot of variations on vaulting, crawling, and other features already coded into my PC. How can I get the AI to access those functions properly for what Iβm trying to do? Iβve done some basic melee combat stuff thatβs essentially a clone of the player character but not sure what to do when interacting with the environment and not the player.
Check out this channelβs pins, some great videos there for ai behavior concepts in general + unreal specifics
Thanks
Did simple AI get reworked at all in UE5?
Have you also turned on use acceleration for paths?
What have you tried so far? Have you started with the AI with Blueprints course on the learning library?
Ive Just Tried Looking things up, not much shows up for what im looking for
i havent done anything with AI yet
You'll likely want to use nav links to trigger the traversal functionality used by the player.
The course I mentioned will explain all the AI systems that you can use to get started.
alright
any good resources that talks about the StateTree ?
whats the proper way to make them rotate towards focus point
not snap
custom task ?
π
You can have the movement component do it by changing the rotation rate, turning on use controller rotation (movement component) and turning off use control rotation yaw (character).
these ?
Yeah. The use controller desired rotation. But you must turn it off on the character or it will snap.
They are indeed almost the same. Evals are meant as light weight (compared to a task) way of exposing data to the state tree. Most of the time you dont need them.
The state tree state changes get logged into visual logger.
Good point, noted. We have discussed of having a "stack" view where you can see active states and tasks (of a selected state) plus in and out transitions.
We are mixing BTs and STs. BTs still have more AI support out of the box. In one of our use cases, BT runs the main behavior, and ST is used for e.g. smart object interactions.
can it be done in the opposite way? Could STs control general behavior and run BTs as tasks to control specific behavior?
We are mixing BTs and ST
Will BT's have a new task to run ST likeRun Behavior Dynamic?
We have now MVP on Discord ! @lyric flint Welcome! (;
Yes, welcome! π
I'd say nothing is stopping you. ST are contained within single Struct, so you just need to add correct task/service to handle it
I was just wondering how would one approach combining state tree brain component and behavior tree brain component in this case
(lazily copying from another answer)
The main thing is that STs aim to be more general purpose than BTs. ST has some concepts that make them a bit more flexible than BTs (e.g. transitions, data binding). OTOH, BTs are more mature and have better support for build AIs out of the box.
and just so we are clear, you can use ST with BT (or other way around), you just can't have StateTreeBrain and BT Brain Componenet at the same time. But since ST can be contained within single struct, you don't need StateTreeBrain component.
hm, I thought you always need a brain component to tick either state tree or behavior tree π€
(partly copying from another answer)
The main thing is that STs aim to be more general purpose than BTs. ST has some concepts that make them a bit more flexible than BTs (e.g. transitions, data binding). OTOH, BTs are more mature and have better support for build AIs out of the box.
SmartObjects allow to annotate the world for the AI do to stuff. Currently it's quite bare bones spatial database, which allows you to build annotated slots and query them.
We're working on Gameplay Interactions which combine Smart Objects and StateTrees and animation workflows to allow you to create behaviors that interact with the world, like opening a door, or sitting on bench, which can be used by the AI or player.
I mean if I had a behavior tree brain component that'd always tick the active BT when I only need it when the ST says so
well, you need to wrap it within something, you can just as well copy paste/the StateTreeBrain implementation into something of your own
I had another idea, to make the AIC's brain component the StateTreeBrainComponent and create a separate BehaviorTreeBrainComponent that could be triggered out of ST's task. The only concern here would be how do I orchestrate switching between STBC and BTBC
doesn't BT always need BTBC? I mean it is passed as a reference to all core BTNode virtual methods
wouldn't that make the BTBC my core brain component and hence main driver of what AI actually does when I actually want this role to be designated for the state tree?
what will be main thing is the one you run as the main one
π€ I see, in this case I might need to override something inside the AIC then to make the ST the boss
The task Tick() should return EStateTreeRunStatus::Running for as long as you are not at target yet. If you return EStateTreeRunStatus::Succeeded then the state will finish.
Usually you should set up the path following on EnterState() (return Running if everything is ok, succ/fail if you want to stop immediatelly), and monitor the progress in Tick() (Running until at goal), and do the clean up in ExitState().
BTs cannot really be embedded into ST, but I guess you could have a BT that reacts to "commands", which is sent by ST.
Yes, we have a "use smart object" BT node that runs an ST and the asset comes from a Smart Object behavior. [edit] And to clarify, the BT does not use the State Tree component to run the ST, but has ST instance data and ticks the State Tree itself.
ohoho, welcome Mikko, this is becoming my new favorite channel after #engine-source :D Quick minor ST bug I noticed yesterday in 5.1,
(it is necessary to reselect the state to update bindings list after moving the state)
Ok, thank you!
also another bug happened to me but I could not reproduce it anymore. I changed a state to Group. Hitting + for transitions then kept adding more and more -> [None] into the tree but transitions list in details panels was still empty. I will see if it reproduces and give better info then.
Also additional thing which I found a bit frustrating yesterday when working with ST Tasks when compared to BT Tasks. EnterState/Tick/EndState are functions returning a value in ST Task. It makes it more difficult to use latent nodes like AI Tasks. In BTTask I would usually just hook AI Task / latent node to execution event and add FinishExecution(true/false) to latent node output exec pins. In ST Task I have to create custom event in the event graph, call the custom event from EnterState and set bools when output exec pins are fired. These bools are then read in EnterState/Tick. Ideally I would like to have EnterState/Tick/EndState return Running by default in C++ and return a different value in case something like FinishExecution is called during the function execution. That would allow these functions to have no return value, have them as events in the event graph and support latent nodes conveniently. But I have to say I did not investigate how tasks are instanced, so I have no idea if having async tasks or variables there is ok at all. Here are BTTask and STTask comparison pics for a task doing the same thing.
When I read about the ST a while ago, I thought that the BT controlled the AI and the ST were in the smart objects, so when the AI activates the smart objects it uses the ST. I had thought that STs would be used to handle npc crow or figurant.
now, After reading these days i'm more confused π
Thanks
You can use ST also as your main brain logic instead of BT.
BT is a wild horse but when you tame it the BT goes very well, I would have preferred a BT 2.0, the ST interface looks very intimidating hahha
btw, I can't get my hands on unreal 5 right now but I'm really hyped to try this out. and something I would like to know or I will not sleep. Does ST have services that can run at the same time as task? Like BT
That is what I am trying to understand right now. It feels like it is all just tasks and you leave that tasks running forever. But I have troubles combining async EQS, waiting for the result, then doing something (MoveTo) what requires access to the output of the EQS. This is what I have converted from BT now but it is not working as expected yet.
but I have to say I am close to giving up in favor of just waiting until there is more info and docs available. I am a bit confused by the fact that some tasks need to be by design running infinitely not because there would be no success/fail output from them available but because I just don't want to complete the state based on them ending.
Thank you I just discovered those last night π
Does anyone know what these symbols mean above my NPCs?
I have an AI controller on them, and when I start the level, they all walk away from my PC. Even with two different controllers.
Maybe the STs are made for me HAHAHA, I have the eqs in the service and I have the move activated practically all the time.
Okay, so for anybody who finds this later. This state tree is offering more or less same behavior as the behavior tree next to it. It takes a bit practice to think of the tree as of hierarchical state machine. Important piece which is not visible from the tree is that tasks Set Focus, Set Grait, Shoot, Run EQS Query never actually Succeed or Fail. They run infinitely and always return Running state (even if they do their thing once in the EnterState event). That is true even for EQS as otherwise it would end the execution of its child Wait For Query Result state (this was probably most confusing part of it for me). Important piece is also the Wait For Query Result state. It must be there because otherwise Find Loc state would not execute (this is more clear if you properly think of it as of hierarchical state machine).
Now I only wonder what to do in case I will need some tasks sometimes as returning succeeded and sometimes as running infinitely. It might make sense to introduce some bool which toggles the policy for returned state (something like bRunningInfinitely what forces it to never succeed/fail).
Something I think should be improved is the ability to understand whole state tree just by looking at it. Enter and transition conditions are hidden behind (?) icon which does nothing when hovered. And even then I would need to hover every transition to understand the tree. For me it is not a problem as I am author of the tree but I can imagine it could make it difficult to understand bigger trees for other developers. Similar thing applies for the behavior of tasks (running infinitely vs returning succeed/fail) but that can be probably mitigated by naming tasks accordingly.
but the way data is passed around without blackboard is awesome.
Hi everyone!
I've been delaying the AI in my "game" for too long and my first approach was to do it just in code, with old school State Machines
it worked more less ok, but I have realized that I wanted to learn how AI is done in a professional environment so I will be redoing it using other techniques
my first approach to BT's is not very good to be honest
how do you find state tree compared to them? Do you think its worth to get into ST directly and skip BTs?
I say start with BTs. Much more info out there on them for the time being.
I feel like I'm the only one who doesn't mind blackboards π
well, I haven't used them very much yet but I think I see the the annoying part of having to move the data from your character/controller to be able to use in the BTs
but I guess that if you can share the same BB for some characters, there is a performance gain
The BB concept is not bad just the technical side is a bit dated after all these years. I have enough of things like setting BB keys again everywhere after renaming one or as somebody mentioned, going thru sacred ritual to support a certain struct type. + stuff like referencing by name, being forced to single huge blackboard containing everything and so on. If it ever gets reworked using latest UE and language features it will be a different story.
I would say stick with BT. Even if it has some dated parts, it has years of development and bugfixing behind it and is battle tested by many games.
hi
That's what I was missing
Thanks
It just seemed quite needless to have data split into loads of small BPs to me (services and blackboards mainly), I've always preferred just writing the logic in code where each BB / Service can be a simple func
I even have a single UEnvQueryContext class that can return all of my base common contexts via enum rather than making a separate class for each with a line or two of code in each
But it's all down to preference at the end of the day π
Hi all
I made an AI flying and I'm trying to use the "AI Move To" node to move him to another actor
When my AI is too high, the node "fails"
Anyone knows why please ?
Am I missing a parameter ?
Even if my another "actor" is too far from "Landscape" (high) it does not work
I guess the "NavMesh" has a height limit
Likely failing because the nav mesh is 2d and it's trying to project the point on the ground and it's too far.
The only thing I don't like is that they are by FName. I use the blackboard key selector most of the time, but that can be annoying to set up, especially outside of the BT Nodes.
Any idea why the AI perception might be spawning at 000, even if the ai is not there?
i visualize sight sense for example and its center is at 000.
thank you i'll look at it again
have anyone had experiment granting ability/gameplayeffect using statetreetask? im thinking of making a general STTask for actor to garnting ability/effect to self
i really like the workflow of ST for these type of behaviour
AI perception component doesn't have a location. It gets the pawn's view location.
So any idea why it would interpret the pawns view location to be at 000?
Did you add it to the controller or the character? Does the controller have a pawn? You say it's there even if the AI isn't. Sounds like a controller was spawned on accident.
Hmmm. I put the aiperception component in the controller.
I could look for a 2nd/extra controller in the world outliner. But, just in case, any other ideas?
What is the cheapest points test you can do in EQS?
Grid perhaps?
Assuming identical point counts
Or if indentical point counts, each test may be identical in cost?
points are n in O(n)
I'm not sure what that means. Do you know which pattern is the cheapest to generate, assuming the same point count?
point count is just a multiplier to the test(s) overhead
ofc each shape has different algorithm but you wont see much practical overhead difference between them
I dont recall its name but I'd say the sphere thing -- donut but without inner circles
it must be relying on a very simple math
grid is one of the most expensive ones -- even though its not something very expensive -- since it does 2d loop and slightly more complex math
Great to know thank you for explaining π
I am at a complete loss as to what in the world is happening.
I have a nav mesh and a simple "move to" behaviour where the pawn will simply look within a radius and move to the next point.
When packaging the game for PC, all is fine, everyone moves.
When packaging for mobile android, the ai pawns simply don't move at all.
I tried manually reloading the nav system by command and C++, setting it to dynamic and none of it worked.
The AI controller is a detour crowd ai controller.
This is the behaviour tree:
At this stage, are there any ways i can debug this further?
fairly weird question but has anyone had the experience of Instance Editable variables on a blueprint task getting reset to default in the behavior tree upon restarting the editor?
specifically an enum
either VCS problem or your BT having serialization errors
any fix? dont mind deleting/remaking the task
if same thing doesnt happen on another BT, your BT asset is the problem. if its globally related with task i dont know
oh if you duplicated the BT asset, i'm pretty confident its a serialization error happening on BT asset
oh
i deleted the enum and remade the variable
maybe its working now (for now...)
but thanks for the info on serialization
afaik task's properties are serialized into BT asset directly
I'm not sure though. I just had similar issues, especially on nodes rather than properties when I duplicated BT assets
maybe i duplicated something with a different ENUM and just changed the property type instead of deleting the property and making a new one
and it got confused
but since i did that now, it works.
interesting
i guess BTTasks has a different serialization thing and custom details panel implementation because they work differently compared to blueprint objects
from my experience they time to time do weird things like that and its easy to blame engine code since i can observe most of the time its not related with my project
btw similar things happen when you duplicate tasks too
just fyi
isnt that what we're talking about? oh we were talking about behavior trees
im a few beers in and i meant task when i said BT
behavior...task...
so good to know duplicating trees can do this too lol
is there a good 3D pathing Ai for space games? i know theres big name middleware solutions but i cant imagine they are the only ones.
ones that can do both Ai actors and missiles. cant be the only option is to spend more than $2000 USD on just the pathing Ai
It has had a steam game shipped on it so it works fine. You'll have to compile on cpp tho
Hello good folk!
I'm very new to all of this, but I have a very basic AI set up that moves to the location of the player and it works as intended when the enemy is placed manually in the level
My issue is that, when the same enemy is spawned during runtime, it won't move at all.
Does it need to be "activated" somehow?
In your AI character change this
That was it, thank you very much!
remind me please is it safe to store TArray inside node memory? TArray<FActiveGameplayEffectHandle> to be specific
Not really. You risk leaking memory since the TArray's destructor won't get run automatically (due to the details of how BT memory is organized). It should work if you mark your node as bIsInstanced = true and use a TArray as a regular member variable.
shouldn't I avoid instancing BT nodes at all costs?
it's better not to instantiate BT nodes, but sometimes it's the only way (if you really really need that TArray in there, for example). One important decision data point is how many BT nodes of that class are you going to have, or how many AI agents will use BTs that utilize these nodes.
this is probably a dumb question but what's the difference between a task and a service?
how can i differeantiate what should i put as a service or as a task?
Service runs parallel with the branch, and task takes over execution as far as i know
not sure if it's right
Can i instance tasks? I want to create a behaviour tree with basic tasks, but change those tasks for subclasses. Is this possible?
When trying to debug AI vision by pressing the apostrophe, not happens. Got debug plugin checkbox ticket and also activated AI debug through Show -> Developer -> AI Debug. Anything I'm missing?
Do you have an AI agent in the scene?
@manic karma Yup!
Can you share a video of the problem?
I see through the BT debug that it is running the tree on an AI controller
Hmm, not sure what to show, when hitting the apostrophe key that should turn up the debug info in the left top corner, nothing happens instead. Tried on a blank project as well etc
try gdt.Toggle - if it enables the gameplay debugger then I'd suggest changing the activation key (there should be an option somewhere in Editor Settings). Some keyboard layouts don't quite work with the default GameplayDebugger's key.
@crystal hatch Thanks, that does indeed trigger it. Cheers, on it π
You can, but data driving it will get you really far.
Anyone have ideas for why the AIPerception component (added to ai controller) might not stay with the actor? Currently visualizing sight radius at 000 in the world.
Confirmed there is only 1 controller for that AI
in a clean/empty project, I used the same settings/setup and everything worked fine.
You need to attach your AIController to your actor, there's a checkbox..
I tried that too but ill try again
there's always a checkbox
in the scene outliner you should see the AIController as a child of the actor its controlling if its properly setup
otherwise it shows up as a sibling..
ai is top right, sight sense visualized bottom left
checkbox checked
same result
clean slate project works fine without the controller being attached as a child. Perception component follows.
it says your pawn name is ai spawner? is that right?
hmmm oh dear
haha brb
let me see if that indicates a source of the problem. should not be the spawner.
good eye haha
yeah, doesn't sound right to me
the spawner is not even a pawn so no idea why thats possible or didnt give an error
alright
updated
same issue remains
worth mentioning that this project is shared with programmers/c++. Maybe theres something related to how components are handled with c++ that each component needs to be told to stick with the drone/actor?
Take a picture of your scene outliner for the AI, does the controller sit at the same level or as a child of the thing its controlling?
as a sibling for both projects
work day is done for now but can confirm it working on my side project with controller as a sibling
screenshot of drone moving forward (through walls because collision lolz) with sight radius/aiperception debugger on.
controller not attached to ai drone
movement speed was set at begin play within the ai drone event graph.
not sure why the eye icon is closed in the outliner for the controller.. possibly because it doesnt have 3d components.
hey guys i wanna ask,does making custom statetreeconditon class wont make whatever blueprint class inherit from it appear in StateTree schema condition list?
i make a custom condition class taht have another blueprintimplemntableevent that has input of Actor but when declaring it in statetreeschema,that blueprint class that inherit from that custom conditon class wont appear
anyone can check this code to see what's wrong?
// Fill out your copyright notice in the Description page of Project Settings.
#include "StateTree/Conditions/STActorConditionBlueprintBase.h"
#include "CoreMinimal.h"
#include "StateTreeExecutionContext.h"
#include "BlueprintNodeHelpers.h"
//----------------------------------------------------------------------//
// USTActorConditionBlueprintBase
//----------------------------------------------------------------------//
USTActorConditionBlueprintBase::USTActorConditionBlueprintBase(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
{
bHasTestConditionActor = BlueprintNodeHelpers::HasBlueprintFunction(TEXT("ReceiveTestConditionActor"), *this, *StaticClass());
}
bool USTActorConditionBlueprintBase::TestCondition(FStateTreeExecutionContext& Context) const
{
if (bHasTestConditionActor)
{
FScopedCurrentContext(*this, Context);
return ReceiveTestConditionActor(GetOwnerActor(Context));
}
return false;
}
//----------------------------------------------------------------------//
// FStateTreeBlueprintConditionWrapper
//----------------------------------------------------------------------//
bool FSTActorBlueprintConditionWrapper::TestCondition(FStateTreeExecutionContext& Context) const
{
USTActorConditionBlueprintBase* Condition = Context.GetInstanceDataPtr<USTActorConditionBlueprintBase>(*this);
check(Condition);
return Condition->TestCondition(Context);
}
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "Templates/SubclassOf.h"
#include "StateTreeConditionBase.h"
#include "Blueprint/StateTreeNodeBlueprintBase.h"
#include "Blueprint/StateTreeConditionBlueprintBase.h"
#include "STActorConditionBlueprintBase.generated.h"
struct FStateTreeExecutionContext;
/*
* Base class for Blueprint based Conditions.
*/
UCLASS(Abstract, Blueprintable)
class CREATIONARTTOOLS_API USTActorConditionBlueprintBase : public UStateTreeNodeBlueprintBase
{
GENERATED_BODY()
public:
USTActorConditionBlueprintBase(const FObjectInitializer& ObjectInitializer);
UFUNCTION(BlueprintImplementableEvent)
bool ReceiveTestConditionActor(AActor* OwnerActor) const;
protected:
virtual bool TestCondition(FStateTreeExecutionContext& Context) const;
friend struct FSTActorBlueprintConditionWrapper;
uint8 bHasTestConditionActor : 1;
};
/**
* Wrapper for Blueprint based Conditions.
*/
USTRUCT()
struct CREATIONARTTOOLS_API FSTActorBlueprintConditionWrapper : public FStateTreeConditionBase
{
GENERATED_BODY()
virtual const UStruct* GetInstanceDataType() const override { return ConditionClass; };
virtual bool TestCondition(FStateTreeExecutionContext& Context) const override;
UPROPERTY()
TSubclassOf<USTActorConditionBlueprintBase> ConditionClass = nullptr;
};
ping me if you can
Hey there everyone, a small question how would you make AI remain in a specific area or volume and it cannot leave that particular area?
I am asking this in the context of an open world where the nav mesh is generated for the whole world and AI is using Nav invokers.
thank you.
I tried this too. A quick reading of the statetree ui code suggested that it only displays blueprints whose base is exactly one of the *BlueprintBase classes. However it seemed like it would be possible to inject your own class as one of the accepted root classes for the UI. I didn't have time to test, but look for AddRootClass or something similar in the statetree module.
Have the spawn location stored on the AI, if the distance gets too long, have it return.
hmm, that might work in this case, but is there a way to do this with a help of a trigger? As i don't want the AI to check for the distance everytime.
you dont have to do this everytime
you can use a service to set decorator
and if decorator returns true, trigger returning back behavior
hmm i'll look into it
Has anyone seen any problems with sequence nodes in 5.1? I have a BT that worked properly in 5.0 and the same sequence node does not advance in 5.1 (does not fail, simply doesn't play the children in sequence).
Hey everyone, i have a question about combining GAS and BT. I want to create a task that activates GAS ability and finishes execution when ability ends. I thought about using InstanceMemory but i'm not sure there is a way to use it for that particular goal. Any ideas how to approach this?
As alternative I can instance this task and just call FinishLatentTask directly from ability. But then there is another question, how taxing it is for performance to instance a BT Node? How bad would it be, if, for example, 50 ai pawns called a dud ability from instanced task node every 5 seconds?
@golden scarab You could activate the abilities via event, pass in the BTTask as instigator (so you have a reference to it), wait and then call FinishLatentTask once the ability has ended.
But you could also just finish the task normally after the ability has activated and add a decorator that stops it from advancing if a certain tag is applied.
Yeah this way would be a better one...
I'll try it out and see if this works well
hmmm okay all my condtionclass has that BlueprintBase so i saw the actually c++ class is in the editor condition list but when im making a BP child of that class,its not there anymore
but with the internal classes,making a bp child of the baseclass showed the bp class in the ditor just not the custom child of the bp one
π¦
Just a hunch, try delaying whatever you have in your AI Controller Begin Play. I've seen projects where it didn't get a chance to load things into memory before the AI Controller spawned and variables were not initializing properly. It's bad practice, but do it for debug.
For what it does, their solution is well worth the money.
hi I'm new to UE and currently trying to get the MassSpawner from CrowdAI working, while using different vehicle assets. I followed some tutorials, but my vehicles are not driving correctly and my error log is spammed with "Attempting to move a fully simulated skeletal mesh /Game/PolygonCity/Maps/UEDPIE_0_Demonstration.Demonstration:PersistentLevel.BP_Sedan_C_1.VehicleMesh. Please use the Teleport flag"
Does anyone know how to get rid of this error?
sounds like #mass would be a better place to ask this question
ok, thank you :)
@lapis grotto I redid the ai btt, bt and bb with a new controller with a task of rotating in place. This worked. I will try the delay
I am having issues with my NavMesh preview not showing up. I'm not sure if it's invalid or just not drawing. I can press P but it won't show up... Is there any setting i may have ticked off or so?
Maybe it is under your map?
doesn't show up from below or above ground :/ i dont know what is wrong
when should I call a blueprint function instead of doing the logic directly inside of a task
example: predict location of an actor 1 sec from now
should this be a blueprint function called through a task in the AI Tree?
a task can also have blueprint functions, so I think you might be asking a malformed question
I think this is what I meant by "calling function through a task"
it's like
I have the character blueprint
and their AI Tree
and by "calling a blueprint function" I meant calling a function inside the character blueprint
or am I getting more tangled here? I genuienly don't know
So I added a delay of 0.5 s and i even looped it to try to use the BT but to no avail, debugging further
You also need a delay on the false part of the branch to avoid infinity loops
why though? The initial delay was given to let the system catch up in a sense. If the Behaviour tree is not running, I am asking for it to try to run it again. The second it does, the loop is done
either way it didn't work, on mobile the behaviour tree isn't being run
I made a basic tree where the BTT is to spin in place, and that one works
hey sorry for pinging i wanna ask did u ever manage to get this sort out?
Because if the bt fails to run, it fails for a reason. Forcing a new try the same frame would be rather useless, and it would keep failing
Causing infinite loop
Adding a delay keeps the loop, but allows life to move on, and perhaps whatever stopped the bt from starting changed its state
If not, we stilll have the loop, but its not blocking anything (read game thread)
You can use an AI task to run the ability with. Then the node memory just is a weak pointer to the AI task.
regardless, did not work
Does anyone know what this means in terms of what he did?
Is there any ways to make behavior trees reusable?
I have tried using dynamic behavior trees but it seems like the blackboard owners HAVE to be the same.
This makes it so that i cannot create modular behavior trees. I cant for example make a retreat function that I can call in the BT of both my knight and archer.
Is there any way I can make behaviors (inside a behavior tree), that use its own blackboard, so that I can use it for multiple enemies?
It seems like dynamic behavior trees can do somewhat do this, however, you cant have dynamic trees within these dynamic trees
Interesting, never thought about using themπ€. Will look into it, thanks!
Actually, I was thinking about using Brain Component's FAIMessage system to synchronise task and ability. A bit like in BTTask_RunEQSQuery. Seems like all it needs to get going is for a task to create FAIMessageObserver and ability to call BrainComponent->HandleMessage with same FName message
The BT is already set up to listen for AI tasks to end. You just need to override a function: OnGameplayTaskDeactivated
Sounds like hebjust removed and re-added the navmesh, and rebuilt navigation
does it sound like its at runtime or in editor? @misty gale
I tried the editor route unsuccessfully and I am not sure how you would do that at runtime
You have to use the same blackboard if you want to use subtrees. It's really easy to make simple and genetic blackboards for this.
But if for example, I would like all my enemies in the game to have a specific behavior, like retreating, then I would also have to use the same BB for each enemy. Otherwise, I would just have to copy the whole retreat behavior in each separate tree
Besides, if I had to do this for each behavior, the BB(blackboard) would get massive
It's the constraints of the system. You can try and change that if you know enough C++.
Your blackboard doesn't have to be massive. You can easily reuse BB keys. It's not like your attack target needs to be a different key than your retreat target.
Hmm guess I'll have some more thinking to do.
And that is true, although I would like to avoid having to use 1 blackboard in total for all my enemies
Why? I'm working on a AAA game with a bunch of enemies. They share a blackboard and it's not very large. Maybe 10 keys.
That does sound very reasonable
Im just trying to create the most modular behavior system I can think of. I'd like to be able to change behaviors in runtime and have small, compact behavior trees
And not end up with huge trees and messy blackboards and such. I guess it takes a different design vision with just 1 blackboard. I dont like to create dependencies and I might forget where I changed the location BB value anywhere for example
Mine are incredibly modular. You really only need a MoveTo vector blackboard key that will handle any move to. It's a retreat location if it's retreating. Its an attack location if it's attacking. It's a wander location if it's wandering.
yeye i get what u mean xD. I'll have to take a look at it. I thought of doing it that way, but wasn't sure about the approach
Only option at runtime is dynamic navmesh afaik?
i set that up in the project settings
apparetnly should have an impact and all but saw none
invokers?
cool but i don't see how i can use that. I just tried it using the BT but nothing happened
Nah I was just airing thoughts, wasnt sure it'd even help in your case
No. Invokers is an option.
Ah yes, there was another option for that ! To only generate around the invokers.π
i mean im gonna try now without a behaviour tree
I exhausted almost all attempts at using a behaviour tree for mobile android
and in all cases it seems to fail
So porting a very large simulation to UE where I have been using recast directly with my own layer for pathing across navigation meshes. But with all the 64 bit stuff in UE 5 was wondering if they had something that solved this baked in?
To be clear pathing over navmesh boundaries, where the world is too large for just a single navmesh
I think what the people above here have said, is what u should prob look into
so neither does this work on mobile but works on PIE
gonna move this in the mobile channel since it doesn't seem to be an issue with the AI, but overall the mobile aspect
ty
Well this relies on the very same navmesh doesnt it
Whats the fail reason?
At this point I have no idea :/
I made a thread to log what I did and I tried everything to no avail
I did a couple more debugs which some worked and some failed. I decided to add a pause before the AIC would start the behaviour and that did not work, or at least did not fix the issue. So i started back from scratch with a new BB, BT and BTS and BTT. I tried assigning the new AIC and using a simple BB and BT to just do a BTT_Spin. All this...
It always works on PIE and on packaged computer builds
but in packaged android builds, anything related to movement fails
I thought the nav mesh was at fault and I tried to make it dynamic and rebuild it, works fine on PIE, doesn't do anything in Android
but when I created a BT with a task that is NOT move to, it worked!
so it seems to be movement related, but maybe not nav mesh related?
Sounds very much navmesh related
Any other movement type probably just works
When you "GetRandomPointInNavigableRadius",
other movement like what?
Does the return bool go true or false
Other movement method like simulated movement inputs (just like a player moves, using add movement input(not saying its a valid option for this case, just making a point about it likely being related to nav movement specifically, and not movement itself))
the issue is that it takes a bit longer to package for android and THEN have to upload it
and hope that google play updates it fast
Crossing fingers that i never have to do android π
Sounds like a lot of work just to check the return bool from that function
uploading it to the play store
yes it takes this long
lol
and no i am not running a potato, the PC output takes about 2 mins
alright drumroll
@misty gale
Good catch
It is set to false and no vector is obtained
so this is failing
Hey
How much does it cost to create AI enemy walking in set of paths and detect enemies and apply some attack patterns?
I'll have a look tomorrow
is there a way I can set the duration of a "Wait" node on a behavior tree from a stored blackboard key?
it seems like you can only manually add a regular or random deviation to them
Could someone kindly remind me what the console code is to see all generated nav meshes - not just the default?
@sacred shale using the bt only no. You would need to create a btt that tasks to wait as per the blackboard.
@cursive stag show navigation
is there like a wait function I can add to my BTT?
Delay?
thats it
I haven't done it but that is how I would do it
That only shows 1 of the 2 navigation meshes
i'm making my nodes in C++ so would I have to refactor it for blueprint to use the BP delay?
@cursive stag hmm??? Can you show screenshot
@sacred shale oh, cpp.... not sure if the function is called wait. I would ask the #cpp
thanks
@dusk pewter
@cursive stag try this https://forums.unrealengine.com/t/show-navigation-shows-only-one-navdata/321068
Hello, I have multiple NavData with different agent height in my level, for example, I have blue nav mesh for crouched characters and default green for standing characters. I can easily see my navmeshes in editor using Enable Drawing checkbox of nav data actor but in PIE I can see only green mesh. Is there some command which enables PIE drawing ...
If you are using C++, you can override the wait BT Task and add blackboard functionality.
Can I make a navmesh invoker generate a certain area of the navmesh manually?
So by default it does not generate the navmesh but if I call a function it does? I have an open world setup and I want my smart object managing encounters to be able to manually generate the navmesh in the combat area. Dynamic Navmesh generation and generatio around invokers is on.
alright hope to hear from you soon\
Isn't it enough to rely on the area generating automatically when you enable the invoker?
I'm totally saving this for reuse π
i didnt read the convo above but since its a pure node you are evaluating the function twice
since its connected three* times
So it is navigation related as far as i can imagine
Also theres an impure version of the node in newer ue versions. Recommend using that π
Basically, I'm trying to create a combat encounter zone in an open world scenario. So if I leave the area, the enemies would only try to reach me to an extent after which they stay at the position and shoot. Going far enough would despawn the enemies
So I was thinking of blocking them by navmesh
have you considered having a stationary invoker in the middle of the area and toggling it when appropriate?
exactly what I was asking. How do you do that?
which part?
Manually deciding if the invoker is gon s have a navmesh generated around it.
Also I'm thinking of manually deciding points AI stands at if the player leaves the zone
NavigationInvokerComponent's Activate and Deactivate
this will be trickier. You'd need find paths before deactivating the invoker and then disable path update on invalidation. NavigationPath.RecalculateOnInvalidation = ENavigationOptionFlag::Disable can be used here, or similar. Should take you most of the way there (if not all the way).
How do I properly stop/remove/destroy an AI controller? I've tried unpossessing, stopping logic, destroying etc. but it hangs around in the outliner (even when it detaches from the pawn) and keeps executing stuff
try this
https://docs.unrealengine.com/4.26/en-US/BlueprintAPI/Pawn/DetachfromControllerPendingDestr-/
Detach from Controller Pending Destroy
Thanks, i've tried that one I end up with the same thing, it sticks around and keeps printing debug strings
Have you tried DestroyActor? What does output log say when you call it?
At the moment the pawn calls an event to the controller to destroy actor on itself after a delay and then calls detach pending destroy on itself. It's all just debug strings in the output log
Pawn:
Controller:
as the very first thing on death UnPosses the pawn
Tried every combination of unpossess and detach, seperately and together with no luck
Thinking its something to do with this visAI plugin...
Do active timers stop actors being destroyed?
No
It didn't pan out. π© the editor searches explicitly for the built in bases. So it doesn't seem doable without engine changes
@misty gale my next step was checking if 5.1 was a good packaging engine because 5.0 was pitifully bad
How can I determine corners in the path ?
ohh π¦ thanks for helping out tho maybe i can make custom conditons and evaluator with cpp
Lets hope that works better i guess π π€
@misty gale I mean I can tinker with the function in c++ but I just don't understand why it fails. Because the nav mesh system doesn't work?
I tried reloading the nav system through command and c++ and each time it was successful when using the callbacks
So what is left....?
Im not really sure. It seems the ai is unable to find a location to navigate to, for some reason...
Like it cant find any navmesh
does anyone know why my AI is still running after I cut off the first arrow off the root node?
I'm seriously so confused, it shouldn't run, the only node that's running is the root node and my AI is still behaving like the nodes are connected when the root node is disconnected from everything else
Well no one could possibly know without any code or what you're even talking about
What is the "first arrow"?
Root node of what?
this is so weird
this like goes against all logic I've ever known
am I even real
is the universe even real
what's even happening
its the equivalent of commenting out beginplay and it still triggers beginplay
no it is running, the behavior is running as though the nodes are connected, changed a wait node from 1.5 to 10 seconds despite not being connected and it was running as it (shouldn't) have
Duplicate the file and delete the original
@crystal hatch This looks reasonable and can prevent people shooting in foot when accidently doing stuff with them on the client but I wonder could it be that maybe client wants to get nearby smart object to display some cosmetic stuff like interaction widgets even if it might not be exactly in sync? If I understand correctly, without the subsystem, the player will need to receive these from the server.
The main reason for this is that we don't support client-side smart objects just yet. People could try and would report issues, while we don't really expect it to work. Plus this change is a direct fix to client-side GC complaints - if you have SOSubsystem on the client, and you register smart objects with it, the smart objects will hang in limbo in PendingSmartObjectRegistration that will never get consumed but does reference the ubjects potentially blocking GC from removing them.
We will support client-side smart objects in the future, especially that there is internal work to support player's interaction with smart objects.
Great, that is all I need to know, thanks a lot!
@misty gale I noticed the impure exists in 427 and there is a reachable and navigable flavor
Gonna test the other 2
When do you need to determine the corner? Before using the path or before the corner section?
shouldn't a blackboard be shared between all AI agents?
I mean I know it's shared but in my case I have subtrees
Generally, how do games that have massive open worlds with roaming AI handle navmeshes? Do they use that dynamic navmesh that is always generating around the player (invokers)? Are there any new options introduced with UE5?
You can also use nav mesh streaming. It should work with world partition.
Well - it depends. Many ways you can handle this.
Oh nice! So you could generate a nice offline navmesh over a massive world and I assume changes to each chunk wouldn't force an entire reuild?
You can do the nav mesh streaming that Luthage mentioned, you can just have some zones that have navmeshes, you can have preplanned routes and then do more simple local nav stuff as well.
Nice! In my case the world is like valheim so technically AI can be anywhere and can follow you anywhere too so it would seem either a gigantic streamed navmesh or the invoker would be the way to go
I just don't want the game to be constantly eating performance from it constantly rebuilding but maybe that's how games like Fortnite do it
Correct. World partition breaks up the nav mesh and loads it in with the chunks.
So you'd have a giant navmesh bounds volume covering the entire world for this?
Invokers are incredibly expensive.
yeah and also limited range so you couldn't see an AI more than a medium distance away walking
I'll look into the streamed navmeshes, hopefully moving a single rock won't rebuild the entire thing each time
Are there any docs on this feature? All I can see from a brief search are people asking about navmeshes with level streaming
Not that I know of. I don't think you have to actually do anything in 5 for it to work. 4 you had to build the nav mesh in a very specific way, but I don't think that's the case in 5.
Yeah at least in UE4 if I tried a single large navmesh it would take an impossibly long time to build once the size goes over about 100K units, wouldn't be feasible for a very large open world with decent precision
I really wonder how Fortnite does it since it's a large world AND everything is destructible
So the navmesh must be at least semi dynamic
No there's loads of AI walking around
Must've changed that
They can follow you up stairs and open doors
Yeah they've added many AI over the last few years
Not to mention the recent Horde Rush mode where there are literally 50+ zombies all running after you on the large map
Reacting to destroyed walls and everything
I'm very curious what kind of navmesh setup they are running
Maybe Mieszko will chime in about that π
(I just assume he knows what's happing in the Fortnite world being an important AI person and all π )
There were some posters early in UE5 release who commented that UE5/late UE4 had some changes that made Nav invokers unnecessary in open world maps. (I think it was WorldPartition specifically that helped with that, but there's also ZoneGraph that looks useful for long range nav.)
Too much text to catch up - what's up?
TLDR: How does Fortnite handle navmeshes for its AI stuff
Not the STW side btw
@unborn jungle For awareness
One big navmesh on the whole map. And the other one in some places, sometimes. All dynamic with a twist - we load pregenerated navmesh at the beginning of the map and dump all the "dirty areas" (apart from locations where we stream random sublevels). That's the gist of it.
let me know if you have follow up questions
So, one big navmesh, then you examine what is a dirty area (what does that mean for ya'll?) and get rid of that specific part?
Normally when you have a fully dynamic navmesh it gets loaded but dirtied almost instantly because every actor that gets loaded dirties the navoctree (and creates a "dirty area"). It's pretty easy to side step this mechanic and block rebuilding on load and before unlocking it flushing all the dirty areas. Once unlocked regular dynamic navmesh rebuilding will take place.
Ah - do it this way so it isn't constantly trying to rebuild? So you just flush once more or less?
the main point is to avoid initial rebuild of the whole map - the map is so large that most areas will not change from the initial state, and we can build navmesh for that off line, in the editor or via commandlets.
@misty gale so using this I get a false boolean but I do get a vector
gonna bring it up to CPP, I am not sure what is happening here
false means the vector is not reliable, meaning it doesn't meet the requirements
Is there a way to maybe expose this as a simple checkbox? (if it hasn't been already) I've never really had to mess with a giant navmesh to be honest, lol
Or anywhere that I can look when it comes to side stepping the dirtying of the navmesh on load
would be easy to add, but I never got around to it, and now I'm not involved with navigation code anymore. I'd say it's a good exercise that could result in a good PR (wink, wink, nudge, nudge π )
π€©
do you perchance know if there is a way to force the navigation?
Basically this works fine in PIE and packaged on PC; it fails at all times on Android. So there is a disconnect somewhere and if the bool is false, it means the nav is at fault... I tried regenerating the nav over and over again and i do get callbacks confirming it but no progress. The Pawn simply won't move
start by looking at how ENavigationBuildLock::InitialLock is being used and consider calling DefaultDirtyAreasController.Reset before releasing the initial lock
which UE4/5 version?
what kind of navmesh generation? Static/dynamic/modifiers only?
dynamic, i can try it back on static but no dice on either so far
i'm checking out if i disabled AI somewhere somehow but like I said, it works fine on PC, but fails in android
In terms of AI code the only difference between PC and Android is data cooking, so make sure you don't have any funky android specific packing options. I'd also pay close attention to cooker's log, preferably making all the navigation logs VeryVerbose
can it be due to chunking?
I don't think so but I don't have any hard suggestions for you, so I your guess is as good as mine π
ty
np. Have you considered upgrading to 5.0/5.1?
Yes and no. 5.0 was not a good build so I worked on 427
Ibsaw they fixed a lot in 5.1 so I might give it a shot
I'm asking because it's a lot easier to get stuff fixed if you report an issue in 5.1 as opposed to 4.27.x
I guess first thing is replicating the issue in a new project, be it 5 1 or 4.27^^
yeah, I remember reviewing it like it was yesterday... oh wait, it was today! π
@crystal hatch @misty gale
I get that but when 5.0 launched, a month later the Google play store required a bunch of updates that barely made it into 5.1 so you couldn't publish
When the path is determined. I would like to know where is or which segment is the last corner
If you use C++, you can get the path and do tests on the path points. A dot product should be enough to determine it. Example: if you have 3 points it would be the dot product of PointB - PointA and PointC - Point B. Then just walk through the path points.
Is there a way to use multiple nav mesh bounds in one map but then allowing AI to move between them?
Like, one per tile on a very large world partition landscape, for example
Very interesting, thanks for the answer. So say a map is 10 KM squared, I'd make an absolutely gigantic navmesh that covers the entire and then do long offline rebuilds before packaging but keep it dynamic? I'll need to look into ways to prevent the entire thing constantly rebuilding when in the editor as if often rebuilds the entire area which on huge maps takes a long time
Also a side question, how can I pre build navmeshes on sublevels while keeping them dynamic? ( I have a lot of small sublevels in my game (only one is ever loaded at a time) that need only minor secondary rebuilds at runtime, but I've tried all the hacks on the forums but haven't found a way to cleanly build a navmesh for each sublevel to reduce the runtime cost- it appears to generate navmeshes freshly each time a sublevel is loaded, regardless of whether I had prebuilt them in editor before)
Tried all kinds of combos by having the nav mesh bounds volume in the persistent level or having separate ones in each sublevel. There are a few forum posts explaining methods to get this to work but I haven't succeeded unfortunately
I'm trying to see if I'm getting a hit on my player character from the AI but for some reason it only returns false even though I can see it hit, why is this the case?
Does State Tree come with any type of debugger or way of seeing what the graph is currently executing?
was looking for it briefly today, I am afraid not and I really miss it
for now I use VLogs and print tasks
Wowzers. And they call this production ready?
Also, the checks for GAS Tags look for containers on the actor and not at the ability system component of said actor. Who the hell stores loose tags for abilities?
ASC owner actor usually implements IGameplayTagAssetInterface which returns tags from ASC.
Did anybody use Smart Objects for covers? I wonder how crazy of an idea it is. Not sure if spawning thousands of SOs everywhere and sometimes even dynamically is ok. What discourages me is that there is no nice way to create SOs dynamically in a more lightweight form than a component. Definitions don't seem to be expected to be easily created during runtime what means I would need to spawn single component with single slot per every cover point. That sounds like a lot. Was hoping to do something like this but with SOs https://www.unrealengine.com/marketplace/en-US/product/ai-cover-system . Its API looks almost like SO API, so imo it is a reasonable idea but I am not sure if the SOs are already shaped enough for this at the current stage.
this feels like the sort of optimization that should come standard with dynamic navmeshes tbh
feels like the only type of game that would want the navmesh to get rebuilt on load would be like runtime procedural generation sort of deals
seems like a trivial task for EQS
just a LOS test on the target that fails if there is LOS at crouch height
World partition should cut up the nav data already.
Ah, thanks... just means I have to make a prohibitively large nav bounds
I have to rebuild it from the command line but the behavior is sketchy
I get errors about it being too large
Even on an 8x8 km landscape
What version are you on? I remember seeing in the 5.1 release notes they made it so it can be built on larger worlds.
maybe we will get nav mesh 2.0 some day
It seems like the error messages are inconsistent with how I'm resizing it, as though it's using some kind of cached values somewhere
it's a real resource hog
It sure is
It's not based on size of area, but on amount of memory.
I wish I were smarter, I'd build my own nav mesh, with blackjack and hookers.
Yeah, I only have 32gb of ram
I guess it's time to upgrade
"Dear, I need to buy a computer with 128gb of memory. For, reasons."
You can increase the cell size or remove areas where they shouldn't go with modifier volumes.
It's not that you don't have enough ram, it's that they hard coded a max size for the nav mesh.
It seems like the max size would be larger than 64 square km
I mean I know that's not small, but
It's not large compared to some of the massive terrains they've showed off
they are called nav modifier volumes
It's not area size, it's memory size.
for example unpleasent terrain you can just toss a null nav modifier on it
no more navigation there
Right but does adding those reduce the total memory needed to calculate the whole nav mesh?
It reduces the amount of memory needed to hold the nav data.
Hmm
less nav data less juice
I'll look into that, it can't hurt, at least
Thanks
Kind of a double edged sword, though, my player pawns are AI controlled, so
If I eliminate nav mesh it means the player can't walk there either
64 SQ km is big for navmesh, I imagine too big
Increasing cell size will help but will reduce accuracy
@misty gale @crystal hatch It works in 5.1
I am going to try a fresh 4.27.3 custom project and see if something is amiss, probably tomorrow
hah and now my engine is broken, goshdarn it
Well thats the right kinda progress atleast!
there are caveats to this approach. Rebuilding from scratch guarantees the navmesh will be valid. If you discard initial "dirtiness" you risk outdated navmesh. Depending on the game that might be fine, but it's not a call we're fine to make globally - we stick to the safe side. But I do agree this functionality should be optionally available.
"One big navmesh" approach's applicability depends on whether you're willing to pay the memory cost - the bigger the navmesh the more memory it will take so check your worst case scenario and decide if you can spare the memory.
It's usable and by "production ready" we mean "it's here to stay, the API won't be changed overnight, and what will change will get deprecated and have a clear update path". It doesn't mean "it's all it will ever be" which is good because we have a ton of more features in mind.
Which one is more optimized EQS or Get random point navigable radius?
This is eqs way to roam
And this is alternative. Which one should I use in game that contains lots of ai's in open world?
GetRandomPointInNavigableRadius is going to be cheaper, assuming most of the area around is navigable, but you'll have absolutely no control over how the point is picked which will result in undesired and unfixable issues (unfixable until you change the way you pick the point).
Okay thank you!
Anyone come across a bug where an AI seemingly ignores its target location's Z-value in all move-to nodes?
In my project there is a landscape the AI moves on but also a cave system below the landscape where the AI is supposed to traverse in certain situations. I'm very specifically telling my AI to move to a location in the caves (at about -9000 Z-value) but it will always move to that location above ground (about -5000 Z-value) with the same XY values as the desired location. What's very annoying is that movement always succeeds even though it's clearly 5k units off. I know for a fact I'm inputting the correct values, because if the AI is already in the caves it will go to the correct location. It should also be noted that it 100% is able to reach it via the nav mesh, as my current solution has been to force it to move to authored points gradually, which lets it get to that location but moving directly there (skipping everything in-between) does not. I'm looking to move it directly there as my current solution has a lot of problems
I'm wondering if Z is ignored in AI movement if X/Y is close enough?
Anyone experienced with Behavioural Trees in C++?
Thanks for taking the time to answer Mieszko. Do you have any idea about this side question or is it expected that sublevels should completely rebuild navmeshes at runtime?
My decorator won't self abort if value is changed :/
have you looked at what vislog has to say? My two guesses are: huge default navigation query extent (with a very large Z), or that the path is partial and the location right on top of the goal is the "closest one" according to the metric used.
Works in BPs
the answer depends on what you mean by "sublevel". Are you using WorldPartitioning or "regular" levels? UE4 or 5?
UE4 (4.27). Regular level streaming- a persistent level that is empty essentially (just a skybox) that loads in small levels at runtime
Only 1 is ever loaded at a time but it seems to always freshly create the navmesh even if I had built it before playing in the editor
have you tried looking at other native "self aborting" decorators? Or at the BP-implementable decorator's native base class to check how it's set up?
Sadly I don't have the git engine on hand so I couldn't look into C++ classes :/
I strongly suggest you do that. You might solve your problem yourself, and at the very least you'll learn stuff.
the navmesh instances that come from sublevels are discarded, by default. You could try setting NavigationSystem's bShouldDiscardSubLevelNavData to false (via ini file or project settings). If there's only ever one at a time it might work. You'll also probably need bAutoSpawnMissingNavData = false, set this via Navigation System Config in World Settings for your persistent map. And see where it gets you.
Huge thanks, really appreciate that!
I'll try these tips out
Would be great to help the runtime cost as currently I just hold a loading screen until the OnNavigationGenerationComplete delegate fires
But it could be about 10x faster if it only had to do the minor dynamic corrections and could be generated offline per sublevel
hi, i'm having a hard time conceptualizing how to use the behavior tree for behavior that would be multi-step. like, "go to this location. once that's done do this. then do this."
my move to task is asynchronous, it immediately returns success and the task doesn't tick. movement to the location requested is then handled in the controller's tick. but for this particular behavior i want to wait while moving then continue through the next part of the behavior.
so i was sort of conceptualizing it by having a "holding" part of the tree to hold up the behavior there when the AI is moving, and when the AI stops moving to continue through the tasks. is this achievable?
i mean is this an achievable flow of logic in the behavior tree, my move to functionality and changing of the blackboard condition bMoving works perfectly fine. assuming that bMoving is always correct, it's true immediately after calling the CustomMoveTo task and is set to false as soon as the AI reaches its desired location
my move to task is asynchronous, it immediately returns success
why not add an option to not return instantly?
in that case do i tick in the task to just check if bMoving is false and if so then return success?
or i suppose i could make a new custom task which ticks and doesn't Finish/return until bMoving (or whatever bb key i want) = false (or whatever condition i want) huh...
π€―
ill call it WaitUntil lol
How do you trigger the move? I mean, which function do you use for it?
umm...function? like..inside the custom move to task?
my own function lol
my ai's movement input/input consumption is all custom and ran from the controller's tick. so asking what "function" i use for it is kinda vague.
So you mean you're not using engine supplied AI movement
it's adapted. but the base ai moveto function itself no i am not using it.
i just use character movement component and pathfinding
so it sounds like your systems is missing notifies on "movement finished" that you could be waiting for in your BT move task, that would gate the return of Success

