#gameplay-ai

1 messages · Page 86 of 1

dull arrow
#

Anyone have experience/insights into doing 100-200 replicated ACharacters, any low hanging fruit optims that one could share?
Zombie horde, not worried about anims too much atm (simple characters, anim sharing), but for pathfinding / crowd movement etc I'm still looking for good solutions

silent hamlet
#

I'm attempting to implement a similar system and this is very interesting. Im not sure i understand why you cant use the actual ai actor/pawn itself but you use a proxy...? Also, I see you mention nav trace to ensure location is valid for the offset actors/followers but...do you check this on tick during the whole path for every actor? Else how do you ensure that followers stay on nav mesh and avoid obstacles?

Thanks for sharing this and the talk anyway!

slow bobcat
slow bobcat
chilly nebula
#

<@&213101288538374145> ?

silent hamlet
#

Also you mentioned that your designers can drop stuff in the world to influence the way the agents are arranged? 🙃

slow bobcat
slow bobcat
silent hamlet
# slow bobcat Because then you would use "move to location" and that part of the engine doesn'...

Aaaah but so each proxy actor is actually pathing. I thought you'd just use nav traces to check you are on the mesh and that's it for the followers. That explains then how the followers are avoiding obstacles. Oh so this system is quite expensive overall. It will be fine for me most likely as I have just a handful of actors in my herd. But just out of curiosity how many agents were you able to support in your game at once with this system?

#

Here!

slow bobcat
#

We used that with 30 AI's max

silent hamlet
#

Nah as said i have very small groups and it will be fine anyways I think in my case. I was just curious

#

But now I see why using the actors of course. Wonder how complex would it be to just copy the original path update logic and adapt it to this. But id guess its not worth the effort

slow bobcat
slow bobcat
# silent hamlet Here!

ah that's for another use of the same system. In our current game, designers can place vectors (FVector with meta = (MakeEditWidget = true)) in a patrolling enemy to create patrol squads. Other AI's associated to that Patrolling enemy will place their Proxy actors at the patrolling follow locations to keep formation

slow bobcat
silent hamlet
slow bobcat
silent hamlet
#

Ahah that'd be awesome! We'll see what he wants to do

gleaming star
#

anyone have a holy grail document* for state trees? made a basic one, like them but seems like you cna get super in depth

#

also, this is more generic but would it make sense to make children of the controller class? the reason im thinking of this is i'd like to make many AIs based off a master but for some they wouldn't have the same perception component details

#

and also they'd have differtn state trees

slow bobcat
#

About the controller: makes sense you need different perception etc. Usually people handle that through a data driven approach (ie Data Assets / Data Tables with all the data) and loading things upon spawning AI's

gentle hamlet
#

how do i make nav mesh bounds volume have higher precision

gleaming star
slow bobcat
gentle hamlet
#

imo they should be in the nav mesh details

silent hamlet
slow bobcat
#

Yeah that too, but if you delete the recast object for whatever reason, you need to re-set everything again

silent hamlet
#

Indeed

harsh storm
#

There was also a bug some time ago where the agents didn't respect recast objects settings

#

Or something like that

#

Or maybe it was that the recast object's settings didn't respect the project settings.

#

Something like that. I can't exactly recall.

dull arrow
# slow bobcat Definitely use mass. I would look into days gone articles for example (ai pro vo...

I've heard examples of people getting to 100+ characters without Mass (just maybe not 5k+), so I'm curious as to getting something like that working for now.
ATM I'm using 50~ super unoptimized characters doing their own pathfinding to the player and doing fine perf wise, I'd like to bump that up by getting them to share 1 path but have it get varied somehow, as well as some other tricks

silent hamlet
# dull arrow I've heard examples of people getting to 100+ characters without Mass (just mayb...

Depends on how complex the logic should be. If you're doing a vampire survivor kind of thing you probably can get away with a lot. There's a nice devlog from Dani/Megabonk guy that shows how he achieved 3000+ agents. Its unity but the idea should apply anyway. Basically, the simpler the ai the more you can spawn. Then there is updating skeletons too which might be your next problem. Just try. Spawn them, see where the bottleneck is

slow bobcat
harsh storm
#

Iris might help with new networking performance stuff in this regard. But otherwise, you'd want to use repgraph.

#

Then to just have that many characters - you'd need to do AI LODing, navmesh walking, animation optimizations, etc...

#

You can absolutely get 100+ characters (contrary to popular belief) - but doing it networked makes it more difficult.

#

Also - ask yourself, do you really need 100+ characters? Or can you fake it for the clients?

#

IE - actually have like 40, but it feels like 100+

dull arrow
#

Yeah doing all those things atm, my biggest bottleneck atm is everything doing their own pathfinding to the player and so I'm trying to simplify that to the horde leader doing the pathfinding and everyone else following the leader etc.

harsh storm
#

Depending on your game - something like Flow Fields could help as well. Of course you'd have to build all this yourself.

dull arrow
harsh storm
#

If pathfinding is your biggest bottleneck, then just focus in on that.

#

Follow the Leader approach is a fairly common optimization thing

#

Could also stagger the path finding

#

So only have like 30 AI do the pathfinding per frame

#

Or w/e bucket you decide meets your performance targets

#

Most people (if not all) won't notice if an AI updates its pathing every 5 frames for example.

dull arrow
#

yeah exactly, just looking for material on some cool tricks for making the leader pathfind and others follow that path but having it vary etc.
Saw some people mention proxy actors to get the AI to choose a different target next to the player but that sounds like they're individually doing their pathing

#

Appreciate the tips 👍

harsh storm
#

And if you are wanting to do this on a listen server setup - good luck

#

That's going to be heavy for an overwhelming majority of people

dull arrow
#

nah dedicated

#

just shooting high with 100 but will lower as needed

harsh storm
#

In the future - using UE's multimesh server stuff could also help

#

So you could have one server dedicated to all the AI stuff for example

celest python
#

Can somoene remind me the property in CMC that zeroes acceleration when a new moveto req happens?

harsh storm
celest python
gleaming star
#

if i have different AI types that do differnt things, would i ultimatley have to make a new AI controller for each of these? i see the process of trying to set everything is not that simple, and i also can't seem to set AI perception at runtime / dynamically. i see you can set the state tree and that i could manage, but i also haven't tested that so not sure if there are pitfalls. but yea not sure how to manage multple AIs under some sort of hierarchy

slow bobcat
gleaming star
silent hamlet
gleaming star
silent hamlet
#

I've done it (must say I had only like 5 different enemies in my game) and it works fine. And also it was just mainly being lazy but im sure that if its just to link trees there's a way to do it all in the base controller.

gleaming star
dawn schooner
#

Hii! Is there any built-in way to debug state trees to know the exact state that a particular instance is in? z_pepe_happy

slow bobcat
dawn schooner
elfin smelt
#

I think it is also logged in the VisLog ? 🤔

gentle hamlet
#

Does anyone have a clue as to why?

elfin smelt
#

you can check the Visual Logger to have more information

gentle hamlet
#

you mean the output log?

#

If I log it I get a "request successful"

wide robin
#

they meant this one

subtle totem
#

Guys do you know how much performance we gain if we transition from behavior trees to State trees ? Does the transition worth it ? I am having around 15 - 20 enemies alive in a fight in my game ( I am building some thing similar to risk of rain 2 )

hallow compass
#

Perf aside, state tree is just a superior framework to work with AIs

#

But yeah, depending on your system state tree will scale better than behavior treees

subtle totem
#

Thank you

harsh storm
#

Go with whichever you understand more or are more comfortable with or want to learn

#

One could argue the data flow and execution flow is more simple/straightforward in BT than in ST

slow bobcat
slow bobcat
keen crow
#

is this the place to ask about learning agents feature or is there a separate channel for that?

keen crow
#

Well, anyways. Long story short, the question is - is it ok to have multiple interactors and training environments and separate set of NN data assets for them or should I do the contrary and have just 1 of each?

Short story long:
So i'm just trying to get into that stuff and i'm going through a tutorial on https://dev.epicgames.com/community/learning/courses/GAR/unreal-engine-learning-agents-5-5/7dmy/unreal-engine-learning-to-drive-5-5#beginplay
and there's a part at begin play where you set up interactors and training environments. The tutorial has a small scope so there is only 1 interactor and training environment, but as I'm doing my stuff, intuitively I want to make several interactors and environments: like a separate entity for combat state, locomotion and orientation state, character attributes states, etc. However, I could squash them all into single interactor/TE had I wanted to, but they would be bloated.

#

But looking at BeginPlay part of the tutorial I see that besides interactors and TEs, there are several other entities we must create: Policies, Critics, PPO trainers, and creation of each of those entities takes an interactor/TE as an input. Policies and Critics also must be provided with NN data assets ||so I guess they would contain the weights of the "model"||. So I guess if I go with approach to having multiple interactors and TEs, I must also have multiple policies, critics and PPO trainers for each interactor/TE pair, and I could either

  • reuse a single set of NN data assets, but I'm afraid in this case learning result can end up inconsistent because all of those entities (interactor and so on) would just interfere with each other.
  • have a separate set of NN DAs, but in this case I'm afraid the learning could end up too loose and independent, whereas in reality the concepts and logic behind all those separated interactors and TEs actually connected, like I would want the AI to move differently depending on its state of health, equipped items, various traits of other surrounding NPCs, etc, but observations for all of these are made in separate interactors, for example.

Sooo, what would be the best approach here?

gentle hamlet
#

it says destination not valid, what should I do?

slow bobcat
#

Debug your logic to know why

gentle hamlet
#

It's an actor within the world

slow bobcat
#

Your actor is nullptr most probably

gentle hamlet
#

I can't place empty actors as objectives?

slow bobcat
#

Empty actors are not a thing. Either your pointer points to a valid memory address of an actor object or not

harsh storm
#

It may not be that your actor is wrong - but that it simply wasn't ready by the time the task ran

slow bobcat
#

Yep. I would imagine you are storing some actor in a variable and you are using it in your move to node. The variable probably hasn't been process yet (you haven't call Set() on it)

gentle hamlet
#

I'm using actor io

#

It's stored in a logic actor

#

Which it's selected from details

slow bobcat
harsh storm
#

Looking back through the stuff that you posted - you appear to be using your own custom approach to AI and not using BTs or STs. If you could provide more information on how you have things set up, we could possibly help spot an issue that you may not notice. But you'd have to provide more information than what you have thus far. @gentle hamlet

heady silo
#

Alright, so I managed to get my StateTree logic to allow enemies to pick up weapons and do a random move. But for some reason, despite defining transition rules back, they only execute one of these tasks and never do anything else. Did I do my transitions wrong? What is happening?

#

I re-enabled the movement speed tasks and surprisingly this also works now. But I still can't get them to go again

#

I made sure to get rid of any conditions and have it go back to root, but still nothing happens :/

bronze island
#

Hi everyone,
I'm seeking architectural advice for my top-down, 4-player co-op game in the style of Vampire Survivors\League of legends Swarm. The core loop involves flooding the map with enemies, and I'm unsure about the best approach to handle the AI efficiently.

My Current Setup:
Using Unreal Engine 5.6
Player characters utilize the Gameplay Ability System (GAS)

Planned two enemy archetypes:
"Trash" Mobs: High quantity, simple behavior (move toward nearest player, damage via collision)
"Special" Enemies: Lower quantity, will use GAS for complex abilities (AoE, Invisibility...)

