#gameplay-ai

1 messages ยท Page 71 of 1

pine steeple
#

i just have a plugin that it does it all

#

use it in multiple projects

heady silo
#

which plugin?

wraith wing
#

Dont you need transitions on fail/succ

pine steeple
wraith wing
#

I did Simple tree and ended with shitload of transitions to get it working right

pine steeple
#

but it doesnt have the full team stuff

wraith wing
#

Like default go up to root is going all the way outside linked tree

pine steeple
#

yeah i did BT for like 7 years

#

state tree is new

heady silo
#

I was getting flack for using BTs when state tree exists lol, should I drop my trees entirely? is it stable enough to ship anything?

harsh storm
#

Just keep using BTs if it works for you

pine steeple
#

i use BT for most of the AI

#

but im using mass for tings

#

so i need to use statetree

#

BTs are great for single things per thing

harsh storm
#

BTs are tried and true

#

Many games shipped with it

heady silo
harsh storm
#

ST is still highly in development

pine steeple
#

Red Solstice 2 we have like 700+ behaviour trees o_0

#

though most are deprecated/dev only

heady silo
#

either that or try to adapt this for the organizer:
https://www.fab.com/listings/9a9f66b4-26f0-4a83-a758-3d8d4dd94ec5

Fab.com

Unlike traditional approaches which uses complex (and difficult to maintain!) behavior trees or finite state machines, GOAP NPC keeps game characters' behavior simple, efficient and user-friendly.Here you can watch a short video which showcases an example scenario with different behaviors, and some explanations about how to create your own.Goal-...

#

but I hear this is no longer supported

pine steeple
#

i mean depends what type of AI you are after

#

we did semi complex ai with BT's

#

but if they need to make descisions organically

#

then BT's are not the right way

#

BT's are great for "designed" flow

#

like X and Y and Z influences a decision choice

#

and that choice can be multiple things

#

then you need a different system to BT

heady silo
#

I guess the ideal goal, no idea if I'll get here, but the best way to describe it is like this: being on the wrong end of a tactical shooter

pine steeple
#

if the AI needs to make smart decisions to evolving gameplay where actions cant be determined

heady silo
#

so instead of being the one who gives orders for units to clear rooms, you're being pressured from every angle, flashbanged, and relentlessly hunted down

#

F.E.A.R. managed to smoke and mirrors this with excellent map design and good smoke and mirrors

pine steeple
#

imean you see ai in games and think that must be complicated

heady silo
#

but I want something less... scripted?

pine steeple
#

but i guarentee its simple stuff just looks complicated

heady silo
#

Yes and no

#

like

#

the end goal

#

is to feel like there is a command heirarchy to the enemy

#

and that commander is making intelligent decisions based on what they know about the player and their objectives

#

so there's macro and micro levels to this

pine steeple
#

we achieved this kinda using tokens (based on the Doom) talk

#

and a AIDirector class

heady silo
#

but even if I can't make the higher order stuff work

#

I want at the micro level, for the AI to be able to form squads based on nearby friendlies and properly clear rooms with realistic tactics

#

without having to script all the movements on splines if possible

#

and be smart enough to heal each other and do covered retreats

pine steeple
#

well ideally you want an AIDirector to determine all the stuff, and then order the ai to do what they need to do (both for performance and single point of responsibility). If you want it even more organic then each AI need to do the decision making based on the information it gathers from the world and its target

heady silo
#

also stuff like bounding overwatch

#

stacking and breaching

#

I know I'll need smart objects for sure

#

but for whatever reason all the smart objects tutorials are out of date for 5.5

#

I was looking at the doom token system in Ali's tutorial awhile back

#

but I wasn't sure if it would really meet my goals

#

I initially was looking at HL2's AI for the squadslot system to control who's moving and who's firing

#

maybe assign roles based on detection order

#

who is closest

#

observing the 4 Fs- have the agent with best visibility on the player/player's cover to suppress while other units flank/grenade

#

there's a flanking plugin but 5.5 broke it and I couldn't get it working anyway

#

lol

#

I hadn't looked into the director too much because I'm relatively new to the engine, decided to focus on emulating what I knew about existing titles and scaling up over time

#

trying to nail the basics first

wraith wing
#

All that complicated systems and average game has ai dumb as fuck

heady silo
#

or pecieved to be

#

but the big advantage those devs had was that the AI programmer was basically given the freedom to go nuts for an entire year with basically no intervention from management

#

and the game's design- tight linearity, the slow motion mechanic- meant they could sharpen the AI to be super hard but never feel too unfair because of the power given to the player to fight them

#

a lot of more modern games have open worlds, so the AI has a lot more variables to consider due to the massive amounts of space

#

and getting ideal decision making in a manner that is performant is rough

#

F.E.A.R. is pretty much remembered for the AI alone, because the world design is incredibly bland. Lots of dark corridors, offices, pump stations, abandoned towns

#

we have much nicer looking worlds but with the greater complexity, AI programming is that much harder to make the most of it

#

which is why you have shit like scavs beaming you in the face in Tarkov from 300m with a 30 condition AK through multiple tree branches and a thick fog layer

#

I guess that's why neural networks seem to be the focus for the next generation of AI tech- just have the program copy human players

#

I guess the best case there would be to have some milsim developer do a training tool for the military with real soldiers doing CQB drills, and then just train an AI with that data

harsh storm
#

While I can only go off 2nd hand info, I do trust the source, but I'd avoid using GOAP. Instead, favor HTN. It achieves the same stuff as GOAP but in a more designer friendly way and more performant. There is a wonderful HTN plugin that you can pick up as well. Really really nice.

#

If you search for GOAP from "Luthage" - she talks about it.

#

(in this channel)

heady silo
#

looks up the HTN plugin

#

JESUS $300 FOR A PERSONAL EDITION

#

O_O

harsh storm
#

It would take you far longer to build it yourself

#

Unless you only value your time at like $0.00001 an hour, just buy it

heady silo
#

Yeah, true. I just don't want to be accused of making an asset flip when I have something I can ship

harsh storm
#

No one gives a care about that dude

#

They just want fun experiences

#

And this is code, not a syntyty asset

heady silo
#

Fair, I just also want to learn about this stuff because it can prove I know how to do things which might get me hired somewhere

harsh storm
#

"I optimized my time to meet deadlines" or some dumb crap

heady silo
#

plus I already bought a few assets already, I'd like to make my money back

harsh storm
#

Then just use BT's and ST's

#

What you described as wanting to do is perfectly achievable with the tools UE already has

slow bobcat
#

Aaah you are using mass... Then I can't help sorry. Never used mass

silent hamlet
#

Deadlock? If a task fails what happens is managed by the transition on that state. I think by default it goes to root

#

"that state" = the state the task belongs to

odd kestrel
#

Hello everyone! I was experimenting with StateTrees, which look a lot better and more flexible after the changes from 5.4 and 5.5. I`ve watched the video from unreal fest and the quick tutorial they shared, and have a good understanding of the basics. But I can't find examples on how to do a couple of things on the C++ side of things. For example, how can I store state for a given C++ state tree task? for example, lets say I have a counter in a task that once reaches a given value, the task is completed and the tree can move to the next state. How can I achieve that (changing the state of a given task) in C++ if all the virtual methods exposed are const? Does anybody know of a good C++ example I can follow?

odd kestrel
#

oh actually I think I found the example I needed on Tasks\StateTreeRunEnvQueryTask.h and Tasks\StateTreeMoveToTask.h

somber schooner
#

Hi guys can you help my out with my AI
This is how im updating my ai behavior,
https://blueprintue.com/blueprint/0jncb-xj/
this function is in a service that runs on my main node. It runs on tick

I would like help on two things:

  1. how do i stop the AI from turning so immediately to the player

  2. i don't want it to just continuously do the jump attack every time its far away, so any idea on how i can reduce it or something? I've already added a condition so its supposed to work only half the time, but ig because its a tick, every time the behavior tree goes there it does the checks it, so basically its being checked multiple times instead of just once is my guess as to why its always doing the jumping attack.

celest python
rancid mural
#

It's a day ending in Y and I'm working on enemies so of course navigation is broken for me again.

Noticed that my humanoid enemies would shove themselves against a wall forever trying to navigate to perfectly overlap their destination in some cases regardless of acceptance radius etc, so I figured maybe I needed to fix my navigation agents.

So I go set up one that matches the capsule of my humanoids, one for the capsule of my big things, one for the capsule of my little flying dudes.

And two of those work. The big guy is, once again, completely broken and refuses to move even though I can see his color-coded navmesh on the ground and debuf says he's using the right agent. So I try to tweak cell settings and stuff in the recastnavmesh that matches his agent, the usual arcane rituals where the best advice I've ever found, the most detailed explanation of what works and doesn't, is 'lol I dunno just keep changing them'. That got a result; now it refuses to even build the data. So at least the apparent result and the in-game result match now.

#

Ah perfect, the strongest arcane ritual of all: complain, hopelessly do the exact same thing for the third or fourth time, now it works exactly as it should.

#

But of course, one shouldn't play with dark rituals, since now it's everything else that refuses to move. And then trying to fix that made it so now both are broken.

pine steeple
#

if i return succeded here if (FVector::DistSquaredXY(AgentNavLocation, InstanceData.TargetLocation) <= 100.f)
{
return EStateTreeRunStatus::Succeeded;
} the other task is still stuck running

#
    const FStateTreeTransitionResult& Transition) const
{
    const FVector& MoveToLoc = Context.GetExternalData(MoveToLocationHandle).Location;
    FDominanceMassFindNavMeshPathTargetInstanceData& InstanceData = Context.GetInstanceData<FDominanceMassFindNavMeshPathTargetInstanceData>(*this);

    InstanceData.MoveTargetLocation = MoveToLoc;

    return EStateTreeRunStatus::Running;
}
``` this task
slow bobcat
#

Yeah because you return running

#

The first task finishes, tries to trigger a transition. It probably fails doing that

#

So your state keeps running

pine steeple
#

but that doesnt make sense

slow bobcat
#

Because the other task is still running

pine steeple
#

cause my move navmesh should signal

slow bobcat
slow bobcat
pine steeple
#

no task 1 grabs the location

#

task 2 does a navmesh move

slow bobcat
#

Ah yeah... That's not gonna work

#

They run in parallel mate

#

Put the task 2 in its own state as a sub state of your current one

#

State 1- grabs point
State 1.1- moves to point

#

I think in 5.5 you can do something like "this task doesn't run until X value is set from some other task", but I'm stuck in 5.4 so not sure

naive flower
#

Is there a way to get AI to turn smoothly? My AI just snaps when turning.

rancid mural
#

though you'll ultimately need animations for turning in place if you want that to look good

naive flower
#

Its currently turning like the the right, but I wish to end up with something like on the left.

ruby shard
#

anyone knows why UE's detour crowd is not solving collisions ? (agents get into each others), i checked dDetourCrowd sample project and its not like that. ๐Ÿค”

silent hamlet
# pine steeple task 2 does a navmesh move

If you group your tasks like that, they are both ruled by the same transition. So IF you have transitions setup for complete/succeed/fail they will be triggered according to the task that completes first

#

You said you are making one of them succeed so it should trigger a transition. Can you share the transitions you setup for this state?

slow bobcat
heady silo
# pine steeple well ideally you want an AIDirector to determine all the stuff, and then order t...

I'd also love to figure out very close pathfinding for groups of AI like this game:
https://youtu.be/zkmYOfKCKSE?t=439
I'm not sure how they pulled this off in the early aughts, I'm guessing that for the player teams they had four models animated with only one player controller and then just did a group health pool instead of calculating each individual soldier's route, but we have no idea how it works

Hello everyone, Monkiedude22 and welcome to another entry in the "First Minutes" series. This time I'm taking a first look at Full Spectrum Warrior on the Xbox One X.

There is no commentary in this video, but feel free to ask me any questions about the game in the comments section and I'll do my best to reply ASAP. :)

