#gameplay-ai

1 messages · Page 85 of 1

harsh storm
#

I can easily push it to 100+, but the reality is, unless I'm making like Dead Rising - zombie games don't often need that much.

#

Just have like 40-ish and reuse 'em

#

Design the level around it 🥳

slow bobcat
#

Yeah my experience is with games with heavy AI, animation, navigation etc. "proper" npc's

harsh storm
#

Zombies are, without a doubt, by far, my main area of interest for AI 🤣

misty wharf
#

Project Zomboxxigar when

harsh storm
misty wharf
#

:D

harsh storm
#

Like, I'm not even kidding either, lol

#

I make so many zombie game/prototypes and talk about so many ideas - it is a running joke in my gamedev circle

#

So pretty much every game has some kind of zombie in it

#

Even conjured up a zombie dating sim game 🤣

#

Mainly as a joke, but still

misty wharf
#

That sounds like it could be a hit

slow bobcat
#

You should definitely Game Jam that...

hallow compass
#

Common AI Behaviors plugin is shaping nicely

hallow compass
#

In this session, Roland Geraerts of uCrowds explores the core design ideas of the TerraCrowds engine, including its integration with Unreal Engine components like MetaHumans and MassAI.

This session covers memory-oriented design, crowd logic for controlling characters, and the Explicit Corridor Map for efficient pathfinding. Other topics inclu...

▶ Play video
obsidian delta
#

does anyone know why breakpoints on state tree in blueprint dont work?

#

I feel like im missing something obvious

hallow compass
#

It works but will be after IDE, BP graph breakpoints

#

Be sure the breakpoint can actually be triggered

celest python
#

Tick aggregation, vblanco trick, significance manager, multithreaded anims and somehow making montages not bottleneck cpu helps you reach ~50 on PS4 hardware i think

obsidian delta
#

I know that the tree runs those states from breakpoints in cpp

hallow compass
#

Weird

obsidian delta
#

also i see that my state tree completely ignores an event lol

#

doesnt even evaluate it

hallow compass
#

Show setup and give context

obsidian delta
#

theres nothing crazy going on

#

it usually cycles the last 3 states

#

and goes back to root

#

I know that this runs

#

I guess i can try tacing what it does with the event in cpp

slow bobcat
slow bobcat
obsidian delta
#

I dont really know what its doing with the event i sent it

hallow compass
#

Check debugger

obsidian delta
#

i dont see anything

hallow compass
#

Play your game and pause/stop when the event should of been triggered

#

Playback in state tree debugger to see if it got tried

obsidian delta
#

hmmm it doesnt show me anything

obsidian delta
#

Ok i just figured im dumb

#

i was supposed to force transition from states in root

#

cant just expect the tree to transition because i sent it an event'

slow bobcat
#

I imagine you are discussing something in the thread but not sure what / with who. Also do you have the original source of info? Who is VBlanco?

celest python
#

Instead of moving something with a movement component which calls MoveComponentImpl, so use that static function to update the location manually

#

~2.6x faster on megafunk's tests

#

for example, that MoveComponentImpl is beyond disgusting yet it runs for a niagara particle

#

a particle which has no collision does not require any of the things that function is doing

slow bobcat
#

Ok so this is not for characters but for other things withiut physx no?

celest python
#

for components that does not require the steps MoveComponentImpl doing, so its for components characters using

#

but probably not for the capsulecomponent

#

it could still work for capsulecomponent if you dont need how it slides you once you collide with a wall etc.

#

unity-like basic movement

#

biggest problem is marking render state dirty cant be threaded

#

if you can achieve that vblanco trick can run on other threads

celest python
#

he shared the code with us through megafunk

#

he was quite active in early days here

slow bobcat
celest python
#

yep but its the same code just on github 😄

#

with no further usage examples

slow bobcat
#

I don't know what megafunk is

slow bobcat
#

Aaaah I see ok ok

#

Thanks a lot for this.

#

Ah wait hahaha this is Vori's repo!

#

We worked together for a bit in the se company

#

I talked about this with him but never checked the repo

#

Nice

celest python
#

ah yeah, mega and vori authoring the repo together 😄

runic flare
#