The Core Dilemma:
I need to support hundreds of simultaneous "trash" enemies efficiently. Their requirements are simple:
Stats (Health, Speed, Damage, Scale...)
Status (Slowed, Stunned, Bleed...)
Move toward the closest player (with potential threat-weighting)
Damage players on collision
Play spawn/death VFX and hit sounds
Drop experience shards on death
Basic walking animation
Etc...

I'm considering several approaches but would love insights from those who have tackled similar problems:
Mass AI System – Seems powerful, but most examples showcase thousands of entities. Is it overkill for ~600 units?
Dedicated AI plugins (like World Director NPC PRO, NPC Optimizator)

My main concern: While GAS works well for players and special enemies, I'm worried it won't scale efficiently for hundreds of simple AI.

Has anyone successfully implemented a similar horde system? I'd particularly appreciate insights on:
Performance trade-offs between these approaches
Whether GAS can realistically handle this scale for simple entities
Recommended architectures for this "two-tier" AI system

Thanks in advance for any guidance!

rancid wing
#

heyo

#

anyone know a good tutorial on making a behavior tree control multiple enemies, essentially using one mother ai for all the enemies

#

Im wondering how to approach the patrols for this

slow bobcat
# rancid wing anyone know a good tutorial on making a behavior tree control multiple enemies, ...

Plenty in YouTube but to summarise: you make a general tree with general states like idle, combat, patrol etc. Those have decorators to control how/when each state is entered. Then what you do in each is yo have a "run dynamic bt". You create a data asset per enemy type where you define which tree should each run per state. ie: melee will run a Melee_combat_bt while ranged enemies will run Ranged_combat_bt. You can specialise bosses and what not. Then, when your enemies are spawned, on Possess, you run the "master bt", read their data asset and inject the behaviors defined in it in the master enemy tree

slow bobcat
# bronze island Hi everyone, I'm seeking architectural advice for my top-down, 4-player co-op ga...