Follow Me!

-------------...

โ–ถ Play video
slow bobcat
#

Each soldier ca use its own path but, as Squize points below, you don't need to

misty gale
#

They can 90% use the same path really

slow bobcat
#

Yeah, you could calculate just the first soldier path and the offset the last point of each soldier after to their own end point

hidden nexus
#

Hey!
I have an enemy that should attack the player from the side. I find that location using an EQS query and I pass it to a MoveTo node.
I want the enemy to follow if the player moves, but that seems to only work with an actor target, not a vector target.
I tried to use a blackboard decorator with OnValueChanged and AbortSelf but then the enemy just freezes.
The only other solution I could find is to spawn an invisible actor, I'm trying to avoid that because that sounds annoying to manage.

Any ideas?
Thanks!

subtle pelican
#

Hey yall, is there a difference between these two noise nodes that report sound to AI Perception? Seems like I should use the non-server node (Report Noise Event) since it specifically targets AISense_Hearing, but I wanted to understand the difference.

misty wharf
subtle pelican
#

They both work in PIE and standalone for AIPerception. The AI registers the noise using either node. I'm just not sure if in a packaged game it would make a difference because of the "server only" tag on the top node. Either way, seems like Report Noise Event is the one I should be using.

misty wharf
#

Ah you're right, it does seem like the make noise code is actually supported in the perception system

#

MakeNoise does check that it's on server but not sure if the perception system deals with that internally somewhere also. Considering I think AI controllers would only run on server, I think it probably would be taken care of with that.

#

(Obviously irrelevant for singleplayer games)

slow bobcat
misty wharf
#

There's probably some way to update the movement target ๐Ÿค”

#

Dunno how you'd do that, but if you wanted to find out, you probably would need to look at how it handles it when your movement target is an actor.

#

Since it needs to keep track of its position, it would need to keep updating the location while moving... so similarly you could use something else if you dig deep enough into it

#

but I don't know if it's ultimately worth it... you can create some throwaway dummy actors for this purpose just fine, eg. kinda like GAS sometimes uses actors for targeting and such and discards them later

misty gale
#

Sounds like an offset would do

#

But cant you just chase the target normally untill within some relatively large radius, then branch out on the side ?

#

Guess the follow actor node also just uses some timer to update it at some frequency

naive oar
#

Can someone that pushes to unreal engine source code make sure this is included in 5.5.2, seems like they just forgot? Overriding Linked Trees doesn't work without it

bool UStateTreeAIComponent::SetContextRequirements(FStateTreeExecutionContext& Context, bool bLogErrors /*= false*/)
{
    Context.SetCollectExternalDataCallback(FOnCollectStateTreeExternalData::CreateUObject(this, &UStateTreeAIComponent::CollectExternalData));
    Context.SetLinkedStateTreeOverrides(&LinkedStateTreeOverrides); <===== Not in 5.5.1
    return UStateTreeAIComponentSchema::SetContextRequirements(*this, Context, bLogErrors);
}
misty wharf
hidden nexus
#

One day when I grow up I'll make a task that does it with a vector

harsh storm
naive oar
#

Looks like they already removed the override in ue5-main 4 months ago, but it hasn't been included in release. if it uses super it's all good

silent hamlet
slow bobcat
#

I'm a bit outdated (5.4) in terms of state trees. What's the state tree link override for?

harsh storm
#

Allows you to override a linked state tree that is inside of the state tree asset

#

Pretty much - programmatically set the linked state tree asset for a particular state in the tree.

slow bobcat
#

Ah nice. Makes sense. We are about to update from 5.4 to 5.5.1 and I'm sacred. We have a good bunch of custom state tree stuff... Wonder how many things will stop working....

stable plover
#

I am trying to make zombies move to and attack the player in a loop, but it seems like the zombies get stuck in a move to and just pause, this either resolves itself after x seconds or if i enter the attack radius, if anyone can help that would be appreciated thankyou

#

i am running a linked asset

#

this is the debugger

#

i dont know exactly why its getting caught up in the move to but here is the transition logic

#

it doesnt do it with my other zombie type just the melee zombie

slow bobcat
#

Isn't it that zombies are getting stuck against each other? Is your movement query returning Blocked by any chance?

stable plover
stable plover
#

in this instance after 20 seconds they started moving to the player again

slow bobcat
stable plover
#

nvm they moved it i got it

stable plover
#

i think i got it

#

one sec

#

ok i think i fixed it, i just increased the distance check from 85 to 350 and that seems to have worked

#

thank you for the visual logger suggestion

mighty edge
#

Hello Everyone!
Encountered a problem that BB Decorator act like "On value change" than "on Result change"

just for testing, I built on clean project, Simple BTree with selector and BlackBoard float decorator "Greater than 0.0" notify observer "On Result change", abort "lower priority" followed by custom task (just printstring value of bb entry) that always return "Fail", and lower priority task (just "wait"). When I change value of Bboard entry in >0 range (result of decorator check not change - pass) its trigger abort lower priority task.
Is it bug, or I just do not understand "on result change"
I run into this problem in main project and its break my logic. Thank four your Time!
video how it acts in real time
updt. U.E. version 5.51

Decorator "notify observer" acts like it "On Value change" and not like "On Result Change"

โ–ถ Play video
slow bobcat
#

Not sure ai follow but to clarify:

  • on value change: when the value changes, even if it's the same number as (0 to 1 returns true, 1 to 1 returns true)
  • on result changes: when the evaluation actually changes (different value from previous check).

Now you say you change your value from 0 to 0 it passes trough and aborts?

mighty edge
slow bobcat
#

But... I don't get it. That's right no?
You are asking "if my value is bigger than 0, execute the task below the decorator and abort the lower ones"
You are passing a 0.1 and a 0.2, which are bigger than 0, so the decorator passes and aborts the lower prio

What am I missing here?

#

Not sure what you mean by "on same evaluation result (pass)"

gilded mica
#

Guys a little help, someone knows how to debug the sight in AIPerception? I dont see it in the Viewport

slow bobcat
#

Ah wait

#

Just saw the video

slow bobcat
#

You keep moving the slider in the background and the number changes. The decorator evaluates every time the value of that variable changes (short of a listener) and runs the test. If the test result changes, it passes, what I mean: at 0 and below the result is false, bigger than 0 returns true. If you let it set at a positive number for few frames, does it keep retriggering again and again or not? I expect it does if it re evaluates on tick too or just when there's an bbk change event. That I'm not sure

mighty edge
slow bobcat
#

I would do it manually since you have the slider. Set some random positive number, observe the tree for a bit, change it again to a positive.

#

Then to a negative and see what happens, if it triggers or not

mighty edge
#

also try to play with tick interval of evaluation and task, all same

#

at this point i need confirmation that I'm not crazy))

slow bobcat
#

So it only triggers once, the first time the value changes to positive

mighty edge
#

0-1 true, 1-2 true, 2-0 nothing.

slow bobcat
#

And 2-1?

mighty edge
#

triggers

#

If i change the condition (to lower than 0, for example) its triggers in the interval that satisfies the condition

mighty edge
#

"Hi, I think there might be a misunderstanding about what Notify Observer does (I still find it confusing myself). From what I see, it will always reevaluate and abort tasks as necessary when the value changes regardless of Notify Observer. What the Notify Observer affects, is whether the task itself should restart. So for example, if you would put a decorator on a sequence with Notify Observer to On Value Change, then whenever the value changes the sequence would restart itself, even if the Result of the decorator was never False. Whereas if Notify Observer would be On Result Change, then the sequence would not restart itself."
Answer from user "chrudimer" on epic forum, looks like he right.

#

Thank a lot Bruno, really appreciate your will to help, you are a hero!

heady silo
misty gale
#

I feel like I'm doing this very wrongly, and just completely lack the understanding of the AI system 8-)

#

Using the "CanMove" to block the entire tree while the task executes

#

otherwise i seem to get weird behaviour.. but surely this can be the way to do it

#

extremely simple tree, in a turn based setting

harsh storm
#

Should be able to stop the tree by getting the brain component on the AIC and running stop

misty gale
#

But is this really the way to use the tree?

#

feels like im using it the wrong way and just forcing it to behave

harsh storm
#

That's because you are

#

BT's are priority selectors

misty gale
#

Right

harsh storm
#

If the attack hasn't ran "Finish Execute" then the tree will be stuck on that task

misty gale
#

untill some timeout happens, it seems

#

e.g. if i never call Finish Execute, the BT seem to be destroyed

harsh storm
#

That's news to me

misty gale
#

