#gameplay-ai
1 messages ยท Page 11 of 1
The navmesh modifier is a way less intrusive method in my view - the "tool" that would generate the area mesh for this modifier actor would just be a separate step, and the modifier itself would work like any other modifier does after that - making it a clean separation and also not requiring you to adjust anything in the ways you generate your navmesh (maybe you also already have a navmesh generated and dont wanna switch it out)
Whereas a custom generator means you need to adjust things in the world and project settings, throw your old navmesh and nav boundaries out, set the settings again and generate the whole thing just to see if it does what you want it to do
As a user i would much prefer a tool that just "spits out" an area geometry for my modifier - this means i can also manually edit it afterwards
But as a developer i right now am just trying to see if ANYTHING works ๐
What keeps me away from the navmesh modifiers is that you end up having two generators (navmesh itself + this area mesh generator) in the end and both will need parameters etc :/
More parameters just mean more headache and conflicts
I will check some algos for turning texture to mesh ๐ฎ then i think about the problem again
you'd essentially do some sort of triangulation and then convert that to the volume
Yes, thats what i m looking for, basically a binary cutoff at some user-defined threshold that decides where the edge between inside and outside should be based on pixel values, then need to place these vertices at the right height and extrude up and down with some predefined value to ensure it doesnt miss the navmesh
But of course the polygon would have to be smoothed etc
Might be a quite costy algorithm after all
Heh i just realized i did these algorithms already at uni 8 years ago, marching cubes etc
yea the hardest part is translating that into whatever UE does ๐
I did some research now and marching cubes/squares seems to be the standard still :/
I m a bit scared to run into a timesink here with this, this was just supposed to be a nice-to-have for my prototype haha
@wary ivy in which case would you want to feed a custom texture into a nav mesh modifier? From what I have seen - and from what I personally want - the most common demand is to use the painted landscape layers which are also just textures
I just prefer decoupled systems
that way you aren't marrying the end user to use landscape layers
i think once the landscape layers work, adding a texture as input is not a big deal
instead they could just generate the navmesh modifier volumes with whatever texture they want and use whatever kind of texturing technique for landscape
yea, true
because some people use single layer "auto materials" and what not
Good points, thanks
Hi guys how is possible I did not publish it in here
๐ฑ
https://youtu.be/69coRSn80u0
Dream for Unreal 5 is a new and exciting Stable Diffusion plugin for Unreal 5.
This short video will show you how to down load, install and start using the dream plugin to begin creating your own fantasy creations.
Discord: https://discord.gg/jxWBwY8r5c
Dependencies location:
C:\Program Files\Epic Games\UE_5.0\Engine\Binaries\ThirdParty\Pytho...
Hmm, two unreal engine bundles on Humble this week
If the nav mesh is navigable and it's just the drawing that is clipping, you can just adjust the drawing.
yea with the offset, i know, but i showed the clipping intentionally to show how much it differs
is there a way i could set up StateTree so i only need to cast to the actor once
i feel when i do a cast for every task that wants to change on actor, i am doing something wrong
Just don't cast?
ST's get bound to a specific type of class anyway
Then in your tasks, you'd just have a variable of that type
And you just bind it in the details panel for the task
right
Now - obviously, this ties the task to THAT specific type of enemy.
my variable types was set to actor
So it reduces the reusability of the task itself.
If you want it to be more reusable, you are just going to have to cast.
whats the advantage of using BT or ST over simply writing a state machine in blueprint?
c++?
its a serious question btw
everything i imagine i want to do with an AI i can visualise in BP
I am not the best person to answer this maybe but I was waiting for StateTrees to be out of Beta and want to start using them soon and I like using BPs a lot for many things and my expectation towards StateTrees is that they give a more organized structure and flow for an AI's decision-making than a BP could give
State Machines have the problem of transition logic being in the state itself. It's fine if you have a simple AI, but the amount of work to add new states grows exponentially the more states that you have.
BTs separate the action from the transition logic and makes it more modular.
State trees appear to be a hybrid, but I haven't dug into them much as they are still currently in a very rough state.
I would not present BTs as "only good", there is no silver bullet for AI, BTs also have disadvantages and can get messy and costy
hmmm ok
In any case I would rather use a ST or BT for AI than a pure BP because the BP in itself has no structure for this sort of flow so you most probably end up modelling something like a state machine or behavior tree inside it to tackle your AI problem
yeah its mostly how new ST is that is difficult for me atm. dont want to waste my time in BT.
Do you mean it is difficult because it is not fully finished or lacking tutorials or what do you mean?
There is no "correct" architecture to use. It's entirely dependent on what your game and team needs are. I use a Utility/BT hybrid, because that's what the game needs. I wouldn't recommend it for a more scripted experience, because you will be fighting the system the entire time.
lacking tutorials or examples but im also new to UE in general
I think the docs do a pretty solid job at getting you up to speed personally.
so in a way im also new to AI, atleast the scale of it. Which leads me to chosing StateTree because its newest, so i can grow into it.
I think your issue is more that you're new to UE in general.
im stupid
My advice would be to use what is stable and learn the engine before venturing off to the new shiny stuff.
thanks
there is so much in my design that will be tuned against AI so i want it early, atleast a version i can expand on as i learn more.
How is StateTree not stable? it is officially out of Beta.
The better question is, to follow up on what @uneven cloud said with which i fully agree: is the ST the best tool for the job?
That is less a question of which tool is easier to get into than the which tool fulfills the requirements of the job better
You are interpreting it as the wrong type of stable than what I intended. BT's in UE are battle-tested and have a plethora of resources. ST's, not so much. No actual games shipped with it as of yet. It is stable in as to say that Epic changed it to stable.
can (should) i store TOptional or FVariant in NodeMemory? I have a decorator to set a value (single) to blackboard fields of different types (I choose types by a custom enum) and I want to reset previous BB value in OnCeaseRelevant but I don't want to declare a struct like
struct FSetBlackboardValueMemory
{
EMyBlackboardKeyType MyBlackboardKeyType;
bool bWasSet;
float InitialFloatValue;
int InitialIntValue;
FName InitialNameValue;
FString InitialStringValue;
FVector InitialVectorValue;
}
instead I'd like it to be simply
struct FSetBlackboardValueMemory
{
FVariant InitialValue;
bool bWasSet;
}
so is using FVariants/FOptionals good idea here?
Only PODs are really safe to be used in BT node memory. BT instance memory is one big pool for all nodes, allocated at once, initialized with zeros, and that's it, no constructors are being called. The memory for individual nodes are just reinterpretations of memory offsets.
With this in mind you can work around it to a degree by having a flag in your memory that would (due to how the memory is initialized) be initially '0' and when detected you could manually initialize the things that need that. I say "to a degree" because there's no way I can see to "fake" destruction - the whole memory pool is released at once, no destructors are being called for individual memory "cells" (because BT instance memory doesn't even have that concept), so you risk memory leaks.
I made a AI Sense Stimuli in my player.
I added AI Perception component to my AI.
I set the configuration to hearing and did all settings everyone online said to do.
I have all Sense update nodes going and a noise being made every second and not a single update fires on the AI despite the player certifiably making it through the "Report Noise Made" function
Like AI perception seemingly looks like it was given up on by the UE devs considering unsupported/broken it is. Soght worms. Somehow hearing had an entirely different system. Like, what tf was dynamic about that to the ue devs that did AI perception? Like pawn sensing was better.....
Like pawn sense was as straight as hello world after trying to figure out a simple task in AI Perception.
like, i am confused what is wrong with hearing.
i mainly want to use hearing since using sight wouldn't make sense mentally for a mob with no eyes
thanks, btw can TArray<float> be considered as POD? is it safe to store TArrays in NodeMemory in general?
what's under the Senses Config > AS Hearing Config?
I found it after you commented that
They gotta start that expanded..... lord Jesus
no, but a float[] can if you really need an array.
Of course you can always make your note "instanced" and there store whatever you want as node's properties.
hmm, okay. what about TWeakObjectPtrs to UObjects/Actors?
TWeakObjectPtr is fine since its construction boils down to zeroing its internals, and it doesn't require any destruction.
I'm doing some research about pathfinding and navmesh prior to writing the code for my Mass Entities to do pathfinding (the paths are requested per-battalion, not per unit, so it should be relatively cheap). I've been looking at the AIController, CMC and Pathfinding Component source code to get an idea of how Unreal implements all of this on top of Recast/Detour. Is there anything else I should study/read, any resources, to get a better understanding on the topic?
I'd be also interested in async pathfinding requests (so that the current frame is not overloaded when multiple requests are made simultaneously) and multithreaded requests (if supported at all).
I want to spawn a character with a behiover tree in C++, what should I use?
See how UAIBlueprintHelperLibrary::SpawnAIFromClass does it.
pathfinding is already async if you are moving to an actor
it works like this:
A* from nav geometry
string pulling (post processing the path)
move request
path following follows the path segment
instead of calling move to, if you do async path finding and call requestmove on pathfollowing comp you can move FVectors with async pathfinding too
I see. Given my setup (consisting of Mass entities) the movement is always frim vector to vector. I was looking into lower level pathfinding (not using the pathfollowing component nor CMC).
Probably after some research, I'll be using: https://docs.unrealengine.com/4.26/en-US/API/Runtime/NavigationSystem/UNavigationSystemV1/FindPathAsync/
Asynchronously looks for a path from to for agent with properties .
My prototype is First Person Melee
Humanoid enemies will range from zombies to overpowered knight types
To mention a few specifics i have in mind:
Unarmed and look for weapon or run away
Block on incoming attacks
Separate aggressive and opportunist action
is this best done in ST or BT? Or can it just as well be made with BP?
I am new to UE so either way it will be a challenge either way
thankful for any speculation and i can elaborate if needed
pathfinding gives you an array of FVectors
pathfollowingcomp just sends direction to movement component
towards next FVector index in the array
I think the general idea is that behavior tree is far more efficient than doing similar logic with blueprints
When it works for your game
The issue being if you make the whole system in blueprints to discover that it dumps your CPU performance
im asking from the perspective of someone new to UE
and i gave a small summary on some particulars
As Luthage pretty much said before - it dependsโข๏ธ
It is really dependent on you.
That's just how a lot of gamedev is
What works for one project, might not work for another.
In your description - either tool will work fine.
ok then
i'll keep grinding on statetree because the system im thinking about sounds driven by states and substates
State tree is probably the best of both worlds, it's just an experimental engine feature so it could change
i figured it was almost ready
ยฏ_(ใ)_/ยฏ
yeah, that's exactly what I needed. I'm close to getting it to work, not difficult to be honest once you reach the correct functions. Thanks a lot for the help. BTW, what's the differemce between normal and Hierarchical pathfinding?
mmm have no idea what would be better for an RTS
will test both, profile, and see what works better in context
thanks a lot!!! ๐
What is the feature called in games where the geometry between the camera and player gets hidden or removed? Project Zomboid or The Sims come to mind as examples
I'm trying to figure out how I can implement this but I have no idea what to search for
Wall occlusion is what I typically call it.
Well, right, but searching for occlusion doesn't produce much in this context
So add "wall" in front of it
Occlusion masking is another way I've heard it described
Oh, sorry
"How to make walls hide like in Diablo" - works too
Thought I was in general
@young lintel There is also this https://www.unrealengine.com/marketplace/en-US/product/mask-occluding-objects-from-camera
If you're the marketplace buying type
ยฏ_(ใ)_/ยฏ
I mean, I'm not unwilling to consider it... that does look pretty good
Thank you, but I'm headed back to #ue5-general lol
i seem to have hit something
my new AI controller with AI perception doesnt register stimulus
sight perception and stimuli doesnt generate any updates
i can see the debug info about the perception but adding moving stimulis into the area of sense does not do anything
Saved be a tiny bit ! About 2 ms if memory serves ๐ not mass tho but still
again i had missed to check friendly/neutral in the ai perception
wasted time on that
Hey, quick question: I have AI Characters that are using MoveToLocation. One AI was fine, but 16 AI causes the CharacterMovementComponents to take (combined) 50ms ish to complete each frame. Does anyone know how I should be moving these AI so they're not destroying frames? I'm going to need more than 16 of them in the long run.
It didnt save me much..
0.5ms only, though I only have 50 pawns
with statetree, how could i design a pulse/clock/timer i can use to get periodical updates?
I have an actor component that does my timer logic and sends an event to the StateTree
I don't know if it's "right" but it works
ok! can i ask how you distribute the event?
I just get the StateTree component and call Send State Tree Event with a custom gameplay tag for the event
I've had what appear to be a lot of bugs with StateTree tasks completing properly so I've had to use Events for several things
yea i noticed that states arent progressing without some debug overrides if empty
and such
Yea I had the same issues. I have a StateTree helper component I made that has a function that sends the StateTree an event. It has solved most of my issues, and I've found having a helper component suuuuper useful for async tasks that need input/output between state siblings
yeah i havent been able to make intricate statetrees yet
still dipping my toes into it
for now i will just use an integer increment for clock
I absolutely hated using BehaviorTree, so I'll do just about anything to get off of it. While there's still basically 0 documentation for it, I much prefer how StateTree is laid out and I find it a lot more intuitive to use than BT
im almost in the same situation
i didnt think the little i learned about BT made me able to approach AI in plain english as much as i want
Yeah i got a few more ๐ that and paralellfor on the tracing did wonders for the gamethread
Have you profiled to see exactly what is the bottleneck? Maybe with blueprints it's slower, but we could have a few dozens / hundreds of characters with AI and pathfinding without many issues. I'd profile first to make sure what's slowing down everything
I don't fully understand this yet (insights is kinda new to me) but it's what lead me to the CharacterMovementComponent
I assume this is very high
I'm seeing a capsule and sphere component underneath, what are they doing?
Capsule is their collision, the sphere just triggers some distance items when the player enters it
if you are sphere casting every frame, and the radius is big, that will probably be the cause
Hmm...Let me look at the code for that, I generally don't cast but maybe I messed something up
Man... That sphere is just doing OnOverlap events with a pretty simple check but I guess that's enough to cause the issue. I'll have to figure out another way to handle the logic in that overlap
A big sphere cast on tick is very expensive. I'd look just in case if you can set the physics to only do overlaps (might be cheaper) but I'd find another way. For example, you might cast the sphere overlaps on a timer (not every frame) and distribute them over multiple frames.
Async traces are also a bit faster and multithreaded iirc so that could bring an improvement as well
Have you tried to deactivate the sphere completely and see what performance looks like? Just to be 100% sure that's the cause
Literally the only thing this sphere does (it's massive) is check if the player is in range and activate the nameplate/healthbar/statusbar. I disabled the sphere entirely and performance only dropped 10ish frames instead of 30 frames this time. I haven't looked at it thought insights yet but it it was definitely the bulk of the issue. I THOUGHT the OnOverlap was cheap, but I'll just have to adjust it
Regardless of your usage, the sphere is actually colliding and querying spatial structures to get actors in radius. The bigger the radius, the worse it will get
It's not cheap at all
Also if those enemies are not many, you can just check the distance to the player manually (via vector maths) and you won't need the spheres at all
Is there a better way to determine when the player is in range? I'm going to stop using this immediately. Maybe I'll just move it to a timer
Querying spatial structures makes sense to reduce complexity of checks for many agents
If you are just checking the range from enemies (AIs ?) to a single player, just do your own distance check based on actor positions. Even if you do it every frame it will be infinitely cheaper
I can do that instead I think. I only have four players so it's not the end of the world I don't think
That's gonna be a nanoseconds operation
It's an easy fix, too. I don't even need it every frame, just every few
Yea just popped open insights, now the largest cost are the two skeletal systems that I'm using (long story, but they're going to be replaced soon). Thanks for the help!
np glad that made a difference!
Is it more logical to write with ai c++ or bp?
any tips on how to approach a melee AI that challenges a first person perspective
design wise
im already getting a conflict with a rotate towards location and move to location
the latter snaps
if i am unclear let me rephrase
what UE nodes are useful for making an actor move to and around a specific object or location
Is it possible to query a single point in a navmesh to see if it is navigable.or not?
Also, do navmesh queries take height into account?
project point to navmesh with given box extent
box extent is your radius
if it returns false it is not navigable
though it doesnt account partial paths etc etc
just checks if there is navmesh there
great, it might be exactly what I need. Although I fear it might be expensive and limit my multithreading possibilities if it is only in the game thread
you must access a uobject to do it
so its not 100% thread safe
but also 1k of navmesh projections are only expensive as calling a single BP function
(based on vblanco...)
in theory its just a fancy trace
ohhh lol. Nice then. I had the idea to use them to solve a ver specific problem related to boid formations, pathfinding and obstacles
I only need to do a few per frame
Isnt this kinda what sphere does?
Either helper actor, or rotate vector around axis
no, sphere trace does physics queries to get actors in the radius. Checking the distance between two known actors (two vectors) is infinitely cheaper
Hm. Im sure someone has told sphere traces are incredibly cheap due to basically just checking vs radius
DistSquared is one of the most cheap things you can do
hmm, i dont think so
cant beat that argument, though cant get convinced without testing my own too
Fair enough
I should provide my data, but i dont store it anywhere logical ๐
Id have to retest to provide anything
It's just not true, look at the profiling graph shared some minutes ago.
And I also had a huge performance issue with sphere casts
It is not checking vs radius. It is doing a 3D sweep with a sphere shape
Not gonna start a big argument, but im not sure theres a big diff between a 3d sweep and checking vs radius
Anyhow ill take your word for it
i'm suspicious of its performance benefit over distsquared is, it does three ifs and one >= meanwhile distsquared is only a mathematical operation
any branch should be more expensive than math operations
I can go back to dist squared and verify, i got it set up ready ti rumble
Gimme a minute
But why are you saying that Sphere casts only checks radius? It's just not how traces work. Traces do physic queries
It's like a linetrace, but bigger due to the sphere shape
They are pretty close to each other on gcc but distsquared slightly has less instructions
Yeah but that is not what a sphere trace does ๐
Use stopwatch and profile in shipping btw
I was talking out of the context
Ye I feel like the conversation deviated ๐คฃ
oh god.. i just switched to MSVC on godbolt and instruction count went to triple
My original point was that Sphere traces are much more expensive than anything that just compares two points
It was a simplification of what it entailed, but it doesn't matter. It's pretty clear that its quite a lot more expensive than a vector comparison
Is this a good way to handle the different senses that are detected?
It works well for me, but wondering if its the proper way
Hello, what are the solutions for
UAIPerceptionComponent + UAISenseConfig_Sight
not recognizing a player moving in a vertical direction for example running through a set of stairs
It just loses sight and my system kind of allows the AI to only move to a target only if it sees it
Just had chance to check StateTree..
god damn that data binding system is awesome... ๐
what is a helper actor in this context?
Could be an actor that just attach itself to target and applies a steady world rotation
so something like an empty object used for relative positioning?
i did a lot of that in 2D for camera related positioning
Yeah exactly
I guess it would be a 2 component actor, a scene root and a scene targetlocation which is offset from the root
Perhaps it doesnt even attach, it just follows with some movement speed
Was the first thing that came to mind atleast
not a bad idea
but at this point with my little knowledge i have nothing to compare it with
im still a bit confused about how to move without changing look direction
for an AI character
It was to provide two different directions basically , one look direction, and a separate move direction
Which ofc could just be two direction vectors
aye i get that
i just ment the toolbox of UE functions
what im confused about i mean
do you know a video that shows how to spam pawn ai for c++
so having dabbled in StateTree i have a question
a couple of questions
is it common practice to treat state tasks as aynchonous events ?
should i write most of my actions on my AI actor and use state tasks to execute these actions ?
if so, how should i make callbacks to the state tree?
I modified where it did the raycast for the sight sense so it did a different raycast to different parts of the body each update.. so basically choose a point on the skeleton and cast to that.
Anyone?
No one really knows. Just guesses. ST hasn't been out long enough for people to formulate real-world practices. Only theories.
Tasks should be done in the task itself. Use the character as the data holder. So ST becomes the brain more or less and the character is just how the ST gets information from the world. (At least one way)
i wasnt able to run AI Move in a task, which is where my confusion starts
Couldn't say why without digging into it. But even in BT/BP, people run into issues with using that node. So it could very well just be a setup issue. And I don't have the time to dig into it.
im truly looking forward to StateTree knowledge
hey guys I am quite new to BT. and I am running into this issue.
I set two decorators,
IF Player can't see the enemy -> go to random location
IF Player can see the enemy-> find a place where to hide
The 'PlayerCanSeeTheEnemy' bool works fine but when returning TRUE nothing happens. The Player should look for a place where to hide but he doesn't and it stays stuck, no movement. In the BT the Root is highlighted yellow.
Weird fact is that if I remove the condition both task and EQS query works fine. Can someone help me with this? Thank you guys!
One thing to keep in mind is that the BT evaluates left to right. So the one on the left has higher priority, so if you flip them you won't need the Can't See Player.
I would use the visual logger to debug. Likely one of your tasks is failing and the vis log will tell you which one.
I have another decorator on top of this, I managed by 'merging' the two conditions for each sequence and now seems to work fine ๐ thank dude
Anyone have any idea why this option would be greyed out? The documentation doesn't seem to help.
https://docs.unrealengine.com/5.1/en-US/world-partitioned-navigation-mesh/
I was using Navigation Invokers, but it turns out that AI cannot move to locations outside their invoker range...which becomes pretty useless when I need AI to move decent distances
I haven't been able to get my hands on it yet, but the first thing I'll try is to put the actions in the control/character, like I do in BT, where I send the actions with an Interface.
What happens if you control an enemy that is not a character? Would you have two practically identical ST just for that?
Your brain tells you where to move but it's your legs that make you move.
i did a quick test, i can access the ai controller and move to location in a task
but it also worked just casting to an event on the actor
i guess its very versatile
Yes, I'm from the anti-interface club but if you have a bipedal soldier, a creature, a drone and a tank. It's hard to come up with a hierarchy of AIController and characters that works for everyone.
Yeah - it is honestly. But also at the same time, I don't know how I feel about it being tied to a specific class. Actor context that is.
i still couldnt understand how we are suppose to access owner actor from tasks/conditions
i guess its strictly meant to be used with the data bindings
I was thinking about a UCLASS generator with yaml until i realize this
but for example for a move to task, it feels weird to not have an "owner" to move
this worked fine
i have an evaluator on tick that gets various values every nth times
like perception data and so on
Alright, I admit I have no understanding of how this is supposed to work, but does anyone have any hints about why this isn't doing what I want it to?
(If "IsPlayerControlled" returns true I basically want the behavior tree not to run at all)
its funny
my attack method is flipping a variable from checked to unchecked
i have a task that flip to checked in a task. no task tht flips it back
yet the AI attacks
Yeah.. if I delete this connector between Root and Selector, my AI still runs the whole behavior tree
But without any of the handy debugging information
They're becoming self aware
Your AI just wants to kill, mine just wants to wander
๐
its just...
as if the variable on the character is addressed via a task, it somehow gets flipped back because reasons.
but its not consistent either
I guess need to just tell the AI Controller to stop or start thinking whenever I toggle this
I was hoping for a more intelligent solution allowing it to make its own choice, so it would still run certain things even when under player control, like responding to attack or starvation problems
Create a variable in the task/condition and put it in the "Context" category.
Obviously it should be a child of actor
Does it automatically detect and bind the context actor in the schema?
You still have to manually bind it.
But it actually shows up if it is in the Context category
Ah, alright
How are you switching to player controlled? If you are changing controllers (which is recommended) then you should be stopping all logic on the AI controller.
No, the player is independent of the characters in the game, they can merely choose to give orders to them
The AIController should, ideally, still be responsible for what the character does after you tell it to do something
That isn't how it currently works, but that is how I would like it to work
Currently I have blueprints that control moving to things and interacting with them when the player gives a command
But the autonomous AI will need to be capable of all of the same interactions so it feels like unnecessary work to have to create the behaviors in two places
Think of like... The Sims, I guess
For a very loose comparison
I was hoping I could have the player tell the character to, for example, mine a rock, just by adjusting some values in the blackboard, while still giving the AI autonomy over how it accomplishes that task
However I was also hoping to be able to block certain sections of the behavior tree if the player is actively assigning tasks
So like if the character is starving to death it would override the order to mine a rock in order to solve the starvation problem before continuing to mine
But it wouldn't just start wandering around like a non-controlled character
Sounds like you could make use of utility scoring system. Afaik there is no built-in functionality for that but you can build your own solution or look at Github or marketplace
Well, yeah... but in the meantime it would be good if I could just lock out sections of the behavior tree, lol
I guess I could run a task in every single sequence that fails if the player is controlling
But it seems like decorators should be capable of this if I was using them correctly
Your execution was wrong in the picture above
You can use decorators for that
Let me check one of my behavior trees
Oh I have to move it down lower
You have to have selector above
I guess that makes sense
Like in the picture. Also if you don't want to do anything if the player is controlling, put wait or some task there even though there is nothing going to happen
Well, ideally, I'm going to add some behaviors that will be the sorts of behaviors a player could assign
I had some troubles before so that's how I do it.
Yeah, then there would be no problem at all
Cool, thanks
I feel good because StateTree exists and it looks like almost a perfect tool for general purpose usage
I feel bad because StateTree exists and it abstracts away around 5k lines of code I wrote to handle what StateTree could do easily in editor 
Funny thing about ST - it can be modeled in Godot almost exactly ๐
thats surprising
Not really. The scene tree easily leads to this kind of design ๐
As a matter of fact - that's the most common way people create state machines in Godot-land
Not a 100% replica of ST mind you, but the rough idea.
Is this your first engine?
yeah
Ahh - makes sense.
one year ago when I first learned about ECS it was also another shock of my life
Fancy for loops
a fancy for loop + a vaguely database like query
there ya go fps go up
I don't suppose anyone here has a lot of experience with NLP do they?
How would one make an AI to approach a player/location maneuvering (i.e. strafing left and right while still approaching target) ? So far I only have an idea of running eqs query in a service on a move to to reevaluate next point with providing players LoS and locations in EQS contexts for EQS tests but idk... intuitively I feel like this is wrong
EQS is definitely the right way to do it
the squeenix guys used that and just did a series of concentric circles as target points for their "waiting in a queue to attack" agents
so they use EQS to generate points around the target.. then the strafing comes from simply spinning those EQS locations by animating the heading for the generator
They had some sidestepping logic so that they faced the target and then stepped left/right if the EQS point was far enough away for a sidestep
is this a talk or tutorial or something?
how can i treat a state as enter dosomething and exit on condition
as opposed to enter dosomething and exit
hi, my behaviour tree moveto is failing, but AI Move to in the BP is working
check that the target you specify is being communicated in the moveto
usually my problem, target actor var doesnt contain anything
use debug
Hello, do you know why since I've changed the model for my enemy he became dumb af? He can't come down the stairs, if you go behind a sofa standing he can't see you
not sure how to debug in behaviour tree? seems like I cant add comments etc
with the previous model he wasn't like that
compare them
find a way to see if that key is valid
because i dont think moveto throws any error if the target is none
well, it has to be, the previous node Blackboard: TargetPlayer is set checks it
when the AI cant see the player, it runs the left branch, when they see them, it runs right right branch, the TargetPlayer var becomes set & valid, and then I move to it
if I print out the value in BP it returns the player character
the moveto function just fails, but it works in bp
ok weird, its working now after refreshing a BP didnt change anything ;s
any idea how to figure out which node aborts a task in bht?
From my experience it will go to IdleState
ty
What do you guys think.. functional programming for all now in UE? https://simon.peytonjones.org/assets/pdfs/verse-conf.pdf
Anyone know the intended way to have AI move over large distances in World Partition? I was using Navigation Invokers but when I give the AI a location outside of their invoker range they just won't execute it. I was trying to get the navmesh to use Tile Pool Sizes but my IsWorldPartitionedNavMesh is grayed out and I cannot seem to get it to activate. Not sure what setting is missing as I have all the documentation settings correct.
Publication date: January 2023
I wonder how did you access it ๐
@celest python You still messin' with ST's?
yeah currently trying to inherit from FStateTreeConditionCommonBase
One thing that I am not sure about the usefulness of is the evalutators. I know what they're for but like...you can just get the same information in the given task.
Any thoughts?
Was just thinking about it ten minutes ago, but I dont have any certain ideas too yet
I guess its suppose to update the parameters of the schema directly
rather than local task parameters
Hmm - does the entire state tree rerun after a "Tree Succeeded" call?
So after a state transitions to Tree Succeeded - does it reevaluate all that stuff again?
afaik yes
I guess an evaluator can be looked at like some kind of service from BT. But for the entire state tree.
yeah, gotta check city sample to completely understand - but its ~100gb
Is there a way to call the same sequence from multiple places?
in a blackboard
or group a bunch of tasks together to make one task that I can use in multiple places around my blackboard?
Make it a sub tree
And now - seemingly randomly, the "TreeStart" event isn't being called on the evaluator ๐ค
I made a basic ai like this, but when a horde of enemies follow me, they always make a line and it looks silly, what can I do to make it more horde-like and not a line?
Is sight perception supposed to refresh visual targets after expiration? I'm experiencing something weird - I'm standing right in front of an enemy and after sight sense lifetime perception component doesn't return any valid stimuli source, but inside of it perceptual data there is still a visual stimuli of the player character, but is is expired with like 250ms overdue
It was on twitter feed.
yeah just saw it, we are talking about it at #lounge right now
if you wanna join
I don't think its actually going to be the next scripting language.. at least I hope not ๐
Anyone tried doing any compute shaders for AI with Unreal?
make a BT with a MoveTo task to a location which is set by a Run EQS service that finds a random spot for a horde to move towards your players
or try just deriving your AI controller from ACrowdFollowingAIController
Instead of going directly towards the player, vary the locations. The EQS is really good for this.
+1 for EQS
Thanks for replys, Ill check the EQS
can I manually refresh expired sense stimuli? For sight in particular
why would you refresh it if its expired?
@ocean wren because of this
it seems that registered sight stimulis are not expected to be refreshed because of the sense's notify type
Hmm, it should update the sense stimuli automatically while you've got it in vision.. are you sure something isn't blocking it?
100%
Been a while since I played with it, but I never had any issues with it needing refreshing or anything to my memory.. I guess you'll have to single step it and figure out whats happening
if i remember right, it has a timer since last sensed and just resets that every time it was successfully sensed
well, not a timer, an elapsed value
sense timeout or some such
Anyone every had an AI skip a task only once trying to get my AI to walk to a location then return but the return task keeps getting skipped on the first loop so the location becomes offset
You can see it here, the first loop it'll play but the Move To Player Check Return plays too fast compared to the other loops where it plays normally and functions normally
So I think my AI Move To is failing on the first loop, after setting up a print to the failed node I can see it printing only on the first loop anyone know what could cause this?
What is it you're trying to do? that looks like a very weird sequence
The reason youre node is succeeding is because its going to targetlocation, but you're already at target location
I assume you meant to go back to guard location?
but either way, you should refactor that.. so that its just a lower priority to return to guard post and then allow higher priority if there's a threat or a patrol to do that takes over the priority.. that way you'll always go back to guard post if nothing more important happens
so use a selector instead of a sequence
How would I re-create the "Wait" task that's given to you in the Behavior tree?
Use Task Wait Delay node in your task
Hmmm
I'm trying to figure out how I can prevent a custom task from moving on until it's done
I will send an example in a sec
Cool, thanks
Is there a way I can do it when I don't know how long it will take?
Like the Move To task?
where it moves on once the AI reaches its destination
You can finish task whenever you want by using finish execute node
You can do something like this for example:
you're welcome ๐
I'm having another issue
with 2 Move To tasks in a sequence
and it does one but not the other
Can you send a screenshot?
sure
So I get the two locations in services
then move to the first one
then the second one
and it should just repeat that
You're using selector, you need to use sequence instead
haha no problem!
Anyone know why my AI Move To keeps failing when my patrol points are too far apart?
Using the visual logger will help you to debug that.
How do you get pawns to block navigation for other pawns but not themselveS?
I have setup dynamic navmesh generation etc. but having the pawns affect the navmesh underneath themselves leads to them twitching as they can't figure out the start point
Is there something to make them stick to a path for longer before abandoning it?
You really don't want to change the navigation under them. There is a crowd following system for obstacle avoidance.
Thanks, yeah i've abandoned that line of thought.
The crowd following system is a bit awkward for my use case I think. I dont want enemy soldiers stepping out of the way of eachother like they are working together
https://www.youtube.com/watch?v=zIDqJ9qDm9w&ab_channel=ReidsChannel
hello i tried to follow this tutorial and everything works, i wanted to add a behavior where npc will roam randomly
so i added this script but it doesn't seem to work. is there a better way for it?
Support the channel through donations. Crypto accepted!
PayPal: https://paypal.me/reidschannel?locale.x=en_US
Patreon: https://www.patreon.com/reidschannel
Bitcoin: 1JFwWHr4X6uAeoZadukzqKjzFBj3Qjy7Sk
Ethereum: 0x2B2Bc108F1Cc0fF899959dEF3226637787d8C3dE
Dogecoin: DNQ33YnhpWoTBokBNVkZP5ub8KTLkpyjpv
Join our community discord!
Discord: https://dis...
I'm now using crowd avoidance which is working great, I realised it respects some of the RVO avoidance settings like mask group which makes it great for my needs!
But now I have an issue where setting the group to avoid at runtime is ignored, I assume it gets registered or something. Anyone know how to change it?
Using all 3 nodes to triple check even though I should be alright with the ignore node:
How do you trigger the Random Roam event?
i tried it directly to event tick and next to wait event but both didn't work
the way you have it implemented calls for only a single call, and once done it will loop indefinitely. If you call it repeatedly you'll interfere with previous calls resulting in AI not moving at all.
i see, do you happen to know how it should be implemented or a tutorial explaining some parts?
sadly i just started on trying out how behavior tree works but i still don't get how some of it works.
how do i create behivor tree class in c++
I do, but it's been described so many times that I suggest you looked it up. In short I'd suggest using BTs and combining EQS task with a MoveTo task. Alternatively you can implement your own BT task that would contain the BP code you've posted.
UPROPERTY(EditDefaultsOnly)
TSubclassOf<UBehaviorTree> BehaviorTree;
in .h
and
UAIBlueprintHelperLibrary::SpawnAIFromClass(GetWorld(),SpawnClass.Get(), BehaviorTree ,Location,Rotation,false,nullptr);
in .cpp
BehaviorTree tree gives error
what is the problem
then you say you get an error it's always a good idea to paste the specific error you get from the compiler. But in this specific case it's easy to guess. Check UAIBlueprintHelperLibrary::SpawnAIFromClass's signature and it will become obvious. But I also believe that' pretty much what the compiler tells you.
in short: TSubclassOf<UBehaviorTree> is not the same as UBehaviorTree*
oh thank
it worked
I wasted my hours
does focus only work in a BT task ?
Yeah it did, was the nav invoker radius
always, and I can't stress it enough, ALWAYS read the compiler errors, most of the time it's a silly mistake you can address on your own. It's programmer's fault 99.999% of the time ๐
I know BTs in and out but for the life of me I don't know what you mean ๐
i couldnt get this to work in a statetree task
but judging from your answer i didnt try hard enough
and from my very limited experience the only other time i used it, was in a BT
bad question i kno i kno
yeah, this functionality is BT-independent. You need to make sure the flags in your pawn or movement component are set. Look for bUseControllerRotationYaw
oh ok
i hadnt thought of that
@crystal hatch while i have you here i need to ask, how can i enter a statetree state and not exit until i want it to exit?
Sorry, don't know, not my cup of tea (yet). You'll have to wait for @lyric flint to drop by.
gotcha ๐
I want to spawn ai
Behavior tree not working when spawn as actor
how can i make it work
@crystal hatch Why is SmartObjectSubsystem only creted on authority ? (not clients) ?
Pretty much the same reason AIControllers only exist on servers. If we had one on clients we'd need to keep them in sync complicating the whole communication. We'll make it work for Players, don't worry.
okay thanks, was mostly wondering about Players and predicting interactions ;
Set Auto Posses AI to Placed In World Or Spawned in your character
thankk๐ฟ
hey there, can someone tell me how can i change the rotation here?, i tried to put a custom query of both type, points and actor, But the result is save for every type of actor/vector value . For the default one (EvnQueryContext_Querier) its taking the forward vector of the pawn. but i want to generate behind the pawn i.e. forward vector * -1. Any idea how can i do this?
is there a blackboard present per AI spawned
or would 10 AI use "Spawned" in Blackboards
You can create your own Environment Query Context and provide values for yourself..
See those dropdowns? those relate to query context objects.. so make your own
Hey, i would like to check if enemy is facing the player or is atleast almost facing the player.. I think i need to get enemy's forward vector and characters location and use DOT-product..Buuut I'm having problem implementing this to work on blueprint, could someone guide me how would u do this kind of functionality
I tried to make my own, but they are not working don't know why.
Yes, you want the dot product.. you should get the vector between your player and the enemy.. (enemy position - player position).normalized and your forward vector, then do a dot product on that to get the angle
You might want to make it only work on the horizontal plane...
There's actually a blueprint node that has this functionality if I recall?
Creating new FStateTreeConditionCommonBases was more wonky than I imagined
I dont want to think about the boilerplate written behind the scenes to make it work
That's a shame. It looked pretty straightforward to create a new task at least. I only glanced at it.
there must be some very hell of a reflection system magic happening
to optimize it to moon
for example you manually put
UPROPERTY(EditAnywhere, Category = Parameter)
bool bInvert = false;
to everywhere
base class doesnt have it
and you must have this constructor
explicit FStateTreeCondition_AngleFromLocation(const EStateTreeCompare InInverts)
: bInvert(InInverts == EStateTreeCompare::Invert)
{
}
and declare another struct to put your data
etc etc
Sounds like another use case for BP ๐คฃ
this one probably cant be done in BP
this is to expose things to data binding system
Oh - I thought you were just doing custom enter conditions
I'm creating that Compare X thingies
yeah
finally managed to make it appear
i guess that "bind" dropdown menus dont appear magically in BP
if it is, fml
gonna write a yaml to FStateTreeConditionCommonBase ๐
So uhhh - look at what the BPBase does and copy that ๐
it doesnt seem to do anything, but my R# doesnt work at StateTreeModule
I think there is a setting you have to flip for it to work on the engine module/plugin stuff. Rider doesn't index that stuff for me either.
oh yeah i didnt enable that on r#
thanks
oh...
things just make sense
i was wondering why StateTree has a linker
to handle that BP data binding
and custom c++ boilerplate stuff i mentioned
so its not possible to copy what BP base class is doing
because BP classes are handled internally
and probably it boils down into state tree compilation process
oof
here comes yaml parser then
remind me does a BT which is ran in Run Behavior task has to have the same blackboard asset as the invoking BT?
Hmm, what class does that Bind expose? that a delegate?
I need to have a bind-able entry in a list of matches for an NLP system
wondering how to make the UI bindable... basically a list of token strings and types with a matcher method and some method to build if a match is made
guess I'll give statetree a look
no you can't
ok another question. is it possible to set FBlackboardKeySelector anywhere outside of BTs? For example in some data asset?
you mean this? i dont understand yet but its somehow handled at StateTreeLinker
anim graphs also has the same functionality but you can also bind function calls if signature matches
Yes. You do need to be able to initialize from the correct blackboard asset. Your class also needs to use IBlackboardAssetProvider and you need to implement the function to get the blackboard to show the drop-down for the keys.
thanks
in ue4, is there a way to have nested dynamic behavior subtrees? for example, the parent BT has a Set Behavior Dynamic node where you add a behavior tree which also has a SetBehavior Dynamic node with a different tag?
I tried setting a behavior corresponding to the tag within and it fails
it doesnt look beyond the existing nodes on the parent BT for that tag as far as I can tell
there is, but it's weird. the thing is when you call SetDynamicBehavior, the UBehaviorTreeComponent (or something inside of it) searches for BTTask_RunBehaviorDynamic only in loaded trees in tree stack. So what I ended up with is create my custom Run behavior dynamic derivative that re-injects dynamic behaviors after starting the next dynamic subtree. To optimize it a little bit I also created my own UBehaviorTreeComponent that allows to set dynamic behavior for trees starting from some index in tree stack
ohh.. I will have to look into overriding some of these then ๐ At first, I thought it is a matter of delay or something coz I was trying to set the internal BT as soon as I added the external one.. so I tried adding with 5 secs just to test.. but no.. it wasnt that ๐
thanks for this.. I will give this a shot!
A logic should run when BT branch is entered and left. What is better choice? Service or Decorator?
any, but doing it with a service is easier (although makes more sence making it with a decorator). just override OnBecomeRelevant and OnCeaseRelevant and set bNotifyBecome/CeaseRelevant to true in node's constructor
Good, thanks. I was wondering is there is any standard for it but there is probably none.
Question for StateTree - if mieszko or mikko ever see this:
Are there any plans for integrating binding "getter functions" to data bindings on ST? like how anim graph does it
UE::StateTree::PropertyBinding and UStateTree::Link() btw
FStateTreePropertyBindingCompiler
oh no.. you also have to write that linker stuff for tasks too 
but good news is you have something like TStateTreeExternalDataHandle
InstanceData.AbilityEndDelegateHandle = ASC->OnAbilityEnded.AddWeakLambda(Actor, [this, Actor, &Context] // @todo this is extremely dangerous....
{
InstanceDataType& InstanceData = Context.GetInstanceData<InstanceDataType>(*this);
InstanceData.bAbilityIsRunning = false;
UAbilitySystemComponent* ASC = GetAbilitySystemComponent(Actor);
if (ensure(IsValid(ASC)))
{
ASC->OnAbilityEnded.Remove(InstanceData.AbilityEndDelegateHandle);
}
});
I made something like this in EnterState to hack the const correctness in statetree 
cant wait to deal with ambigious bugs this will produce because of &Context
i guess at some extent instance data type also gets to manage things like this to avoid const limit on core functions
hey there, any idea how can i rotate the arc direction of the EQS, i tried which multiple vector values for the direction context by making custom querycontext , but none of them are working. I want to generate the donut in semi circle behind the AI, like in the image its generating in the front, but i want it at the back.
@harsh storm just fyi - i was looking at source code.. which seems to be not updated properly for 5.1
we dont need that boilerplate I've shown
its easy as creating two structs and declaring data properties on one and override relevant functions on another to create tasks or conditions
hehe, he also spent at least a few hours ๐
there was a small phase he was asking "wtf" questions about ST at #cpp and twitter
Are you actually trying to use STs for your zombies?
Alright - cool. I like BTs, A LOT - but screw it. We're making zombie games together, but separately. I'll switch to using it just 'cause ๐
Are you doing #multiplayer? @celest python
yes
๐คฉ