Key question here is if you need collision between enemies or not (vampire survivor doesn't have this).

If you don't, things will be very simple. If you do, that's where things get expensive/complicated.
Collision ! = flocking/spread

  • mass is definitely the way to go when having large numbers (large means "over 50" for unreal)
  • GAS gas nothing to do with one or many enemies. Gas is cheap to run, just a hassle to set up initially due to the sheer amount of moving parts it has. You can use it with very large numbers. It will all bake down to what your GA's and GC's do in the end when it comes to performance

Your main issues are going to be: collision among characters, movement (forget about using the character moving component) and animation. You might want to look into the new Mover Plugin. It's in very easily stages but night help

polar furnace
#

hello, can we abort the move to task if it was the middle of execution i mean a long run is ordered and my ai is on 30% of way. so if the ai see the enemy can decorator cancel the move ? and rerun the bahavior?

#

surely we have some service to update data like bIsEnemyOnSight = true

static cape
slow bobcat
rancid wing
#

I think your trying to say there will be a ton of mini BT s that each enemy has, my problem is I am doing something similar, but when I have more information than 5 enemies the game gets extremely cpu intensive

#

So I thought maybe I can have the mother bt tick every 3-4 frames maybe , then not use a patrol bt for enemies and instead do a AI move to function for the patrol that the mother bt links too??

slow bobcat
slow bobcat
rancid wing
#

Got it, it's only when I add the enemies so I'll check!

bronze island
slow bobcat
#

any time

gentle hamlet
#

actor IO is a level scripting tool

harsh storm
#

Oh - is that the thing that someone made to be like Valve's stuff

gentle hamlet
#

yea

#

I'm also using the project borealis movement and scythe so I might as well

harsh storm
#

Well, pesonally, I'm not convinced - but no matter. Let's go back to square 1. Describe your total setup and the flow of data. Screenshots (that aren't unnecessarily cropped) also help.

gentle hamlet
#

this is the function, it is triggering

harsh storm
#

What is "it"?

#

We don't have your project in front of us

#

For all we know, Logic Actor Base initializes things incorrectly

#

Or how you're getting the actor is wrong

#

Or that you're calling things too early

#

Or any number of reasons

#

Don't provide as little information as possible.

gentle hamlet
#

If I change the Npc it works

slow bobcat
#

Also you are calling move to actor on all enemies but you are in a enemy task? That looks dodgy

#

I don't see where is Objective being set

#

Which is probably the thing that is nullptr

harsh storm
signal hamlet
#

Hello, I've scoured some of the post history and seeing this topic come up often, but I'd like to know if there's more material on this I could learn from :
AI currently ACharacters, CMC is expensive, could we potentially move them to pawns that pathfind similarily to characters? and handle movement in some custom fashion (manually applying gravity, etc)

Otherwise I'm seeing posts about people optimizing their AI such that they have 100+ units with CMC's enabled, in that case what are some tips for achieving this. Navwalking, anim sharing, etc are all a given, characters are super simple and have small amt of bones. Currently doing 30-40 with no issues, but would like some pointers about optimizing this further if anyone's got any.

Generally when there's a lot of AI they should "swarm" together so potentially some group optimizations there that I'm not familiar with

harsh storm
#

At this point - I'd say to show your complete setup, from start to finish.

slow bobcat
harsh storm
#

Have y'all switched to Mover yet Bruno?

slow bobcat
#

Nah that thing is way to experimental for production. If I were to start a 3/4 years project now... Maybe. I would definitely consider it, but since we have 20 enemies tops in a very simple movement setup... Makes little sense for us

signal hamlet
#

similarily here staying away from unproven systems for production, but I'm not seeing too much talks about optimizing group AI while keeping them as characters. switching to MASS also doesn't fit our timeline atm

harsh storm
#

Well, I'll ask the same question I always ask in these situations. Do you actually need a bunch of AI or can you fake it and make it feel like a bunch?

#

As an example - a game like L4D may never actually have 100 AI running at once, but when you're in the thick of things in a horde, it can certainly feel that way.

#

Where as a game like Dead Rising does need a crap ton of AI going

#

Extremely simple AI - but AI none-the-less

#

L4D probably only has like 30 AI at a given time. If even. Just clever level design and spawn points.

signal hamlet
#

yeah very simple AI in our case as well, there are special variants that are smarter and a lot less frequent , but for the dummy horde they do still need to all individually break off and get killed etc as needed.
can currently pull off a decent amount (30~) just fine but was wondering how those pushing 100+ were doing it. seeing claims of 200+ on screen CMC's in some previous posts here. wondering if there's a neat GDC talk about something like this

harsh storm
#

I don't know of any GDC talk about it for Unreal

#

But I was able to do it via AI lods, animation sharing (or budgeting), navmesh walking, significance manager

slow bobcat
#

Usually people use Significance Manager to create a LOD system for AI and tweak ticks, anima etc etc

#

Pretty much what Durox says

harsh storm
#

And if you identify exactly what you need from the CMC - you can also write a more simple movement component that does exactly what you need and nothing more as well.

#

Like - maybe you don't need it to test penetration like 40 times lol (exaggeration mind you)

signal hamlet
#

Cool, anim sharing will be the next big one that I had planned, others are mostly already implemented. How many are you able to have on screen at once using CMC in your project @harsh storm

harsh storm
#

It's been awhile since I've touched it - but I had like 500 on screen. They weren't moving though (but that isn't what you asked 🥁)

signal hamlet
#

lol fair enough. ty.

harsh storm
#

Anim sharing really helps reduce the animation cost

#

But it comes with its own caveats

#

Moving AI characters around though? I was able to get like 150+ if I recall. But that is an extreme case for a vast majority of cases.

#

An overwhelming majority of games really do have less than like 40 AI at a given time. Regardless of engine.

#

@signal hamlet It is hard to see - but I can't download the video, so enjoy this crappy screenshot. But this was 4 years ago in UE4. The FPS is 67 though. Non-packaged.

#

(And I definitely don't have the video anymore)

signal hamlet
#

yeah that's awesome.
on my end 20-25 would be fine but we're moving to multiplayer and i'm mostly trying to save the servers from blowing up, ~3-4 groups of 4-5 players aroudn the map handling their own "hordes" of 15-20 AI.

harsh storm
#

If the server is only going to have 20-25 AI, you should be fine.

#

Just do the basics of optimization

#

Shouldn't need to go extreme.

#

Or are you saying that it'd be 4 groups of 20 AI? (IE - 4 groups of players and each group has up to 20 AI)

signal hamlet
#

yeah that one.

harsh storm
#

So actually 80 AI

signal hamlet
#

so less worried about clients they'll just have what's relevant to them but the server will be aware of all of them , so trying to do as much as possible for the servers

harsh storm
#

You'll also want to optimize networking stuff

hallow compass
#

tell all AIs in the same state to use a given anim instance ?

hallow compass
#

very nice

#

does it supports runtime remove/add ?

#

if for example want to play an anim montage on a specific SKMC

magic brook
#

anyone run into issues with state trees? I have a simple state set up where the AI goes into a state , then the child state determines a random location via a STTask, then moves to the location (the location has been set as a parameter) I had this working with no issues last week, I have not touched anything that I am aware of. The AI now apears to be looping its tasks before it finishes them. resulting in the AI spinning in place. The Ai will also not transition to the wait task that it is supposed to once the tasks have finished.

#

state tree

#

the BP of the task

slow bobcat
# magic brook

Tasks run in parallel. First task finished will execute the state transition. See that part that says "Any" in your tasks group? Change that so the state will only transition when all the tasks are done

#

What is probably happening is that the random location task finishes 1st and triggering the transition. I also suggest you move the move taskinto a child state of Move To Random locsiton state, it's the only way to guarantee the random location param is ready when the movement starts. Since tasks run in parallel, chances are move to is starting before get random is finished

slow bobcat
robust veldt
#

Does ST event data is auto clear in next frame.

slow bobcat
robust veldt
slow bobcat
#

the comment has a spelling mistake, it actually means "had the chance", not the "change"

robust veldt
slow bobcat
#

Now... The async context... No idea if it works differently. I just discovered it today and I have no idea how it fits in the overall logic

hallow compass
#

i dont understand the point of K2_GetRandomReachablePointInRadius since its a pure node with 2 returns

#

meaning you cant check for a small pure call if the output location was with a true retuned boolean

misty wharf
robust veldt
#

How to stop this. I want my child state is optional.

slow bobcat
robust veldt
#

I have a state with one child state that have Enter Condition, if the condition is failed, It exit parent state also.

slow bobcat
#

yeah, because it makes no sense to run the parent if no child can run. Or is your parent executing a task too that is being interrupted?

robust veldt
#

Yeah. My parent state has task to run.

robust veldt
slow bobcat
#

so you need a task to run no matter what happens in the state... which is odd

robust veldt
slow bobcat
#

Maybe you can re-think the structure? or make that a global task? Answering this without knowing if there's an option to select a state if it has a task but the children are not runable (doubt there is)

signal olive
#

I'm trying to figure out why "event smart link reached" is working with a generated nav link class but not a manually placed nav link with the same logic, it makes no sense

slow bobcat
slow bobcat
signal olive
slow bobcat
#

Generated Nav link proxy

#

nav link proxy

signal olive
#

I see

#

But they should still both trigger in identical fashion, in theory

robust veldt
slow bobcat
slow bobcat
robust veldt
signal olive
#

Well, both have an overridable smart link reached event, but only the generated link trips the break point

slow bobcat
slow bobcat
#

check how does this look and try enabling the relevancy, copy the start/end points etc

slow bobcat
#

and you copied start/end clicking the button too right?

signal olive
#

Correct

slow bobcat
#

then you are going to need to debug code to know why is it not triggering

#

there's a log for it in visual logger. Maybe you can start there

harsh storm
# robust veldt For example here.

So the crux of your issue is that you want the Send Objective Event to run regardless if OnOverlapGate or SpawnEncounter actually enter because of their enter conditions?

neon sparrow
#

Guys is there a good learning material for state tree for ai

#

And ai in general

slow bobcat
#

Check the pinned messages

static cape
heady silo
#

(Since he was doing a shuffle I figured I'd give him a good beat)

slow bobcat
heady silo
#

O_O

#

I'm guessing it might be declaring a new move every frame?

#

I just don't understand why this is happening though. Shouldn't the AI MoveTo necessarily slow the execution flow?

#

do I need to decouple the task and execute the move outside of the task?

heady silo
#

I'm guessing I have to break tasks down a lot more than under behavior trees. With a BT I just run the EQS query, load the location generated into the blackboard key, and run a path to it

#

I think I was trying to do too much in one task

heady silo
#

it's still not transitioning properly though

static cape
#

Is there a feasible way of making state trees jump to certain tasks on keyboard inputs?

robust veldt
slow bobcat
harsh storm
#

You might need to have a parent state on it though

#

I just tested it - yeah, just change OnOverlapGate to be TryEnter and then treat it like any other taks that you have to handle transitions for.

#

This was the set up

#

Though - that won't select the SpawnEncounter state

#

Okay - so, you can organize your states in a funky way

#

Pretty much - have a param on the Base state that your OnOverlapGate state will alter. Then have a sibling state that just holds the other states that you want to run based on that.

Now, if you want only one state (so just the spawn encounter) - then OnOverlapGate and SpawnEncounter can be sibling states. With OnOverlapGate's transition being "On State Completed" and having it go to the SpawnEncounter state.

#

And you don't have to fiddle with the selection behavior

#

But - you do need to handle the situation where SpawnEncounter can't be entered.

#

It really depends on what you're trying to achieve

#

So if you only have one child state on the OnOverlapGate state - then set it to TryEnter and set the transition to be On State Completed -> SpawnEncounter

#

But if you have multiple child states that you'd want to run in order (or try in order), then have an intermediary state

#

So it'd look something like this. The whole point of the HolderState is to go back to the Try Select Children In Order seletion behavior

#

Of course adapt this to your specific needs. But uhhh - I think I gave you some things to work with 😅 @robust veldt

#

CC: @slow bobcat in case you had a slight curiosity (saw you say you haven't encountered this issue before so you weren't sure)

slow bobcat
# harsh storm CC: <@397712228435886091> in case you had a slight curiosity (saw you say you ha...

While I get the issue and the solution... It still smells to me the problem is more how the AI architecture is built. Sounds like a re-think of the structure would solve the issue in a more natural way. For example: if you need A to always happens unless option B or C can happen, sounds to me like a Selector approach. I don't read the dependency of "B and C are children of A" anywhere in the issue. I would probably think on a different solution less convoluted / easier to read

harsh storm
#

I'd probably rearchitect as well - but I also wanted to provide a solution that could work as well.

#

I haven't encountered this issue in my travels either.

slow bobcat
#

If the issue is "A should happen always", it is even more of a reason to re-think The structure of the tree

robust veldt
#

Current flow I want to implement is when player first enter gate then spawn encounter. Otherwise just process overlap gate event.

harsh storm
#

So enter gate - spawn encounter -> overlap gate event
Enter gate again -> overlap gate event

?

robust veldt
#

That is in pseudo code. Problem is structure in ST.

slow bobcat
#

But that's ez then

#
  • Main state
    • cond "has already entered" : enter gate
    • spawn
    • overlap
harsh storm
slow bobcat
#

Enter gate condition is a bool on the door "already entered == false". Set to true in the state once entered

#

Once you enter the first time, it will never meet the condition and skip it, but the other two will always evaluate

harsh storm
#

Either of our approaches would work. Really just depends on how you want to go about it.

#

But uhh - yeah, this is a much easier problem

#

Yeah - the formatting sucks in discord to try and model the ST

slow bobcat
#

Basically the door will have a root state and 3 child states, one of them will only happen once (a task inside will block the enter condition flipping the bool)

harsh storm
#

I would put a task on my GateState that, on Enter, would set the GateEntered bool (I named it SpawnedEncounter for w/e reason) to true. Yeah - it will run each time the ProcessGate state is done as well, but w/e. If that is an issue for you, then go with Bruno's 3 state approach.

#

Either way - the main takeaway is to just flip your states.

slow bobcat
#

Durox will pass you the bill for our Saturday consulting

robust veldt
#

Here is current flow. I thought I could simple add a optional child state to OnOverlapGate. 🥲

#

The new flow:

celest python
#

Is there a way to use FStateTreePropertyRef in BP?

celest python
#

hm, FProperty is not even exposed to this type

#

no wonder why its not on BPs

#

so how do we take ref from BP?

#

this type looks like a weird way of reinventing FInstancedStruct in a way that it'd be local memory instead

#

FStateTreeBlueprintPropertyRef ChillBar_yay

celest python
#

types are not exported ThonkSpin

drifting ginkgo
#

Anyone have takes on SmartObjects, specifically if they should use a 'nesting' style.

Take the stall in the witcher 4, I'm wondering if it's like a "Work" object with a bunch of different slots inside, or they're each unique actors/components of differing actors.

slow bobcat
#

Keep in mind that's a super doctored/tailored tech demo. That said, I would imagine a real implementation would be just one smart object with different slots

drifting ginkgo
#

Yeh given the extreme collab I'm hoping it's the intended standard but I can't find the video snippet anymore to see if they showcased editor view of the SO setup.

Most things seem to fit in the scale of 1 SmartObject with users transition or taking independent slots but then I think about something say a tavern. At that scale you'd likely want seperate objects. Trying to understand where best that line would sit. (Otherwise you'd have two different setups for differing "zoom" levels)

#

A smithy for example feels like 1 SmartObject would be clean for development it's all 'self contained' to some extent. But likely should be independent SOs at that stage

cinder crescent
#

Anyone had any luck getting this working? Having trouble getting it to behave the same as setting that "Linked Asset" to the state tree outside of runtime

celest python
#

Is it possible to run parallel states in ST?

#

run both A and B

harsh storm
#

No

#

B would have to be a child of A

#

@celest python

celest python
#

Thanks

harsh storm
harsh storm
#

(Current one will still be available)

slow bobcat
#

You can already see some AI debug in it. Also VisLog

warped tiger
# celest python run both A and B

You could use FStateTreeRunParallelStateTreeTask to run a state tree as a parallel task. Not exactly the same as running 2 parallel states, but it may meet your needs

heady silo
#

Can you limit an EQS query inside a specific area? I have a query that gets nearby walls/solid objects and maps around them, but I want to limit this to a room by room query to simulate room clearing. Would I need to define a trigger volume to contain the query, or do I need to put invisible marks to call the query from?

crystal brook
#

with EQS and navigation on a sphere do i still require a navigation volume for it to work?

#

I have the combat variant ai working on my planet but in the eqs bp, he doesnt seem to find a path and just perminently bounce between idle/flanking

slow bobcat
slow bobcat
crystal brook
#

just reinstalling the combat character i kind of messed the State tree stuff unreal wouldnt let me undo

#

nm f it unreal screwed the pouch there

#

didnt offer me the combat varient and the proceed to f up something else

crystal brook
#

yep started to work after i repaired the combat variant and enabled a navmesh

crystal brook
#

now there mad

crystal brook
#

any ideas what is preventing these NPC's from generating the navmesh? when using nav mesh invoker ?

#

this was sitting in the output log also

#
LogStateTree: Error: UStateTreeComponentSchema::SetContextData: Could not find context actor of type BP_CombatEnemy_C. StateTree will not update.
LogStateTree: Error: UStateTreeComponentSchema::SetContextRequirements: Missing external data requirements. StateTree will not update.
LogStateTree: Warning: Context Requirements in UStateTreeComponent::StartTree failed. Component tick is disabled.

LogStateTree: Warning: Parameters for 'ST_CombatEnemy' stored in StateTreeReference were auto-fixed to be usable at runtime.
LogStateTree: Error: UStateTreeComponentSchema::SetContextData: Could not find context actor of type BP_CombatEnemy_C. StateTree will not update.
LogStateTree: Error: UStateTreeComponentSchema::SetContextRequirements: Missing external data requirements. StateTree will not update.

LogStateTree: Warning: Context Requirements in UStateTreeComponent::StartTree failed. Component tick is disabled.
LogStateTree: Warning: Parameters for 'ST_CombatEnemy' stored in StateTreeReference were auto-fixed to be usable at runtime
LogCrowdFollowing: Warning: Unable to find RecastNavMesh instance while trying to create UCrowdManager instance
LogStateTree: Warning: Context Requirements in UStateTreeComponent::StopLogic failed. Component tick is disabled.
LogStateTree: Warning: Context Requirements in UStateTreeComponent::StopLogic failed. Component tick is disabled.
LogStateTree: Warning: Context Requirements in UStateTreeComponent::StopLogic failed. Component tick is disabled.
heady silo
#

So I've been trying to adapt some tasks from my Behavior Tree to StateTree and I keep running into weird shit. Despite using the same EQS, the StateTree refuses to pickup the weapon or even path to it. The Behavior Tree version of this task worked perfectly fine with the same basic setup (use the EQS to look for weapons in view, set the location of the weapon as the pathing location, path to the weapon, do an Interaction, which adds the weapon to inventory and equips it). But for whatever reason, the STT version of the task just refuses to execute.

#

"Could not trigger completion transition" seems to be the issue

#

I wasn't checking for any more criteria here, I just wanted to move to the spot, then call Arm.Self, so I went OnStateCompleted, but it just doesn't work.

#

Not sure what I'm doing wrong

crystal brook
#

hrm just curious why there is this difference in AI setup, like my AI i am playing with dosnt have a blackboard tree

#

but instead it has SST

#

oh just saw you posted your SST as well

#

my one has the default -> root which might be what you need

crystal brook
#

its setup to just choose randomly as is ... but there is also "on state completed"

heady silo
#

which I was able to do super easily in BTs

crystal brook
#

yeah the only reason i mention.. about the combat variant... because in the evading SST it deals with rotating toward character and flanking is basically path finding/move to a location where the character is (in your case your pickup), then you would just need to make a SST in theory to make the character execute your pickup / interact code, in combats case it just attacks which is also just another sub SST

#

ah i see now the reason theres a difference in the approaches is because SST can use EQS natively

#

and thats how it does its path finding

crystal brook
#

crazy shiz

#

that is growing in realtime .. i did a radius of 64000 and removale radius of 32000 but yep because the two ais do not get allowed to contribute to the navmesh we are screwed here

#

well more then two .. there about 20 of them the engine culls for what ever reason

#

so weird - even with tile removal radius of 255

#

fun and games 😄

#

wait i wonder if spawn another hudge structure if it will limite the range of the path finding again

sullen crater
#

Hello guys! Iam new in StateTree. What is the best way implement abort, just like in Behavior Tree.

slow bobcat
warped tiger
#

<@&213101288538374145>

heady silo
crystal brook
#

yea i guess that is basically why.. its just a flexibility thing

gleaming star
#

is there any issue with putting the AI perception component in the pawns vs the controller? i am just finding it way less beneficial to do things via the controller vs the pawns, as the pawns are where all the differentiating logic is. i could just do it in the controller still but i don't really see a benefit for this unless im missing the reasoning why most things direct you to put it in the ai controller class

harsh storm
#

Well - when you put it on the pawn, UE yells at you.

#

Just build a basic getter and still do your logic on the pawn

#

You can sub to the same delegates that you would in the controller

gleaming star
harsh storm
#

You'd have to go into C++ and do that. Create a new AIController base that will set it.

#

So your base controller would just handle this in its possession event.

gleaming star
#

yea that might be needed. not really too good w c++ but i think i could manage to make a new base class for this

#

would i then be able to set this in the bp classes?

harsh storm
#

Honestly - you should at least get a basic understanding of C++ in Unreal. It opens the door for so many more possibilities. And as long as you stick with the Gameplay Framework (IE - actors, components, UObject, etc...) - it is pretty easy to write. You don't really deal with the raw C++ bullcrap (though you can!).

harsh storm
gleaming star
harsh storm
#

Yup, structs and enums are a very good entry point into C++ with UE

gleaming star
#

it is quite simple but there's just that inital learning curve for every like syntax quirk

harsh storm
#

That's just because C++ hates you.

gleaming star
#

lmfaoooo

harsh storm
#

Now, C++ can't really talk to BP (well, it can, but you really shouldn't in gameplay code). So if you don't want to have to create a new base AI Pawn, you will have to also create a C++ interface in order to get the config from your BP pawns.

#

Then your BP pawn would need to implement said interface.

#

But I'd recommend creating a base C++ Pawn

#

It is kind of annoying boilerplate, but I always have my own custom base version of the following classes for every project:

  1. GameMode
  2. GameState
  3. PlayerController
  4. PlayerState
  5. Character
    5a) Base Player Character
    5b) Base Enemy Character
  6. CharacterMovementComponent
  7. AIController