(unless that's just a bug, with it not showing in the instance list)

harsh storm
#

I've ran this pattern in many games. Haven't encountered that

misty gale
#

hmm alright

harsh storm
#

Putting the gate on that selector like you did shouldn't be necessary

misty gale
#

It's probably the rest of my logic that makes it bug out then

harsh storm
#

Could be

misty gale
#

my turn system felt robust untill i started using BT ๐Ÿ˜›

#

then it all became this fragile little thing, often getting stuck

#

unless i block it like now (or stop the brain), but that just confirms my feeling of doing it wrong then

harsh storm
#

Well, something else may be interfering with things.

#

Without more code and explanation - can't say really. But that pattern should work

misty gale
#

Its a cobs web right now so I'll save the details for later I think

harsh storm
#

Also - are you sure BT is the right thing to go for in a turn-based game? ๐Ÿค”

misty gale
#

Well .... ๐Ÿ˜„

#

I was gonna roll my own

#

because it would be dirt simple

#

but I keep finding excuses not to touch BT

harsh storm
#

That's fine

misty gale
#

and thus wanted to give it another go

harsh storm
#

I would probably reach for ST for most turn based games

misty gale
#

isn't that still beta ?

harsh storm
#

Though you could use the BT as a way to handle a units full turn

misty gale
#

not that that matters heh

#

It really only became an issue once i introduced multiturn actions ๐Ÿ˜„

#

made me go from "fire and forget" actions to "fire and retain state untill done" actions

harsh storm
#

You could still model that in the BT to be honest

misty gale
#

that's sort of what I tried with the CanMove blocker (which really is "HasTurn")

harsh storm
#

I'd just turn the BT off when it isn't their turn.

#

Then when it is, turn it on again

misty gale
#

stop/start brain ?

#

makes sense

harsh storm
#

Yeah

#

On the very first branch - check if they're doing a multi-turn action, if so, continue it, if not, go to the next branch

#

The action itself should be on the unit, not in the BT imo

misty gale
#

yeah it is in the unit

#

unless you mean even more abstract

#

The BT is the Action selector , as i see it

#

it checks and decides on the most viable action

harsh storm
#

Yeah, makes sense.

misty gale
#

I'll go for stopping the brain as you suggested tho

#

it sounds more in line with what i want to achieve, without blocking it with endless updates left and right

#

I'll stop it between a mutli action turn aswell I think..

#

So its just a "Pick the best action" slot machine

harsh storm
#

Pretty much

misty gale
#

and the state for the mutliturn action is retained in the unit, so if that's ongoing, i'll just not boot up the tree at all that turn

harsh storm
#

Should be fine.

misty gale
#

ty for the feedback!

obtuse igloo
#

Is there a way to get a specific actor with the smart object component, check if it's been claimed, and also be able to manually claim and unclaim/free it without using the querying?

spring scaffold
#

Hi guys
Wanted to ask is it possible to change value of "Tile Generation Radius" in NavigationInvoker in blueprint during runtime? I tried to drag invoker from components and search inside it for this but couldnt find it.

harsh storm
#

Check the C++ to see if it is accessible. Because from that, doesn't look like it is BP exposed.

wraith wing
#

GuYs is this enough to stop evaluating BT? I see debug white lines still flowing

silent hamlet
#

Yes that will stop executing the tree on that controller

heady silo
#

Is there a way to generate around friendly units? I'm trying to make a task for a soldier to path to his friend's current position and take cover from the player near that location. I tried to use ActorsOfClass and OnCircle generators for this test but I wound up with a weird test that seems to just generate on the edges of the available navmesh. Not really sure how to go about this.

heady silo
#

even when assigning values it does nothing

dense owl
#

Iโ€™d say turn off each test backwards sequentially to see if a particular one is causing the issue

heady silo
#

even with all the tests off this is where it is

silent hamlet
#

But i don't understand if you have troubles with this or with generating points around specific "friendly" units

#

Also i see you have another generator in that query graph...not sure if related, depending on what the problem is

rancid mural
#

repeating this question I asked to no response a few weeks ago since I'm considering a move to state trees or state machines before I start polishing the ai for the enemies I currently have

Maybe a weird question with no good answer but 'keep at it', but who knows...

Which of state machines/Behavior trees/state trees is easiest to remember or has the most convenient debugging or transparent operations?

I find myself coming back to BTs after a while to work on something new or because I noticed a bug and it can be...challenging, just refreshing on how my own stuff works or figuring out why something is happening even when I know roughly where to look. It doesn't feel particularly intuitive.

silent hamlet
rancid mural
#

I guess I'd say my enemies are mostly in the vein of what you'd see in a soulslike or survival horror game (depending on the particular enemy)

relatively simple, don't need to do much thinking outside of their interactions with the player (if they're going to sneak around and do something clever, I'm much more likely to cheat by scripting it than try to have them figure it out)

#

for that, I'd imagine even blueprint scripting is on the table

silent hamlet
#

Souls like is quite more complex that a generic survival, zombie-like thing. The stuff that goes into npcs selecting an action during combat in souls is quite involved. But if you just want a high level "Guard" behavior (patrol-investigate-attack) you can do it with both. I personally find it simpler to think about it in states so state trees are more natural for me in that sense.

rancid mural
#

yeah, soulslikes are closer to what I need. I've been spending a lot of time just picking apart what behaviors trigger what actions in fromsoft games
it's kind of interesting to see that, say, a generic hollow in dark souls 1 will just keep swinging forever if you do this, but if you do this it will back away but if you do this it will sidehop, etc., and figuring out not just what they do but why the programmers would want them to do it.
and comparing what they've changed in their base enemies across games (some of them are almost identical but bigger, with larger weapons, and (near?)-infinite rotation on faster attacks)

#

my game is first person and controls pretty different, so it's not like I can just crib stuff, but it gets me thinking in the right directions

silent hamlet
#

Yea but man that is not easy feat. They use some goat inspired system and do utility scoring on potential moves based on a lot of factors. Unless you're down for a proper challenge id think of something simpler ๐Ÿ™ƒ

#

Lol, goap

#

Maybe they used goat for the capra demon tho

rancid mural
#

yeah, I'm definitely aiming more for 'make it seem clever' than 'make it actually clever'

silent hamlet
#

This gives you a high level view of what they are doing there

tardy blade
#

How do you show the green nav mesh and what does it mean if no green shows up?

heady silo
#

Press P by default

#

And no green means the navmesh doesnโ€™t cover that area

pastel moth
#

Is there a way to retrieve all the EQS points?

#

I dont want to filter any of them I just want to get all the points that are generated by it

heady silo
slow bobcat
#

There's no goap really since there's no plan building, but more "run X subtree based on this conditions", which is what utility will give you. You can download hacked versions of dark souls where you can run their debug tools and see the AI's debug. Will help a lot

pastel moth
#

I'm failing to get points around a querier using EQS. I don't know what is wrong. I'm generating points around the querier. I have no filter criteria. I just want to get all the points. Here is what my blueprint looks like. I'm not sure what is going wrong here.

#

Here's my environmental query

misty wharf
# pastel moth

Most likely the problem is you're trying to get them as actors

#

iirc that only works with generators that generate actors - the one you're using generates locations

pastel moth
#

Ah.

#

Ill try getting them as locations then

#

still no dice with get get query result as locations. The query status is fail anyways*

#

I have the actor I'm generating the query around extremely close to the navmesh where I want to generate the points on so I don't think thats an issue

misty wharf
#

๐Ÿค”

#

Hard to say, try using the visual logger since it should record more information about it

pastel moth
#

Darn ok

#

Well thank you

misty wharf
#

Maybe worth trying the eqs testing pawn and seeing if it works or not

#

If not maybe try turning off the navigation part of it and see if it has any effect, might help rule something out

pastel moth
#

Any idea how to get the reference to an EQTestingPawn? I tried using get all actors of class but no dice

misty wharf
#

uhh I think you need to make a new actor

#

and inherit from it

#

you just drop it in the level then and use it in editor, you don't need to do anything else with it and it should visualize queries

pastel moth
#

yeah Ive been trying to use the EQS Pawn itself

#

Ill try it this way with making my own BP and inheriting from the EQSPawn

#

darn still no luck

#

oh I bet I have an idea...

#

its probably because Im running it on beginplay for testing purposes and it cant generate the points around the querier because the land/navmesh hasnt been generated

#

woo

#

its working

#

Doing it on beginplay before everything was being generated + the locations thing too. Thanks @misty wharf

tardy blade
#

I don't know if this is a problem with AI or Animation but in the Content Example => Animation Physics Control level there is a Character supposed to walk through physical objects from target to target, but when you press play or simulate he doesn't walk anywhere.

#

This Guy

#

There is a navmesh on the map but it doesn't cover everywhere and when you rebuild the pathing what is outsie the displays disapears.

misty wharf
#

<@&213101288538374145>

#

honestly discord should just disable the markdown "ha ha change the link text ha ha" feature because it's not useful for anyone but scammers :P

hoary peak
#

Didn't they get backlash on that before even releasing it?

misty wharf
#

No idea

misty wharf
#

Not really an mp expert but if you're doing things that need to be synced with server multiple times per second I'm not sure how else would you imagine this to work when the AI contollers only run on the server

#

But yes you are correct in that the reason report noise doesn't work on client is because AI controllers run on the server and not on the clients

#

Ah, sounds like a reasonable solution

pastel moth
#

might be a ridiculous question but can you have transitions on root in a state tree?

#

LogStateTree (Error) BP_IslandPlayer_C_2: FStateTreeExecutionContext::Start: Failed to select initial state on 'BP_IslandPlayer_C_2' using StateTree 'StateTree /Game/Blueprint/Enemies/AI/EnemyIslandPlayer/ST_IslandManager.ST_IslandManager'. This should not happen, check that the StateTree logic can always select a state at start.

The reason I ask is because I thought the state tree automatically enters root and I can make it sit in that state till I trigger a transition with an event..

#

here's what my tree looks like not sure why it cant select root from the start

misty wharf
#

so in your case it has no valid leaf states to enter

#

this is probably solvable by adding an extra "do nothing" state into root which is the one it enters by default when nothing else happens

#

and you potentially want to add a wait infinitely task into it so it doesn't just keep entering it repeatedly every single frame

pastel moth
#

Yeah I managed to get that far. Is there a reason a tree couldnt transition when I send an event though?

#

sec sending an updated screenshot

#

managed to revise it to something like this

#

what Im trying to solve is that I have an EQS query in my get build point nodes and it keeps triggering over and over. I thought I could just get all the points from the EQS query then transition to CheckPointsAndBuild

misty wharf
#

Well most likely if you get the error about it failing to select something from root it means the tree doesn't really start, so if you then try to transition it obviously wouldn't work

pastel moth
#

Yeah

misty wharf
#

You can't be in a state that contains child states without activating at least one child

#

So if you wanted to have the EQS in the parent, you'd need a "waiting" state as the first child

pastel moth
#

so would I just have to "try enter" that get build points node for the selection behavior? My understanding is try enter wont try to force you to transition to the leaf nodes

misty wharf
#

With your current structure if GetBuildPoints is entered then it will either enter CheckPointsAndBuild or not enter either of them because it can't

pastel moth
#

ah okay so I'd need a child state of GetbuildPoints then I'd go to CheckPointsAndBuild?

#

man this is confusing haha

misty wharf
#

Yeah not sure what the big idea was with making it like that. It makes it hard to do what you're trying to do

pastel moth
#

I think I might just write this not using a state tree... I could just grab my EQS points, loop through them and test to see if I can build buildings.

It seems overly complicated to just try and do this simple thing

pastel moth
#

or maybe I can do something clever and skip some steps that are annoying to do in the tree

#

well thanks again @misty wharf really appreciate it

misty wharf
#

np

harsh storm
#

The way I found it easiest to approach ST with making states is...just don't have child tasks for the most part.

#

lol

#

So, something like this. The parent state could have stuff that the child states of it needs. But the actual overall state is just under that parent, but the children of that parent don't have children of their own really. (Using 1 as the example here)

#

For the most part though, the parent is mainly just for grouping logical states.

misty wharf
#

Yeah

#

It's just kind of a pain in the ass to set it up so that one state pulls some data and a second state uses it because sibling states can't bind to each other

harsh storm
#

And also - don't really have multiple tasks on one state

#

Because that is a headache as well

#

I would say only do it if you need stuff running in parallel. But don't have them rely on each other.

strange flare
#

hi i just wana know if this is a room for genrative ai or is the npc ai kind of ai

harsh storm
strange flare
#

oh thx ๐Ÿ˜… ๐Ÿ˜‚

pastel moth
late pivot
#

Hey everyone, can anyone explain to me why adding a child state to a state breaks my logic in state trees? For example this works fine with these two states as sibling states.

#

but if I add them to a group or make them a child of one or the other the logic no longer works.

#

im trying to find the right set up to transition to a state using an event and payload and have each sibling state be able to bind that payload

#

(also I realize that I didnt move the payload event to the "Group" state in my example above, but I did attempt that without any luck.)

odd kestrel
#

I'm trying to get my NPC to follow the player, so I created a very simple state tree with a state that uses the "Move To" state tree task provided by the engine. The first time the tree enters the state, it works. The problem is: if the NPC eventually reaches the player, it stops following them. I did some c++ debugging and I confirmed the tree is re-entering the state, the target actor is correctly set to the player and trackMovingGoal is set to true, but when the state is re-entered, the task status is already set to finish. I'm assuming the state tree task instance data is keeping the same move task instance for performance reasons, but doesn't seem to be resetting its state? Do I need to do it manually somehow?

dense owl
wraith wing
#

Pretty good talk

pastel moth
#

anyone know how state trees evaluate event transitions in unreal? I havent dug into the code yet.

so far this was my idea of how it worked? Is this right?

If I send an event to a tree will it save it? Then when it gets to a state where that event is required to enter it sees that it occurred and says "Okay you're good, go enter that state"?

misty wharf
#

I'm pretty sure events are evaluated immediately

#

So if you are in a state that has a transition for that event, it gets triggered, but if you later enter a state with such a transition, nothing happens (unless you send another event at that time)

slow bobcat
pastel moth
#

so if I send an event with tag from outside of the state tree will basically discard it? It needs to be in the actual state when I send that event?

naive oar
#

you can add a transition at the root state as it will always be active, then it will catch it always, even if in linked trees

pastel moth
#

Ah a transition from root with that event?

naive oar
#

all states leading to the state you are in are always active and can transition

pastel moth
#

Ah okay thanks

#

I think I kept thinking of this as a FSM too much

naive oar
#

so you dont need a million transitions to "dead" on every state you could be in, just put it in the root

#

then send the dead event and done

#

also any tasks placed in higher up states are active while the childs are active. so you could put tasks that listen for certain stuff in root and then trigger transitions no matter where you are.
for example, in a combat tree, you could react to incoming attacks (place the task at the root of the combat tree) no matter where in the combat tree you currently are

pastel moth
#

sick thanks

#

This is what my tree currently looks like. I have that construct building as a group and that tag as a required event to enter on GetBuildPoints

#

oh whoops I see root is a group.. that was an accident. Meant for it to be a state and have that as select children in order..

#

Any idea why root cant transition to get build points when I send the event? The tag is correct and I have confirmed I'm sending the event using my BP. I have an enter condition for it.

naive oar
#

i've stopped using those required events to enter, i found them to be a bit buggy, triggering exceptions and what not. i would just put the idle above getbuildpoints and then transition from root to get build points directly, when done, go back to root, and then it will go back to idle

pastel moth
#

I'm trying to figure out how to block it from entering that GetBuildPoint state

#

I originally had another state above GetBuildPoints that had a transition with event

naive oar
#

it cant enter get build points if root leads to idle and idle leads to root. except when the event fires

pastel moth
#

ahhh okay I see

#

Thanks a lot Jorm

#

That did it

sterile glen
misty wharf
#

@slow bobcat by the way, are you familiar at all with AI systems in games like RimWorld, where NPCs need to perform tasks based on what's going on in the game world? I'm working on adding some stuff like that into my video rental store simulator for employee AI's and this is annoyingly complicated lol

slow bobcat
#

what kind of tasks do they need to perform?

sterile glen
#

yes @misty wharf , there are 2-3 controller i'm spawning, however BT is only working properly on one of them :/

#

I've made a custom task to print the name of the controller when the task gets finished, and the log is only printing for 1 controller, for others its not working, however in the BT it shows the its stuck at first task .

#

I'm stuck at this issue since days, don't know what side i'm doing wrong, any help would be great

misty wharf
# slow bobcat what kind of tasks do they need to perform?

The tasks themselves are not that tricky, they would generally pick up things and put them elsewhere, or do some other kinds of interactions. F.ex. pick up a video, rewind it, and put it on a shelf. The complicated part of this is what happens if the AI can't finish the task, f.ex. because there is no shelf space.

My current thinking is that I'm going to have "task generators", f.ex. if a video is placed in a "rewind" box, there's a generator that then would generate a "rewind video" task for it. But at that point, I think it would need to validate whether this task can be completed, eg. check for empty shelf space. The task generator would probably also need to monitor the conditions and cancel/invalidate tasks it generated that are no longer possible to complete. If an AI is in progress of working on this task, they'd get an event telling them to abort the task in such a scenario.

Mostly just wondering whether this is a sound approach or if there's something I might be overlooking or not considering since I've not really built these types of systems in the past.

misty wharf
sterile glen
#

yeah, it randomly picks one of the pawn and works fine there, for the rest, the execution is stuck at the left most leaf

#

i added debug in the task , and it only runs for one of the controller. Let me share the task.

#


#include "Bots/Task/BTUnitTask.h"
#include "Bots\BotController.h"

UBTUnitTask::UBTUnitTask()
{
    NodeName = TEXT("SampleTask");
    bNotifyTaskFinished = true;
    bNotifyTick = false;
}

EBTNodeResult::Type UBTUnitTask::ExecuteTask(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory)
{
    ABotController* BotController = Cast<ABotController>(OwnerComp.GetAIOwner());

    if (!BotController)
    {
        UE_LOG(LogTemp, Warning, TEXT("No AI Controller found. Aborting task."));
        return EBTNodeResult::Failed;
    }


    float WaitTime = FMath::FRandRange(2.0f, 4.0f);

    // Schedule a timer to finish the task
    FTimerDelegate TimerDelegate;
    TimerDelegate.BindUObject(this, &UBTUnitTask::OnTimerFinished, &OwnerComp);

    BotController->GetWorldTimerManager().SetTimer(TimerHandle, TimerDelegate, WaitTime, false);

    UE_LOG(LogTemp, Log, TEXT("Task started, will wait for %.2f seconds."), WaitTime);

    return EBTNodeResult::InProgress;
}

void UBTUnitTask::OnTimerFinished(UBehaviorTreeComponent* OwnerComp)
{
    ABotController* BotController = Cast<ABotController>(OwnerComp->GetAIOwner());
    if (BotController)
    {
        UE_LOG(LogTemp, Log, TEXT("AI Controller Name: %s"), *BotController->GetName());
    }

    // Finish the task
    FinishLatentTask(*OwnerComp, EBTNodeResult::Succeeded);
}


void UBTUnitTask::OnTaskFinished(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory, EBTNodeResult::Type TaskResult)
{
    UE_LOG(LogTemp, Log, TEXT("Task finished with result: %d"), static_cast<int32>(TaskResult));

    ABotController* BotController = Cast<ABotController>(OwnerComp.GetAIOwner());

    // Clear the timer in case the task was finished early
    if (BotController)
    {
        BotController->GetWorldTimerManager().ClearTimer(TimerHandle);
    }
}



misty wharf
#

I'm not a 100% sure but to use delegates in this way you might have to make the task instanced

#

I would try to disable the spawning logic, and place a few of the bots into the level and set them to be auto-possessed by the appropriate controller... just to rule out any potential problems with the spawn code

slow bobcat
#

or place them into the memory of the task (it's what I do)e

sterile glen
#

@misty wharf I can see the controllers which are running the behaviour tree in the list when I play it in editor.
This tells that BT is loaded for the Bot Controller

#

Now for the task, can you share me how can I make them instance ?
I understand that I'm stuck in a very generic problem, many devs try to run same BT for multiple AI Controlled Pawns and that should work straight away.

slow bobcat
#

I can check the books I have at home and see if there's anything decent about GOAP or any other form of planners

misty wharf
#

Interesting, I'll have to look into that then. I wasn't really thinking it needed that, since it's fairly straightforward in the sense that they don't need to plan it, they can do it perfectly in sequence :) Eg. the task has the associated video with it, so the AI which took the task from the task queue just goes there, picks it up, then searches for a smart object with the rewind activity on it, and so forth. If at any point in this sequence the next step isn't possible to complete, it either retries or gives up

sterile glen
#

@misty wharf bCreateNodeInstance = true; helped. Thanks ๐Ÿ™‚

misty wharf
#

๐Ÿ‘

slow bobcat
# misty wharf Interesting, I'll have to look into that then. I wasn't really thinking it neede...

you don't need to. GOAP is a very interesting exercise but getting it right takes time (plus, in my exp, performance tends to be a problem).
You could other approaches like a Utility System.
Basically you have a bung of trees to chose from: HandleReturnedTapes would be one.

  • Reserves the space in the shelve (so nobody takes it)
  • It grabs the tape
  • Goes to the video and rewinds
  • Takes the tape back to the shelve.

The Utility will add weights like "is there a pending tape? +1", "is there space in the shelve? +1", plus other weights for other options. Then you compute that and decide the one most interesting

#

We do something like that to pick combos/attacks, based on distance to the target, space around to move (obstacles) and other stuff

#

ignore the mmo part, you can apply the same principles to smaller games

#

State Trees already have their own utility system

misty wharf
#

Thanks, gonna have a look at those. I'll look at some planner stuff also I think - I'm not sure if it's needed but I think it might give some ideas that could be useful at some point either way :)

slow bobcat
#

There's also the slots approach, where each part of your stuff has slots (imagine if each step was some sort of smart object). If you can reserve a slot in each step, then you do it. The GameAIPro book (I think it's in the second One?), has something like that to handle a queue in front of an ATM, people watching a street performance etc