I have seen Siggi mention the term property binding functions a bunch -- can someone explain what that means exactly? I'm looking for a way to bind functions in state tree nodes (primarily conditions) so I don't need to sync duplicate state (e.g. I don't want to bind to a bIsVulnerable, I want to bind to a bool IsVulnerable() const), I'm wondering if this is what he's referring to and if so how do I do this?

crude mirage
#

how do you make enemy ai? i’m specifically confused about state tree tasks but really any ai in general

celest python
#

it exists in anim BPs but not on state trees

#

i dont know what is the technical reason it didnt exist at the first place or was it a design decision but it'll improve things a lot

celest python
#

there are many inspiring resources to get you started

obtuse igloo
#

Hi all! I was wondering if someone could help me figure out the Move To Actor Or Location node, I want to use the actor goal and have my ai follow a toy ball as the continuous goal. But when I use an actor and the ai is within the acceptable radius, it isn’t firing off the finished event.

So I swapped to see what would be different if I used the Location of the toy ball actor as a goal instead, and it fires off the finished event just fine, but of course the ball would not be in the location the ai went to (because the ball is rolling around). This is why I wanted to use the Actor goal instead and get notified when the ai has reached the ball (and then kick it).

Any suggestions appreciated! I tried explaining the best I could ^_^

chilly nebula
green loom
#

Heyop - any idea why the EQS appears to work differently run time. The test pawn shows the 0 score on where the character is at and two green ones in the flank. In the in-game view, the character (BP_Valkyrie) moves to one but the point scoring appears to ignore the Distance to Querier filter. 😩

#

(Test pawn in the first image has the same valkyrie model. The context is player start in editor - and the player in game)

hallow compass
#

task handles arent unique across multiple state trees ?

#

two state trees on two different AIs will return the state state handle for the same executed state

slow bobcat
#

I'm not sure about this but isn't the handle a way to identify a state in a tree to grab its Execution data?

hallow compass
#

If 2 AIs runs the same events with same runtime data

slow bobcat
#

Handles are incremental from 0 (not valid) to N. If they run the same in the same order...

frank trellis
#

my AI Moveto isn't working even though i set a location and what happenes on success. Can i Get help? (Yes, I have navmesh)

celest python
#

print this

#

from on fail

#

then check vislogger

frank trellis
#

how do i check vislogger?

celest python
#

tools tab in editor

frank trellis
#

seems like they DO move, just for a split second

#

should i show more code?

runic flare
# chilly nebula yes you can bind to a function like that, its exactly what binding functions are...

This is great, thanks! Just so I'm sure I understand, let's say I have a UHealthComponent which is part of my tree's context. I have a function bool UHealthComponent::IsVulnerable() const --> in order to use this function via binding, I basically need to create a wrapper where I define InstanceData that has a member UHealthComponent* HealthComponent, then I define a struct that inherits from FStateTreePropertyFunctionCommonBase and the override its Execute function where I'd do InstanceData.Result = HealthComponent->IsVulnerable() ?

chilly nebula
celest python
burnt wraith
#

Does anyone know how to mitigate delayed animation montage section playing on clients? I have a state tree triggering a gameplay ability on my AI that is a serveronly ability and is supposed to play an animation montage section that is to melee attack. On the Listen Server it's fine, but when I switch to client it lags at the start of the animation and then finishes the animation and calls my OnMontageCompleted function. I tried making a Multicast function on my pawn that is called by the GA to play the animation on the clients, but there is still a lag

chilly nebula
celest python
regal patio
#

Телеграм канал!!! - https://t.me/chE_pUhaaa
Дискорд сервер!!! - https://discord.gg/AWdYDgjBbN
Підтримати Хеквіза(і чєпуху!) - https://donatello.to/HackWhiz

Підпишись і постав лайк, не будь чєпухою...

Таймкоди:
00:00 - Вступ
01:15 - Яке завда...

▶ Play video
blazing flax
#

i'm trying to disable RVO collision after an enemy dies, so that other enemies don't yoink around the corpse and will just run through it, but nothing seems to work. I've tried a few recommendations from around the internet:

  • detach from controller pending destroy
  • un possess
  • updating avoidance group mask
  • changing movement modes

but none of them seem to work. I'm 99% sure its not a collision thing, because disabling RVO entirely prevents the behavior. it just seems that disabling it when they die has no effect

tranquil meadow
#

This is more of theoretical than something more concrete. For enemy AI design using a ticket system, how do you guys handle using different moves that may have different range requirements with tickets?

slow bobcat
#

If you figure out those two, you will learn how to disable it

#

There should be a function (probably in the movement component or the AI Controller) where it looks to nearby agents to calculate the velocity

hot narwhal
#

Hello, i have a really weird bug where my state tree execute 4 or 5 times for one controller. I have a state tree ai component on my ai controller, i disabled the start automatically and just called start logic in the possess event. When i play in editor, with one player, i have 4 execution lines in the debugger of the state tree. I created a task that is executed on the root node and that juste print string for one frame, and the print is appearing 5 times. I testes with the ai being spawner as well as being places in the world but i have this bug in both cases. Does anyone have any clue about this ? I am using 5.5

#

I have an evalutor where i print string that is called only once

slow bobcat
hot narwhal
#

That means my tasks are executed multiple times one the same frame it feels like a bug more than a feature

slow bobcat
#

Yep. I agree. Sounds like a bad hack

hot narwhal
slow bobcat
#

Ctrl+F "while (" and you should find it

#

I'm in a car in a road trip so no way I can check

chilly nebula
hot narwhal
hot narwhal
slow bobcat
#

The loop uses a variable Calle MaxIterations iirc

#

Aaah it's not a while, it's a for

hot narwhal
#

But it is weird that on the debugger itself there's 4 executions lines, i think it is a different problem

celest python
#

Right now my custom AI system does everything state tree does minus the editor. Each goal returns an array of score struct and utility component does the calculation based on the data it received to select the most important goal. Only missing feature right now to carry this to ST is dynamic weights/scores

chilly nebula
celest python
#

alright, I completely missed we can even add float inputs

#

appearently what I was looking for already existed for a long time

hallow compass
#

anyone knows from where is the stimuli debug trace sphere and age drawn ?

#

cant find it, thought the perception comp/system still had an dead stimuli but Perceptual Data is empty

#

so idk where it comes from

chilly nebula
chilly nebula
hallow compass
#

this is the legacy system

#

pressing 4

chilly nebula
#

could also be in gameplay debugger 🙂 (yes, we are working on consolidating it all)

hallow compass
chilly nebula
#

stimuli is part of perception yeah, you seeing entries you dont know where are coming from?

hallow compass
#

gif is low fps but basically it spams the collapse/uncollapse so nothing is usable

hallow compass
#

but after the MaxAge, i dont see the stimuli anymore on the perception comp & system, but its still drawn

chilly nebula
#

you looking specifically for the code where the debug drawing is happening yeah?

#

@hallow compass I guess you've already seen UAISenseConfig_Sight::DescribeSelfToGameplayDebugger() ?

hallow compass
#

yep, lots of stuff but not the specifc draw sphere, line and text

celest python
#

hmm, so my final mental struggle is - in my current system each goal scores itself and a component that manages all scoring system just calls Goal->Score(...);, while in ST its more "top-down", as in, it looks like scoring and considerations only happen through the state tree graph. but it makes a lot of sense since collection of systems form a behavior in the graph instead of tasks creating monolithic behaviors through OOP. Composition over OOP i guess

so if I have a tree that has a sequence of nodes that links two assets: "slide towards enemy (one asset) and shoot enemy (one asset)", that always has a requirement of a same specific condition to get a higher score everytime, I'd need to put that consideration everytime I link the state tree asset combining two behaviors because there is no way for ST to receive this info from the asset itself

am I right or is there any workflow to make this easier 🤔

chilly nebula
# celest python hmm, so my final mental struggle is - in my current system each goal scores itse...

The scoring is run as a state selector, and yes you have to have those states pre-authored. We are looking into ways to expand on this in the future, for example to score multiple targets (like ranged attack 10 different targets, and score them on distance, hp remainin etc).

For runtime composition, you might be able to have "slots" for activities in your authored tree that you override at runtime (using tags) with external assets if you want to re-use specific states across multiple trees or selector nodes.

Having to score each action separately is a cornerstone of utility scoring, and the re-usable pieces are the considerations (like distance, or remaining health on target).

chilly nebula
hallow compass
#

thanks!

digital pilot
#

anyone know if you need to add nav data collision to a mesh in order for AI to jump on top of it? Or is there an actor or reusable thing to use you can just drag out and it will add it for you?

hallow compass
#

Any primitive with a collision and nav enabled can do the job

odd violet
#

Quick question, I'm trying to use AI StateTree schema with my StateTree Asset on my Enemy AI Controller class as a component. I know about the "Context" use in StateTree task variables to get the State Tree context actor as a State Tree built-in feature, however this is my first time using the* AI State Tree schema* and I've assigned the Context Actor Class to to be MyChracterClass and my AIController Class to be MyAIControllerCustomClass however, even though in the StateTree Editor UI there's mentioning of both, in one of my tasks if I try to create a "Context" variable of type MyAIControllerCustomClass it's still invalid. Is there a proper way of initialising the AI Controller Context variable in State Tree Tasks when using the AI StateTree schema with StateTree assets on AI Controller classes?

#

I've attached some quick screenshots to better explain. I know there's the option of using the Context Actor class instead, but I was hoping to use the StateTree asset by attaching a StateTree component onto my AI Controller rather than the Character class. Does anyone have any experience with this? I tried googling and looking for YT tutorials but everyone just seems to use the Actor Class as Context instead 🤔

autumn grove
#

Has anyone tried to train an Open LLM onto the Unreal Engine 5 source code to create an actually useful, correct code helper for "vibe coding"? ChatGPT and others just hallucinate the shit out of everything. And provide at best 70% correct solutions.

worthy lagoon
#

Anyone know why my navmesh works in editor but not when packaged?

slow bobcat
slow bobcat
autumn grove
slow bobcat
#

So far, chatgpt5 (lates model) yields the best results and it's still veeeeeery far from good

autumn grove
lost plinth
#

hello, I need a bit of help with my behaviour tree

#

I plan to just have a simple perception system with the use of sight

#

I have already got my AI to do a simple idle and walk to a random location behaviour however I have issues when trying to get my AI to move to a specific object

#

I'll post some helpful screenshots

hallow compass
#

Just learn the engine

lost plinth
#

In the first screenshot, I have my behaviour tree, the second screenshot shows how the AI itself works, and the last screenshot shows how the AI is spawned

#

the issue I have is, this specific branch of the tree is failing, which is the perception part and it causes the whole tree to fail

#

I believe I have the correct stimuli set up as well as my config file

#

and since my AI is spawning I have set the setting in the pawn to have the behaviour tree control the AI when it is spawned

#

I'm just unsure where I might be going wrong

#

if anyone has any idea I really do appreciate the help you can provide!

slow bobcat
lost plinth
#

well this is the state of the blackboard keys

#

ok so I've found out two things

#

when an AI can't see the object as it isn't in it's line of sight, the tree fails

#

when the AI can see the object, the tree does run, but it still doesn't move because the move to function is called for a split second then immediately goes back to the wait condition

#

so I think if it is in the line of sight, it does percieve it, but I'm confused why the tree itself fails when it isn't in the line of sight

lost plinth
#

been playing around and I'm still not getting anywhere

#

for whatever reason it looks like my AI behaviour tree, if the AI can't percieve the object, it does go into the second branch

#

but the second branch doesn't call the service, which should set a key called idleorrun to be 1 or 2

#

instead the key remains as a value of 0

#

and I don't get why, because this service should be running independent from the AI tree

slow bobcat
#

A service will run if:

  • the service is on a running task
  • the service is on a composite node (selector / sequence) and a task within the composite node (or a children of it) is running
#

The selector on the left will only run if the task below it runs, and that's not happening because the decorator prevents it

slow bobcat
#

If you set breakpoints in the BT you should have a better image of what's going on

lost plinth
#

I was trying to use breakpoints but they didn't really activate

#

though now I think I realise that it just was because the service wasn't being called

slow bobcat
#

I mean breakpoints in the BT nodes within the BT editor

lost plinth
#

I've changed my tree and I solved the issue with the service

#

I still need to investigate the actual perception part though

#

something interesting I found

#

it seems that because the stimuli are static, the AI doesn't seem to walk to them

#

but when I move the location of the stimuli during gameplay, the AI is then more interested to walk to it

quartz shadow
#

Hi ! Is there a dedicated channel for State trees ? Is this in Mass ?

misty wharf
#

You can ask ST related things here

lost plinth
#

something I also just wanted to know

#

how could I make my AI stop a certain distance from an object

#

so if say they were walking towards it they stop within a radius of 10 units

misty wharf
lost plinth
#

I forgot that was in move to

#

thank you!

misty wharf
#

👍

final prism
#

Does anyone have an idea what the "cluster links" in recast are? It seems they are used for hierarchical pathfinding, but i can't find any documentation on these anywhere..

lost plinth
#

hi does anyone know the node that does this: it finds the nearest reachable point on a navmesh from the given location

#

I'm realised that is why my AI is failing

slow bobcat
slow bobcat
lost plinth
#

so just a scalar value?

slow bobcat
#

look for the node Project point on navigation and you will se what I mean

lost plinth
#

hmm I tried using it but my location ended up being 0,0,0

#

how exactly is it meant to work?

slow bobcat
#

You pass a location and a extension (x, y, z) and the system will look for the closest nav point withing that extent (if any)

#

Let's say your location is 1, 1, 10. Your extent needs to be at least 10 on the Z axis or it will never find nav

lost plinth
#

ah ok

#

thank you, that works perfectly now

odd violet
#

Ok, is there a particular reason why AI StateTree component start even though I unchecked the "Start Logic Automatically"

misty wharf
#

Oh they went from it never starting automatically even if you have it checked to always starting even if you don't have it checked?

hallow compass
#

if only spline metadata was nicer to use ... i wouldnt have to have an ugly array to sync with the splie points

odd violet
runic flare
#

This article from last week shows new methods of avoiding tick in State Tree in 5.6. It explicitly mentions, and shows, a version of Run EQS Query that fires a delegate when results are ready. Is it just me, or does that task not exist in 5.6? I can make my own but the article showing me the exact thing I want gives me pause -- am I missing something?

Epic Games Developer

Tips and tricks for optimizing performance for StateTree by utilizing the new Scheduled Tick Policy to limit the amount of ticks or to use async tasks t...

#

Ah I see the article was mentioned here, maybe you can clear this up for me Siggi?

quartz shadow
#

Hey ! I have a question regarding meta properties on ST Tasks etc.... If we create a linked asset and we expose a variable from a task being processed in this asset. Then when used in another ST all meta specifiers linked to the property exposed seems not to be propagated correctly. Is this expected/known ?

Example: Let's say I have a task with a float that I want to cap to 0 - If I promote this variable as a global parameter of my tree I can now set a value below 0. Solution I found is to have the instance data wrapping another struct so that it works as expected but it's far from being a great solution as it create other issue

Context: I am investigating composition of ST and how we can reuse them easily (I am on 5.5 BTW)

stable plover
#

some people said disable is worldpartitionednavmesh, i did that and no luck

grizzled schooner
#

Hey everyone,

I'm looking to learn more about StateTree's - is there any good written books/documentation on it?

slow bobcat
slow bobcat
#

With sub levels you need to add a nav bounds volume to the persistent to ensure the recast object is generated there, so nav chunks can be added/removed at all times

stable plover
stable plover
#

Attached 0 tiles to NavMesh
weird I got this in the logs

#

but my chunk actors exist

grizzled schooner
stable plover
#

yea @slow bobcat the tiles attach in editor its pie

#

when i build LogNavigation: Verbose: pos: V(X=-64000.00, Y=-89600.00, Z=9650.00) ext: V(X=12799.00, Y=12799.00, Z=3011.00) LogNavigation: Verbose: URecastNavMeshDataChunk::AttachTiles Attaching to NavMesh - RecastNavMesh_UAID_5811228C0404AA9802-Default LogNavigation: Verbose: Attached 169 tiles to NavMesh - RecastNavMesh_UAID_5811228C0404AA9802-Default LogNavigation: Verbose: [NavigationDataChunkActor_UAID_5811228C0404BC9802_1504567100] ANavigationDataChunkActor::AddNavigationDataChunkInEditor LogNavigation: Verbose: pos: V(X=-89600.00, Y=-64000.00, Z=7200.00) ext: V(X=12799.00, Y=12799.00, Z=1741.00) LogNavigation: Verbose: URecastNavMeshDataChunk::AttachTiles Attaching to NavMesh - RecastNavMesh_UAID_5811228C0404AA9802-Default LogNavigation: Verbose: Attached 169 tiles to NavMesh - RecastNavMesh_UAID_5811228C0404AA9802-Default LogNavigation: Verbose: [NavigationDataChunkActor_UAID_5811228C0404BC9802_1504558095] ANavigationDataChunkActor::AddNavigationDataChunkInEditor LogNavigation: Verbose: pos: V(X=-89600.00, Y=-89600.00, Z=9735.00) ext: V(X=12799.00, Y=12799.00, Z=2426.00) LogNavigation: Verbose: URecastNavMeshDataChunk::AttachTiles Attaching to NavMesh - RecastNavMesh_UAID_5811228C0404AA9802-Default LogNavigation: Verbose: Attached 169 tiles to NavMesh - RecastNavMesh_UAID_5811228C0404AA9802-Default LogUObjectHash: Compacting FUObjectHashTables data took 1.60ms

#

so my conclusion is that they are not getting serialized

muted fossil
#

Maybe some kind of dump question regarding StateTree, but how do I avoid that there is an infinite loop happening from root to idle and idle to root?
While ActorState.TaskState is idle it will loop infinitly instead of staying in the idle state and thus call STT_Idle all the time even though the idle animation is already looping.
Any tip?
(in 5.5 this was not a problem btw, guess they changed sth in 5.6 in that regard?)

muted fossil
#

is there a better way to solve this except introducing an empty state?

slow bobcat
#

If all of them fail their conditions, you are pretty much trapped in root indeed

muted fossil
#

yeah

slow bobcat
#

If you want you can add default for clarity (we have the same, we call it dummy state), but gives you nothing aside understanding the tree better when reading it. It's fine if you are just in root until something happens

muted fossil
#

moved the default state to the very end of the state list, otherwise it will never evaluate the other states if default state is at the start obviously 😄

muted fossil
slow bobcat
muted fossil
#

yeah for more complex stiuations that might be not sufficient

reef trellis
#

Hello everyone. I'm experimenting with State Trees for a project of mine. And have been stuck with an issue that I can't seem to fix, probably due to a lack of understanding. I've read a lot of the pinned post hoping to find a solution, but haven't been able to find something that explains what I'm experiencing.

This is my state tree. I am using it in conjunction with smart objects' gameplay behaivours and it runs on a AI character. The character is able to roam, look for work, start working, re-evaluate and change just fine.

Roam - [OnCompleted] -> Next State :
Move to Random Location - 1st Task: Get Random Location (does not affect); 2nd Task MoveTo (affects completion); [OnCompleted] -> Next State
Wait

Look for work - 1st task: Search for smart objects (does no affect completion); 2nd Task: claim smart object (does not affect completion); 3rd Task: Move to smart object location (affects completion); [OnSucceded] -> Work; [OnFailed] -> Root

Start working - uses the smart object (runs the gameplay behavior)
Reevaluate - search for smart objects with higher priority than the current one
Change work - stops current and switches to new smart object in case it finds one.

When performing one of the jobs (which is to carry an object from point A to point B), while waiting for the Event to trigger in the "Work" state (which should only trigger when move to + playing an animation on arrival finishes), it jumps right into Roam State for some reason, before the event is even triggered, all while playing the deliver animation.

Does anyone have any idea of what I could be doing wrong?

chilly nebula
chilly nebula
chilly nebula
quartz shadow
# chilly nebula the "interface" to linked assets should be tree parameters, so you expose and bi...

Thanks for your answer ! Yep that's what I did but the issue is that meta spécifiers are not propagated. Let's say I create a ST asset and want to expose a param of a task as an input of my tree i.e tree parameters. When promoting the variable from my task to a tree parameters all meta spécifiers (Like ClampMin/ClampMax etc..) are not propagated.

So if I write a state tree task which take a float parameters with ClampMin = 0 for example I could technically set a négative value after promoting this variable to a tree parameter , same issue with gameplay tag filtering etc....

final prism
#

Is there a way to share data from sub state trees to the main tree? Outside of sending events

chilly nebula
chilly nebula
final prism
chilly nebula
quartz shadow
# chilly nebula That might be a bit confusing, but its because they are different parameters. Y...

I see indeed but is there any plan to expose task, Condition, etc param as a tree parameters (Or another category that is tweakable from parent ST) so that it can only be bind to this task and we can propagate spécifiers ?

Because without it, It break a bit the "data validation" assumption we can do using spécifiers.

Or is there a better way of achieving what I want to do i.e create small reusable trees that have input param with restricted value ?

Again thanks for taking time to answer this is really appreciated

quiet iron
#

Theoretically, with the same AI behavior implemented with Behavior tree and State tree. Do they have any differences in performance when scaling?

hallow compass
#

ST better afaik

#

You can have more controlled ticking, or completely event based state tree

#

BTs needs to tick to run a state

hallow compass
#

is it normal that the move to fails here ?
im allowing partial path, but it fails to project the location (gizmo here) on the navmesh

final prism
merry blade
#

hey folks how does one simply make tick work in state trees, my global task and my regular tasks refuse to tick for whatever reason

chilly nebula
chilly nebula
final prism
chilly nebula
final prism
# chilly nebula Did you use FStateTreePropertyRef ?

The only thing available in editor is the FBlueprintStateTreePropertyRef. If I make the property a normal property, then bind to it via a property ref in the subtree, im not sure how id propagate to the parent tree, as the subtree state type doesnt allow me to add any tasks

#

unless I can create a property ref that binds to a property ref?

chilly nebula
#

As I mentioned, this is difficult with BPs 🙂 it needs to be done in C++. Thats part of the reason why we are working on something better for this pattern

#

But no, I have not tested this with subtrees

final prism
#

And that's the only thing shared between the sub state tree and the state tree calling it

chilly nebula
#

good point, my head was still in tasks which is where I've used this

#

that wouldnt work anyway, since you cant reference the parent tree's properties. The parent tree would have to be the one pushing a reference into the parameters

#

@final prism actually, it might sorta work? I could setup the bindings at least. Just remember to set the underlying type of the property in order to reference it

#

This is on 5.7 fyi

hallow compass
#

i like the new ST icon

final prism
# chilly nebula

oh hold up, Im on 5.6, but this may actually work, I think i cant bind to anything because my test tree doesnt have any other properties..

chilly nebula
#

I was able to bind the ref to a tree parameter, state parameters etc. I didnt check if the value goes through or can be changed. Im interested to hear if it will work

final prism
#

I would still need to be able to create a task with a property ref that binds to this property ref, not sure that would work

chilly nebula
final prism
final prism
#

Does the state tree debugger have a way of inspecting data state? It seems to only show running states

quiet iron
misty wharf
#

The one very neat thing about ST's is that you can run multiple on the same actor at the same time if I remember correctly

#

Eg. you can have a character be controlled by an ST, and it can interact with a smart object, which in turn has logic via a state tree to control the character for the interaction

#

I've not tried it though so maybe someone can confirm how well it works :) I know in theory the scenario I described is possible with behavior trees too, but in practice it's pretty clunky because it will always restart the character's original BT from zero after using the SO's BT

#

Probably gonna look at these more complex behaviors with ST's and stuff more when I get around to overhauling the AI logic in my game which is something I'll probably have to do at some point. It's all BT's now and has a few rough edges lol

chilly nebula
#

This above is correct, and State Trees are used for more things than just AI behaviors! Quest systems, dialogs, encounters and even whole minigames have been implemented using State Trees.

final prism
final prism
#

There's also a really odd bug with binding to float parameter types, it seems theres multiple types specified as float? (it seems to be double or single precision but im not actually sure, its very odd)

misty wharf
final prism
#

Why is the new default for float double precision anyway? Why not have float and double types?

#

Wait do i have to bind to double in the property reference then? This is so confusing haha

misty wharf
#

I guess they thought it would be simpler to just have a single float type in blueprints so it wouln't confuse people who aren't necessarily programmers

#

even though it's actually two float types and it's actually confusing now.. :D

final prism
#

Just Unreal things I guess

final prism
#

It seems making it a double property reference works

#

not a huge fan of having to use doubles in code, but at least it works..

harsh storm
final prism
#

I think if they removed float in favor of double, it would've been at least a bit less confusing, since double in code would actually be the same as double in blueprint

reef trellis
#

Why would a state go to the Root, if there are no transitions in the state or any child state to move there?

Is this the default behaviour for when all child states of another state under Root complete?

warped tiger
west carbon
#

So one of the built in decorators is called Gameplay Tag Condition and claims that it can check if the specified actor has a gameplay tag or not. But I don't see any option to add gameplay tags to an actor in the first place, only tags you can add to them are FNames

misty wharf
analog mural
#

I'm working on enemy hit reaction logic but I'm running into an issue. When an enemy gets hit, it plays a hit montage. During this montage I want to prevent the enemy from walking. I have a bIsStunned BB variable which I set to true when the enemy takes damage and false after the hit montage is done playing. In the BT I have two IsNotStunned decorators to prevent any movement or actions (e.g. attacking) while the enemy is stunned.

However, I noticed that the enemy still moves forward sometimes. In the video after the 2nd time it gets knocked back, it moves forward while the montage is still playing. Why is that?

The following code gets called OnTakeDamage and in the hit montage blend out delegate

void AMWEnemyAIController::UpdateBlackboardIsStunned(bool bNewIsStunned)
{
    Blackboard->SetValueAsBool("bIsStunned", bNewIsStunned);
}
silent hamlet
analog mural
#

SetMovementMode won't work either as that prevents knockback which I implemented using LaunchCharacter

silent hamlet
#

hm from your video it seems when it is stunned none of your bt branches are executed (which makes sense given your decorators). is maybe the move logic somewhere else?

analog mural
#

Yes, the first time it gets knocked back it doesn't execute any of the branches, which makes sense. But for some reason the 2nd time it gets knocked back, it still runs the MoveTo with the IsInCombat decorator in the middle of the bt

#

The IsNotStunned decorator details panel can be seen in the screenshot. Don't think it's related to that

silent hamlet
#

Ah yes I see. Hm it seems the isstunned flag is not set then. Did you check it remains applied during the stun?

#

Perhaps there is some flickering (apply/remove) behavior somewhere

#

Nice combat feel btw

analog mural
#

It looks like if I hit the enemy while it is still in the hit state, it stays on false and doesn't set the variable to true again. Thought it was related to the bt but I guess not. Thanks, atleast I know where to look now

west carbon
misty wharf
analog mural
# analog mural I'm working on enemy hit reaction logic but I'm running into an issue. When an e...

Turns out I didn't fix it. It seems to be a race-condition. Very rarely,BTT_MeleeAttack in my BT gets triggered a split second before the enemy enters a hit state (plays hit montage, sets bIsStunned to true, etc.). This is probably because the enemy gets close enough to the player to attack, but then gets hit right after.
On the 3rd hit in the video, you can see MeleeAttack getting triggered in the output log, OnTakeDamage being called, and montage ending immediately after getting hit. Any tips on how to fix this?

OnTakeDamage removes the attack state, invoking UMWAttackState::OnExit

void AMWEnemyCharacter::OnTakeDamage(AActor* Weapon, float InDamage, EDamageTypes DamageType, UMWAttackConfig* AttackConfig)
{
    CharacterStateManager->RemoveState(EMWCharacterStateType::ATTACK);
    CharacterStateManager->AddState(EMWCharacterStateType::HIT);
    EnemyController->UpdateBlackboardIsStunned(true);
    UE_LOG(LogTemp, Error, TEXT("Take damage"));
}

void AMWEnemyCharacter::PlayHitAnimation()
{
    AnimInstance->Montage_Play(HitReaction);
    HitBlendingOut.BindLambda([this](UAnimMontage* Montage, bool bInterrupted)
        {
            EnemyController->UpdateBlackboardIsStunned(false);
            CharacterStateManager->RemoveState(EMWCharacterStateType::HIT);
            UE_LOG(LogTemp, Error, TEXT("Hit animation ended"));
        });
    AnimInstance->Montage_SetBlendingOutDelegate(HitBlendingOut, HitReaction);
}

The attack state below is entered at the start of MeleeAttack

void UMWAttackState::OnEnter(TObjectPtr<ACharacter> InOwningCharacter)
{
    EnemyCharacter->bIsAttacking = true;
    EnemyCharacter->EnemyController->UpdateBlackboardIsStunned(true);
}

void UMWAttackState::OnExit()
{
    EnemyCharacter->AnimInstance->StopAllMontages(0.1f);
    EnemyCharacter->EnemyController->UpdateBlackboardIsStunned(false);
    EnemyCharacter->bIsAttacking = false;
}
stable plover
#

hello all im trying to bake the navigation mesh using the build paths, I followed the docs and did everything they did, its visible and exists in editor, with nav chunks etc, but in PIE its not there, everything exists in the world but the data isnt getting serialized for the new scene if anyone can help that would be appreciated thanks

#

im using 5.4.4

#

has anyone experienced this issue?

#

are there other ways to bake the nav?

slow bobcat
#

The other thing would be to check the tiles loading, see if their nav chunks contain information. If they do, check where the nav chunks are added/removed from the recast nav data, debug that in code to see if anything is missing

rancid wing
#

anyone ever have a sub bt not working?

#

as you can see is going into the roam sub tree

#

but in there

#

*crickets

tiny sinew
#

and see what going on

rancid wing
#

yeah I did

#

still not working

#

its the sub tree

#

idk

#

well actually

rancid wing
tiny sinew
#

Why you place a wait with nothing?

#

Show the full tree

rancid wing
#

sorry Its gonna be a moment

#

I now have an issue with cpath volume throwing wrong end location

#

for now I put that aside

hallow compass
#

seems like the state tree property picker doesnt take into account public BlueprintGetters for wraper protected properties

hallow compass
#

i have "Should State Change on Reselect" set to false and i still have Enter/Exit called when my task is reselected from parent

robust veldt
#
FStateTreeExecutionContext& Context
...
Context.ForEachEvent([&](const FStateTreeSharedEvent& Event) -> EStateTreeLoopEvents

I wonder why this lamda is invalid. lurkin

slow bobcat
#

The for each will run the lambda for each element, makes little sense to return things from the lambda

#

I might be wrong, but it's worth trying

robust veldt
# slow bobcat Remove the return type. Not sure but I think that's not a valid sintax in a for ...

FStateTreeEventQueue require lamda with return value.


    /**
     * Iterates over all events.
     * @param Function a lambda which takes const FStateTreeSharedEvent& Event, and returns EStateTreeLoopEvents.
     */
    template<typename TFunc>
    void ForEachEvent(TFunc&& Function) const
    {
        for (TArray<FStateTreeSharedEvent>::TConstIterator It(SharedEvents); It; ++It)
        {
            const EStateTreeLoopEvents Result = Function(*It);
            if (Result == EStateTreeLoopEvents::Break)
            {
                break;
            }
            if (Result == EStateTreeLoopEvents::Consume)
            {
                It.RemoveCurrent();
            }
        }
    }

slow bobcat
#

Yeah but doesn't it mean to call "return yourState" in the lambda without the -> to indicate the return type? Like you would do with any of the Algo:: functions

robust veldt
#

Maybe this syntax has issue.

        template<typename TFunc>
    typename TEnableIf<TIsInvocable<TFunc, FStateTreeSharedEvent>::Value, void>::Type ForEachEvent(TFunc&& Function) const
    {
        if (!EventQueue)
        {
            return;
        }
        EventQueue->template ForEachEvent(Function);
    }
slow bobcat
#

Ah ummm

#

Wonder if you can pass a lambda as a universal reference. My c++ is bit limited when it comes to types in templates

#

It's seems you can indeed.

#

What's the error you get?

#

It's weird that I can't find any usages for that foreach either

robust veldt
# slow bobcat What's the error you get?
StateTreeExecutionContext.h(227): error C2187: syntax error: 'template' was unexpected here
StateTreeExecutionContext.h(227): note: the template instantiation context (the oldest one first) is
robust veldt
slow bobcat
robust veldt
#

Remove the template and cost will make it work.

slow bobcat
#

Yeah but then it will not be a templated function resolved at compilation time

robust veldt
#

All template is resolve at compile time. If I remember correctly. lurkin

slow bobcat
#

Yehq what I mean is that "if you remove the template" from it.

slow bobcat
robust veldt
slow bobcat
#

The you will be calling the implementation of the function that is not a template (I guess it has one?), or even worse, think that "<xxxx" is a "smaller than" and not compile

slow bobcat
robust veldt
slow bobcat
#

Ah ok ok

#

Maybe you can bring over the fix from 5.6

final prism
severe kayak
#

Hey, is there a way to debug and see the cone or the radius of how far the AI that has AIPerception component has?
I know the gameplaydebugger has nice utility for it but it shows spheres on my player character when I was heard or seen but I want to be able to see the NPCs line of sight etc before they notice me.
Thanks!

hallow compass
#

you will see a circle (the radius of the sight) and some lines (the cone)

severe kayak
#

no way! it was so big I havent noticed the radius! Thanks!

hallow compass
#

yeah default is 3000

#

so 30 meters

final prism
#

Has anyone added turning angle to Unreals pathfinding before? Something like reaching a target location while facing in a specific direction requires a modified pathfinder I would think

celest python
slow bobcat
celest python
#

catmull rom acts weird when it happens

slow bobcat
# celest python catmull rom acts weird when it happens

we have stairs and inclined ramps etc. All good there. Shouldn't be a problem if it's a very stepped angle
Shitty drawing of the curve in blue, but on the left a very common case for us, on the right what you are describing. It will just work

#

The main issues for me with Catmull are:

  • even though it has several params to tweak, we can only use a very specific set of values to actually get a decent curve, otherwise you end up with things resembling a zig-zag
  • I had to add some math to evenly distribute the points alongside the curve because the original formula (the one in the wikipedia article) doesn't have even distribution. It concentrates points at the beginning and sparse them at the end
celest python
#

appearently I used CubicCRSplineInterp

#

beware, old and dumb code

#

and it runs on tick instead of manipulating the path for some reason ThonkSpin

quiet iron
#

Hey guys, quick question. I was watching some Unreal talks about state tree and I see that the task UI is different from my UI. Is this something that they custom in their engine?

slow bobcat
quiet iron
#

Ah yeah, makes sense, I watch another clip in 5.3, they have the same UI as above.

quiet iron
#

Also can I ask what's the different between Global Task and Task that is assigned in the Root state? I'm assuming that putting task in root state act like global task but it will eventually call Enter and Exit anytime that the tree is re-evaluate?

rancid wing
#

anyone here ever use the cpathfiniding plugin?
the 3d pathfinding plugin basically

elfin smelt
# celest python <:this:919995670985859152>

It is great !
Do you had some resources to do that ? I think I will try something like that in my free time one day
the mathematical part doesn't really scare me but deep dive into the recast implementation in Unreal do 😅

celest python
#

you dont need to dive into recast for this

#

just manipulate the direction of the movement like I do or manipulate the path array

final prism
#

Do dynamic sub-state trees exist yet?

reef trellis
#

In state trees, if there is a condition or event that should stop execution of any state and transition directly to a specific state, what is the best way to go about it?
Should there be a event transition on every single state (child and parent states)?
Or should the tree logic be forcibly restarted after the condition is set (perhaps outside of state tree logic)?

static raven
#

I'm trying to replace the default Hearing sense implementation, the "config" class have an "TSubClass Implementation" member, with the config specifier. But if I set my custom implementation class as default in DefaultGame.ini the property is unset in editor instead of using my class.

This happened to anyone before?

slow bobcat
slow bobcat
slow bobcat
final prism
#

I believe they are broken in 5.5, though I haven't found a way to change them dynamically, will investigate further..

slow bobcat
slow bobcat
quiet iron
static raven
final prism
slow bobcat
#

Aaah sorry I completely missed the second image!

#

Ooook yeah. Not sure why that shows up as none

#

Maybe you can set a data breakpoint in the implementation?

#

I see you have 2 examples, one with your own class and another using the default from the engine. Does the defualt work?

static raven
#

yup, that one works, that is in BaseGame.ini

slow bobcat
#

Only I could think of are:

  • the path to your class is not set right and soemthing is missing
  • or maybe your class implementation is not right? You can always copy paste the engine file in a different folder and see if you can make that one work as if it was yours
static raven
#

yeah I think it could be related to the path. Is there a way to actually run any kind of validation over the implementation of a class and prevent it to be a default value of a config variable? because I can manually set it in the editor panel, it just doesn't work when I try to set it as a default class 🤔

#

anyways, thanks for your time, I just wanted to see if this happened before to somebody else, for what I know could even be a bug in the engine 🤷🏻‍♂️

obsidian delta
#

is it possible to increase nav accuracy to encompass this better?

hallow compass
#

see nav radius on recast mesh actor

misty wharf
#

That's the wrong place. If you modify it there you'll lose the changes as soon as you regenerate navigation. You need to modify it in project settings.

misty wharf
obsidian delta
#

actually changing it in project settings didnt do much

#

idk something with nav settings is fucked i feel like

#

some settings work some dont

obsidian delta
somber kernel
#

hi, In the state tree, I want to place a task that gradually slows down the AI's speed. However, the task blueprint does not support the 'tick' event, so what is the solution?

misty wharf
# obsidian delta well i have pretty small agents

Yeah make sure the agent radius is set correctly. Having a gap between the edge of the mesh and your geometry is normal, the edge of the navmesh is calculated from the origin of your agent. Also, if you modified it in project settings and it did nothing, you may need to delete the navmesh actor and regenerate. Modifying the actor directly may cause you to lose your settings when regenerating the navmesh

quiet iron
#

What is the best way to retrieve the AIController inside a custom task in C++?

#

I read that if you're using StateTreeAIComponent (using the AISchema), it would guarantee the AIController for me. But I don't quite sure how to get that. I can retrieve the schema but I see no function to retreive the AIController

misty wharf
#

If you're using the AI schema, this should automatically connect it to the Controller context value from the schema (assuming it was named Controller, I forget)

quiet iron
#

what's Category=Context do? It will auto connect? I only know 3 categories (Input, Output, Parameter)

misty wharf
#

Context will automatically connect things to the schema's context values

#

As long as their names and types match

quiet iron
#

That's explain

#

Also can I ask, usually how can you bind to dynamic delegate in a custom task? Because the task is a struct so it won't have the UFUNCTION macro to be able to bind.

misty wharf
#

I don't know if there's a better way in 5.6 though, I'm a bit out of date on the details of that :)

#

If you're unsure about using this, you should check the builtin tasks if any of them have dynamic delegate bindings and see how they do it

quiet iron
#

I'm using 5.5 btw. And yeah, the first thing when I changed from struct to class UObject is the engine crashes from the start, saying something corrupted. I have to delete my state tree and it won't crash again.

misty wharf
#

I wonder if a finnish person took that screenshot. Parameters.Lurppa sounds finnish even though Lurppa doesn't mean anything lol

#

oh actually Lurppa is Droopy's finnish name, so I'm like 99% a finnish person took that screenshot

final musk
#

hi folks, i'm having problems with a character going around a higher cost nav area, it slows down and kinda jitters while taking a corner. there are no collisions or anything. Im issuing the move command using the MoveTo task node in behaviour tree
I also tried creating a kind of straight "hallway" with a thin normal cost line surrounded with high cost areas on both sides, depending on where i click in the space at the end of that hallway, for example if i click on the left side, the character walks through normally but if i click on the right side, it goes supper slow and jitters like crazy.
im not really sure whats even the cause or what to change, if anyone has any idea that would be a huge help!

exotic merlin
#

Helloooo, hope you're doing well !

#

Was wondering if there is a State Tree repository with examples, best practices etc.
If there is something using GAS as well, that would be nice!

#

I went over the pins, but didn't see to have one.

#

Thanks for your notes @misty wharf 🙂

obsidian delta
#

tbh state tree is kinda

#

do whatever you want

#

theres no forced workflow

#

epic docs are sufficient I think

exotic merlin
#

Alright!
We'll just migrate our behavior tasks to state tree ones and that's it

obsidian delta
#

just think of it like graph nodes

harsh storm
#

Yeah, this is one of my 4 main channels.

#

Everything else is secondary

exotic merlin
#

How do you guys manage to handle this guy ? He's the bane of our existence on Gameplay.

celest python
hallow compass
#

so you can make all your GAS async stuff just fine

exotic merlin
#

it's more about having premade tasks (just avoid to recreate them myself if someone already did), and having some examples

hallow compass
#

didnt yet used GAS with STs so i havent made ones in my utils plugin

exotic merlin
#

I'll definitely have to create those different use cases (I wanna attack, and I need the actor close enough, and my attack not in CD etc)

#

etc etc etc

#

You could argue that there is 100 different ways of doing it (like in a BT too).

#

If, if, there was a repo with examples showing one "good practice" one 😉

#

Thanks for the feedback!

slim egret
#

hi, is it possible that when creating StateTreeAIComponent in the AIController cpp, even when exposed to BPs, its properties can't be modified?
I tried every possible specifier on the UPROPERTY but no matter what i can't modify its internal state tree (or other properties) when selecting it in the components window in my BP AIC that derives from this cpp AIC

exotic merlin
#

Might want to pin that ... New stuff in 5.6

hallow compass
#

got passed a few time here already

#

im adding this to my notes tho

slow bobcat
slim egret
# slow bobcat That's odd. Should be enough to have it as public or protected with an EditAnywh...

Yes, frustrating. I tried also regenerating project files and restarting the editor after compilation and still it didn't work.
When adding a state Tree Component via cpp it did let me modify the properties in the BP, but then I noticed that I need state tree Ai component because my state tree using the Ai schema..
Changing the component to state tree Ai broke that properties visibility/edit ability

#

But from what I understand from you, it should show correct? What I encounter isn't the intended behavior?

slow bobcat
#

I will check once I'm back to the pc in a bit, but I think I just do that

slow bobcat
# slim egret Yes, frustrating. I tried also regenerating project files and restarting the edi...

As I remembered, nothing special.

  • Our AIStateTreeComponent inherits from AIStateTreeComponent and nothing special to it
class OUR_API UOurAIStateTreeComponent : public UStateTreeAIComponent```

- we add it to the AI Controller as any other component (it's a protected member in our AI Controller)
```/** component handling the interactions of this actor with State Trees*/
UPROPERTY(EditAnywhere, BlueprintReadOnly, meta = (AllowPrivateAccess = "true"))
class UOutAIStateTreeComponent* StateTreeComponent;```

- the only "weird" thing we have is the meta AllowPrivateAccess because of a bug we had were we couldn't bind to it in the ST's
```Adding "meta = (AllowPrivateAccess = "true")" to AITargetSystemComponent and StateTreeComponent in the BaseAiController so that state trees can bind to it```
hot narwhal
#

hey, is there a way to make a replicated state tree task or do i need to trigger the RPC in the ai character directly. I just want to have a task that play an anim montage but it is not replicated

misty wharf
hot narwhal
#

I will call an rpc on the caracter directly

misty wharf
#

Yeah that sounds reasonable. #multiplayer is probably the best place for mp-related questions since they're a bit more specialized I guess :)

hot narwhal
#

Yeah, my question was more state tree related but yeah i might ask there next time

final musk
misty wharf
final musk
misty wharf
#

But having it avoid itself sounds kinda strange. Either way, maybe it's worth trying to unregister it from the crowd system so it doesn't count as something to avoid

#

Maybe it'll put you one step closer to finding out what's happening

#

Also, If you have RVO avoidance and crowd avoidance both enabled, iirc they may conflict

quiet iron
#

Hey guys, what factor to determine a stimulus is newly added among sensed stimuli? I can't rely on age because if the AI perceives 2 entities, the age variables will always be zero (until it cannot perceive anymore). So I cannot figured out which one is old or new.

misty wharf
wise sluice
#

It should be OnTargetPerceptionUpdated from the PerceptionComponent

quartz shadow
#

Hey ! Is there a way for a ST Event to live across multiple frames ? From what I understand the EventQueue is stored in the InstancedData of the component and is getting reset on tick (When we trigger transition) so if I am correct that is no possible right ?

Context: Let's say I have a running State that perform a GA and under certain condition I trigger a ST Event. I would like to wait for my current task to finish go back to root and check if I received some ST event to trigger a specific behavior.

Ideally if it could have a life time that could be useful as well. But maybe I should just create a dedicated system that handle this kind of logic and only have a dedicated enter conditions.

exotic merlin
# quartz shadow Hey ! Is there a way for a ST Event to live across multiple frames ? From what I...

I haven't used it, but my research yesterday showed this:

StateTree Delegates Give Another Way To Limit Work Done Until Data Is Ready

In addition to the changes for scheduling ticks, StateTree has added delegate listeners that can be used by tasks and transitions to respond to a certain bound delegate dispatchers. The transition is intuitively called On Delegate and allows for binding which delegate dispatcher to use much like binding any other property in StateTree.
https://dev.epicgames.com/community/learning/tutorials/z3km/unreal-engine-tickless-statetree-changes

Epic Games Developer

Tips and tricks for optimizing performance for StateTree by utilizing the new Scheduled Tick Policy to limit the amount of ticks or to use async tasks t...

quartz shadow
runic flare
#

I want to use State Tree LinkedAsset states to run trees from my main tree to perform specific behaviours (like Patrol). However it looks like LinkedAsset state type requires that the chosen tree asset have the same schema as the "parent" tree. I was hoping it would accept a subclass of the parent tree's schema but it doesn't look like that's the case ☹️ . Does anyone know if there's a way around this? Maybe this functionality will be added in a future version?

slow bobcat
white pike
#

Hello guys, I made an enemy AI which follows the player if the player is in the sight of the enem. If there's Nothing in the enemy sight, then it moves randomly.

But when my enemy detects the player it just stops Moving, and i Don't understand why. Random movement works well. does anyone had a similar problem in the past ?

#

This is the BP of the enemy chasing action

slow bobcat
#

Chrkc visual logger, see why the movement stops

hallow compass
#

also, you can use a print/breakpoint in your BT task to check if the AIMoveTo is called

white pike
white pike
hallow compass
#

did you checked its actually called

white pike
#

then it does this

hallow compass
#

well here you are close so it makes sense

#

what is printed if you are far enough from the AI but seen ?

white pike
#

It does the same 🙁

#

but actually i think i have a clue !

#

I will try to solve it Thank you!

#

My Target Actor is set here, the code is inside this blueprint

#

But I think I forgot to assign this BP on my Enemy, maybe that's why it's not working

white pike
#

My target actor is well assigned, it's a problem of movement

hallow compass
#

weird indeed

white pike
hallow compass
#

there is not point restarting

#

see step by step what is working

slow bobcat
#

Check in visual logger. Chances are you are not projecting the location and its not on nav, canceling the movement...

hallow compass
#

it does seem like its the movemenet faults, you need to debug with the visual logger if the target is correct

slow bobcat
#

Do you have nav mesh? That could be the other reason

hallow compass
#

thats the weird part for me

slow bobcat
#

Nope. Calls failure because can't find the end goal location on the nav

#

If you can't move it fails

hallow compass
#

well on the screens you can see "Success" being called

slow bobcat
#

Ah wait, I missed that image. One sec

#

Ah... Ummmmm

#

Weird

#

Visual logger for the win then

white pike
#

I somehow managed to start visual logger, but I didn't understand what i can do with it (first time using it)

white pike
#

Stops moving only when it comes to chasing the player

slow bobcat
#

and yoiu should see entries there just for the nav. One of them should draw the path calculated. Let's see it

white pike
#

I think the ai think it's already in the goal wherever the player is

slow bobcat
#

could it be you are setting the AI to reach itself?

#

Maybe TargetActor bbk is set to the wrong actor?

#

if yoiu look at your BB while running the game and the movement stops, what is the value in your BBK?

#

well you have it here too

#

is that the player?

#

one thing you can do is to grab the BBK actor location just before passing it to the IAMoveTo node and draw debug a spwhere. See where is it

white pike
#

OMG you're right the debug cube is on the enemy and not on the player

white pike
slow bobcat
# white pike this one here

add a debug draw to the actor location before setting it to the BBK in both cases (perceived and not perceived)

#

I wounder if the AI is detecting itself or you are passing a nullptr because the BBK is not set and, somehow the move to picks the current location as a safe option

#

you might be setting the bbk in two places or something like that too

white pike
white pike
#

the blue cube means that target actor bbk is well assigned and green cube means that target actor bbk wasn't well assigned

quiet iron
#

in state tree, can I communicate between tasks with non blueprintable data types?

harsh storm
#

In C++ - sure. But it can only happen in C++.

exotic merlin
reef trellis
#

Having a hard time understanding state tree flow and transitions. I've read unreal documentation and some of the links posted hear. The behavior I'm expecting is not happening, for sure I'm missing something.

I have this State Tree I've been working on (posted here before, it's a little bit different now), and it is getting stuck on root.

After it enters "Scared/ Act scared" state, if "IsScared" bool changes to false again, it does not go in "Search for Work" state. Based on my tree and it's transitions, shouldn't it though? I can provide more info if needed

reef trellis
#

Had to force an event transition for it to work. But still confused why it simply does not continue normal execution with the boolean change.

quiet iron
slow bobcat
reef trellis
slow bobcat
reef trellis
harsh storm
quiet iron
#

I guess I just gonna wrap the variable into a blueprint wrapper

slow bobcat
# reef trellis They are all default, except for "Look for Work"

That's the thing. If you don't set a transition that checks a value in tick, or reacts to an event, the state will only transition when a task finishes (or the last, depends on your setup). If you want the state to be interrupted, you either have an event that will force another state (ie: an event transition in root) or you have a transition checkign on tick some value in your state (ie: if X bool is false, go to root)

#

In your example, you don't have any transitions in the image. You are waiting for the tasks to finish and then go to root

#

Nothing there handles interruption

reef trellis
reef trellis
quiet iron
#

How can other task or transition listen for the value changed to trigger the transition logic? For example: I would like other tasks / transitions to listen the PerceptionInfo output changes, then it could react and transition to the correct state. Like Observer in behavior tree.

reef trellis
quiet iron
#

I'm looking for an event driven method though. Like blackboard, they have a delegate to signal when a parameter is changed.

reef trellis
harsh storm
#

The "observer" concept from BTs did not transfer over to STs. You have to build it yourself.

reef trellis
#

For Perception I'm using a state tree evaluator and on "OnTreeStart" and on "OnTreeEnd" I am binding and unbinding custom events that handle perception stuff like sight and hearing. not sure if that is what you were looking for

Note: haven't fully tested it though

slow bobcat
reef trellis
slow bobcat
gentle widget
#

Anyone know why my AI would move toward the player if I load directly into the level within the editor, but the AI will not move if you load into the level from another level (i.e. pressing start on the main menu)

#

State tree for reference

#

Additional details, the AI moving toward the player is the intended behavior. Basically, it works correctly if I play the level directly from the editor, but doesn't work if I start the game from the main menu.

runic flare
# slow bobcat Is there a restrictive check in code like "IsA<>"?

IsA would be good bc it'd allow for child schemas -- I'm guessing there's a schema class == somewhere. I could hack around it for sure but I'm wondering if A. I'm thinking about the intended use of schemas incorrectly, or B. child schemas will be supported for subtrees in the future. It just seems like a very restrictive design making it harder to make my trees modular. I really don't want all my trees to need to share a giant megascehma when my e.g. Patrol subtree should be the only tree that cares about my PatrolComponent context object.

gentle widget
# gentle widget Additional details, the AI moving toward the player is the intended behavior. Ba...

Still trying to work out this issue, I initially thought it might have something to do with load order but that does not seem to be the issue. I've tried delaying activation of the state tree, spawning enemies in based on player distance to the spawn point, etc. Does not seem to fix the issue. Visual logger is not being very useful in this case, only error it's showing me is that the NPC failed to navigate to the player. It's a weird issue, everything works just fine if I play the level directly from PIE.

crude mirage
#

Does anyone have like a base enemy ai blueprint that isn’t the one in the combat template? I’m specifically running into errors with the state tree tasks because I stupidly tried to just duplicate all the template ai ones so I need to start from scratch but all the tutorials are either outdated or hard to understand.

somber kernel
gentle widget
quiet iron
#

Have anyone tried this in 5.5? Does this node work?

spiral robin
#

Hi everyone! Duplicating question from #cpp here, as it's probably more appropriate place to ask about state trees.
I want to use StateTrees for my quest system, as it sounds ideal for my purposes. However, I'm not sure about a few things:

  1. Are there currently any ways to run state tree other than from UStateTreeComponent (or reimplementing state tree running logic based on this component's logic myself)? It would be ideal If I could run them from game instance subsystem, as I'll have multiple maps, and quests must persist on map changes. Of course I can just make some QuestRunnerActor, spawn it on map open and add a component for each active quest, so it's not that big issue, however the approach with subsystem would be cleaner.
  2. Can I persist internal state of running state tree? I have a simple save/load system, and I want be able to store/restore quest state transparently, without some ugly workarounds. If I understand correctly, the component stores running state in FStateTreeInstanceData InstanceData, and the documentation says I can serialize it. So, would it be enough to restore state tree's state on game load?
reef trellis
# quiet iron Have anyone tried this in 5.5? Does this node work?

Reading posts in unreal forum, looks like it hasn't been working for quite a few iterations of UE5 including 5.5. Haven't used it though. You could try using "SendStateTreeEvent" if what you want is to force a transition to a particular state, and add the transtion "OnEvent" in the root state or something.

quiet iron
#

Yeah I've read that

somber kernel
#

Hi, How do I interrupt a state tree to run a specific task/function, and then resume execution from the point of interruption?

harsh storm
#

Anyone else have issues with state tree event transitions? I have an event transition on my root, sending the tree event, and then nothing happens 🤔

hallow compass
#

can you see the request in the ST debugger ?

harsh storm
#

Yeah

#

Just nuffin' happens

drifting ginkgo
#

I was having some issues on 5.6 with some cherry picks from main. Was going to retest in latest.
Setup was just a simple transition in a parent leaf to transition such as this ^^

hallow compass
#

in the tree

harsh storm
hallow compass
#

even if it failed

harsh storm
#

Nope - nuffin'

#

What I show, is all I see.

hallow compass
#

how are you sending the event

harsh storm
hallow compass
drifting ginkgo
reef trellis
drifting ginkgo
#

I had some problems with certain child states and event dispatchers in a similar way. Might be best to try a global task just to see if it can work without fear of the state getting wiped.

harsh storm
#

@slow bobcat Did you ever figure out a good workflow with dealing with State Tree tasks in C++ and binding to a delegate from an object in your instance data?

robust veldt
harsh storm
#

Yeah, I use those in BP. But I'm talking about when you are binding to a delegate from another object. It needs a UFUNCTION, but structs can't have those.

#

Right now, I'm just kind of copying what the EQS task does and relying on a lambda.

robust veldt
harsh storm
robust veldt
harsh storm
#

Please do. Because the GetInstanceDataType function returns a UStruct*

robust veldt
#

UClass is extend from UStruct so it will fit.

harsh storm
#

Oh yeah - you're right. I forgot about that.

harsh storm
#

I can't find it and I am guessing because Rider doesn't have it indexed

robust veldt
#

Engine\Plugins\Runtime\GameplayInteractions\Source\GameplayInteractionsModule\Private\StateTree\StateTreeTask_PlayContextualAnim.h

Fullpath here.

slow bobcat
harsh storm
#

Not very

final prism
minor pawn
#

Hey,

I'm trying to build "rooms" at runtime.
My logic works fine, so I want to go to the next stept, to make my characters look alive.
I want to add at runtime NavModifierVolumes. Which works so far.
What does not work is, that the NavigationSystemV1 will acknowledge the spawned obstacles on runtime and block navigation.
I've built a tiny map to see, if my code works generally and it does.
I've built a tiny square of NavModifiers and assigned the correct AreaClass.

My Characters won't move out of the square and I can see in purple, that there is a modifier.
On my other map, where i build everything randomally, I cannot see the modifiers and the Characters move out of their area.
Since I can see the nav mesh, I guess, I setup the runtime gernation of my navMesh correctly to Dynamic.

What am I missing? Is adding Modifiers at runtime not supposed to work?

real raven
minor pawn
real raven
#

there is settings you need to enable in your config to make use of the invoker system

minor pawn
real raven
#

this although with the standard pathfinding system will cause for some pathfinding to fail, if the target is not close to the navmesh

real raven
#

there has to be a way to get rid of that, but i have not yet found a solution to this problem

minor pawn
#

I also managed to break my setup, so I no longer see a color for my AreaClass 😮‍💨

#

Ok, reset helped. I can see my NavAreas on static gernerated content, but not when spawned at runtime. Also the AI behaves like that

final prism
minor pawn
#

Ok, the missing piece was, that you can not use a NavModifierVolume at runtime, because it does not have a NavModifierComponent.
I need to create a duplicate of this actor and add the Component myself.
When spawning the duplicated Actor, I can see the Modifiers at runtime and my Characters behave as expected

minor pawn
#

My next problem is, that I don't know how to update a FStateTreePropertyRef with the WeakExecutionContext.

I'm adding a listener to PerceptionComponent->OnTargetPerceptionUpdated But I don't get a reference to the Property's value:

const FStateTreeStrongExecutionContext StrongContext = GetWeakExecutionContext().MakeStrongExecutionContext();
FGameplayTag* GameplayTag = Motivation.GetPtrFromStrongExecutionContext<FGameplayTag>(StrongContext);

GameplayTag is nullptr

woven aurora
#

Hi everyone, I have this problem where I have 2 states for my enemy AI, passive and combat, and basically I have a key just to switch between them for me to see how they switch, but whenever I press it (it is in passive by default), it says on the bahaviour tree that it transitions into the combat sequence, but the actual actions of the enemy tell me otherwise as he's still doing patrol, it's been a day already that I've been trying to figure this out, anyone?

minor pawn
#

I am wondering, why I can't bind my evaluators output variables in an enter condition. I can see the variable on the left marked as output, but can't bind it. I'm using the blueprint base classes in c++

somber kernel
#

Guys, does anyone understand the golden rule for smoothly transitioning between statuses without problems?

It seems confusing between parent and child statuses and the Selection Behavior options

harsh storm
robust veldt
#

I have task that have bool input variable, Is there any way to make condition as input. For example, I want to check if length of array output of other task and assign to that bool.
Similar with MVVM plugin, that allow convert type.

slow bobcat
harsh storm
#

Because it is the dynamic delegate that allows you to pass additional arbitrary args. But you need access to the ST execution context to finish a task.

#

So some delegates just won't let it happen to my knowledge.

slow bobcat
#
  • on enter subscribe to delegate with your instanced data function
  • On Callback (within your instanced data), change bool bTaskDone to true
  • on tick check a bool "bTaskDone". If true call FinishTask
  • On End un-subscribe from the delegate
final prism
robust veldt
somber kernel
#

Transitions in the State Tree are very complicated , has anyone managed to understand them??

rancid marten
#

Switched the NPCs in the Arena Shooter variant over to a struct health system and hit scanning. In the Move to Roam Location state, their movement is doing tiny steps to the target location. And ONLY when the game is running smooth, they act normal when frames chop.

harsh storm
reef trellis
somber kernel
#

@harsh storm @reef trellis
For example here, state A does not transition to state B , what’s the reason?

harsh storm
slow bobcat
somber kernel
reef trellis
#

what happens if you remove the transition from root, and put it select children in order?

final prism
#

Definitely an odd setup. I'm not sure if putting tasks on the root is a good idea. Additionally, try enter won't select children, I'm not sure you can transition directly to children of states with the "try enter" type. Try setting all of them to "try select children in order" and see what happens

harsh storm
#

Having tasks on the root is fine. Same with transitions on the root.

And yes, the debug text task never actually "finishes". However, the Delay task should.

#

And what does the debugger say?

#

Are you even in state a?

somber kernel
#

@reef trellis @final prism
"Try Select Children in Order" runs all the children at once.
This means I can’t take advantage of transitions or set a delay for one of the states

final prism
#

It selects the first leaf node in the state tree. This is supposed to be a hfsm, you're supposed to select multiple hierarchies of states

#

Try select children in order will not run all children at once, it will select the first child in order, then run the next child once that one completes

reef trellis
final prism
#

It's important to understand the hierarchy at play. If it selects A as a child of Root, it will have selected both root and child, as they are a hierarchy, thus it will run the tasks of the entire hierarchy at once, i.e. both root and a

reef trellis
harsh storm
#

Yes

#

Tasks on root should be seen as always running if the tree is active pretty much

reef trellis
#

does that mean it will also run enter conditions and transitions on root or any parent state? every time a new child is selected I mean

final prism
#

I believe there is an option for that on the state tree enter condition

somber kernel
#

@final prism
I understood a little, but I’m still confused.
For example, in the image , why can’t I transition from the root directly to state B?
The system is forcing me to go through state A !

slow bobcat
harsh storm
harsh storm
reef trellis
somber kernel
#

@slow bobcat @harsh storm @reef trellis
I’m starting to understand a little, whenever a parent state runs, it must activate all of its child states at the same time and without delay.
Each of those states has its own transitions that only work once its assigned task is completed.

Also, you cannot transition between sibling states if their parent is not in Try Select Children in Order mode.

harsh storm
#

That mode shouldn't have any dictation on how a state transitions.

#

The state itself has its transition rules.

somber kernel
harsh storm
#

The state's transition logic will allow it to jump to another state. That is a huge reason behind state machines in general. The fact that you can go from state to state.

#

When a state is selected, it will try to evaluate other states to see if they can be entered as well

#

The child states of the state that is being selected that is

somber kernel
#

You’re right, it works even if it’s in Try Enter mode.
Hmm, from what I understand, Selection Behavior works in one way, and Transitions work in a different way. This is what causes confusion, and sometimes they end up working at the same time

harsh storm
#

I'd advise you to just leave the selection behavior on the default until you understand more about how the ST works in general.

#

Baby steps.

minor pawn
rancid marten
#

select the NPC and push apostraphe during play

minor pawn
#

yea, that's not working for me, that's why I'm asking for the keybind option

rancid marten
#

You pushing the one next to the enter key? I was dumb and pushed the top left one when I was first told about it. Beyond that idk.

minor pawn
#

for me it's the # key

#

left from enter

#

Maybe you can check your editor settings and see if you can find the key bound to any option.
You should be able to search for the key

rancid marten
#

went through editor and project settings and couldn't find anything bound to the key

#

I only found out it was even a thing 2 days ago

minor pawn
#

shiiii...
I really need this, because I witness strange senses.
Feels like my vision is tilted to left

rancid marten
#

I'm not doing too much better. I can't even get NPCs to move to a target location unless the frames are chopping.

reef trellis
#

Posted in #blueprint , but forwarding to here since this is happening in a state tree task 😅
I'm at a loss

#

trying to stop "move to" tasks when entering a specific state.

harsh storm
#

In order to broadcast the delegates, you need the execution context.

robust veldt
#

Old World /InGameMission/UEDPIE_0_TestMissionLevel.TestMissionLevel not cleaned up by GC! Object BP_Enemy_EtherealGuardian_C /InGameMission/UEDPIE_0_TestMissionLevel.TestMissionLevel:PersistentLevel.BP_Enemy_EtherealGuardian_C_0 is being referenced by StateTree /InGameMission/Missions/ST_SpawnMobAndWaitForDeath.ST_SpawnMobAndWaitForDeath:
 (standalone)  StateTree /InGameMission/Missions/ST_SpawnMobAndWaitForDeath.ST_SpawnMobAndWaitForDeath
 -> StateTree /InGameMission/Missions/ST_SpawnMobAndWaitForDeath.ST_SpawnMobAndWaitForDeath::AddReferencedObjects((Garbage)  BP_Enemy_EtherealGuardian_C /InGameMission/UEDPIE_0_TestMissionLevel.TestMissionLevel:PersistentLevel.BP_Enemy_EtherealGuardian_C_0)
    ^ UE::ReferenceChainSearch::FReferenceInfoSearch::HandleObjectReference() [Source\Runtime\CoreUObject\Private\UObject\ReferenceChainSearch.cpp:1106]
    ^ UE::ReferenceChainSearch::TReferenceSearchBase<UE::ReferenceChainSearch::FReferenceInfoSearch>::FCollector<1>::HandleObjectReference() [Source\Runtime\CoreUObject\Private\UObject\ReferenceChainSearch.cpp:284]
    ^ FInstancedStructContainer::AddStructReferencedObjects() [Source\Runtime\CoreUObject\Private\StructUtils\InstancedStructContainer.cpp:442]
    ^ FStateTreeInstanceStorage::AddStructReferencedObjects() [Plugins\Runtime\StateTree\Source\StateTreeModule\Private\StateTreeInstanceData.cpp:257]
    ^ UStateTree::AddReferencedObjects() [Plugins\Runtime\StateTree\Source\StateTreeModule\Private\StateTree.cpp:404]
     ^ This reference is preventing the old World from being GC'd ^
  -> UObject* UObject::Outer = (Garbage)  Level /InGameMission/UEDPIE_0_TestMissionLevel.TestMissionLevel:PersistentLevel
   -> UObject* UObject::Outer = (Garbage)  World /InGameMission/UEDPIE_0_TestMissionLevel.TestMissionLevel

I am getting this error, when spawn actor from task and cache in UObject instance data. Any idea to resolve it, although I clear ref when exit task

shadow furnace
robust veldt
shadow furnace
#

after you supposedly clean it out

#

hmm... it should nuke this in ResetLinked

robust veldt
shadow furnace
#

I am reading UStateTree::AddReferencedObjects

robust veldt
shadow furnace
#

then I guess you didn't clean it out

#

I'm not really sure what callback to use here

robust veldt
#

But property function does not have clean function.

shadow furnace
#

why would it need to?

#

just reset it

robust veldt
#

I mean there is no way to reset it.

shadow furnace
#

If there's a more statetree specific thing I am probably missing it

shadow furnace
robust veldt
#

Could be bug of StateTree as instance data of task does not have this issue.

shadow furnace
#

can you obtain it from UStateTree::GetSharedInstanceData?

#

yeah it's possible

#

I'm confused why exiting the state isn't cleaning this out

#

does one of them add instance data and just leave it around?

#

I've only really made one simple state tree thingy so I might be asking a weird question

harsh storm
#

@slow bobcat Okay, so I think I have somethin' here that you might even be able to use. No more need for tick based bool check if you don't want to. But you pretty much just BindUObject to your instance data. Then give a payload of FStateTreeWeakExecutionContext. Then the first thing you do in the bound method is make it a FStateTreeStrongExecutionContext.

Then from there you can call FinishTask. I haven't dug too much into the dangers of this approach yet though. But this is how I'm doing it with the lambda approach. And I kind of copied it from Epic's EQS task.

One drawback that I know is that payloads can't be references. And the struct is like 48 bytes.

You may not even need to make a strong execution context honestly. But overall, that's the gist. You will need it if you need access to the instance data though. So, probably more useful in a lambda than the instance data itself 😅

robust veldt
#

Damn, ST variable does not support weak object.

slow bobcat
harsh storm
#

And you can use that same idea when it comes to binding to a uobject really

slow bobcat
# harsh storm And you can use that same idea when it comes to binding to a uobject really

But isn't that super dangerous? The execution context is created anew every tick of the tree. I don't get how is that supposed to work.

  • the state tree tick creates an execution context
  • the execution context tick is the thing actually ticking the tree (global tasks, events, transitions, conditions and tasks in that order if memory doesn't fail me)

If you cache that context, aren't you keeping a ref to a temporary object of undefine lifetime? Or do you capture it by value (a copy)? But if by value... The context will be incorrect next tick no? When a new context is created.
@chilly nebula i could really use your insights here if you have the time please.

quiet iron
#

I'm still confusing about the usage of State Tree for other purposes beside AI. I hear that State Tree can be used for Quest system or door / chest. But I don't understand in what cases it could help. Seems like it's overkill for something with simple states.

celest python
#

its a tool that abstracts transitions in a way where you can do utility selection, prioritization or state machines and you get to have a nice way to marshall data to your tasks from the editor since it has property binding system

#

whats normally a complex sphagetti code in a scripting language becomes a structured graph system in ST

quiet iron
celest python
#

I'd do a chest in blueprints tbh

slow bobcat
quiet iron
slow bobcat
#

But, at hearth, our plugin is a state machine

#

We use that because the dialog support was very good

#

But ST's were second in line

quiet iron
#

Maybe this could be the use for ST for a quest system. Found it on the internet.

chilly nebula
harsh storm
harsh storm
#

So it is expected that you can pass the context around using Context.MakeWeakExecutionContext()

#

And that is the "safe" way of doing it?

harsh storm
# quiet iron I know, that's what Unreal advertised, I can see it strength when implementing f...

Echoing what others have already said. The decision to use a ST would fall in line with the decision to use a full blown state machine really. You don't necessarily always reach for one, because sometimes, just operating off a simple bool or enum is sufficient enough.

That said - there is nothing preventing you from using it as the main driver of say, your main menu. Because those can be thought of as "states" as well. Or as the overall game's flow. Those can also be "states". It really depends on what type of game you're making.

I used it instead of Flow Graph, for example, in a small prototype my wife and I were doing. It served as the overall game manager.

reef trellis
#

Does anyone have an idea why this AsyncTask reference isn't valid during this state tree task execution, but showing as valid in the character tick?

slow bobcat
#

What I mean by differences is how is each type handled. Is one created when the tree starts and updated at some point? And the weak is the one passed around created on each tick?

harsh storm
#

I only caught this late last night, so I wasn't able to follow the code with the weak/strong context all that well

slow bobcat
harsh storm
#

I plan on digging into it more tonight to try and reason about.

#

Or hopefully Siggi explains before 🙏

chilly nebula
harsh storm
#

Yeah, I'm on 5.6

harsh storm
#

But by doing this - we kind of are. Even if superficially.

chilly nebula
#

more changes coming in 5.7 and 5.8 regarding instance data storage, and yes I agree its not easy to understand or use atm

harsh storm
#

Yeah, I'm just going under the assumption that as long as you make a weak context, you can pass around the context. Then need to check if it is valid before using it elsewhere.

signal island
#

best way to transition from an A state to a B state, state tree events, state tree delegates? what you guys use?

hallow compass
#

it depends™

slow bobcat
quartz shadow
#

I probably missed something. Context: I wanna modify parent params from a child tree. What I tried is to promote a boolean property ref as a parameter of my child ST and bind it in my parent tree to a parent parameter but this flow seems not to work I did not debug yet

chilly nebula
slow bobcat
chilly nebula
slow bobcat
chilly nebula
drifting ginkgo
#

The biggest struggle atm I find is the state lifecycle eg.

In 5.6 event dispatchers in a parent state appear to get destroyed/cleanedup and as a user coming in you're never sure if it's intended or an inprogress piece.
But also massive kudos keen for STs future

#

But I guess alot of this stems from the flexibility of it atm, how do you wanna handle transitions, event/requestTransitions/delegates/enter conditions/etc

chilly nebula
chilly nebula
drifting ginkgo
#

I previously had a simple OnDamaged binding in the initialize thinking of it as a ParentState, but it appears when I then enter the combat state the binding or the state "instance" is gone somehow

#

I've used global tasks/evaluators to start offsetting this but I love the mental model of that parent leaf of the tree allowing bindings/setup in this way, although may just be a lack of understanding the workflows for now

chilly nebula
drifting ginkgo
#

Yeh I believe the debugger showed up clean, given the entire binding was prone to disappearing I thought it may be intentional sort of cleanup, like there's only allowed to be 1 truly 'active' state?

chilly nebula
drifting ginkgo
#

I have a Vitality component that calls OnDamaged, then I'd bind to that in Initialize to try push into the combat state, but that binding that existed via a Task that was within Initialize would get cleared somehjow'

#

Sec I'll open it up and can grab any screenshots of use, but my expectation was those kind of things could exist in the tree instead of global task/eval side, again may just be a weird setup though. I am always using a dedicated server with Steam that might be playing odd

chilly nebula
drifting ginkgo
#

There's the theoretical setup, whether Delegate or StateTreeEvent that TestEvent was either Unbinding or the State that contained it "Initialize" was getting cleared somehow.

I'm getting the ropes of C++ and starting to dig into the code though so will check that EQS example out

#

Have found workarounds but this is the underlying research problem I'm looking to understand as a user atm, if find anything as dig my way through C++ will share but imagine it's likely a lack of knowledge or attempting to use it incorrectly at this point. Appreciate the time and info though Prayjj

chilly nebula
drifting ginkgo
chilly nebula
drifting ginkgo
#

Keen for the days StateTree just outright supplements BPs akin to FlowGraph etc.

Yeh 5.6 with the cherrypick to dodge crashes for Setting StateTree refs at runtime, think that doesn't pollute much, was gonna poke 5.7 but might just hit up ue5-main since seems there's a bunch there. Added you as a friend to DM *** that through in couple days or so if that's fine 🫡

hallow compass
#

love seeing Mass and State Tree getting together

chilly nebula
hallow compass
#

all the "external data" thing is a bit opaque though, how are the structs are queried ?

drifting ginkgo
#

UAF as well if I'm not mistaken FeelsWowMan

hallow compass
chilly nebula
drifting ginkgo
chilly nebula
chilly nebula
drifting ginkgo
#

Appreciate the jam Siggi gotta dip, will send through that ST new user exp doc in coupla days Prayjj please let team know we lovin this stuff chefskiss

reef trellis
#

Can someone explain to me how context actor in a state tree gets updated during execution?

chilly nebula
reef trellis
#

I'm having an issue where I can't stop a character from moving because the Async task pointer I'm setting outside of the state tree comes out as invalid in the state tree. And I can't think of a work around, or how to do this properly

#

Is there a way to force it to be updated?

reef trellis
#

Otherwise how to people update variables within the actor itself? What is the best approach to accomplish this?

chilly nebula
chilly nebula
reef trellis
harsh storm
reef trellis
#

That's why I was asking if the context actor ever get's updated, during state tree execution

chilly nebula
reef trellis
#

I thought it would at least let me terminate it at will

drifting ginkgo
#

And 5.6?

harsh storm
#

No. I don't use LSTs

#

And I hardly ever change the child selection logic

drifting ginkgo
#

Legend I'll try without those then to see if I can't find a consistent repo. Thanks

rancid marten
minor pawn
somber kernel
harsh storm
#

Looks like "Project Settings -> Engine -> Gameplay Debugger -> Input -> Activation Key"

rancid marten
somber kernel
rancid marten
#

That's what I'm about to do but I was hoping someone has seen an NPC behave this way when just moving to random locations (only when frames aren't chopping).

rancid marten
#

Right now I think there's a problem with the EQS and I'm going to replace it with some other move to random location task

#

The NPCs definitely are finding a location to move to, but they're just glitching while doing it and only if my frames aren't chopping.

#

I don't understand EQSs and if it has anything to do with why they glitch-move to the target location that it finds

somber kernel
rancid marten
#

The Move to Roam Location state works fine whenever frames chop. If you see the video, at one point I alt tab to demonstrate how they will move at normal speed for a brief moment

#

at :30 in

#

I suspect something is ticking constantly and refreshing. So that when the frames lower it is able to run that one logic normally.

#

But I have zero idea what would be doing that because Find Roam Location seems to work fine.

#

I have isolated the problem to the Searching state and its sub-states.

#

They seem to be stuck in the Search for Enemy state

somber kernel
#

Compare it to the template and see what it changed in the enemy search state

#

Perhaps you entered incomplete or incorrect variables, or perhaps you performed incorrect transitions

drifting ginkgo
#

I'm using TryEnter because I prefer rather than 'The ball rolls down the hill' I feel like I have more choice when the ball rolls to the next increment. Although it seems like that may be causing a few of my problems along the way?

drifting ginkgo
#

Interestingly you can add an 'Base' State with the SelectionBehaviour - Try Enter. (Changing Initialize to - TrySelectChildrenInOrder)
and get the behaviour I'd expect it rests in Base, but the Initialize bindings will receive as expected. But Initialize set to TryEnter and you lose those bindings events Shrujj

chilly nebula
spiral robin
#

Hey guys, need help from StateTree gurus. Can anyone please tell, what am I doing wrong here? I use StateTrees for my quest system, and I'm planning to implement persistence via workaround using Selection Utility. I've implemented my custom selection utility and assigned it to each child state of Root. However, this doesn't work as expected, the first state is always selected no matter what. And judging by logs and debugger, my custom selection utility's GetScore method never even gets invoked. Why is that?

spiral robin
#

Also, I probably just don't understand correctly what Selection Utilities are. My previous understanding was that it's just the thing that provides you a score, that score will be multiplied by weight, and that result will be used as final Utility (that will be used for selecting child by highest utility). However now I've noticed this:

#

If you add another selection utility, it builds an expression, and it combines Utility Scores with boolean operators for some reason (despite the fact they only have GetScore that returns float). I also don't understand why is that

spiral robin
#

Also, here is my consideration implementation:

#

This log is never printed, I've also tried putting breakpoint in this node and in C++ code that invokes blueprint's ReceiveGetScore, the execution never stops there as well

warped tiger
#

Hi, I've noticed that if a state tree's state with children has bShouldStateChangeOnReselect = false and EnterState returns EStateTreeRunStatus::Failed, the next time FStateTreeExecutionContext::TickTriggerTransitionsInternal() will try to find a new state as part of its max 5 iterations, it won't call EnterState. Is this how it's expected to work? Shouldn't EnterState be called again if EnterState failed in the previous iteration? 🤔

minor pawn
#

I'm facing a problem, where the controller seems not to be rotating with the character.
I have a different project, where it works, but I can't spot the difference.
II have a perception on the controller, so I can check the cone to see, if it's rotating.
So the characters look always in the same direction, but the mesh is rotating correctly.
I checked every option in both (character and controller).
The only difference I can see is, that the one with the problem is created with c++ and the perception component is created in the constructor

warped tiger
# warped tiger Hi, I've noticed that if a state tree's state with children has `bShouldStateCha...

In other words, should this tree print "Hello"?

FAlwaysFailTask::FAlwaysFailTask()
{
    bShouldStateChangeOnReselect = false;
}

EStateTreeRunStatus FAlwaysFailTask::EnterState(FStateTreeExecutionContext& Context, const FStateTreeTransitionResult& Transition) const
{
    return EStateTreeRunStatus::Failed;
}
EStateTreeRunStatus FPrintTask::Tick(FStateTreeExecutionContext& Context, const float DeltaTime) const
{
    UE_LOG(LogTemp, Log, TEXT("Hello"));
    return EStateTreeRunStatus::Running;
}
heady silo
#

I'm really struggling with StateTree. I've been trying to move some of the logic I got working under Behavior Trees to StateTrees. Basically, on spawn for the AI I have them assigned a patrol route with an instance-editable variable based on the actor that guides the patrol (BP_AIPatrol). The patrol route actor has a function in it called IncrementPatrolRoute that will add to a patrol index that varies depending on the length of the patrol, and when it reaches the end, swaps things around to get the actor to move back along the same route to the origin.

This works in BTs just fine (fig 1.), but I'm not sure how to get StateTree to pull the patrol route. I'm assuming I need to pass it via payload somehow for an entry condition? But when it comes to the StateTree task, there's no way to grab what I need from the controlled pawn, STT's EnterState only has transition data and none of the pins will reference the source actor. (fig 2.) How do I get the state in my state tree to fire if the actor has a patrol route assigned to it? (fig 3.)

#

I tried to add it to the global bindings but I'm not sure how to call that

#

(plus, that is only setup at runtime, and if I want functionality later where a guard will relieve another guard and take over their patrol route, that's not flexible enough)

heady silo
#

...well shit

robust veldt
robust veldt
#

When task is finish, then get active again, does instance data get reset?

drifting ginkgo
quiet iron
quiet iron
robust veldt
quiet iron
#

cleared meaning it will create a new instance data for that and the old one will be invalid?

#

Or they will stay at the same block of address

robust veldt
quiet iron
#

Thanks

hallow compass
hallow compass
drifting ginkgo
drifting ginkgo
quiet iron
#

Ahh, just thought you can do comments on the state tree itself.

celest python
#

not a bad idea tbh

heady silo
static cape
#

Hello everyone, hope this is the right place to ask this. I am relatively new to unreal. My ultimate goal for a project I am working on (for uni) is to make an AI in unreal 5 that can play an RTS game. However as a shorter term goal i would happily take some pointers on where to start my research. Because quite frankly at the moment i cant even get an AI controller to control more than one BP independently from one another. Any and all advice appreciated, thank you in advance

magic brook
#

Anyone able to assist me with EQS troubleshooting? I an new and attempting to do some very basic EQS. I am just setting up a sphere trace from a location to determine "good cover locations" for an AI basically. If I set up the location to draw the trace from an actor in the world, an AI character, or the playerpawn the EQS test pawn returns all locations as good even when they are not. If I manually set the location to trace from by entering world coordinates in the blueprint instead of grabbing an actors location it also does not work as expected. IF I set the location as the EQS test pawn OR the player start it works as expected.
I think I am missing something of vital importance-
example of it working, useing the player start as the actor of class

#

example of not working

slow bobcat
slow bobcat
#

Also the functions you posted do not help since we can't know where/how do you use said values

magic brook
#

one sec- I will add more detail- I have also been working on trying to get it to work

magic brook
#

linking a video showing everything almost done

magic brook
# magic brook I recorded and uploaded to youtube? I recoreded at too high resolution and was h...

what I was typeing in notepad "Ok I am working on this state tree
I have it going from root to the search part of it (all testing stuff ect)
it goes from search to test eqs
under test eqs it runs the task I set in there
this is the task
enter state- it then runs the hide part
thats just a custom event
it pulls the character running the tree, runs the query, then prints that it ran query (for troubleshooting)
on query finished- it gets the results (should only be on result)
the result is location, i also print location to view it for troubleshooting
move to location then finish task after delay (im not sure the delay is working, but thats a later problem)

this is the EQS that runs

checks path exists, filters?
then does sphere trace
thats just the default one atm - offset so it doesn't get stuck in floor when it looks
looking for the test dummy sorry
howed he get there rip
the dummy has the test in it- so it is traceing correctly i think
currently useing self location of scource of trace-

the state tree is being used by this actor

he should do trace from self, then go to another location that is not seen from self trace i think?
but he is not
observe

its running the query, and returning a location it selects, but does not appear to be actually filtering the results/doing the sphere trace.
"

magic brook
rich wolf
#

what's up with blackboard having struct type possible, but you cannot set or get them?

#

or am i missing something?

rich wolf
#

apparently it is so

slow bobcat
heady silo
#

would this be a realistic ask for a perception system in UE or is this going to be impossible?

#

PITS means Pie in the Sky, basically preemptively being ready to cut it if I don't have time to do it

regal patio
#

In this video, I walk you through the best self-hosted AI tools you can actually run in your home lab. From Ollama and OpenWebUI to n8n, LocalAI, AnythingLLM, Whisper, Stable Diffusion, and ComfyUI, I cover how each tool works, how they fit together, and how you can build your own private AI stack at home. If you’ve been thinking about running...

▶ Play video
harsh storm
mighty geode
#

Any good AI tutorial for UE with C++?

#

That teaches in deep so I can understand how to implement certain behaviour like investigate but when the other soldier arrive, the alerted soldier alert him and he also starts to investigate but instead he provide cover in case the investigating soldier find anything

mighty geode
drifting ginkgo
#

Anyone have suggestions for good C++ common tasks they have built for StateTree that aren't possible in BPs?
Looking to extend stateTree Tasks/Components as a starting point to learning more about it 🙏

drifting ginkgo
#

Went with exposing up some simple functions/types to better understand the relationship of elements, anyone learning this is going quite well for better understanding the relationship of things.

warped tiger
#

<@&213101288538374145>

quiet iron
#

I don't understand why the Context Data needs to be added with a fixed FGuid. So it's persistence when serialize and deserialize?

heady silo
#

I dunno if anyone's tried this, but I wanted to know if maybe someone knows.

Is it possible to add SmartObject slots to dynamic objects or moving actors like NPCs? I was thinking about doing this to allow for specific formations for NPCs (like a wedge or a snake formation). Or are SmartObjects baked into the level at runtime and cannot move/change?

#

I guess if it doesn't work that way I could always try and grab a followed actor's position and just do the vector math for where they should aim to follow, but I was hoping to make things easier on myself

cyan sigil
#

Smart objects should be spawnable. It would be absurd for that to be not the case.

heady silo
ornate onyx
#

Anyone know why **** NAVMESH NEEDS TO BE REBUILT **** is showing up at runtime, when everything in project settings and elsewhere is set to "DYNAMIC"?

#

for whatever reason, moving the actor that has dynamic navmesh on it at runtime, forces a refresh and it works, but not before doing this... and I don't see anything in blueprint to recast navmesh manually

slow bobcat
ornate onyx
#

what's weird is, the blueprint actor spawning at runtime (dynamic mesh actor) works fine, and I have an actor with a navigation invoker spawning on that spawned mesh, which works fine... (except the nav invoker part), but no navmesh

#

until... I move the spawned mesh actor at runtime, THEN the navmesh appears

#

also works if any options are toggled on the spawned mesh actor, which forces some random refresh on it, which navmesh sees apparently

#

@slow bobcat I guess the theory is that navmesh does an initial pass at runtime looking for already existing meshes, does not yet see the dynamic mesh created..., then via bp mesh is made, navmesh is not signaled that this happened

slow bobcat
#

Ummm that sounds odd...

silent hamlet
#

hello! I am writing my first State Tree Task in C++. I took an existing state from the Gameplay Interactions plugin basically as boilerplate. Now, the source compiles fine, but I cannot see the task in the editor.

The code is in a Loaded GameFeature Plugin, and I can correctly see other stuff from that plugin. Not sure if i forgot something obvious? Any help would be great!

(attached source because discord wants me to pay to write long messages) 😢

slow bobcat
#

Or there's a path check

ornate onyx
#

&*(#%$

#

so it looks like this is going to be another one of those, spend 3 days trying 200 different things, and it ends up being a box you need to uncheck somewhere in a sea of 600 other options

#

pain

silent hamlet
stark pulsar
#

Hey everyone i am trying to make a metahuma chatbot but i am soo lost right now in how to do so i want the chatbot to response even questions like what is the current weather in New Orleans i wanna know if there is any step by step tutorial or something or maybe like what ton use how to do so so far what i know is audio2face nvidia ace and metahumansdk has something to do with the process maybe even TTS bot something but i am absolutely lost please help a friend out.