Even if they are empty. Depending on the game (and smart design decisions), you can get away with not having a base player character and base enemy character though.

gleaming star
#

i really should just do it just to learn those class setups tho

harsh storm
#

You can make them in C++ and easily reparent all of your classes.

#

Shouldn't really break anything

gleaming star
#

that's what i figured, maybe i'll give it a go, im not too deep into the AI's yet, but character would be a risk, but that would also be most beneficial

harsh storm
#

The biggest headache is moving data over to C++ and not just reparenting.

#

You can keep all the data the same and just change the parent class. Shouldn't cause any issues at all.

#

Then, you can slowly move more stuff to C++ on an as needed basis.

#

And, in your base character class, you can fix the silly positioning of the SkeletalMesh component

#

So you don't have to do (0, 0, -90) for the location and (0, 0, -90) for the rotation on every freaking character so that they actually face forward

#

Just do it in your base character class. Profit.

gleaming star
#

im atually using paperzd characters (2d sprites) so i have my own unique challenges with that, but that has always baffled me for the characters lol

#

the biggest decision with cpp for me is always , is it better to keep working on project, or take two days and learn how to do x,y,z, so i can keep working on project better lol

harsh storm
#

Well, even just a little bit of C++ makes the experience in Unreal a lot better. You can get by perfectly fine by just doing like 5% of your project in C++

gleaming star
#

honestly structs and enums in cpp has made things so much better when it comes to organizing data and feeling confident that they wont break

#

i've gone much deeper into systems because of just that

#

so i know that's right

wintry urchin
#

Can anyone give me tips on how to improve my AI? Right now it is pretty basic with patrol and can also detect sound. But doesn't always attack like it should.

https://www.youtube.com/watch?v=ejB1AJ55Q78

Experimenting with bodycam-style in Unreal Engine 5. Walking through the test area and eliminating some robot enemies to see how the effect looks in action.

The environment is all megascans stuff, with a few from the construction pack from Dekagon Studios. Weapons are from the Military Weapon pack (dark).

#unrealengine5 #bodycam #gamedev #...

▶ Play video
crystal brook
#

so i have asked chatbot gpt to write me a version of navmeshboundsvolume

#

which is supposed to have some type of planetry support but it doesnt appear to do any thing

harsh storm
#

Sounds about right

crystal brook
#

i lost the chat with the bot now but it made this function ProjectToSphere

#

am i supposed to call that myself

harsh storm
#

We don't have your project in front of us and know nothing about it.

crystal brook
#

note sure how i could trigger that projecttosphere function if that is the case

wintry urchin
crystal brook
#

sounds like there is a probability variable somewhere

harsh storm
crystal brook
#

back in combat variant the AI has perceived threat also

#

but with my problem what i kind of dont get is why NavMesh cant just go to every polygon intersection point of the brush shape .. then do a ratio'd multi ray cast with radius .. toward the origin of the mesh

#

pcg also should also allow for something like this but they dont even have a brush to use in that respect as far as i know

#

even with teslation level 5 that would still be very easy to manage and not hurt performance at all

#

that would keep the tile count under control and nice in the (1 << 20) range

harsh storm
# wintry urchin Behavior trees