misty wharf
#

Yeah I'm using the smart object system with it so it could consider slots also. It's slightly complicated by the fact that some things like a shelf can be used from a number of slots, but for different purposes, and it would be kind of silly if a customer doesn't use a shelf to browse, because an employee at the other side of the store has reserved it to put a video on it

#

But I think the basic idea makes sense, it just needs to take into account these types of annoying complications lol

slow bobcat
#

in those cases, you can always play dirty tricks like "employees access the shelf from the back, because them being employees, have access to that route", like how big super markets stock up their fridges (they have corridors behind them)

#

would need to have some level design changes but, sometimes, takes less time than re-inventing the wheel

neon carbon
#

There really is something wrong with detour ai controllers because the avoidance just doesnโ€™t work

#

Is it really broken ? I would appreciate feedback from anyone else who has tried using detour ai controllers

misty wharf
slow bobcat
neon carbon
#

Basic avoidance

#

Itโ€™s not working even in 5.5

#

Whatโ€™s going on

slow bobcat
#

That's not what crowd control is for. You can tweak the readioues to make it look like it but, in the end, it's just collision handling. It doesn't change paths etc

neon carbon
#

Here

#

This one

slow bobcat
#

Crowd control (or RVO for that matter) is just a way to handle AI Agents getting stuck againat each other

neon carbon
slow bobcat
# neon carbon https://youtu.be/spI6iDz2XLY?si=d4YYuA6N4_WnDIJF

at this precise moment the collisions are being detected by crowd control and it's pushing characters away from each other.
https://youtu.be/spI6iDz2XLY?t=235

In this video, I'll show you how to use the Detour Crowd Manager in Unreal Engine 5. I'll give a brief explanation on how it works, show you how to set it up, and show you how to tune parameters so you can get the system working with your game.

โ–ถ Play video
#

I'm guessing you are following that guide step by step?

wraith wing
#

You need cmc for avoidance

slow bobcat
#

RVO does more or less the same but doesn't care about NavMesh or Pushing your characters into cliffs or inside objects

wraith wing
#

If youre using pawn..

neon carbon
neon carbon
slow bobcat
neon carbon
#

As of now I just have pedestrians walking around and they just walk into each other as if theyโ€™re blind

#

Thatโ€™s why Iโ€™m looking for some avoidance method

slow bobcat
#

but do they resolve the "walking into each other" problem and continue walking their way or do they get stuck?

neon carbon
slow bobcat
#

and if you enable the crowd control debug what do you see?

neon carbon
#

Whole point is I donโ€™t want them to touch

slow bobcat
#

yeah, that you can control a bit with the params of crowd control. I think there's a radius param you can tweak so it looks like the video you shared

#

Are you doing things exactly as on that video? because the guy writes some code tweaking stuff

#

there's always a bunch of stuff people choose to ignore when using this system.
All that is from this book
It's for ue4, but most of it is still relevant

#

I would also recommend reading about flocking behaviors and combine it with crowd control. That will probably will give you the best result

ruby shard
paper gust
#

Hello, anyone here with crowd expertise?

I need to create a crowd of 200 characters in Blueprint for a short film in Unreal 5.4. Currently, I have a pretty advanced crowd setup with Animation Blueprints, etc. Now, I need to add cloth via Chaos. So far, so good, but as soon as I have more than 5 characters with cloth, everything starts bugging out (causing lag, and the Take Recorder captures the lag). If anyone has an idea on how to fix this issue, Iโ€™m all ears!

Another question: I have blendshapes for my crowd characters, with different morphologies. Iโ€™d like to easily adapt the cloth to match the morphologies. From what Iโ€™ve researched, it seems difficult to do this directly in Unreal. I was considering using Houdini with a point deform, but if anyone has a workflow tip for this, Iโ€™m all for it!

Thanks in advance! ๐Ÿ˜Š

slow bobcat
#

One thong you could do is to make a build in development or test and run Unreal Insights in it, see what is expensive out of everything, see if that gives you clues about how to optimize things

paper gust
#

thanks ! I will check that notethat

ocean wren
#

Bit like they used to do with machinema

ocean wren
# ruby shard anyone knows why UE's detour crowd is not solving collisions ? (agents get into ...

There's some debug you can enable to show the samples used for avoidance and a few values you can tweak. Its been years since I used it, but it definitely did work back then. Much much better than RVO implementation, which honestly doesn't work at all really. Sadly my memory is vague on the details now, but I do recall having to derive from a Detour class for my character/controller? and ended up implementing a few extras for my own purposes (I wanted to be able to push other agents out of the way).

slow bobcat
twilit arch
#

Hi, wonder whether someone can help as I'm getting pretty desperate. Has anyone come across an issue where Behaviour Tree Task keys are being reset every time the project is loaded?

Bools are set to default values and keys are reset to SelfActor across all my behaviour trees that are connected to a character - Strangely, if I copy a 'backup' version the keys remain so I can copy and paste it each time, but that isn't sustainable and is a ridiculous solution moving forward.