Though - I think where we differ is, you're doing #gameplay-ability-system if I recall, where as, I'm not.
yeah, though i use gas in a weird way.. mostly to benefit from it's replication features lazily
the way how UE evolved in a year caused me a lot of trouble.. i went through ~7 heavy refactorings because of my learning progress and new features
like for now state tree literally makes #gameplay-ability-system redundant for me
how come the left task isn't executing?
I've set the decorator to abort lower priority and the decorator is passing. I'm watching the breakpoints on the task and it isn't even trying to execute so it's not like it's just instantly failing
@celest python Can you link me what you read for your ticketing system? It sounds kind of interesting for knowledge bank. Might use it for my game as well, though I also might not even need it.
I think the PatrolTarget condition is what needs to abort in order for execution to pull back
Hence the "abort" -- it only aborts what is relevant and running, it doesn't monitor all conditions on idle branches; just pulls back when a relevant decorator is no longer valid
I could be wrong though
Hm, maybe you're right
the left decorator is set to abort self and abort lower priority and it even highlights the right node as a lower priority abort target
Yeah, that makes sense, sorry
Then I have no clue
What composite are they connected to?
Actually, I guess that doesn't matter if you've monitored it
Are there more nodes to the left with lower priority abort decorators?
yes but they aren't firing
I found this, not sure if it's relevant to you
If there are multiple nodes that are all set to abort โLower Priorityโ (or โBothโ), they will all have to be satisfied before the lower priority tree will be aborted. That way, you wonโt have to worry about separate value changes repeatedly aborting your lower priority tasks when the higher priority task canโt actually execute.
it's not. that just means if I had three decorators it wouldn't abort the lower priority task until all three pass
anyone figured out how to stick to a statetree state yet?
The word "node" rather than "decorator" in that sentence made it unclear to me, but that makes sense
Well, I doubt I can help you; hope you figure it out
my debugger appears to be lying
task_followspline is being executed but it's not being executed
end me. it was being pissy because I was using a timer in my task
switching that logic to a one second tick on the task itself fixed the problem
probably some horrible async deamon leaking up the abstraction layers
I have a question about a problem with nav modifiers I haven't noticed before (I'm impressed that I didn't tbh).
Turns out that, if you have a mesh, let say a box, and you add a nav modifier component to it, the collision calculated for it is by doing some short of parent-wrapping-collision. The problem is that, when rotating the box, this happens (image).
Is there a way to make the nav modifier tight to the box so it only cuts from the nav the section intersecting the nav-mesh and the collision?
Maybe something we can override in the engine?
We happen to have lots of assets that are re-used all over the place and this is becoming tedious to fix by level designers.
Tagging @crystal hatch since he probably knows the most about this.
NavModifierComponent is using parent actor's bounding box (I'm simplifying a bit). If you marked your StaticMeshes as nav obstacles it should do what you expect.
Hey! Thanks for taking the time to answer.
Do you mean like this?
our designers where looking for something more like this
you can use "null" area to mimic the component approach.
Yeah, I figured as much. Can you mess around with collision settings, like using ComplexAsSimple and such?
What your designers want is impossible. Think about AI agents wanting to go underneath the thing.
Can you mess around with collision settings, like using ComplexAsSimple and such?
We can definitely try and see what happens.
What your designers want is impossible. Think about AI agents wanting to go underneath the thing.
This is a good point. I was already wondering myself how to solve it and, well... it's solved the way the system works already
Thanks a lot. This gives me enough to give them a reasonable "no can do".
Cheers
I guess I could do some dark magic to calculate the position, rotation and size of a nav modifier volume to get something like this
that's definitely the way to go if you need something like this, but you mentioned thousands of assets/instances, so I strongly suggest figuring out an automated process for this ๐
yeah, not all cases are problematic but... enough to put time in it.
We get cases like this too
which are currently solved by hand
Note that AI will have issues navigating around that static mesh
oh yeah, that's another story...
Can't wait for ML to solve this shit for me XD
thanks again. Much appreciated.
If you want to kill an ai (i.e. shoot the pawn), is it best practice to cast to the pawn and do something at that level or then get it's controller and do something at that level?
Or do you go a further level and do something to the blackboard specifically?
I was just thinking something like play animation, spawn object dead at the location, destroy original actor might be less taxing, but could have issues?
So maybe going into I am dead on the blackboard and make a dead state where it plays I am dead then stays on the ground post animation..... It's been a long minute since I did anything with AI and I'm helping a friend on his jam project.
if it's for a jam I'd say:
- Stop AI logic (via the controller)
- unposses the pawn
- play "die" animation on the pawn.
I figured something like that. I'm pretty rusty, but those seem like the right keywords lol.
Is there a better 'best practice' you would use for longer projects? I'd love to know if there's a bog standard way of doing things.
You mean the token system?
Its just the DOOM and Spider-Man GDCs
Also mentioned in Division 2: https://www.massive.se/blog/inside-massive/gamedev/myths-in-video-game-ai/
Schweet. Thanks. Also - make sure you ping me when replying ๐ .
Alright ๐
the details depend on specifics of the project. The overall structure is like I said, the details regard what to do with the pawn and/or its skel mesh (if it needs to stay on the ground, for how long, if you want to pool pawns, etc).
When using navigation invokers, are there any commonly accepted solutions for being able to provide them a target location on the other side of a very large landscape and allowing them to eventually navigate there?
I have some pretty severe limitations with a pre-baked navmesh and I'd love to use invokers but my AI needs to be able to travel long distances between points, I thought about making road splines they can follow in between pathfinding I was just curious if there was some already accepted solution to this type of problem
What are the limitations that navigation streaming doesn't solve for? Invokers are incredibly expensive (far more than dynamic regen) and cause issues like you are seeing.
Typically I don't have them navigate when the player(s) aren't around and simulate instead. That usually includes a grid or spline based simple navigation.
Navigating across a large landscape, from one side to the other. Assigning an AI character a target location on the other side of the landscape even with a fully generated navmesh often results in them making lots of wrong turns, backtracking, and eventually getting stuck in a place that doesn't connect
I have a design goal of simulating small groups of traders walking from one side of the map to the other, which I could probably fake with some effort but I also need to be able to allow a player to follow them if they choose to
Which doesn't really work if the whole trade caravan navigates into a ravine and gets stuck trying to walk up a cliff
I'm not against using splines for roads that AI could follow for longer distance journeys like that but I wanted to do my due diligence researching that type of solution before I start implementing it
As it is, my goals of a large terrain have been reduced down to 2x2km because of limitations in navmesh complexity
I don't know, I'm new to Unreal so I don't really know what my expectations should be
I'm sure there's probably things I can do to improve the way I'm using the navmesh I'm just not sure what those are
I'm not currently using invokers at all
I was looking at Kythera AI to maybe try to solve thee problems but I'd hate to buy it and discover it doesn't solve these problems, lol
its.. damn expensive probably
I'd say ensure hiring somebody/somebodies for your specific goal wont be cheaper than Kythera AI if you are going to buy it
Yeah I've asked for some pricing information from them but haven't heard back yet
Hiring people is never really cheaper, if its a contract you might spend less initially but any problems will have you paying them again
It could give you a better solution, perhaps
At least better tailored to your specific application
How much ai do you have in your game? is it multiplayer or just singleplayer
It's singleplayer but every character in the world is AI
oh interesting. How many characters are there?
It's not densely populated, but eventually there will probably be something like a couple of hundred
Probably on the high end
Most of them aren't wandering the earth, they'll be hanging around towns, gathering resources, and fighting
ok. what do you mean by limitations though? is it computing limitations and low frame rate or something or you mean the degrees of freedom of the ai?
The prototype will probably only be a couple of dozen unless I can get the world size larger without breaking everything
Well, the navmesh doesn't even like to generate with good precision on anything larger than a few square KM
And when it does, if I actually set an AI controller to navigate from one side to the other, the pathfinding gets severely confused
I'm a unity dev so maybe it's just me but I thought that you can directly control precision. I have an idea though ...
You can change the tile sizes and cell sizes of the navmesh, but it's a trade off
You can make larger cells at the expense of precision
But then you have AI that can't get closer than like two meters to an obstacle because the navmesh isn't precise enough
Why don't you just create an invisible lower poly mesh that has the same topology as the mesh you are trying to create the navmesh for and use that instead?
Like you can take your terrain or something and make it a quarter of the verticies or something
I mean my terrain is already effectively 2 meter resolution just to try and stretch everything enough
oh yh it may not work then. Do you have a picture of the terrain or something?
I mean, it's pretty basic
Like I said it's just prototype stuff, imagine a 2km x 2km square landscape
With some hills and valleys
ok
village A on one side, village B on the other, if you have AI at village A, and tell them to Move To a location at Village B, they walk in the general direction for a while, until they find an obstacle, then they might turn around when they realize they've followed a bad path, or they might just stop
Or they might walk back and forth until the AI just gives up
Is this the default unreal engine navmesh/ai system you are using?
yeah
wow that sucks. I don't think issues like that happen in unity.
can you adjust your geometry to make it easier for them?
or is that too much
I mean, maybe but the landscape is already more open than I want it to be
no i mean you can make a set of specific paths
I would be fine with defining ideal paths between major points of interest if necessary
or you can code out your own ai system
But they need to be convoluted
It's never just a straight line
I mean, yeah I'm not really talented enough to be writing my own AI solution
for example you have groups of empty transforms pointing in the paths you want your ai to take
and your ai can pick them at random and add some noise to it's path
I could possibly fudge something like that
Hopefully Kythera's licensing isn't insane
I would love to find a more robust solution that would allow for a larger world size, anyway
The long journey is a lot less intimidating if it's only 2 km
Yeah, this will be commercial though, heh
but they take royalties for commercial
I asked them for a trial, anyway
that's insane imo
I mean you're paying Unreal royalties, too
royalty seems like a lot for just an ai engine
I prefer being able to make a game rather than not
I mean I could make a little arena shooter without buying middleware but it wouldn't be very interesting
If they can provide a solution that enables me to make the game I have in my head, it might be worth paying them a few percent
We'll see what they ask for
I'd prefer if it was all just open source
But, shit in one hand, and prefer in the other, and see which one fills up faster, as they say
I mean, I'm capable of coding, I'm just using blueprints for now until I have a better understanding of the engine
I'm a full stack python web developer at my day job, so I'm fine with writing code if I need to
C++ isn't my favorite but I can muddle through
oh ok i understand. yh I was just asking because I think the AI you are trying to make doesn't seem that difficult to develop yourself as opposed to some of the other game AI applications I've been researching.
No, it's probably not
I mean I could probably come up with a solution just in blueprints with some work
I was hoping there was best practices, or common solutions, for these sorts of problems
You'd think with all the hype about the huge terrains you can make in Unreal that the AI would be capable of using them
It's unfortunate
yh
How much of a performance hit is there with your AI enabled if any?
I mean its too early on to know
And I can obviously disable characters if they're far enough from the player, but if the navigation system isn't even capable of generating a usable path across the map, that is kind of a deal breaker
I don't know I think I probably just need to fiddle with navmesh settings, this seems like too serious a limitation to be intended behavior and not just my own bad implementation
yh another problem though is that it isn't reliable. even if it were to work there are chances your ai can get stuck once in a while
ok
But if none of the AI are capable of not getting stuck it's an issue
I'm sure I could run splines across the map between towns, tag the nodes appropriately, and have AI just find the nearest spline to their destination and follow it
If I put roads in the landscape along those paths, it works out okay, but, I would prefer more flexibility
makes sense. ai is probably a big part of your game
Yeah
If it comes down to it I can reduce the scope a lot by just making the AI not travel across the map, leaving the player characters as the only agents capable of doing it, but, that does detract from the experience I'm going for
trade caravans, roving bandit gangs, migrating monsters
Looks like Mercuna could be another option, they have an indie license for $2k
2k a year?
It looks like a flat $2k
For development budgets under $500k, we offer licences with limited support for ยฃ4,000 for Mercuna AI Navigation, or ยฃ2,000 for either 3D or Ground Navigation.
Since I'm just looking for ground navigation
Is it possible to get the navigation's mesh "width" from a given nav point?
I know that the navmesh can seek different paths by radius, so I guess that it has some way to query the width of a path.
My use case would be the following: I do pathfinding per battalion, and there is a small number (5-15) of units per battalion, which move in formation. The problem is that the formation positions are unaware of their surroundings, causing units to try to walk through walls if the position overlaps, let's say, a wall or corridor. So being able to tweak the formation per PathPoint would be great.
Might be better to make each unit do its own pathfinding while attempting to stay at a given offset from the leader
It would look a lot more natural too
I think waypoint solution can work as well and you just make sure all the waypoints are a distance aways from wall.
Can you manually edit the navmesh or no?
You could certainly do some line traces or sphere traces from the path point to make sure there's room on each side at any given point
I'm not sure the navigation system exposes enough of its guts to be able to determine any sort of "width" of a selected path
Well, you could get to it, deep in the bowels of C++
But it's probably non-trivial
It is a simulation for many agents, so individual pathfinding is going to be very costly probably
Yeah, that's not a problem, the game is quite complicated and I expected to dive deep into the nav system
This guy dug pretty deep into it, https://maladius.com/posts/manual_detour_navmeshes_1/
I don't think you can use his little code snippets but this might give you some hints
Honestly use creative traces and working from that sounds like a more time efficient solution, but I'm not an expert, haha
Oh great, thank you! I've researched quite a lot but didn't find this
Yeah I stumbled over it earlier today, it's not really a solution to anything but it does give some pretty good insight into how it's all put together
I can query nav points which is very close to what I need, but knowing the exact width would be perfect
bcs then I can adapt the formation in advance, instead of querying frequently the outer formation spots to see if there is navmesh there or not
Yeah
although I'm thinking that I can do it somewhat
Wonder if it's as simple as just exposing a variable
yeah, I'll tell you if I find out :D
๐
I got the evaluation version of Mercuna, but their evaluation plugin package doesn't have Linux binaries
smh
Welp, Mercuna gets better results than stock unreal navigation but it still can't find a path beyond a certain length
Like... Less than a kilometer
Not really worth paying a couple thousand dollars for if I still have to hack together my own pathfinding solution
what do they mean by kilometer? can't you just scale up/down your meshes to deal with that problem. or adjust their own unit system?
No
They don't say anything about the limitation but I was just testing it on my prototype map and it works great but only up to a certain distance, if you try to find a path beyond a certain length it just doesn't
My characters are already at 0.5 scale in my effort to get around the limitations of unreal nav mesh
I guess I wait for Kythera to send me an evaluation package to see if they do any better
Well now...
I'm confused. Couldn't you just reduce the nav precision to be compatible with your distances?
don't exactly need a nav mesh precise to the foot when your dealing with a km of distance
The AI still needs to be capable of walking through doorways
Yeah
how about two navmeshes?
Perhaps
That actually might work but I'm not really sure how to switch a character back and forth between them at will
c++ fun
Merkuna might be capable of that, actually
ultimately it's just querying a path from the correct nav mesh then following it
the tricky part is figuring out which function you need to override to change that
lol, yeah
the navigation system has alot of abstraction so actually finding shit sucks
The other parts are tricky too, I'm like, two months into Unreal at this point
The documentation, what little there is, is not good
has anyone tried to implement target dependent modifiers for the ai sight sense?
As an alternative solution to my pathfinding problem I'm thinking of something like, each of my villages has a zone already, what if I add spline components to each one and hand build a spline that describes the road route from each town zone to each other town zone, when an AI is in a town and wants to go to another one, they can find the spline component they need, find the node nearest to their location, then just MoveToLocation each node in the spline...
I guess I could use actual road splines too, two birds with one stone
yep thats pretty easy
It only addresses the need for AI in towns, though, doesn't help any that are outside of towns but that might be alright
the ones outside towns should navigate to the nearest road if they want to go to a town
heres a simple spline following task
That looks great but it's compressed too much to read, haha
I was thinking one-way splines but yeah I guess I could give each spline component a "beginning" and "end" town zone, so the AI can decide whether to ascend or descend the index keys
in your case you would want to use "move directly to" instead of moveto
Well, no I think it will work, the nodes in the splines will be close enough that the normal AI pathfinding should work fine
true but the spline in your case already guarantees a successful path
so might as well save some cpu juice
Yeah... I still want them to be able to be interruptable but still be capable of returning to the same route
kick them off the spline when they are interrupted
I will probably need to build this in a behavior tree
well yeah
thats a behavior tree task up there
if (splinevalid) do -> task_followspline
as something lower priority then combat
@celest python Question with ST. How do you get it to mingle with perception? To me, it seems like ST is designed to be on the actor itself, instead of controller. And the perception is ideally on AIController.
i never worked with default perception system before, but i'd go with the way of having perception related things on tasks actually...
because it lets me enable/disable perception utils per task
๐ค
but its not feasible to refactor
so other way around would be having an evaluator update the perception and evaluator can update schema parameters
The perception stuff is a component that goes on controller or actor. So how would you get it working on a task?
Traditionally - the perception stuff would just update the variables in the BB
without knowing the internals of the perception api: making perception component a parameter in schema is actually a good idea.. you can take perception comp as "in" parameter from tasks and evaluate there. though you would probably replace BB with a custom data object
maybe something like UPerceptionMemory
this is also lets you run multiple perception comps btw.. some advanced AIs require multiple ones based on the design -- out of context
It's wild to me that you've spent a year on AI and haven't even touched the perception stuff ๐
It's like...one of the coolest parts of the AI toolset imo.
my game is an arcade twin stick shooter
every AI is on the screen
though I wrote a custom perception system.. a lightweight one for a client
i was trying to mock what Alien Isolation did exactly
and how perception interops with BB wasnt my taste (for that specific AI), I wanted a custom structure between systems
@celest python Figured out another way. Using gameplay events. When the perception is updated, can send the state tree a gameplay event with certain gameplay tags. Perception.TargetAcquired or w/e. And then use that as transition conditions.
I didn't really understand how it would work by making the perception component as an in param to the schema. 'Nor could I actually figure out how to pass it in BP land.
Well - that at least lets me trigger the state change. Not sure how to actually do anything with the payload data though ๐ค
Just need to figure out a way to pass the actor that triggered the perception event. I could put it as a bound variable in the context actor, but I'd prefer not.
nice. I was more of thinking an idea like embedding perception into states rather than using it as a top-down system, thats why I came up with an extraordinary idea
My smol brain can't wrap my head around that idea. Because it is a component that lives on an actor. Then when one of the senses gets triggered, it broadcasts a delegate, which of course you can subscribe to. So, trying to get that into the task itself - not really sure how.
Can't seem to pass the component reference through the schema either.
I just...need to figure out a way to pass that actor that triggered the perception delegate. I don't like my first idea of binding to an actor variable on the context actor.
@crystal hatch I know you said to tag you on the PR itself, but it didn't seem to be working ๐
https://github.com/EpicGames/UnrealEngine/pull/9910
And of course - now it did. Shame.
Sorry for the double pings ๐
I have a situation when I need to run some sequence under a selector indefinitely while blackboard condition is sattisfied. Which is better in terms of performance: create a simple parallel and put "finish with result in progress" as the main task and run my sequence in background or create a sequence with a loop decorator? The latter would require me to have 2 sequences: one with the blackboard condition and the other with the loop decorator and it looks a bit uglier compared to the first approach
KISS
maybe lets start with a coffee?
just like Keep It Simple Stupid method coffee is also proven to increase the productivity 
Keep It Simple Stupid.
Does your game need optimizing right now?
does KISS imply that I shouldn't ever bother about performance on early stages of development? I was just wondering which way is better if any of them is
Do what is simple and works
And definitely don't pre optimize
It's a massive waste of time
BTs execution flow is extremely optimized for you anyway
you only get to care about context of your BT nodes
I still need to figure out how to have the State Tree actually do something with the payload you send through an event.
Hey guys, there is there a way to make specific actors block specific AI navigation path?
so AI 1 can move through Actor 1, but AI 2 will have to pathfind around it
Hello guys, do you know why my navmesh disappeared from stairs randomly and I didn't touch nothing !?
what is the stuff called for whatever makes AI avoid other AI ?
@crystal hatch @lyric flint
I wrote down also a short feedback on ST. You probably know about all of these points but I wanted to write it down anyway in case it is at least a little bit helpful. I hope you don't mind.
- Live view of ST execution when debugging. This is not really missing unless something goes wrong and you need to understand what is going wrong.
- Being able to understand ST just by looking at its tree. (?) conditions are a mystery unless you select every single state, expand menus and understand the task and the condition. BTs are very good in this because the flow is defined by the BT architecture, so there is no need to understand transitions. Additionally, BTs display all the info like node names, descriptions, keys, values on the nodes, so you most of the time can understand whole behavior just by looking at the graph. Maybe ST could have some expanded view which is less condensed and displays more details.
- If I understand correctly there is no out of box solution for having event-based execution just like BTs had observer stuff, so transitions checking variables need to execute in some interval. For some stuff it is of course possible to use events.
- It still suffers from exponential growth. If you have a multiple states at the same level, you need to define transitions for all of them and maybe add a transition to the new state from every other state. This is probably too crazy of an idea but I wonder if it would make sense for ST to support BT like Abort behavior for entry conditions of states. So when some entry condition succeeds, it can abort lower priority states. I believe that would help with the exponential growth.
- Setting EQS context is a bit more difficult from ST as there is no single place from where both thing could get data easily. In BTs you usually use Context which gives you something from the blackboard. But this is more shortcoming of EQS than ST.
- It can be unclear which task supports Succeed/Fail and which tasks are running indefinitely. You need to understand it in order to build and understand ST properly.
- BlueprintBase of BT uses events. BlueprintBase of ST uses functions. Because of that it is complicated to use latent nodes or event-graph only stuff. I created my own blueprint base derived from the default one but the task picker is not displaying it. I assume there is a hardcoded list of parent classes in the ST module's details customization.
- When having a bindings access to multiple instances of the same task, it is unclear from which task the binding is. I would like to have just multiple instances of the task named MoveTo but I can't because otherwise I am not able to understand which is which as both show up in bindings just as MoveTo.VariableName. Maybe it would be better as StateName.MoveTo.VariableName?
---------
On the other side, it feels like it is really well done. The property binding is great, it feels robust and the API is nice. Perfect base for the future development. For now I will probably use BT for the core of my AI and ST maybe for smaller subparts or other stuff which requires general state machine. Missing debugger is probably most critical point together with the readability. I learned it after I got back to it after 2 weeks pause :D
This is the BT I converted and tested it with
Do you know how to make my AI go around obstacles?
Your questions are not specific enough for anyone to be able to answer them.
Okay sorry I was waiting for someone to have interest and then explain better.. Anyway, I need my AI to chase me and it does.. now I need him to avoid obstacles and go around them in case there's one since when I go down the stairs faster than him he just stands there menancingly and watches me
Is it a non moving actor? Then use nav areas and filters.
AIs can't go places the navigation isn't built at.
He can.. he's just not supposed to go in a straight line but to find a path to reach me
Is there a path? Do you have "partial path" set to true in the move to node?
he gets stuck like a chicken
The visual logger will help to determine if it's a pathing problem or a character movement problem.
The visual logger spams "can see" " cannot see" continuosly
Turn off all categories that aren't navigation related.
so he just get stuck because he doesn't circumnavigates obstacles
it didn't used to before
Navigation is how it navigates around obstacles. There are a number of reasons why it wouldn't be working as you expect, so you first need to figure out exactly what it's doing. The best way to do that is to use the visual logger.
is a nav obstacle modifier not really an obstacle?
You mean the apostrophe?
Meaning, if the target is there, it can go to it
No that's the gameplay debugger. The visual logger is a different tool: https://docs.unrealengine.com/4.27/en-US/TestingAndOptimization/VisualLogger/
now ? lol
A nav modifier is used to modify the nav mesh, usually by setting the area class. If an AI can navigate through it depends on the area class. If I remember correctly, obstacle area class means they will avoid it, but will navigate into it if they need to.
If you uncheck the categories that don't say navigation, you can walk through the timeline to see how it navigates. It will also draw the paths in the viewport.
ok so I leave only AI Nav or Nav ?
i guess AI Navigation
For navigation, I keep both of them on. I always forget which one does what.
i am using a filter and modifier to make an ai avoid a specific area class that my modifiers use
but, this will still go to it if no other option exists
If you don't want it to go into that nav area, you can set the filter to exclude it.
oh I see!
Ok
The visual logger says that the killer was in chase
and could see me
as the gameplay debugger said already
which problem did I fix with this thing? That the killer doesn't go around obstacles during chase as I already knew ?
Like I said earlier, you need to look at what the navigation is doing.
Looks like the pillar isn't affecting navigation.
Are you setting the filter on the AI controller or the MoveTo?
what should i do ?
If you look at the actor in the scene, does that have Can Ever Affect Navigation set to true? What are the collision settings?
You mean the stairs? It's a blueprint and its core element is set to true yes
I mean the pillar.
Yes
Collision Block All
I tried to set Can Character Step to No
but still doesn't work
You have to debug it... look at what the log is saying, what the visual logger is saying.. it will likely tell you whats wrong
...