Activate the gameplay debugger. The default key is ` (which is next to the 1 key on the top row on a qwerty keyboard) and go to the behavior tree visualization. There you can see where it is just stuck at.

silk ferry
#

Hey guys, I'm trying to make a custom move task and use a vector payload. But I'm getting the error:
InfectBuilding Task 'STTask Move No Complete': The type of Context property 'X' on Task 'Root/InfectBuilding/STTask Move No Complete' is expected to be Object Reference or Struct.
Payload is a vector and the tasks seem to only be able to read it as the floats, but throws that error

#

I'm probably doing something daft

#

Oh and this is how I'm creating the struct

crystal brook
#

nfi but yeah should payload struct be none?

drifting ginkgo
#

Setting the Payload to InstancedStruct feels like it might be a starting point.
Then testing if you make a Struct that just contains a vector to confirm it's identifying it correctly.
Applying this new VectorWrapper_Struct in your MAKE as well as the payloadStruct input.
If neither of those work may be a deeper issue

ivory hawk
#

Has anyone figured out any uncommon ways to improve AI Performance in UE? I'm currently shutting down / turning on AI based on how close/far players are from the AI, the images will show you exactly what I'm turning off.

I also made tick interval 0.1 to reduce the overall load on the system when the AI does turn on. Anyone got anymore tips that may not be well known?

I'm asking because right now in the editor I'm at ~70-75 FPS with 200 AI in my map (all "sleeping) and ~40-45 fps with ~90-100 AI "turned on" near me

heady silo
#

So I've managed to get my weapon pickup task working. Apparently the reason it stopped working was because I assigned it to a sense instead of leaving it empty. I don't know why. However, after successfully grabbing the weapon, we don't transition to passive state and patrol. Additionally, I was seemingly able to sidestep having to pass the armed state through the global variables by just directly checking a bool on the actor to inform the state, which worked. I'm not sure if that's best practice, though. (I don't THINK doing it this way involves a cast, so hopefully the performance cost isn't an issue.) So it basically just loops on the failing state after picking up the weapon.

harsh storm
#

Implemented SlideAlongNavMesh option for CMC NavWalking mode. This means pawns in NavWalking mode can move along a navmesh rather than just moving towards a projected point on the navmesh.
Neat

crystal brook
#

not sure where gpt's going wrong with this but it literally crashes unreal 😄

void APlanetNavVolume::BeginPlay()
{
    Super::BeginPlay();

    GeneratePlanetMesh();

    // Adjust Recast parameters for planetary scale and rebuild
    if (UWorld* World = GetWorld())
    {
        if (UNavigationSystemV1* NavSys = FNavigationSystem::GetCurrent<UNavigationSystemV1>(World))
        {
            if (ARecastNavMesh* Recast = Cast<ARecastNavMesh>(NavSys->GetDefaultNavDataInstance(FNavigationSystem::DontCreate)))
            {
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 8

                // ✅ Unreal 5.8+ path (future-proof)
                FNavMeshResolutionParams ResParams = Recast->GetResolutionParams();
                ResParams.CellSize = 50.f;
                ResParams.CellHeight = 50.f;
                ResParams.TileSizeUU = 4096.f;
                Recast->SetResolutionParams(ResParams);
#else
                // ✅ Unreal 5.7 and older path (still legal)
                //UE_DISABLE_DEPRECATION_WARNINGS
                    Recast->CellSize = 50.f;
                Recast->CellHeight = 50.f;
                Recast->TileSizeUU = 4096.f;
                //UE_ENABLE_DEPRECATION_WARNINGS
#endif

                    Recast->CleanUp();
                NavSys->Build();
            }
        }

    }
}
#

ngl it was close to working earlier

#

but yep if you guys want to have a look at what we've been up to

crystal brook
#

holy crap

celest python
#

rewing debugger looks so badass in 5.7

harsh storm
slow bobcat
harsh storm
#

I am just picturing it as some cheaper movement for large areas maybe?

slow bobcat
harsh storm
#

Yeah - that image didn't display for me on either computers I looked on

harsh storm
chilly nebula
harsh storm
#

How is this like any different than what we had?

#

Like, what is the intended usecase

chilly nebula
#

sorry, dont have an answer for you 🙂 but I think we used this on the Witcher demo to get around issues with slopes? Not sure!

covert blaze
#

Is there a way to set up a blueprint function so its accessible to pass into a state tree input parameter?

like i have Actor Foo. Actor Foo is included in the state tree scheme. Actor Foo has a function that returns a transform. I'd like that pass that transform into an input on the state tree.

I know sometimes you need magic out param names ect to wire this up and wanna sanity check if its possible before i just push to a variable and reference that.

hallow compass
#

how can I make a state tree task abstract/hidden so its not showed in the task picker ?

hexed hatch
#

i have an open world map with landscape and world partitions in a multiplayer game setup, now with static navigation mesh and data chunks, does the server load all the map for bots? or what actually happens?

chilly nebula
chilly nebula
heady silo
#

https://zomgmoz.tv/unreal/State-Tree/StateTree-design

So I'm looking this over and I'm just not clear. I have a bool that's supposed to control execution flow into SearchForGun. If we don't have a weapon, go into the state and look for one, and if not, don't go in and transition down to the passive state. However, the flow never reaches State.Passive despite successfully locking out of SearchForGun with the bool control. According to this link, the completion state for an empty state will never trigger. Does this qualify as an empty state? Do I need a task to check the bool to run before the transition will work?

wise sluice
heady silo
#

basically the passive state never fires, it just loops on SearchForGun

wise sluice
#

Can you screen the enter condition debug ?

#

On the timeline, you will see if your enter condition passed or failed at any time

wise sluice
#

So it's always false

#

Where does the boolean is changed to true?

heady silo
#

basically, the bool is supposed to be false to lock off SearchForGun, and then the fail condition is supposed to trigger State.Passive (we want to patrol when we have a gun)

wise sluice
#

I see in your screen that the boolean is never true so it comes back to SearchForGun and select "Locate.NearestWeapon"

#

Also you will fail to transition to Passive if the "IsArmed?" is false

#

Make sure the boolean "IsArmed" is properly updated
And add a state that act as fallback that has no any condition

#

We can see that the transition failed here! Probably because of a task within the state "Locate.NearestWeapon"

#

Since locate.nearestWeapon fails SO it triggers the failed transition -> which is State.Passive
But State.Passive has an enter condition that require your AI to have a weapon (which is not the case)

So you're indeed stuck.
You can either add an extra state as i suggested without any enter condition or add a child to State.Passive.NoWeapon and move the entercondition to another child State.Passive.WithWeapon

heady silo
#

Huh... that's really odd! By the time they are supposed to hit the passive state, they have armed themselves. The pickup task fires without issue, they just don't do anything afterwards.

heady silo
#

sorry it took me a moment to reply, I finished a Tarkov quest and had to play inventory tetris

heady silo
#

I made sure the bool flags in the actor after the action is called

#

what I don't understand is how this is comparing like this

#

Actor.IsArmed is being correctly set in the actor's blueprint

#

and the state should enter upon being flagged as true

#

even when I invert the condition, it keeps saying false is true

#

I also tried switching from Actor.IsArmed? to using the value of that to push the value to IsArmed as a parameter

#

Thankfully the pickup task still works, but it still won't transition to passive

#

Alright, progress!

#

swapping the bool over to the parameter and inverting the bool compare made the bool clear

#

@wise sluice THANK YOU I got it working!!!!

final loom
#

Does anyone know more about the AI Perception Stimuli Source with sound?

#

How I fire it, rather?

crystal brook
#

any ideas why the octree is llike this?

#

hehe its like its trying to build some kind of house for nav to live in 😄

crystal brook
#

well i dont think gpt can come right with this because it just endless runs into the header drift between the versions

#

and then forgets to keep the entire code base together between changes .. ai for ya

#

but yeh ... when sphereical nav mesh devs?

#

CodeLikeMe did a planetry LOD in BP's ffs.. its not impossible

#

and not to be horrible it looked a damn sight better then that octree

solid hinge
#

Hey, I have a problem with navmesh at the world partitioned level. I am using this guide: https://dev.epicgames.com/documentation/en-us/unreal-engine/world-partitioned-navigation-mesh
Navigation is present and working in the editor, but unfortunately it is not present in the navigation build. The AI are standing still because there is no navmesh.
I have a 2x2 map. It is a city. There is a navmodifier on the roads and pavements. I also use navfilters.
Could someone tell me what might be causing this navigation to not exist in the build?

Epic Games Developer

An overview of how to use a Navigation Mesh with World Partition

crystal brook
#

not 100% as i havnt tried to do a runtime .exe build

#

but you might need to make the recastmesh/boundvolume a external data asset

slow bobcat
slow bobcat
# crystal brook

Your octree is set to have a big bound size, it's sub divind the space as needed. You can probably use soemthing smaller but not sure if it will give you any noticeable improvement

slow bobcat
# crystal brook

That's not better than the octree judging by the image. That's pure voxelization without hierarchy, so looking for stuff might be expensive unless there's some weird broad phase logic checking halves of the planet based on location coordinates

slow bobcat
past wave
#

Hi there, is there any way to make a StateTree task latent in blueprints? It's returning completed before i actually call finishtask.

final loom
nova prawn
#

Please could someone tell me where I am going wrong with this as Im kinda lost now, I have a StateTreeAIComponent attached to the AIController, and a NavmeshBoundsVolume placed in the world but the AI Move To is always failing in the state tree's task and I am not sure why, It states Aborted even though Pawn has a valid value etc. Please see the Task and the Tree attached.

#

nvm I forgot i needed a Floating Pawn Movement or MovementComponent for the AI to actually move....

sullen crater
#

Hey, guys. I wanted to ask those of you who have been working with State Tree for a long time. I recently decided to rewrite my entire AI from Behavior Tree to State Tree. And I'm starting to run into some nasty bugs, such as a parameter from another task being invalid.
Example:
I have a state with tasks: A - FindRandomLoc, B - MoveTo. And today I caught a bug several times where the location from A is not passed to B and it just runs to FVector(0,0,0) . I tried to implement my task for MoveTo, everything worked, but when I returned the original native MoveTo task back, everything magically worked fine this time.
There were also times when the EventTick or EnterState methods simply weren't called until I reconnected the pins. How often have you encountered such problems within the State Tree, and have you had similar situations? I really want to use something new, but I don't understand how much these bugs or glitches can slow down the development process.

slow bobcat
solid hinge
#

Everything is set up the same as in the Epic guide.

#

If I use dynamic, it works. But then the fps drops significantly.

winged basin
#

5.7's RewindDebugger is amazing.But where are these function,I can't found the re-enter behavior even in cpp🥹

#

@solid hinge I think your question currently is simple.StateTree begin use will have some confuse,but keep work with it you will figure out.See Offical's content example and youtube's video will help a lot.

slow bobcat
# solid hinge static

In non-world partition (world composition, sub levels) you have to add a nav bounds volume in the persistent level, otherwise the Recast Object will be placed in a sub level and no nav will show up until you load said sub level. Maybe you are experiencing soemthing similar? Your recast object is places in some WP tile that is not loaded yet? Check in editor who owns the recast object

slow bobcat
winged basin
#

lol,but the new rewindDebugger really surprise.More intuitive and powerful, of course, there are still some minor issues.

#

I found binding property and executionRuntimeData in cpp's context's instance data relvant.Below two new feature in picture really hard found for me.

winged basin
#

I have roughly understood the first point,now can bound In/Out property in StateTree's relvant node/function,the variable which bound will update dynamically.

solid hinge
slow bobcat
solid hinge
#

How can I check this? This object is created automatically when I click to refresh/build navigation.

slow bobcat
#

If you open the gameplay debugger in the build and open the Nav section, does it show data?

solid hinge
#

Yes, it is.

slow bobcat
#

Then difficult to say. Except for checking in code what's going on... Maybe someone has some other suggestion?

#

For world composition you need yo load all the sub levels during cooking to generate the nav for the entire game. Could it be you need to do the same for WP somehow?

chilly nebula
chilly nebula
winged basin
#

Thanks!

crystal brook
#

yah got it semi working 😄

#

still has a few issues like when it starts its like it takes nav mesh a little minute to acknowledge the path finding but at least the FPS isn't absolutely in the gutter.. giving a glimmer of hope... (just need to work out how to make it use less area now)

#

the whacky octree remains sadly but yep nfi why its doing that at this stage.. but yep as a drop in volume nav system for a large planet its getting closer

viral field
#

Hey guys, is there something easy to use for grid based enemy movement using pawn sensing inside a character blueprint? Making a fp dungeon crawler like Level and i dont want enemys to move diagonal to the player

crystal brook
#

a navmesh+landscape really shouldnt be difficult at all

#

combat variant is already setup like that out the box isnt it?

signal olive
#

I'm still stuck on figuring out why smart nav link objects placed manually aren't working properly but auto-generated ones are

crystal brook
#

i am not sure how they work but do they need multiple volumes to make connections?

#

i did see some tweakable values that seem to govern what gets connected at what distance

#

like jumpable zones and what not

signal olive
#

I don't think so

#

As I said, generated links work just fine, so I'm not sure why manually created smart links aren't working, I've tried a bunch of things

crystal brook
#

ah i see is smart link like a component such as nav invoker ?

signal olive
#

I'm specifically using Nav Link Proxies

crystal brook
#

hm i just switched it on on mine to see ..

#

it knows it has a link 😄 but to what .. i guess we need to debug the nav links thing in the display part

signal olive
#

Specifically, the "Receive Smart Link Reached" event does not fire

#

Also, I'm pretty sure this ain't right:

crystal brook
#

i wonder if the automatic ones are taking a different settings to the party

#

so the distance to connection is different or something along those lines

slow bobcat
#

Generated links are a completely different class from places smart objects. You will have to debug the code of the placed ones to understand where is that callback used and why is not triggering for you

signal olive
#

Oh, great, now the navmesh has completely stopped regenerating

crystal brook
#

if its on static then yeah

signal olive
#

No I mean it's just not building at all and there's no navmesh period

#

Okay, had to try a new map but it seems to be working better there

#

...okay, so it was a problem with the level?!

#

That is so weird

#

(Apparently now smart links are actually working for some reason)

crystal brook
signal olive
#

lmao idk I think the level was just bugged

crystal brook
#

i think these smart links these are probably a custom class or something as i dont see them in the component or editor side

signal olive
#

Nah, they're a component in the Nav Link Proxy class

crystal brook
#

ah right

#

ok let me take a look at this .. because yeah would be nice to limit the range of navmesh a bit .. even though you say this has no nav mesh so yeh 😂

sullen crater
slow bobcat
#

Then that's your issue. Tasks run in parallel. Move to is probably starting before it gets the param from find random location

#

Put the move to in a sub state

heady silo
#

There should just be a checkbox to flag a task as being exclusive or parallel execution

harsh storm
#

Just don't put two tasks in one state

drifting ginkgo
#

There's at least delegates now you can use to hand data between at timed intervals and potentially StateTreeEvents and their payloads may work.

obtuse igloo
#

Hi all! I'm trying to make a Smart Object toy ball that uses a Gameplay Behavior Config instead of a Behavior Tree.

I was wondering If It's possible to just loop the behavior class? Im trying to have my AI kick the toy ball and subtract from it's Boredom variable, but loop until it's no longer bored, and THEN end the behavior.

On another note, I'm also trying to make it so that if the AI has to cancel it's behavior, do I just call a delegate in the behavior or is just ending the task connected to the smart object, enough?

Any help appreciated! Just trying to get this Utility AI system Ive got to work 😭

crystal brook
#

do a default back to root to create a loop in the main StateTree if thats what you mean

crystal brook
#

i am wondering why the path finding isnt working all the time with the system me and gpt made .. hard to tell if its the navmesh or the state tree

#

but it makes a very nice performant navmesh that works on the planet

#

when they do decide to path find they beat the living hell out of you when theres three or more of them

#

but yep also not clear why its not able to run up the slopes even when max walkable slopes is 89 universally

#

absurd step height

#

ones stupid little that really screws up path finding is if you have a relative camera reference mesh (for gravity camera) like my character has and its not been set to no collision

#

that was causing so much hell for navmesh

keen crow
#

does anyone know if learning agents training and inference is executed on the game thread? if so, is it possible in theory, obviously with some delegations back to game thread, to move these processes to a background thread?

crystal brook
#

if you you are using a navmesh and using dynamic i think it makes sense to tick the do fully async data gathering option

#

not sure which one i turned on .. but that was one of them and it runs like a rocket for navmesh invokers

#

takes a little while to do the initial generation

#

its a settings in the recast actor btw

drifting ginkgo
drifting ginkgo
# sullen crater Yes

Had to make a setup similar to this today, using the Delegates and by ToggleCompletion on the first State, you can decide when and how things flow.

#

Then your delegates look like this, although caveat I'm running 5.7 unaware if 5.6 has any quirks.

drifting ginkgo
#

Tried a few different struct/nesting setups and can only manage to get individual Structs or Arrays of Dispatchers to appear on the Listener options.
Imagine wanting a Tag to Dispatcher Map or something along those lines to have a bunch of events in a Task, but then can enable them in details per-use case. Wondering if anyone's had success?

#

Array indexes are a bit too prone to error but nice that they work.

But you could imagine some BroadcastDelegates coming off something like UseSmartObjectWithGameplayBehaviour, that each Task instance can toggle.

heady silo
#

so I'm trying to get a sound sense working in StateTree to percieve gunfire or other combat noise. I'm trying to pass it through the global variable stack. However, I'm not sure how to make this flow. I'm guessing I need to vary the state tree event based on the stimulus. Seeing a character for a certain amount of time vs hearing combat should have the AI react differently. I feel like a gate is probably the flow control I would need, but I can't figure out how it would work in this case. Is there a different flow control I should use instead?

weary river
#

Hey So i Setup a simple spline with Ai controller and Behaviour Tree and its working fine, for single NPC´s. But as soon as i SPawn more then 5 at the time everyone after the fourth just walks directy to the last spline point. And i couldn´t figure out a solution yet
maybe someone of u got a good advise for me

obtuse igloo
crystal brook
cinder vale
#

Can someone please tell me what is the use of a State's Gameplay Tag? Afaik, there isn't a way to query your current state's tag from within a transition or an enter condition, or is there?

crystal brook
#

check out the sub state tree

#

it might have something that can check the tag off one of the various nodes it outputs

#

and if was referenced inside of blueprints this its just a case of hastag()

cinder vale
# crystal brook check out the sub state tree

Are you talking about setting a State's Type to Subtree?
Also, I think you are oversimplifying your answer. A matter of HasTag? HasTag simply checks a container to see if it has a tag. There doesn't appear to be a way to query a tag from a given state from within a Blueprint.

crystal brook
#

yeah thats why i said .. with the substates it makes sense that they could find out the tags as children of the main state and perhaps blueprints.. but other then that i dont know a really valid answer to provide you at this point 😄

cinder vale
crystal brook
#

yep learning the ropes with this ai stuff bit by bit

#

never imagined how much of a important part of the game design it would be

cinder vale
#

state tree seems super cool

drifting ginkgo
cinder vale
#

I'd really be interested in a simple example or explanation on how a state's tags are useful

crystal brook
#

let assume some where a sub state knows about multiple main states it can now tell the difference?

#

so the logic isnt going bezerk

#

heh i dont know why but yeah with networking you tag your vlans etc to create the network separation/hierarchy you want

cinder vale
#

I can totally see how a sub state would want to know about its parent states and such but it would probably need to query some sort of parameter or an Actor/Object's exposed tag container or something

#

Since State tags are basically un-queryable

crystal brook
#

yeah its probably just being exposed in the C++ side because its basically a variable

#

that they havnt done any thing with yet

drifting ginkgo
#

Then you markup the tag internally with that tag

cinder vale
#

have you done it?

cinder vale
cinder vale
drifting ginkgo
#

All good, honestly I found it by accident myself. I think because the value of it is that the systems are decoupled it sometimes makes discovery tough as there's no overly prompted connections between elements.

I would enjoy some more tag usage but there's other ways, like a default task or state that adds/removes tags to your context actor/object.

drifting ginkgo
heady silo
#

when I'm tracking values in the global AI variables, is it meaningully expensive to track the amount of ammunition remaining on the actor's weapon/ their overall ammo count? Or should I just be tripping bools saying "low on ammo" when hitting a certain amount? I want to control how much fire the enemy will lay down and movement decisions based on the enemy's state

robust veldt
#

Is there a way to make state in ST only transition when all task finish?

drifting ginkgo
robust veldt
drifting ginkgo
robust veldt
drifting ginkgo
merry blade
#

hey fellas i'd like to ask is there something known about blackboards that i might be missing that causes the keys to not be overrideable from tasks, services, or even the owning actor bp. i'm having an issue where every key isn't changing and my decorators are returning fails. sorry for the bad england

slow bobcat
merry blade
slow bobcat
merry blade
#

yes it does stop also i have a print on the right side that prints the boolean and the bbk value and that runs too, it used to be Target in Range and all pretty but its just me losing my mind. i copied it from the key directly. this is still on testing branch so i just name stuff like whatever. i really do wonder if there's anything that might cause this under the hood or somewhere i am missing. in a new project it works and i cant seem to recreate the issue

harsh storm
#

Regarding state trees - has anyone come up with a useful "cooldown" enter condition? Like the cooldown stuff in BTs. Every solution I've come up with has sucked. Requires more plumbing than I'd like. I am hoping that the new ExecutionInstanceData could help here, but I'm not on 5.7 yet. Also don't know if it'll be accessible for enter conditions.

Solutions:

  1. Use the GameplayEffect cooldown stuff. The thing that sucks about this is that it relies on GAS. But you could just check if they have the cooldown tag that gets applied. The GE will automatically remove it as well.

  2. Take that same idea - but just put a GameplayTagContainer on the actor in question. Then you also have to manage adding/removing the cooldown yourself. This just removes the reliance on GAS.

  3. Have cooldown times on the actor itself - check if they're off cooldown. This is very much not scalable unless you have some global cooldown for whatever action the AI is doing.

  4. Have parameters in the state tree (be it global or parent states) that have the cooldown time. The state tree conditions can't alter these values because the function is a const function (haven't tried native code yet). Idea was to update the cooldown time each time the enter condition was evaluated. But couldn't because it is a const function.

  5. Same idea as above, but in your action task, update the parameter to the last activated time and then for the enter condition, just do that comparison. But then this requires 2 variables per action. One for the last action time and one for how long the cooldown should actually be.

  6. This is a really cursed one - Have a global task (in native) that ticks. Expose a cooldown property for each cooldown you want. On Enter state, use reflection to get them all and add references to them to an Array. Then in tick, loop over the array and update the cooldown time. The suck about this is that it is in native - so iterations suck.

slow bobcat
harsh storm
#

Yeah - it is the solution for GAS projects. But I'd like a solution as easy as the BT cooldown stuff.

#

Without a dependency on GAS

slow bobcat
merry blade
harsh storm
#

Which variable is empty?

slow bobcat
scenic ingot
#

Hi if i have a NPC Chasing the player and then i change the target, the Npc wont switch "command" untill it finnish the current behavior tree "task"

#

how i "reset the task" or make it complete so it can run again

harsh storm
#

Are you using BTs? STs? Custom solution?

scenic ingot
#

bt behavior trees ?

harsh storm
#

Make sure the BB Key is being observed - and then when the value changes, abort self.

scenic ingot
#

yeah but chaning a key value to the same value will that trigger ?

harsh storm
#

Just like how you have that decorator on the Attack Sequence

#

But add in an abort option

harsh storm
scenic ingot
#

i would want the "enemy target as a blackboard key value" how do i add it ?

harsh storm
#

It is one of the two. I can never remember.

scenic ingot
#

yeah i know

harsh storm
#

Also - why are you using the BT like a state machine?

scenic ingot
#

but im not changing the key value

harsh storm
#

Having a key as AI_State is a big code smell for BTs

scenic ingot
#

(this is a pack i bought for learning behavior trees) i did not make it :;P

harsh storm
#

Oh, well, in that case - that's concerning

#

Shows a fundamental misunderstanding on how to use Behavior Trees

#

Behavior Trees are extremely straight forward.

scenic ingot
#

yeah but learning it is a a slope for sure

#

so i just start by tweeking stuff really, but your saying this is not the way a BT should run

#

?=

harsh storm
#

Its not the way it should be designed

#

You're (they're) just using it like a state machine.

#

So you're now managing the AI state AND the Behavior Tree

#

Not to mention you are having to handle the state machine's transitions elsewhere

#

IE - what sets it into the Attack AI_State

scenic ingot
#

yeah well i got the state switching under controll

harsh storm
#

For now

#

The issue with state machines is that as they grow, the transition stuff explodes

#

That's what Behavior Trees solve

scenic ingot
#

yeah i can imagain

harsh storm
#

Behavior Trees can be thought of as "priority" selectors

#

Put your highest priority behavior at the far left of the tree

#

And then order it appropriately

#

Each branch is then gated by some condition

scenic ingot
#

hmm i feel like i have to go back to the basics to learn this really

#

yeah

harsh storm
#

And the Behavior Tree will then just go from left to right until it can execute stuff successfully.

#

That is pretty much it in its most simple form.

scenic ingot
#

hm alright

#

but ill have to dig deeper later with that, maybe start from scratch doing my own

#

but for "now"

i imagain if i can add a actor reff in the "blackboard key value" section that when it changes it i can use "notify observer "on Value change" ?

#

right ?

#

or dosent work like that i suppose

harsh storm
#

You have a few concepts to understand to write a Behavior Tree in UE:

  1. Selector node - Runs each of its children, from left to right. Returns success only when the first of its children succeed.

  2. Sequence node - Runs each of its children, from left to right. Returns success only when ALL of its children succeed.

  3. Decorator node - This is primarily used to do checks (so like you already see). At least like 95% of the time I've seen people use it.

  4. Service node - This is just another way to have "parallel" running nodes. So you can put it on any other node and it can tick. That's what it is used for really. (I also like to use this as the way to alter data for a branch - though Decorator can be used to do that as well, personal preference)

  5. Task node - this is the leaf most node and where you do your actual work. So like finding something, moving to something, etc...

  6. Blackboard - this holds all the data that is accessible to the tree (not counting direct actor references like the AIController or Pawn)

scenic ingot
#

hm alright

harsh storm
#

And with that - you have all the information needed to actually write your own behavior tree

harsh storm
#

The "Notify Observer" property is the one that you want to change.

#

I can never remember which one will abort regardless if the actual value changes.

#

50/50 shot - so that means I'll get it wrong.

#

Also - is there any particular reason you're not jumping over to State Trees? @scenic ingot

#

As it is the future going forward. With plans to deprecate Behavior Trees.

#

It is certainly more complex than BTs though (at least in my opinion)

scenic ingot
#

hm well i just had to start somewhere

#

and i bough this badboy for like 5 bucks

#

so.. no reson just imagained this is how its done really

#

But thats for the info, im saving these text and i will try doing my own lateron!

celest python
#

Since when BTTasks are red? 🤔

#

My BTs keep losing data and BB reference

#

might be related?

#

side question: does SuspendBranchActions in BTComponent stop BT evaluation?

#

wtf RunEQS task delegates not exposed to BP

#

how do we get a callback??

celest python
#

so my tasks were also failing because of this

celest python
slow bobcat
#

you can run EQS wherever you want in c++. In BP's I don't think you can outside the BT/ST/Mass ecosystem

celest python
slow bobcat
celest python
slow bobcat
#

yeah but... an EQS requires a querier that is either an actor or an AI controller if I'm not mistaken

celest python
#

Right, but I should be able to provide it with a param. The task function should suppose to work in a UObject too but doesnt seem to be. I guess I won't use it

#

Btw, to clarify, it doesnt even get pasted to the graph as a node

#

Not that function doesn't work when executed in runtime

slow bobcat
celest python
#

Yeah, I am on mobile rn. Check the function I sent*, it's a BlueprintInternalOnly that to be used in Blueprints

#

Or I can send screenshots later on

slow bobcat
#

do you mean RunEQSQuery node?

celest python
#

Yes

slow bobcat
#

that's a BT node. That can't work outside the BT ecosytem

#

But in C++ is trivial to do that kind of functionality

celest python
#

Its a BP node

#

declared in UEnvQueryManager

#

It doesnt work in UObjects because BP compiler requires the underlying UObject to implement GetWorld function, which normally should work but doesnt in my own UObject for some reason

#

probably compiler is confusing the context because of this param

slow bobcat
# celest python

aaah you mean that one! I thought we were talking about the one in you previous screenshot form a BT. Sorry I completely misunderstood you

celest python
#

np, I was on mobile so couldnt be communicative enough 😇

slow bobcat
#

have you checked where does it fail here? I'm guessing it fails to grab the EQSManager?

#

due to how this works maybe?

celest python
#

It doesnt appear in the function call list in the BP graph

#

and when I try to paste it from another actor based BP it doesnt let me

#

so problem is I cant even call it at the first place

slow bobcat
#

aaah ok ok got you now

#

Yeah can't help much I'm afraid. I rarely use BP for this kind of functionality. We usually do our stuff in c++ and expose things to designers in BP's

celest python
#

partly #cpp question instead of #gameplay-ai i guess, since its kind of related with reflection system. but thanks for the initiative! ChillBar_bow

slow bobcat
#

let us know if you manage to fix it blueprint-side please. Always nice to know solutions for these issues

simple verge
#

anyone see any documentation or further explanation of Statetree "live property binding" from the 5.7 release notes?

slow bobcat
chilly nebula
simple verge
#

oh ok. Is this the completion/bug-fix of the feature of having a task with a property binding as a param variable? I was trying to get this to work in 5.6 but it just wouldn't update properly, especially in BP.

chilly nebula
#

if that was a ticking task, async or anything else that needed to update a parameter value after initializing then yes this is a partial fix for that. If you use dispatch/listen task delegates in the same state, then a fix for that is coming in 5.8

simple verge
#

awesome, thank you

harsh storm
chilly nebula
harsh storm
#

I just stopped using Output/Input because Parameter just allows me to do w/e I need at the time.

#

But in BP tasks - I just make it visible everywhere and that works too

#

But now I actually have a reason to use Output

chilly nebula
#

I think it would be clearer if there were only two types really. One that defines a new parameter (owned by the task) and another one that passes by ref?

#

what do you think would be the most intuitive approach?

harsh storm
#

Well - if we're stuck with relying on Categories (which is not intuitive at all) - minimizing them overall would be nice. But I'm not sure how large teams would work. I know having more explicit intent is generally good.

But I generally try to use the simplist stuff personally. If we could reduce it down to just two (Parameter and Output) - that'd be good. But as it stands, we have like 4 or 5? Context/Input/Output/Parameter

#

@slow bobcat Could probably offer a different insight. Because with more structured teams - having the restrictions on how something gets bound can be important.

#

We might even be able to reduce it down to one (just output).

#

Specifically for live property binding functionality though.

#

Because if you make stuff public - then, it is bindable in the task.

#

But again - I'm only speaking from a small team perspective.

hallow compass
#

what ExecutionContext struct type should i use to cache it for a undertermined amount of time ?

#

it seems that none can be used since their & operator are deleted

harsh storm
#

ExecutionContext is going to be created every frame

#

You can create a weak context though

#

Then from there, you have to make a strong context again

#

In 5.7, there is a new thing called like ExecutionInstanceData - that is meant for longer lived data.

#

But haven't messed with that yet as I'm still on 5.6

#

For the weak context stuff - look at how the EQS task does it.

#

That's what I copied

slow bobcat
harsh storm
#

Because variables don't really have a "by-ref" concept in BP land. Function params do.

#

So the bindings would need to be able to support that

#

So, an easy compromise for 5.8 (🙏) would be to just support the Output category and then rely on normal specifiers for everything else.

#

Small step towards greatness!

#

@chilly nebula 👆

#

Hope this answers your question!

drifting ginkgo
#

A BP enjoyer lens here but one thing that's a minor QoL that I'm finding missing in my 5.7 is the out/in visual that tasks previously had.

It's such a handwave element but I think the value it houses it clearly showing intent at a glance of a task. In a world of 1 category it'd be nice to see this somehow maintained, even if there's the occasional quirky input for Ref purposes.

covert blaze
#

What is the correct way (without using the deprecated handles) to see if a StateTreeTask was transitioned into from itself in EnterState. It seems very obnoxious as

SourceState has the following deprecation

    /** Transition source state. */
    UPROPERTY(EditDefaultsOnly, Category = "Default", BlueprintReadOnly)
    FStateTreeStateHandle SourceState = FStateTreeStateHandle::Invalid;```