This is absolutely tanking my project and grinding all my progress to a halt, because I'm having to manually reset tasks whenever I want to play test

#

Like so

twilit arch
#

Potentially this has been fixed - By going into the problematic Tasks and doing File > Refresh all Nodes

I went through all my BT Tasks and did this and, so far, it seems to be correct - huge thanks to Kareem who originally posted about this issue a few months back with no responses!

neon carbon
#

are state trees better than behavior trees?

harsh storm
#

They fill a different use case

#

It's not one being better than the other

neon carbon
harsh storm
#

State trees should be more lightweight than BTs, but it most likely doesn't matter for you

#

You're asking the wrong questions

neon carbon
harsh storm
#

No

#

Again - you're asking the wrong questions

#

For your game, will it be better modeled as a state machine or a behavior tree?

#

That is the question to ask

neon carbon
harsh storm
#

No, you're not

neon carbon
#

anyway if you dont mind telling me, you can

harsh storm
#

How would I know?

#

I don't know what game you're making

#

I don't know what you're doing

#

It is your game

#

You set the parameters

#

Not us

neon carbon
#

ok so let me brief you

harsh storm
#

The state tree is just a general purpose state machine that does state selection behavior more like a behavior tree

neon carbon
#

AI with complex tasks, such as hide away from the player, interact with other AI

harsh storm
#

That is extremely broad

neon carbon
#

for complex and large coded logic, is it better to use BTs or STs?

harsh storm
#

It is not a black and white answer

#

Both are suitable

neon carbon
#

ok then so i dont need to learn STs

harsh storm
neon carbon
#

i was worried i gotta abandon the BTs and move to STs

harsh storm
#

No

#

It is just a way to structure things. It isn't a requirement.

neon carbon
#

im sure somewhere down the long road ill have to, because there will be a particular feature thats only available in STs

harsh storm
#

There isn't

neon carbon
#

and then ill have to scrap the BTs

harsh storm
#

Well - unless you are talking about something like the property bindings (which takes place of the blackboard from BTs)

neon carbon
#

I see

sturdy cedar
#

Hello! We implemented a component to lerp an actor's position towards a target transform (e.g for when the character is interacting with a particular prop and we want to make sure that the interaction starts in front of the prop).
The component works by lerping between the component's transform and the actor's starting transform over a certain duration (the resulting transform is directly set with Actor::SetActorTransform()), and it works fine for player-controlled character, however when we use the component with an AI controlled character, we're having an issue where at the end of the transition the character rotates back to its control rotation: the transition ends with the AI character facing the correct rotation, but it slowly rotates back towards its control rotation.

A quick and easy fix is to set in the character's CharacterMovementComponent Use Controller Desired Rotation to false and Orient Rotation Towards Movement to true, but we were wondering if there any cleaner fixes?

misty wharf
#

Seems it would have to be either that, or adjust the control rotation

hallow compass
#

in what conditions do you use Pawn over character (or the other way around) for humanoids AIs ?

#

in my case they would only be a maximum of 4/6 AI in the level loaded at the same time
since its a multiplayer project i thought that the CMC could come handy if i dont have the time for a custom networked system

misty wharf
#

Probably almost never? There's very little reason for it unless you're doing something where CMC just doesn't work and it's easier to make your own instead of extending/modifying it

wraith wing
#

For performance

misty wharf
#

One case that comes to mind is if you want your character to function upside down. At least last time I was playing with that it just didn't work with that kind of thing

wraith wing
#

I got 1000 optimized pawns on map pathfinding with 4ms game thread

#

I will benchmark vs character but last time I tried cmc it was reaaaly slow

misty wharf
#

I think that falls under "something where CMC just doesn't work" lol

#

But yeah performance can be one

#

There are measure you can take to improve CMC perf, like using NavWalking instead of PhysWalking but it'll always have some amount of overhead I think

wraith wing
#

Ah yeah that was my first first WTF when I got crowd avoidance working on pawn

#

and they ended up in air not navmesh

#

cmc is more advanced than I though

#

should have know, FLOATING pawn movment

hallow compass
#

thanks for the insights

solid spire
#

Anyone else getting crashes in 5.5 if running in editor with a state tree open? It looks like something in the debugger is messing up

near condor
#

Can you change a State Tree Param from outside the state tree (lets say in the AIController)?

#

UE 5.5

wraith wing
late pivot
#

does anyone have an example of a working 5.5 state tree that uses a smart object? I cannot for the life of me get it to work... I get all the up to the point of claiming the smart object but the State tree thats attached to the smart object does not run. Any suggestions?

upbeat hamlet
#

I continued work on an older project and can't remember how to debug this when the behavior tree is doing this... please point me in the right direction ๐Ÿ™‚
There must be an error somewhere, but where?

stiff ibex
sterile crane
#

Does anyone know of an easy way to extend or create a decorator for cooldowns that takes a blackboard key for the time? Its nice that UE provides a cooldown decorator, but no idea why they wouldnt let you pass a key for the time.

If anyone else stumbles onto this, I just made a decorator child class of the Cooldown decorator and then on CalculateRawConditionValue I set the value of the cooldown float from a key then call super

stable plover
#

is there a way to get which stimulus was forgotton off of OnTargetPerceptionForgotton?

stable plover
paper anchor
#

I want to use the Lyra Starter Game Template in Unreal Engine. I have added a drone, and I want it to shoot at Lyra's enemies using AI any one help me

slow bobcat
# paper anchor I want to use the Lyra Starter Game Template in Unreal Engine. I have added a dr...

ummm you are asking a question that is way too broad. Kinda "how do I make AI?"
First steps would be to have a design.

  • how does the drone move?
  • can it fly? should it path (nav path) its flying route?
  • What's a target for the drone? how does it choose it among several potential target candidates? Does it use perception (sight, hearing etc)
  • what happens if the drone gets shot? does it die? do the other AIls target the drone? how?
  • How does the drone weapon work? can it shoot up/down/left/right or will the drone move to align with the bullet trajectory (aiming)?
  • What does the drone do if there's no target in sight?