but CurrentState still uses the FSTateTreeStateHandle.

How am i properly supposed to compare the source state to current state. The CurrentStateHandle is by index, and the source state is a unique ID that is not the index.
covert blaze
#

surely there is a non deprecated way to do this? been digging for 30 mins and im not really sure how to get a State via ID and then compare it against a state handle

solid spire
#

One of my most desired features for state tree is getting a debug output for sub/parallel state trees. Right now we can only dump the root tree running in the brain component and all parallel state trees it might launch we can't dig into to get even a print out of what states are currently active. (I'm talking about in the gameplay debugger, but also any custom tool)

Unless I'm missing something?

slow bobcat
solid spire
#

Yeah that definitely works. For my purposes it'd still be nice to get a quick view in game before I have to open up other windows and start drilling down into what's happening

drifting ginkgo
#

Anyone know why the SourceStateTree and other elements was deprecated from the transition? Trying to figure how to BP access the SourceTree without having to manually expose up the data

slow bobcat
robust veldt
#

It seem like I can not bound to member of tmap. Not sure it is supported in newer version.

chilly nebula
orchid barn
#

I am using behavior trees for first day and i am super confused

#

like... I defined a behavior tree task and what is proper way to call code from my character-derived blueprint class

#

I created ai controller, I use behavior tree in it