Once you have a more or less good base design to start (you don't need to nail everything, just a base and then improve through iteration and testing while you solve unforeseen bugs/problems), decide what are you most comfortable with: Behavior Trees, State Trees or others (custom approaches you want to try or plugins).
Then design it.

Reading in between lines of your question, my guess is that you don't know much about making AI or behavior trees. There are lots of materials online about different topics. My advice is that, once you have your plan, start tackling each issue at a time: movement, target picking, attacking and so on

slow bobcat
#

yeah the actors to forget are added if they don't have any stimulus

stable plover
#

Yes thatโ€™s exactly what it does, but I thought I could use it if a specific sense was forgotten, I found a work around though, when my stimulus of sight gets updated I have a timer of a duration that fires a sight forgotten function

#

I have patrol guards who wonโ€™t agro unless you shoot them then they will forget you if they canโ€™t see you, my workaround works perfectly

slow bobcat
#

yeah you will have to play with that. In my experience, there's always an extra layer you have to add on top of the perception to control these types of things. That's why I'm not a fan of the perception component: it feels over engineered for the lack of features it seems to present

stable plover
#

I like the base functionality for tracking perception but I combine that with eqs for more control

misty wharf
#

Hmm, poking around with State Trees again and was looking into the usual issue of "what if I want to get data but it's async"

#

The structure you would need for that is get data > use data, because you can only bind child state data from parents

#

so there is actually a mode that would allow the tree to only enter get data, without entering a child on it... namely setting selection behavior to "try enter"... but I have no clue how this is even supposed to be used ๐Ÿค”

#

at a glance it appears to do what you want - it will infact not try to enter the child state which uses the data until you finish the parent task... but as it enters the child, it still counts the parent as finished, which in turn... causes the child to immediately finish as well

#

Also, you can give the parent state a parameter. These can be accessed by all the children... so in theory, if a child could write into a parameter, you could use it to store data like this to be accessible by another sibling... but as far as I can tell, you can't bind an 'output' from a task into the parameter. So that doesn't work

upbeat hamlet
#

Is there any way to adjust AI Sense Sight so that it not only "tracks" the origin point of actors?
I have a big vehicle, which I can hide easily behind a rock when the origin point is behind the rock.
Rear and front are very visible, but the AI doesn't get it.

upbeat hamlet
stable plover
#

anyone mess with damage functionality for ai, lets say i shoot a zombie, what should the zombie do, obviously be alerted but should I make it try to find who shot it?

#

like search in an area?

#

not sure what to do and would to hear what others did

misty wharf
#

I think most games would probably aggro the npc being shot at but as said it would depend, eg. maybe you have a silencer on your gun or something

misty wharf
slow bobcat
# stable plover not sure what to do and would to hear what others did

I second what zomg said. Entirely up to your game.
Ours have 4 states:

  • idle: nothing happens
  • caution: ai heard a noise, noticed something but not sure what. Go investigate
  • found: state in which the AI saw the target
  • combat: engaged in combat. Thus can be after approaching the target close enough during found or because damage happened (in which case we skip caution and found and go straight into combat)
#

I would argue you can skip found. We have it because we do some special anims, sounds, alert others and what not

stable plover
stable plover
misty wharf
#

Well if you wanted it to f.ex. just aggro the player, you could look at who was the damage instigator, and set that as the NPC's attack target regardless of whether it's within LOS or not

stable plover
#

just to get to the player

harsh storm
#

Then they don't do anything

misty wharf
#

Well then the question is what do you want it to do

harsh storm
#

Or just run towards some random position

#

In the direction of the player even.

#

Doesn't have to be the player

#

Not like you have a lot of choices here to be honest.

#

And you have to make the decision

stable plover
misty wharf
#

If it's a zombie maybe it can just lumber around at random, if it's a smarter enemy, you could have it calculate possible cover points from the direction it was shot from

#

So really it just all depends on how you want that specific enemy to behave

harsh storm
#

You're asking a game design question more so than an AI question imo

stable plover
stable plover
#

just to get a general direction

harsh storm
#

It isn't. You're asking what your AI should do in X situation. That is pure game design. Asking how to get your AI to do X is an AI question.

stable plover
harsh storm
#

I'm not saying it isn't

stable plover
#

im not trying to ask irrelevant questions, but it seems like the more niche the question the fewer the resources, like for example Ai forgetting, there is no one talking about that, even though there is a built in actor forget event for the perception thats a general event that fires when it forgets eveything from an actor not a specific sense

#

and this question even that im trying to solve, which i do agree is like 90% game design, all of the subject matter is just general functionality, and for someone approaching this for the first time I just wanted some input on how to approach this

misty wharf
#

Most of this stuff really is just a question of thinking of what do you want to happen and breaking it down

#

It is possible that what you (or someone else) comes up with at first isn't going to work so you might have to try a few different things to ultimately find what works best for your game

stable plover
misty wharf
#

I think that can be an advantage also in that maybe you can avoid the most boring tropes lol

#

Or limiting yourself too much to what others are doing already

stable plover
harsh storm
#

I didn't say your question was irrelevant

stable plover
#

I hate asking general questions because its impossible to really answer them

stable plover
harsh storm
#

Which is why you've received the answers that you have. We can generally help achieve most AI behaviors or point you to resources. But we need to know how you want stuff to behave.

#

Realistically, there are like what, 3-ish people who actually answer questions in this channel? Mostly me, zomg, and Bruno (where'd you go Luthage ๐Ÿ˜ญ)

misty wharf
# stable plover really? because my one friend who also develops plays a lot of games and he can ...

I suppose it depends on what you want to learn about it. If you think about the zombie example, you don't really need to know games or game AI to come up with solutions to it - you'd just think of what you as a player would think happens, or how you as the game designer want it to work... like, what would the expectation be when you shoot at a zombie? Would it pull out a gun and shoot back at you? Probably not right? This is something that you don't really need to play games to think of I think

stable plover
#

like a domino effect

#

or an ah ha moment

slow bobcat
harsh storm
#

I would die laughing if I shot a zombie and it turned around and smacked a neighboring zombie.

stable plover
misty wharf
#

I think it could be a fun mechanic

#

Zombies are dumb so you know it gets attacked maybe it thinks whatever was closest to it did that

stable plover
#

appreciate the help

harsh storm
#

Most games just have them attack aggro the attacker, regardless of distance.

stable plover
#

ima actually add the slapping functionality as a base, if he cant hear any sound he will wander in a location frantically 90% of the time, 10% of the time he will slap a zombie

#

ima record it and share it when its finished to hopefully get some laughs

stable plover
slow bobcat
#

Yeah

misty wharf
#

lol that's great

#

now make the other one slap him back and then they can just slap each other for a while

slow bobcat
#

That's a great distraction tech. Low health? Need to go through and you have a sniper with few bullets? Shot few zombies until they star slapping each other and cross through (maybe you can reduce their sight/hearing radiuses while in slapping mode)

heady silo
#

I tried to make my own flanking order but it's basically looping to execute constantly and using a cooldown in the BT can't disable self. Am I going about this anywhere close to correctly?

#

the tldr: grabbing the player's position or last known location from AI::Perception and adding on the axis, then generating an area around the new point to pick a random area inside to perform the move to with an available enemy in the level

#

the ideal version would be more involved, with checking who is closest to the point, prioritization based on remaining health and ammo of the player and enemies, etc.

dense pelican
#

Is this the right channel to talk about neural networks and Unreal Engine?

stable plover
#

If so why not put a wait task afterwards then abort that section when finished

copper glacier
#

Running into a weird issue with StateTrees, I have an InitialState which has a transition to StateB.

StateB can then transition back to InitialState.

When that happens, once a task finishes in InitialState, I get a crash, with an invalid event struct

checkf(ScriptStruct == TBaseStructure<T>::Get() || ScriptStruct->IsChildOf(TBaseStructure<T>::Get()),

StateB has a required event to enter, with a set payload. That event is not emitted in between StateB -> InitialState, but when the task finished in InitialState and it checks transitions, it appears to transition back to StateB like it got that event, but it didn't, so it crashes with an invalid event payload.

Is this a known bug? Or am I doing something wrong?

#

I somehow was able to work around it, but attached is my state.

If VER-67 Dialogue has the RequiredEvent to enter, then I get the above crash, if I move that to Interacting instead, then I do not get the crash.

No other changes. And Idle will only transition to Interacting on that event, which it never gets.

Super odd, but at least it isn't crashing now.

lean imp
#

In case you are using the Motion Matching template, and want to use an ai move system, check this

summer slate
#

Has anyone else had this issue with random integers?

Iโ€™m using a behavior tree, and calling a service that just gets a random integer in range and then sets the blackboard value.

Unfortunately, the first time itโ€™s called it goes to 0. Each time after that it is random as intended..

stoic cove
#

Hello. Is there a way to figure out if an AI character is unable to reach a location using navigation? Here's my problem. In my game, AI characters can be tossed onto platforms and buildings which are not always connected to reachable objectives or other enemies. This makes them get stuck. What I want is a way to simply make them move forward towards the objective while stuck on such locations until they fall off the platform and are able to navigate using navmesh again. How could I achieve this?

copper glacier
#

You could use AIMoveTo and then on failure do a SimpleMoveTo. Essentially AIMoveTo will attempt to path find, and has output pins for you to determine the success of that move. If it fails, you can then do a MoveTolocation/MoveToActor on the AIController directly, with use pathfinding off, and it should just walk in a straight line

slow bobcat
#

for platforms, the best way would be to place some nav links that can only go in one direction. Smart NavLinks allow you to do that

keen crow
#

Remind me please, what is the execution order of decorators on a BT node? is it from top to bottom, bottom to top, or random?

slow bobcat
upbeat hamlet
#

Another question regarding AI Sense Sight.
As far as I understand, it uses the origin of the AI Actor as start for the line trace.
Is there a way to modify this and use a socket location? (an aim laser socket in my case)

misty wharf
#

iirc there's an "eye height" it uses

upbeat hamlet
tidal vessel
#

Anyone know how they setup the Hit Listener in the State Tree Demo? I assume itโ€™s setup so that it jumps to the โ€œReactionsโ€ node when a gameplay tag event is sent to the state tree component. But not quite sure how they went about it.

misty wharf
misty wharf
upbeat hamlet
misty wharf
#

Heh, that's a clever workaround for it :)

tidal vessel
misty wharf
#

I'm not sure if send state tree event is easily accessible in BP's so sending those events might need doing it in C++ to get access to the ST component

tidal vessel
#

Sticking the event on the root is a pretty nice workaround actually.

#

Thank you ๐Ÿ™

misty wharf
#

Well it's not really a workaround, this is how it's intended to work :)

tidal vessel
#

What are some use cases you think for the hit listener if they could use the root anywho

misty wharf
#

What do you mean?

tidal vessel
#

If you can put an event on the root it will listen for it and transition wherever you want it to

#

So in the demo whatโ€™s the point of having a hit listener that seems to be doing something similar I suppose

misty wharf
#

Well just having the event on the root does nothing, so you need something to actually send those events

#

You could send them from the actor owning the state tree, but a task can also be used for it as in that example

tidal vessel
#

Yeah but I mean the root and the hit listener are both listening for the event regardless of how you fire it off. I guess you can use the hit listener if you donโ€™t want to use the send state tree event function

misty wharf
#

Ah

#

I mean the events the hit listener listen to are probably going to be stuff like On Actor Hit

#

so it listens for On Actor Hit and then converts it into a State Tree Event that the tree can then handle

#

(or whatever logic the game uses to determine when the actor was hit)

tidal vessel
#

Yah thatโ€™s what I was thinking

misty wharf
#

But yeah you could alternatively have the conversion directly in your actor, but I guess this approach centralizes all the state tree related logic and requirements into the tree itself, so it becomes a bit more composable without needing changes in the actor where it's used in

halcyon briar
#

Hello.
We're trying to optimize our AI.
We've noticed that our bot's behavior tree code often spends too much time duplicating static objects.
The calls for duplication come from Unreal's behavior tree management code. Specifically, UBehaviorTreeManager::LoadTree - ln 282 (UE 5.4.3)
Is there a way to avoid this duplication?

misty wharf
#

First stop in improving BT performance would probably be to replace blueprint based nodes with C++ based ones and avoid instanced nodes where possible... but if you've done that then can't really offer any further suggestions to that ๐Ÿค”

#

I don't remember running into duplication being a problem when profiling them myself

slow bobcat
#

What are the objects exactly? Nodes in the BT?

#

Sounds like what zomg said, that you guys use Instanced nodes all over the place

halcyon briar
# slow bobcat What are the objects exactly? Nodes in the BT?

I think so. At least that's what UBehaviorTreeManager::LoadTree seems to suggest.
What do you mean by instanced nodes exactly? Do you mean dedicated BTree or BTree nodes for each individual instance (a bot in this case) ?
How do I check if that's the case, and how can I revert it?

slow bobcat
#

Check if your nodes have the Instanced flag set to true. I think that every tree node made in Bp's is Instanced by default (since you need to save values as class members because you can't handle the node memory in BP's)

halcyon briar
wooden stag
#

Anyone know what would cause a state tree to just stop? It's working correctly except for the fact that when it reaches the final state, the task simply executes once and then the state tree stops and does not return to root

Expected behavior: ST goes back to root after "Play Sequence" task finished successfully
Observed behavior: ST simply stops after executing the "Play sequence" task, does not return to root

slow bobcat
slow bobcat
wooden stag
#

could be a bug I suppose

halcyon briar
slow bobcat
#

ah wait... you have a transition to the State itself it the state fails?

#

That sounds weird and risky, as in you might get trapped in an infinite loop

#

Have you tried setting both transitions to root, just as a test?

wooden stag
#

It was indeed like that in the screenshot however I've tried all sorts of transitions, result is the same every time, ST just ends

#

They are currently both set to transition to root

#

on success or fail

slow bobcat
#

and if you set a breakpoint in both finish calls, you can see it stopping right?

#

If you were using code, I would suggest place a breakpoint in StopLogic within the State Tree Component, to see who's calling it

wooden stag
wooden stag
hallow compass
#

where are the state tree theme color list stored ?

#

i cant find it in the UStateTree class

#

nvm its in UStateTreeEditorData, now i wonder how i can subclass UStateTreeEditorData

#

because its made in UStateTreeFactory::FactoryCreateNew but without editing source no solution

slow bobcat
#

You can make your own factory. I do that so I have my own state trees class generated from an option within the AI menu when you create a BP in content (right click etc)

copper glacier
#

Can I claim a smart object slot with a player controller? When I attempt to i get an invalid claim. Trying to allow a player to occupy a slot

copper glacier
#

Or have some rules on if the slot can be used? Like can I disable a slot?

wooden stag
copper glacier
#

If an AI has already claimed the slot, and I then disable the slot, would it reject the claim?

wooden stag
#

No idea, Ive never had to disable slots I just know there's a bool for it, might be worth trying

copper glacier
#

Awesome thanks, it did not reject the existing claim, but listening to the OnSmartObjectEvent delegate let me get when the slot itself was disabled, and then I could free the claim and remove the claim from my state tree evaluator, and send an event to the state tree to switch states, so overall I get the effect I wanted.

Player occupies the spot of a slot, I disable the slot, AI picks something else to do, player leaves, slot is available, AI sees it and attempts to use it again.

misty wharf
#

You should be able to claim them for players also, but if the goal is to make them unclaimable while the player is "blocking" them then disabling them could make more sense ๐Ÿค”

#

There might be another way to disable them through the smart object subsystem, Dilly's approach looks a little weird

#

That seems it would modify the smart object definition, which doesn't affect the runtime state I don't think.

copper glacier
#

Ideally I want to claim the spot, since the player is using it, the alternative was disabling the slot while the player is using it

#

But no matter how I tried to claim it (passing the playercharacter or the playercontroller) i just had an invalid claim, but actually I wonder if it failed because it had already been claimed by the AI controller, and I needed to pass a higher priority...

misty wharf
#

Which function were you using to claim it?

copper glacier
#

MarkSmartObjectAsClaimed

misty wharf
#

Hmm yeah I think that should work ๐Ÿค”

#

Visual Logger has extra info on SO stuff so it might have info on why it failed

copper glacier
#

I think it does..I think it was just I needed to pass a higher priority to my claim... just tested and I get a valid claim back. Oops

wooden stag
copper glacier
unreal kernel
#

Is there an easy way to know if a behavior tree has ended in success or failure? This is for a single run BT. I know there's an OnTreeFinished but it doesn't really tell you if nodes successfully finished or not

summer slate
#

Has anyone else had this issue with random integers?

Iโ€™m using a behavior tree, and calling a service that just gets a random integer in range and then sets the blackboard value.

Unfortunately, the first time itโ€™s called it goes to 0. Each time after that it is random as intended..

woeful abyss
#

Is there any way to use navmesh in vertical planes ?

copper glacier
#

When using a smartobject behavior, is there a way to get the claimed slot? I want to rotate my actor to the proper slot transform before playing an animation and completing the action. The MoveToAndUseSmartObjectWithGameplayBehavior node doesn't point them in the right direction. And If I separate it out to a MoveTo and then a UseSmartObject.., then if the AI loses the slot, I can't cancel the MoveTo. But if I get in the right location and execute the behavior I feel like changing rotation at that time is appropraite, but I can't find any way to get the claim handle from the behavior itself.

misty wharf
copper glacier
#

Ah yeah thanks, I started down the path of rolling my own task, I think I've opted to store the value on the actor (like in a blackboard, but I have my own key/value system but essentially that).

Then in the behavior, I have the Avatar, and I can load the value from there to get the handle

slow bobcat
upbeat hamlet
#

In EQS, is there a way to score points on these rocks higher than on the landscape?

storm sail
#

But one way to do it with the default EQS tests is to do a collision check for those rocks object type

#

You may need to make a custom collision object type for them specifically though

#

The method has caveats though, as you can only have up to 18 collision object types

#

And collision check queries can be a little pricey if you have way too many queries (the little circles)

#

But it's fast and easy to do

upbeat hamlet
storm sail
hallow compass
#

i got some soft object ref in my state tree task, when compiling i get an error:

Run Activites  Task 'Run AI Activities Task':  Level Actor references were found: StaticMeshActor_UAID_0250F2020200044602_1339681119, StaticMeshActor_UAID_0250F2020200044602_1355787120, StaticMeshActor_UAID_0250F2020200044602_1357147121. Direct Actor references are not allowed.
#

i wonder whats the workflow to reference actors in a state tree

misty wharf
#

Well you obviously can't reference a level actor from a state tree asset

#

That's the problem

#

I don't know why they haven't fixed the select actor dropdowns so they don't let you pick a level actor for cases where it's invalid instead of doing a validation like this though

#

The correct way to reference an actor in an ST is pass the actor in from somewhere else, or use an ST task or other method to get the one you want

hallow compass
#

its just a DA

#

and a soft ref is a path

hallow compass
misty wharf
hallow compass
#

the ST

misty wharf
#

Right - I mean in theory you could reference a specific level actor from a DA

#

But if you think of it in context, does that make sense? This would make it so that the DA only ever works in that one specific level and in no other

hallow compass
#

well yeah, because in my design the AI is in one specific level, and has activities

#

each AI has different assigned activites

#

each activities refs an actor

misty wharf
#

Is the actor the activity itself that it can then do?

hallow compass
#

maybe for interactable stuff

#

rn its just a target location

#

see it like patrol points

misty wharf
#

Right... the common solution to this is using something else than specific actor refs to identify things

hallow compass
misty wharf
#

Gameplay Tags are usually the thing used instead

#

F.ex. the smart object system uses gameplay tags for "activities" which you can then query from the smart object subsystem to find concrete smart object actors supporting that activity

hallow compass
#

I indeed forgot about smart objects

#

ill check it

misty wharf
#

You can pretty easily roll your own solution for it also without needing the smart object system depending on what you're doing :)

#

I'm currently using SO's in my project and they do work quite well, but I have some additional requirements that currently mean I have a secondary system in "parallel" which is a bit meh

#

Basically I need to know when certain activities become available or become unavailable, which isn't something the SO system can tell you in a clean way

hallow compass
#

i see

#

in my case the behaviors/activites are highly scripted

#

so a very dynamic thing like the SO system would not really fit

misty wharf
#

I don't see why not... You have your SO, and you specify what kind of behavior it runs when an NPC uses it

#

The behavior can be as scripted as you like

#

But it may require a bunch of fiddling around in C++ to get most out of it so YMMV depending on how comfortable you are with C++

hallow compass
#

idc about c++

#

i care about how much ill spend learning somethign new compared to make my own version

#

if i didnt have this actor soft ref issue i wouldnt even bother SO

misty wharf
#

If you primarily need a way to find activities for your actors... it's gonna be way faster to make your own solution I think

hallow compass
#

rn im thinking of having a WSS registrating all actors with component with a tag

misty wharf
#

The SO system can be kinda complicated but it does support additional things like being able to claim slots so other actors can't use them etc.

hallow compass
#

the map is a house, so its relatively small and easy to "hardcode" the activites

misty wharf
#

well I mean "find" in the sense that you need to know which actor it is without a specific ref to it

hallow compass
#

oh yeah ill use GTs

misty wharf
#

And yeah WSS + actor comp which register with it sounds like a fairly good solution

hallow compass
#

the second biggest annoying thing is that it looks like inline stuff doesnt display categories

hallow compass
#

why does the State Tree AI Move To task creates a new move request each tick ?

#

for a static target location

misty wharf
#

Are you sure the state isn't being re-entered every tick? Because that doesn't sound right

copper glacier
#

Yeah if you have another Task that is completing the state then it will retry, but the normal AI Move To task does not re-trigger that state, so just double check that another task isn't finishing, and that no transition/events are being fired in that state or any in the chain

hallow compass
#

anyways, idc about it because im making my own, the main issue im facing is that i dont understand how the task end from the move req result

#

its flooded in the context tick stuff

hallow compass
#

i mean, the fact that the task ticks is expected right ? since its active
what i dont understand is why epic devs made it update (without exposing a param like "do you want dynmaic target")

copper glacier
#

The task can tick, you just can't mark FinishTask as that triggers the state end,

misty wharf
#
        if (InstanceData.bTrackMovingGoal && !InstanceData.TargetActor)
        {
            const FVector CurrentDestination = InstanceData.MoveToTask->GetMoveRequestRef().GetDestination();
            if (FVector::DistSquared(CurrentDestination, InstanceData.Destination) > (InstanceData.DestinationMoveTolerance * InstanceData.DestinationMoveTolerance))
            {
                UE_VLOG(Context.GetOwner(), LogStateTree, Log, TEXT("FStateTreeMoveToTask destination has moved enough. Restarting task."));
                return PerformMoveTask(Context, *InstanceData.AIController);
            }
        }
#

There's why it creates a new move request :P

#

because you have "track moving goal" and the target is a location

#

just turn off track moving goal and it'll stop doing that

hallow compass
#

indeed

#

thanks

#

the state tree tick is so dense

#

hard to find what was somewhat linked between the task state and the nav req

misty wharf
#

Usually best to just start from the obvious spot.. since it was recreating it on Tick, I looked at the Tick function of the task and there it was :)

hallow compass
misty wharf
#

Ahh I see

hallow compass
#

and this happens somewhat in the state tree context tick

#

but i just realized something, what's the diff between putting vars in the instance data and on task

misty wharf
#

Yeah not sure why they do it like that. They could just bind events to it I think?

hallow compass
misty wharf
#

instancedata can be databound via the ST editor, things directly on task are configurable but not bindable

hallow compass
#

afail

#

oh indeed

#

i dont really see why you wont put everything on the instance data

#

for future "just in case"

thick walrus
#

I'm using Landscape splines for my roads, now I would like to decrease the navigation cost on the roads, so that my NPCs actually use them.
I tried editing the spline mesh of the road, by:

  • Setting it a dynamic Obstacle
  • Setting the Area class of the mesh

The navmesh calculates fine and the roads have less cost than the surrounding landscape.

However, when I restart the Engine, I'm getting ensure fails from the SplineMeshComponent:

ensure(!NavCollision->IsDynamicObstacle()

And when loading in the level the road navmesh cost is messed up.

Is there any way to assign a navigation cost to landscape splines?
Am I misunderstanding what the landscape spline tool is for? It feels like a such a common use case to want to decrease the navigation cost for roads.
(UE 5.5)

upbeat hamlet
#

How do you debug a sub behavior tree? If I open it, I can't see the execution flow.

dense owl
upbeat hamlet
#

Am I missing something? Is it even being called?

misty wharf
#

Does it use the same blackboard as the parent tree? If not, that's the problem. If it does, look in Visual Logger, it should log what's happening in the tree

upbeat hamlet
# misty wharf Does it use the same blackboard as the parent tree? If not, that's the problem. ...

Yea, BB is the same. Thanks for the tip with the visual logger! Haven't used that at all yet, but seems very helpful.
I guess this is the problem, it's not even executed:
LogBehaviorTree (Warning) Failed to execute tree BT_FlyToStrafeLocation: parent of active node does not allow it! (BT_Enemy_Drone::Simple Parallel[26])
The parent is a Simple Parallel, why would it not allow it?

If I set Simple Parallel to Immediate, I don't get this error in the log, but it still doesn't work.

misty wharf
#

Not 100% sure but it might be that simple parallel only allows one single task in the left part

#

You can't put composite nodes into the main task... so you're kind of bypassing that by running a child tree, which might result in issues like this

#

But not sure, I don't really use parallel nodes myself

hallow compass
#

why are almost all virtual methods of the state tree tasks const ?

#

it feels stupid to const_cast to this

misty wharf
#

What are you doing that requires that?

slow bobcat
hallow compass
#

such as AI move to

hallow compass
misty wharf
#

I don't think you should be storing stuff in this in state tree tasks ๐Ÿค”

hallow compass
#

in the task i only have some const stuff
in the instance data i got some runtime stuff

misty wharf
#

Right, so why do you need to const cast it if you're not mutating this?

hallow compass
misty wharf
#

๐Ÿค”

hallow compass
#

wait

hallow compass
#

i think i switched to not const for something i removed

hallow compass
#

How can i disable the "auto braking" when using a move to ?

#

By braking i mean the deceleration thag occurs when the AI is close to the target

#

okay its bUseFixedBrakingDistanceForPaths

upbeat hamlet
#

Hey guys, I need some help with setting up this behavior tree.
I want the AI to move to three different EQS locations, then finish seeking.
I'm not sure how to set up the loop, currently it just runs three times and finishes.
I'd like it to count a loop as done when IsAtLocation was reached three times. Is that possible?
Or do I need a conditional loop and increment a variable in a task or sth like that?

uncut rune
hallow compass
#

Is the AI Controller controller rotation used for anything ?
Im asking because changing the rotation of the controller wont affect the controlled pawn

stiff ibex
upbeat hamlet
#

I have a strange situation with my BT getting stuck.
The target is dead, but my service BTS_StopAttackingIfTargetIsDead is not being called anymore (I added a log message to see if it's running).
As the target is dead, BTD_CanSeeTarget returns false obviously, which is fine.
But why is the service in the parent node above not running anymore?

misty wharf
#

There should be a function you can override in the bts which runs when it becomes inactive, which you could maybe use to stop the attack if the problem is it isn't doing that

halcyon briar
upbeat hamlet
#

Or I move some other task into the parent sequence, then it also works as you explained.

misty wharf
upbeat hamlet
misty wharf
#

๐Ÿค”

#

I just checked the C++ code for it, it should only run when the BTS runs its CaseRelevant logic

#

If it runs on every interval for you then that would suggest that your node is actually being activated and deactivated instead of remaining active

slow bobcat
halcyon briar
near condor
#

Hey all, packaging question relating to State Trees, do we have a fix for packaging when using State Trees in 5.5? Specifically for the crash that occurs because it loses references?

upbeat hamlet
#

Quick EQS question to verify I'm on the right track.
I'm trying to find locations behind my attack target. I guess I have to use the Dot test to check if attack target and ai pawn are looking in the same direction.
I'm quite confused by the settings of the Dot test though.
My result looks correct, the points behind the test vehicle have higher scores (if the ai pawn is looking at the attack target, which I'd have to make sure with focus target).
Can someone verify that the settings make sense?

#

Hmm, nah, it doesn't work like I want.
If I move my testing pawn to the side, I also want the points in the green marked circle to have the highest scores. Is there anything else than Dot test which I can use for this?
Flip cone 180 degrees for example so the points are on the back instead forward facing? Is that possible?

slow bobcat
#

@upbeat hamlet inthink the problem is this. Judging by the second image (how you set the test), you are doing a dot between the querier rotation (box+arrow in the centre) and lines between the test point and the target (being the target the T at the centre-top of the grid).
I think you want to check the rotation direction of the querier vs the line (test point - querier)

#

That way, if the results is <0, it means the point is behind the querier

#

Like that

upbeat hamlet
slow bobcat
#

Aaah you wanted behind the target, not the querier. Sorry I misunderstood

solid spire
#

Hey it seems like the perception system only looks at an actors location for visibility. So waist high barriers obscure their vision. Is there any way to modify this? I'm not seeing any easy way to override this behavior

solid spire
#

Without changing the engine?

dense owl
# solid spire Without changing the engine?

I donโ€™t believe so. Canโ€™t rmbr where the logic is within the perception component exactly but pretty sure it traces on visibility to the capsuleโ€™s bottom or its half-height. If you search messages in this channel you will prly find the exact thing to change as itโ€™s been mentioned before

solid spire
#

Alright. I am seeing something I can override on a character that implements an interface. That's probably what there is to do.

Just always feels like the perception system is surprisingly a black box

dense owl
#

This is very true ๐Ÿ˜€

solid spire
#

Thanks for the help. Now that I've played around a bit, I've got a more general question.

How is both position and shooting direction usually solved for AIs?

My main problems that need solving:
Should be clear that an AI sees you and it makes sense when they do (i.e. they see you from their eyes/body orientation)
AI stops to shoot somewhere that makes sense (point is chosen with a line of sight to target)
AI shoots when it makes sense (trace is possible from gun to target)

Those are pretty fundamentally different traces with different needs.

My current plan would be a small modification of the base unreal perception system to do more traces (head and torso) to avoid sight fail when the target is half covered,
Line traces from locations I might want to shoot from to approximate that a shot is possible,

And a final calculation to determine how to rotate an AI 's aim offset so that it can properly shoot at the target wherever it is seen at.

I'm sure this is largely a solved problem in the industry, so I wanted to see if anyone here had something simpler or more efficient than this.

olive shard
#

I am using an AIPerception to handle sight and sound but I want to add the functionality of a crouch mechanic to my game. I was thinking of somehow making the detection range smaller if the player is crouched. Can anyone help me figure out how I am supposed to do this because I am relatively lost on this?

ocean wren
#

The "standard" way to do it, is to cast rays randomly to bones with perhaps a bias to the extremities. They did this back what, 15-20 years ago. Easy to do in the perception system too

#

Obviously the effect aggregates over frames, but in reality you don't notice any delay and it feels more accurate. Thats what I did and I can confirm that it was perceptually from a player point of view "better".

slow bobcat
#

I solved it similarly in a previous game. 5 traces to head, hip, each shoulder and knee-high (a point below the hip). If 2 out of 5 hit, shoot.
The aiming was done trough animation and rotation constraints. Upper body can rotate X degrees. If the character has to turn more than that, then rotate the body. Same with up/down (arms vs crouch)

cursive ibex
#

Hi everyone, I have an actor which has a NavModifierComponent I want to modify navigation on runtime, I am able to modify the navigation on runtime but after few seconds I am destroying this actor and expecting to have navigation for the modified part but for what ever reason it removes navigation tiles and do not return them back! Runtime Generation already set to Dynamic Modifiers Only, But still I have issue, Unless I set it to dynamic then I have no issue, But dynamic is too expensive as processing cost, Do you have any idea?

slow bobcat
cursive ibex
#

Yes @slow bobcat I have no navigation after spawning the actor and after destroying actor I still have no Navigation, I tried different NavArea classes but result was same.

slow bobcat
cursive ibex
slow bobcat
cursive ibex
old timber
#

Hi, Iโ€™m having an issue with nav links in my level. The AI correctly uses the nav link to jump down from a cliff, but when I ask it to go back up, it ignores the proper path and instead runs into the wall where the nav link is located. How can I fix this so the AI follows the correct path back up?

halcyon briar
misty wharf
#

afaik it's because of how the BP nodes get handled. It can't run BP nodes from the CDO, so it needs to create an instance of it

halcyon briar
misty wharf
#

I would assume it must be NewObject()'ing the BP based nodes somewhere

slow bobcat
# halcyon briar Okay, when we say 'create an instance', am I right in assuming that the engine a...
  • instanced: each node use is allocated in memory. So if you have NodeA in 2 places within a tree and 3 bots are using the tree, you have 6 instances of the node in memory. Which means 6 new Object calls have happened (I think this is what you see in Insights but I'm waiting for your confirmation)
  • not instanced: only one instance per node is used ever (the cdo) and it's nuances (whatever changes in the particular use) is stored in its node memory (instead of in its class members like how a BP would deal with it)

Main problem is that the memory handling (creation of custom memory struct, save and load) is only possible in c++

slow bobcat
slow bobcat
cursive ibex
#

Hi @slow bobcat , I stopped engine I tried to rebuild the game for other reasons, After rebuil I realized I have same issue, Runtime Generation set to Modifiers Only and Even though the NavAreaClass is default it removes the Navigation tiles!?

#

But When ever I set the Runtime Generation to Dynamic I have no issue.

halcyon briar
misty wharf
#

๐Ÿค”

#

Could you be spawning something when they occur?

#

Just makes me wonder why would it be duplicating stuff if you weren't - or running new behavior trees or something

#

<@&213101288538374145> might be a good idea to add a regex to block [fake link](real link)

#

..actually that one isn't even using it, just a regular ol typo in the domain lol

pine steeple
#

yeah ill get it added

misty wharf
#

๐Ÿ‘

#

yeah just noticed a lot of these spam links were using it lately :)

pine steeple
#

stemmcommunuty desperate :/

halcyon briar
mild quiver
#

Any idea why this is happening to my AI? Some information

  1. At the Tree it is going only to "Move To" (targe is my character)
  2. The capsule and other parts are not colliding with the table
  3. The navmesh (in green) shows a clear path between the tables
  4. The agent radius is 40 everywhere and the character radius too. (the capsule is not overlapping objects)
  5. I tried activate/deactivate Controller Desired Rotation and Use Controller Rotation Yaw
  6. The AI slow down near objects.
copper glacier
#

The navmesh seems really thin in between the tables, it looks like there is a large blocker around the tables. If you lower the collision mesh of the tables down to so that the navmesh is 40 units at least between the tables does it do this?

stiff ibex
stable plover
#

I have a question. How can I get the Ai to move and attack at the same time. Iโ€™m using 5.4 so no parallel trees which sucks. Iโ€™m doing a simple Ai move to and looping over a Anim montage on completed. But is there a better way to doing this?

tight saffron
#

I'm clearly missing some simple checkbox or something somewhere but does anyone know why my AI won't move if I get the navmesh to be "IsWorldPartitionNavMesh" in a world paritioned level? Works fine if I don't set that but not if I do. ๐Ÿค”

copper glacier
slow bobcat
#

5.5.2 hotfix was released yesterday. I think some of you had this crash
UE-231892 A crash occurs when a State Tree Parameter is set to a variable type also referenced in a STT

#

seems to be fixed

tough nexus
#

Hello do someoneknow how i can add a ai stimulus source to an physics object blueprint? because if i add a stimulus source to the object when i hit play it only recocgnised the first position of the object instead of updating it?

misty wharf
hallow compass
#

without the numpad how can i access to all categories

#

i try to find a command but nothing found so far

tough nexus
misty wharf
#

You need to make the component the root in order to make the actor move when it does, which should make the reported position be correct also

tough nexus
#

its working

misty wharf
#

๐Ÿ‘

slow bobcat
hallow compass
#

yeah i found it its in the project settings

#

gameplay debugger, category slot

slow bobcat
#

Ah project settings yeah

stable plover
mild quiver
mild quiver
mild quiver
slow bobcat
#

If that's not it either, it could be that your rotation can't handle that turn. If you stop, rotate, move might work. But if you rotate while moving, the curve might be trying to take ai out of the nav in that narrow place

#

Wonder if that's what happens

stiff ibex
mild quiver
slow bobcat
#

Is your capsule radius <= to your agent radius? Otherwise that will happen.
Inwoikd definitely check Visual logger if you haven't yet

mild quiver
stiff ibex
slow bobcat
#

You can right click on Navigation - > show only this (or hide all but this, I can't recall exactly)

mild quiver
silent hamlet
#

@mild quiver try to turn on also pathfollowing (and maybe ainav)

slow bobcat
mild quiver
#

ok, now I understand the visual logger a little bit more, this is what I got from AI navigation

mild quiver
#

but the path is a straight line in red

mild quiver
#

And the issue stopped, basically the following from the Detour Crowd AIController is making the AI stuck

slow bobcat
#

it's super weird Crowd Control shows a path outside the nav when it can only use nav movement (as in movement constrained to the nav mesh)

mild quiver
#

The solution is reparent the AI from Detour Crowd AIController to AI Controller. So it uses the pathing finding on the navmesh and not the Following from the Detour Crowd

#

Thanks you all.

slow bobcat
#

But why is crowd control not respecting the calculated path when your AI is the only one there? Makes me think there's something off. You can not use it of course, but you are missing the avoidance completely

mild quiver
keen crow
#

Is there an easy way to provide query params to EQS contexts when EQS is run by built-in BT nodes? It seems like I need to subclass those nodes (task and service) and manually add "custom query params", because by default query params are extracted from generator and tests binded params, but not from context params ๐Ÿค”

dim lynx
#

I have AI and I have an item that I want him to approach, I have 2 floors, I don't know why, when the item is on the 1st floor he goes to the 2nd floor to pick up the item that is on the 1st floor

#

someone can help?

misty wharf
# dim lynx someone can help?

If I had to guess, the random location ends up not being on the navmesh and it ends up going to the incorrect place as a result. Try using project point to navmesh and see if that helps, if not, try to use Draw Debug Sphere on the locations to find out where it is and hopefully help debug it

#

Visual Logger also shows more information on navigation which can help figure it out

nimble smelt
#

Got a really weird issue. I have this AI that's getting stuck in this state instead of moving onto the Attack/Pursuit branch.

#

Here's the weird part, I tried the visual logger and its not working because PlaySound node is... failing?

#

Now, I could theoretically move this to a simpleparallel or something so that a failure of PlaySound doesn't stop execution proceeding correctly. But like... it IS supposed to play a sound, and I don't understand how that node can "fail" considering the cue exists

#

Oh INTERESTING I think this is distance-based. When I approach the AI in question it suddenly starts behaving correctly

fresh cove
#

ai sight visulization not showing?

misty wharf
#

What AI sight visualization?

#

I don't remember there ever being one when editing these settings

upbeat hamlet
#

Does anyone have an idea why my pawn is clipping into walls? It has a sphere collision set to Block WorldStatic and the wall is WorldStatic, set to BlockAll.
I'm using the MoveToLocation node in the BP. It seems to ignore the collision and uses the origin instead.

slim gazelle
#

Has anyone done a bot simulation on DeepShark R3?

#

Is there any point in trying this model or is it slow on the CPU?

#

make it so that the bot can live like in The Sims, like a simulation, but on neurons.

worthy lagoon
#

What is the most performance cheap way on having lots of npc's roaming around with routines?

storm sail
#

with all seriousness though there's not a whole lot you can do if your npc's are characters

#

You can:
Limit their movement as much as possible (easy)
Clamp the amount of moving NPC's at a time (medium)
Throttle their tick rates when people are very far away (advanced)
Disable tick event, and disable all ticking components when and wherever possible, re-enable them only when necessary (advanced)

#

Those are pretty much your options, there's some marketplace assets that also do this stuff for you

stable plover
#

does anyone know how to fix the move to speed issue, it seems like when the ai moves to a actor that is moving it matches its movement speed and I would not like that

slow bobcat
# worthy lagoon What is the most performance cheap way on having lots of npc's roaming around wi...

Check how the Matrix project uses Mass to handle hundreds of cars and otger stuff moving around. Anything that avoids using the character movement component would help + animation instancing. You could also check the mover plugin (super experimental) that will replace the Character movement component. It's has been used in that massive colaborstive project Epic did couple months ago and people seem happy so far

stable plover
halcyon briar
#

Hello.
I have found multiple such instances of BTTask_RunBehavior spending more than 1ms on the game thread,
and yet I am unable to find which particular BT node is causing this.
What can I try to find the culprit?
edit: the tiny sliver under it is BT_LoadTime. That doesn't help much either.

misty wharf
#

I would try enabling stat named events or some others that might not be enabled, it might be in the profiling menu, forget where they were

#

BTTask_RunBehavior refers to the Run Behavior node btw

#

That's the specific BT node causing it

#

Or rather, the type of node