#

but my attack logic is function in my character at the moment and I doubt the proper way to interact is to use owner pin "Event Receive Execute", then use "get ai controller", then "get controller pawn" and start from there - seems to be wrong design on my side 😛

heady silo
#

You can use the task to call the event inside the actor via casting

#

Not sure if that’s necessarily the best way

orchid barn
#

well this is what i have right now

#

but this double casting feels like i do something wrong

#

another thing is this task is really not universal and will only work with one class and its subclasses, and there seems to be no way to block this from misuse on other kinds of actors

harsh storm
heady silo
#

yeah, Event Recieve Execute AI

serene fern
#

Anyone know why i cant use a enum on a property ref and set var on it ?

#

When i attempt to the enum has no spaces but when enum is used in type a space oddly gets put in when there should be none

#

I posted in there before i remeber there eas this channel you see

dull arrow
#

Has anyone gotten a good solution working for preventing multiple AI from selecting the same GeneratedNavLinkProxy ?
The regular nav link proxy has stuff in there to lock one up, but GeneratedNavLinkProxy doesn't seem to have that.
Overriding IsLinkPathfindingAllowed doesn't seem to prevent others from using it after they've already decided to use it for a path, we'd need something to get them to recalculate?

#

(This is about the auto generated nav proxy class)

hallow compass
#

Cant you set a class override for the generated nav links ?

slow bobcat
#

Seriously... Does that spam ever work? Fuck off from formative servers you morons

hallow compass
#

i still havent found a way to hide a task declared in cpp

slow bobcat
#

Is it a UObject class? Can you label it as abstract? Wonder if that works

hallow compass
#

C++ state tree tasks are structs

slow bobcat
#

Without the code in front I'm not sure

hallow compass
#

but in my case i got a base task that i want abstract

#

but it shows in the picker

harsh storm
#

The tasks generally inherit from that

#

Then check to editor code to see if they have some special thing

hallow compass
#

seems like meta = (Hidden) should work

covert blaze
#

Is there any way to access the weight of tasks within a linked subtree? Trying to have a 'random by weight' selection process for some tasks, but i'm also using linked subtrees with nested weights.

Wondering the best way to get that data and make the roll account for it.

dull arrow
# hallow compass Cant you set a class override for the generated nav links ?

Yeah I have one, but I wasn't able to have a link properly lock itself when it's about to be used, others still choose it when pathing for some reason.

Need to reserve it as soon as 1 AI decides to use it in it's pathing but there doesn't seem to be much in the way of notifying when an AI is moving to it until they've reached it, by then plenty of other AI have chosen to path to it as well.

mighty hornet
#

Hi... what's the best way to go about data persistence in statetree tasks? I assume that each time my state tree executes, new task instance data is created, is that right? So how do I make variable set by a task available to that same task the next time it runs?

drifting ginkgo
mighty hornet
drifting ginkgo
mighty hornet
drifting ginkgo
#

Can't guarantee 5.5 though

mighty hornet
#

In 5.5, doesn't look like that exists, sadly, not on the blueprint side nor in c++. I'll revisit maybe once I upgrade my project.

slow bobcat
celest python
#

@slow bobcat the issue earlier regarding to RunEQSQuery task node not appearing in my UObject was because GetWorld was not returning a AActor outer's world

#
UWorld* UCapability::GetWorld() const
{
    //Return null if the called from the CDO, or if the outer is being destroyed
    if (!HasAnyFlags(RF_ClassDefaultObject) && !GetOuter()->HasAnyFlags(RF_BeginDestroyed) && !GetOuter()->IsUnreachable())
    {
        //Try to get the world from the owning actor if we have one
        AActor* Outer = GetTypedOuter<AActor>();
        if (Outer != nullptr)
        {
            return Outer->GetWorld();
        }
    }
    
    return nullptr;
}

having this kind of a GetWorld function fixed it

slow bobcat
# celest python ```cpp UWorld* UCapability::GetWorld() const { //Return null if the called f...

Thanks for sharing the solution. Didn't know about TypedOuter.

You should catch GetOuter because if that's null (it can be null), you will get a crash.
I suggest you do something like this, catching it and using IsValid, since that checks for nullptr and it being garbage collected (or pending)

{
    UWorld* returnWorld = nullptr;

    //Return null if the called from the CDO
    if (!HasAnyFlags(RF_ClassDefaultObject))
    {
        AActor* OutermostActor = GetTypedOuter<AActor>();

        // make sure the OutermostActor is in a valid state
        returnWorld = ::IsValid(OutermostActor) && !OutermostActor->HasAnyFlags(RF_BeginDestroyed) && !OutermostActor->IsUnreachable() ? OutermostActor->GetWorld() : nullptr;
    }
    
    return returnWorld;
}```
mighty hornet
slow bobcat
static raven
#

Hey guys, I need to add some custom points to my paths that might not be ready on RequestMove. So I think I need to pass a FMetaNavMeshPath as InPath to Super::RequestMove, so it can wait until the path is finished

Anybody have experience doing this? I could found little/almost none info online about this

The code snipped below is inside FPathFollowingComponent::RequestMove, and is the path of the code I hope can be useful to me

// with async pathfinding paths can be incomplete, movement will start after receiving path event 
if (!bIsUsingMetaPath && Path.IsValid() && Path->IsValid())
{
  SetStatus(EPathFollowingStatus::Moving);

  // with path segment should be followed
  const uint32 CurrentSegment = DetermineStartingPathPoint(InPath.Get());
  SetMoveSegment(CurrentSegment);
}
else
{
  SetStatus(EPathFollowingStatus::Waiting);
  GetWorld()->GetTimerManager().SetTimer(WaitingForPathTimer, this, &UPathFollowingComponent::OnWaitingPathTimeout, WaitingTimeout);
}
#

the reason they are not ready at the moment RequestMove is called its because Im using a EQS query to find one of the points I want to insert in the path, so it will be ready at least the next frame

drifting ginkgo
#

@chilly nebula is there any information available if the IN/OUT visualization was removed intentionally or as a bug? Wondering if it should be expected to no longer display going forward? Visualization being akin to how context shows here. (Soz for ping but about to build system and can't find anything about it don't wanna commit if it's a bug)

graceful wind
#

Is anyone experiencing the StateTree Exit Task triggering even though I'm returning EStateTreeRunStatus::Running on both enter state and tick?

#

it is on 5.7

slow bobcat
graceful wind
#

The exit state I mentioned is Engage state. I have engage task there. I tried to put breakpoints on every possibility of "Succeeded" or "Failed" status on Engage task. it is not triggered. it keeps entering and exiting the task.

chilly nebula
odd tide
#
FVector FTDSRecastQueryFilter::RecastToUnreal(const dtReal* RecastPoint) const
{
    return FVector(-RecastPoint[0], -RecastPoint[2], RecastPoint[1]);
}

float GetPathPointCostFactor(const FVector& PathStart, const FVector& PathEnd, const FVector& PathPoint)
{
    FVector PathDirection = (PathEnd - PathStart).GetSafeNormal();
    FVector PointDirection = (PathPoint - PathStart).GetSafeNormal();
    return FVector::DotProduct(PointDirection, PathDirection);
}



dtReal FTDSRecastQueryFilter::getVirtualCost(const dtReal* pa, const dtReal* pb, const dtPolyRef prevRef,
    const dtMeshTile* prevTile, const dtPoly* prevPoly, const dtPolyRef curRef, const dtMeshTile* curTile,
    const dtPoly* curPoly, const dtPolyRef nextRef, const dtMeshTile* nextTile, const dtPoly* nextPoly) const
{
    dtReal BaseCost = FRecastQueryFilter::getVirtualCost(pa, pb, prevRef, prevTile, prevPoly, curRef, curTile, curPoly, nextRef,
        nextTile, nextPoly);


    FVector PointA = RecastToUnreal(pa);
    FVector PointB = RecastToUnreal(pb);
    FVector SegmentCenter = (PointA + PointB) * 0.5f;

    float Progress = GetPathPointCostFactor(PathStart, PathEnd, SegmentCenter);

    return BaseCost * Progress;
}
#

Using a custom filter?

graceful wind
# graceful wind looks like yes, not sure where this transition coming from, still looking on thi...

It looks like in UE 5.7 all child states (including their tasks) are forced to complete when the parent state succeeds. I need to get the current target from the parent task OUT and evaluate it once so the child states can reuse it. But since "Get Current Target" Succeeded, all child states are being forced to complete as well. I changed the State Tree hierarchy and moved "Get Current Enemy Target" into each state that needs it. It tried global task, but it only evaluated once

solid spire
drifting ginkgo
graceful wind
serene fern
#

Could someone help me with my AI pelase

#

here you can see it is trying to get to the box on floor which is where it last saw player

#

now there is a nav mesh there so it should be able to reach that fine but it seems to just sit on the Move To on the state tree but not actually move to the location and I can't work out why

#

thats the settings of the move to

serene fern
#

really need help here cause if I were to use target actor things appear fine but use destination and don't seem to work

#

you can see it seems to just stop working once its in that track player

rich pendant
serene fern
rich pendant
serene fern
#

its the move to in State tree

#

the one already there

#

so from what I can see here it's able to get the location on nav projected and this calls finish task with succeed

#

but for what ever reason it doesn't move on to the move to task which uses the built in move to state tree has

#

this only happens on this task and situation as well. all the other places I've used the move to built in state tree thing stuff is fine

#

i am so confused why this won't work

slow bobcat
#

If you check in visual logger for the navigation and path following categories, what does it show?

serene fern
#

so thats just before the AI looses sight of player

#

and thats after it looses sight of the player

#

that don't make sense

#

so thats saying the location it's trying to go to is 0,0,0 yet it can't be cause it's set

#

the location move to is using is a parameter on state tree which is set there on tick by a global task which is grabbing information from controller for state tree to use here and there

#

so i've verified the detected actor location is being set correctly to something other then 0,0,0

#

so i'm stuck here

#

from what I can see only when the AI switches to trying to move to the location does it all seem to break

#

where as when it's moving towards the actor etc it's fine and this is using the same node baring in mind

#

so you can see it has a location

#

and finish success task is called so it should be moving onto move to but doesn't appear it does and just fails

#

so that what vis log is saying when it looses sight of the player

serene fern
#

So ive had to park the issue for now cause i cant work out why it wont move to that location and ive double triple checked the location it should move to is valid and stuff

drifting ginkgo
#

Anyone running 5.7 ? and able to confirm they don't see the IN / OUT tiles akin to CONTEXT that you used to see?

azure dragon
#

hey guys, how is the ai seeing me (sight) through a door blueprint i have
it has scene -> static mesh
it gets sensed successful

but if i just put a static mesh without a blueprint it can block it

slow bobcat
azure dragon
#

2 doors block it but not one

#

it's like it's too thin or the ai can see through it lol

slow bobcat
#

Umm strange. Are you checkign the setup in runtime? Just in case you are changing something without knowing

heady silo
#

tbh the AI can just see through static meshes too by default, it's really annoying

sullen crater
#

Hello guys! Why it doesnt work? I try get player in parent state and check is valid in child state, but it doesnt work! Active state after BeforeStartSearch set OnStopFearSmellSearch

wise sluice
sullen crater
#

Thank you

sullen crater
wise sluice
#

Yes enter conditions are executed first to decide if your whole state hierarchy should be entered or not

#

The documentation of statetree explains how state are selected and executed
With "TryEnterInChildren" The parent is not entered if we didn't selected a proper leaf

#

BUT once it got executed, it executes the enter states of the whole hierarchy in order from top parent to last children

sullen crater
#

Thank you very much!!!

serene fern
#

for some reason when the AI trys to either go to players last seen or really any location the AI breaks down and fails it seems

#

but when the AI is doing everything else it's fine and does it with minimal issue

reef trellis
serene fern
crystal brook
#

yeah that also happens to me.. the ai jsut either thinks theres no threat any more and wont flank or something else i am not sure why... (but I am using a experimental nav volume for a planet)... which overall works.. but some times the AI just gets stuck infront of another one with that option switched on ... but also seems to make it better in other ways, atleast they dont completely give up if that makes sense

#

and yeah they do some weird side way runnning thing also

#

not sure if any ones seen that

crystal brook
#

but if your ST does have a percieved threat and you dont fight back then it might also be functioning perfectly

#

fight back they start to flank/evade again

serene fern
#

so i think I've found the issue

#

so I pull the detected Actor location from AI Controller and set it locally on the global task

#

and then when AI looses sight of player the Detected Target Location is not updated any further so should be what ever it was last set to

#

however it seems for some reason even though its being set, it seem to show it's always 0,0,0 and never set to anything which I don't get

#

fixed it

#

I forgot that before I was setting a global parameter using set var and I changed it to just be a vector that can be linked to in doing this I never removed the link between the vector on global task from the global parameter so it essentially was working as designed just not how I thought it was working

crystal brook
#

who ever was saying they cant see the IN / OUT stuff
?

#

and yep @serene fern are you ticking to the next task such as "evasion" for exaple at the end of the state

crystal brook
reef trellis
#

anyone having issues with EnvQueries on state trees? If I put this on a test pawn it works fine, but in the state tree the results always come out as empty

reef trellis
#

ok, to my understanding the perform scan is executed before the query can finish, so I guess I'll have to use different states?

reef trellis
#

ended up going with performing tasks in different states, would have liked it to be possible to do in a single one though

#

also with custom state tree task to run the envquery

harsh storm
#

I believe Siggi said they're working on this stuff.

reef trellis
#

have to do a lot of these "hacks", different states with bool check enter conditions

harsh storm
#

That depends entirely on your game

#

I haven't had to do any of that

reef trellis
#

you aren't using async tasks?

harsh storm
#

I am

reef trellis
#

how do you handle waiting for a result within the state tree?

harsh storm
#

Depends on the context.

#

Looking at just what you posted in your most recent screenshot - the enter conditions on the two states don't make sense to me.

#

Do you only want to scan one time or something?

#

Is the EQS doing the scan?

#

If so, why are there two tasks for a "scan"?

reef trellis
#

the eqs is acquiring the 10 locations, and the perform scan is rotating the character around those points

#

I don't want it to keep running the eqs everytime it goes back to the parent, if it's already running

harsh storm
#

Why would it leave the "Perform Scan" state?

reef trellis
#

I set it to, perhaps I shouldn't have?

harsh storm
#

The EQS task should only complete after the EQS query completes. Or it should fail for some other reason.

#

Okay - so it fails when there are no vectors. That should be an enter condition

harsh storm
#

If the state requires valid entries in an array - it should be an enter condition

reef trellis
harsh storm
reef trellis
harsh storm
#

Correct

reef trellis
#

thanks for the brainstorming

harsh storm
#

And if you ever introduce state interruptions - make sure you handle the Exit State

reef trellis
#

do you mean "on tick" transitions?

#

or on event etc

harsh storm
#

No - I mean if you plan on supporting going from one state to another without the active state being what determines that.

#

IE - send state tree event

reef trellis
#

yeah I have thoses

harsh storm
#

Or some running task that executes a transition delegate

#

etc...

reef trellis
#

what should I do in the exit state exactly? finish task terminate any running async task?

#

or query in this case

harsh storm
#

Just clean up your query.

reef trellis
#

I have check in each state if the motivation changes, for transitions

harsh storm
#

I don't recall the exact API for it. But just make sure you cancel it if it is running or something.

reef trellis
#

ok thanks for the input

harsh storm
#

Sounds like a global task that could be doing that

#

And then it can then tell the state tree to transition

reef trellis
#

and call an event?

harsh storm
#

Or use the State Tree delegates.

reef trellis
#

so it's not ideal to do this?

harsh storm
#
  1. The "Motivation" enum seems redundant to me. It looks like your managing a state machine elsewhere AND this state machine. If I'm wrong, then just ignore me.

  2. The STT Adjust Movement Speed could be on the Aggro state (not that it has to mind you). Enter State = change movement speed. Exit State = reset to default.

  3. There is no reason for the enter condition on the Attack state. That's what the acceptance radius in the Move To task is for.

  4. Depending on how you want the AI to behave, the "STE AIPerception LOS" enter condition could be redundant as well. Once you actually successfully get the sight, you can immediately transition to the Aggro state. Of course, if you have some other reason for it, ignore me. (Like maybe you want to have some delayed investigation or something, but even then, you don't really need that kind of book keeping)

reef trellis
#
  1. just using the motivation for the state tree, mostly just for blocking entry to the states

  2. hadn't thought of that, actually nice idea

  3. there was a reason for me adding this, can't justify it now, I'll do a check, thanks

  4. I use it for other internal checks and for investigate, but yes it is redundant for aggro state

harsh storm
#

The extra enum is extra book keeping for the sake of extra book keeping

reef trellis
#

but to my understanding the state tree will always try to run each state, so there needs to be some kind of gate keeping, no?

harsh storm
#

Proper Enter Conditions