#gameplay-ai

1 messages · Page 40 of 1

tough tulip
#

Thanks for the help, really appreciated. đŸ„ł

dense owl
#

Np

lyric flint
#

Hey!can we chat for 5 mins on dm,im still confused

#

Or should i send photos here

#

Of the script

dense owl
lyric flint
#

Alr,i will send in like 10 mins

knotty kiln
#

My current project is on 4.27 so world partition is not available. I'm using old world composition dogecry

uneven cloud
knotty kiln
knotty kiln
dense owl
#

Does Ctrl+W not work on 4.27 tabs? 😛

limber maple
#

How can I make it so my ai dosent keep running into a tree and getting stuck?

cinder crag
#

Hello, I am newbie to AI ! I haven't touched this before. Where can I start learning. All I need is just walk around and when player character is in bounds AI should shoot the character.

deep grove
#

Hey I'm getting the hang of state trees but I noticed that there seems to be something different about ticks in tasks vs actors if I tick an event in a task it fires but it almost looks like it skips add impulse (print strings before and after fire but it never moves the ship) but if I run the same event on tick it works just fine

terse panther
limber maple
#

it is

terse panther
limber maple
lyric flint
#

Anyone can help me make an animal ai that random roamd when it sees players it attacks hin

sacred kiln
#

hey folks, trying to project point to navigation. problem is I have two different Recast Navigation actors and I'm unsure how to get the correct one to feed into Nav Data since I can't tag them?

fathom sun
#

Hello, I have some problems with navmesh generation. For some reason the mesh that gets generated is different from what I can see in editor. Does anyone know why it might be the case?

dense owl
#

Same for you @lyric flint , watch that vid

dense owl
fathom sun
dense owl
fathom sun
dense owl
#

I’ve seen the navmesh do weird stuff for no reason at times

fathom sun
#

How do I rebuild it though?

dense owl
#

Yeah

#

You might see some dynamic shadow warnings you can ignore for now

fathom sun
#

Doesn't seem to fix the issue. After I've restarted the editor, it rebuilt the paths though

#

Like, it was red initially, and it was saying that it's rebuilding them

dense owl
#

And same issue at runtime?

fathom sun
#

Yeah

#

Actually though I haven't noticed a warning, I'm not sure whether it was there before
LogNavigation: Warning: Recreating dtNavMesh instance RecastNavMesh-Default due to saved navmesh origin (X=-400.000 Y=0.000 Z=0.000, usually the RecastNavMesh location) not being aligned with tile size (988 uu)

dense owl
#

Ah then that’s prly it

fathom sun
#

wdym?

dense owl
#

Well it’s saying your navmesh is misaligned

fathom sun
#

And how can I make it aligned? I have never heard anything about it tbh

dense owl
fathom sun
#

I haven't. I have everything pretty much the same as it should be by default, unless Lyra has changed something

dense owl
#

Ugh Lyra is a black hole, it’s very possible

fathom sun
#

Should it be under DefaultEngine or something?

dense owl
#

Someone here will prly know how to fix this, in the interim I would go to the project settings under Engine - Navigation Mesh and see if you can use those debug options

fathom sun
#

Oh, I have just enabled that, and now it seems to be different prior to playtime as well

#

It looks like the whole navmesh is shifted to the left

dense owl
#

Is the tile coordinate set to something other than 0,0,0 ?

fathom sun
#

Do you mean the NavMeshBoundsVolume?

dense owl
#

No

#

In the project settings there

fathom sun
#

It's 0,0,0

dense owl
#

What about tile size UU

fathom sun
#

1000

#

After I moved the objects with debug enabled, it looks to be correct, but now AI cannot navigate the navmesh at all. Before it was going the incorrect path, but now it doesn't walk at all

dense owl
#

Do things look different in there?

fathom sun
#

Doesn't seem to be

dense owl
#

Honestly at this point I would just delete the navmesh and redraw it, unless you have some special stuff on it

fathom sun
#

btw now I don't get any warning, even though all I did is enable the debug

fathom sun
dense owl
#

Maybe turn off the debug from settings after

fathom sun
#

oh, it disabled itself for some reason đŸ€”

#

After I've restarted the engine

#

Oh, now it generates a correct path

dense owl
#

After recreating the mesh?

fathom sun
#

Yeah

#

I had the nav mesh bounds volume before I've built this simple level btw, maybe that was something to do with the issue

dense owl
fathom sun
#

Do I? I thought it rebuilds the mesh when the level layout changes

dense owl
#

Depends how much you change it

fathom sun
#

Alright, thank you 😄

rich pendant
#

Would anyone know if using the simple move to on the player character can use nav links for crossing areas where the nav mesh isn't generated? I'm trying to use it but when it gets to where the nav link is, it just glitches out. (looks like it's vibrating)

Edit: I reset (back to default) some settings on the player character that were to do with navigation which seems to have resolved it.

cinder crag
#

Can someone suggest me How can I regenerate Nav Mesh for my AI/Pawn which should move randomly BELLOW Landscape something like Earth Worms ?

cinder crag
dense owl
#

If you want multiple levels you would prly need to use meshes instead of landscape

cinder crag
dense owl
#

Anyways, maybe use a mesh as the top level and then you can have navmesh on both levels

#

You can use nav links to jump down or climb up

cinder crag
dense owl
#

Oh so like burrowing and digging through the landscape ?

cinder crag
#

Oh yeah

dense owl
#

Tricky, you’d prly want dynamic nav mesh generation and maybe using some sort of mesh cutting/filling at runtime if you used a nav mesh. Otherwise you could maybe fake the dirt and just have their capsules walk around the bottom while adjusting the relative location of the mesh. The navmesh is a plane so you can’t use it for vertical navigation in the usual way

#

Basically, this is not an easy thing to accomplish, I don’t think

cinder crag
#

Isn't it possible to generate nav mesh below the floors or underneath roof surfaces ? đŸ€”

dense owl
#

It is

#

Like I said

#

Use static mesh instead of the actual landscape and you can have nav generate on it, like in the templates

cinder crag
#

Got it.

uneven cloud
uneven cloud
uneven cloud
cinder crag
sacred kiln
uneven cloud
uneven cloud
strange crystal
#

Hey all, quick newbie question. I have a nav mesh that is severly reducing my FPS in the level. I have 2 total in the level. To me they seem to be reasonable in size, but for some reason is tankin my performance. I tested this by deleting the nav mesh in question during simulation, and the lost FPS came right back. I reduced the size of it for now, to maintain performance but it is now interfering with the level navigation.
Are there any performance related settings for Nav Mesh that could help with this?
Essentially I just have a catacombs area, and then a large graveyard area, would be great to have the entire lvl within the nav but I know that would be very taxing on the system

dense owl
#

World partition

strange crystal
#

I will check that out ty!

jolly lotus
#

If you want to have enemy AI be active sometimes (executing behavior tree) and not active other times (just needs to sit there), is it better to set a blackboard boolean that gates the whole behavior tree, or should I stop the behavior tree running somehow?

#

or does it even really matter?

dense owl
jolly lotus
#

Oh ok I'll read about that, thanks!

dense owl
#

You could also just have a Wait node as a fallback if a decorator fails, so it always just chills there on wait, if you want

#

Only it’ll keep evaluating so idk if you want that

jolly lotus
#

Oh cool I see, it doesn't really do anything I can just do ->GetBrainComponent()->StopLogic().

#

Yeah idk I realized with one enemy it might be fine performance-wise to just have him wait in the tree with an abort on the boolean change. I'll try that!

dense owl
uneven cloud
serene imp
#

Does anyone know a good way to do a basic ai flanking behavior? Basically I want the ai to predict where the player will move and try to cut them off

harsh storm
#

The most basic way is to simply make a prediction based off the player's velocity. If they're not moving, then you'll need to figure out some way of scoring the "likely" place a player might go.

#

EQS will help here as well btw.

potent loom
#

A cheaty way I did for a game jam was to put a placeholder component in front of the player, some distance away, and then just use that as a targeting point for enemies to move towards

harsh storm
#

That's definitely not needed.

potent loom
#

Works really well for some kinds of games

dense owl
#

So if the player turns around, the system just fails?

potent loom
#

it's a component

dense owl
#

And

#

A box collision is also a component

#

What are we talking about

harsh storm
#

ActorLocation + Velocity * {time} = predicated location at the current velocity in X seconds

potent loom
#

yeah the box collision moves with the character

harsh storm
#

No component needed

potent loom
#

I'm not sure what's confusing you here

dense owl
#

You said you put it in front of the player

potent loom
#

right

#

like a camera springarm

harsh storm
#

It's exactly how the Prediction sense does it

serene imp
#

Ah

#

I'm working on a human killer ai

harsh storm
#

Doesn't matter. This is the basics of movement prediction.

serene imp
#

Yeah true

#

This is simply a test project for me to learn ai
Now another question, how would I optimize a continuous chase? Would I need to?

harsh storm
#

You don't until you measure it and figure out what is the problem

dense owl
#

Premature optimization is a bad idea in general

serene imp
strange crystal
visual dawn
#

Hello

#

Any nice c++ ai tutorials?

flint matrix
#

Hello, does anyone know how to stop State Tree tasks and switch to another state? Let's say I have an AI with idle and combat modes, and I want it to switch to combat mode right away when it detects a player. I'm aware that theoretically, I could send an event to every idle state and transition them to combat, but I'm looking for a solution that directly transitions to combat from the current state, without having to define it everywhere.

still marsh
#

Some AI debugging commands for beginners like me

pure cradle
#

Hello I need some help
I have made an ai with bt and new ai controller that only have the run bt in it
I try to give it the move to command but it always fail with aborted
I try to debug and the unit does set a point to move to but it never move
I have a nav mesh
Anyone know why?

misty wharf
#

Check Visual Logger. It contains more information on navigation failures. Tools->Debug->Visual Logger

pure cradle
misty wharf
#

What did it say?

dense owl
#

From there go to visual logger and after recording select your AI controller frames one by one until you find the aborted message

#

Then take a snapshot of that and post it in here

dense owl
#

Show your code

pure cradle
dense owl
#

Like just call AIMoveTo once

pure cradle
#

Still not moving

dense owl
#

Show the new log

pure cradle
dense owl
# pure cradle

What does the movement result come out as? Does it say success?

pure cradle
dense owl
ember agate
pure cradle
dense owl
#

And if it still doesn’t run, add a delay until next tick before it. Idk why, but that was an issue I had

pure cradle
dense owl
#

I always think I should ask this silly question” but then I’m like “nah, they wouldn’t”

#

You need a movement component on your character/pawn

dense owl
#

Whether that’s CMC, floating pawn comp, vehicle movement comp

dense owl
pure cradle
dense owl
#

Did you try adding that delay until next tick before AIMoveTo?

pure cradle
dense owl
#

Idk much about how vehicle movement comp works, but I’d give it a shot with a pawn or a character if you need the skeletal mesh. I rmbr you had a pretty long timer so the delay prly won’t fix it

pure cradle
dense owl
flint matrix
misty wharf
#

Does this pawn move at all? As in, if you try to move it via some other method

ember agate
flint matrix
ember agate
#

Yea it also failed the first time for me, Not sure why

pure cradle
dense owl
#

Maybe just make it a character.

#

The vehicle movement component has acceleration curves and stuff that you don’t need for something that doesn’t have wheels

pure cradle
dense owl
deep grove
#

I seem to get this error when using enums as enter conditions but it works as expect so I assume it's a visual bug and not actually an issue shrug

flint matrix
tropic musk
#

I have created this behavior tree for an AI. Everything runs fine the first time around, meaning that it first searches for at target. Then runs towards that target. Then once it is in melee and faces that target it performs the task "BTTask_Attack_Target". I have an issue however, after the BTTask_Attack_Target is done executing I would expect for it to run another loop where it would run the services BTService_Is_Facing_target first (Thus updating the IsLookingAtTarget). But I can see it first executes the BTTask_Attack_Target and then afterwards runs the service.

Why does this happen?
Moving around the service/task doesn't seem to make a huge difference.

Is it hardcoded that it first runs it's tasks and then after that runs it's services or how does that work?

dense owl
tropic musk
#

Right, this is a work in progress, which explains the extra floating branch.
So you're entirely correct that the sequence doens't make much sense here, and probably should be removed. But that doens't really explain why the Task runs before the service, does it?

#

Is it just so much of a mess that unreal behaves unexpectedly?

dense owl
#

Have you watched the 4th pinned link here yet?

tropic musk
#

I have not! That seems like a great starting point!

dense owl
dense owl
#

Generally tho, you want decorators on selectors (tho it does make sense to use it on top of tasks as well, depending on the use case, decorator used, etc.)

#

So that when the condition fails, it aborts

tropic musk
#

Makes sense

#

Thank you so much for your help! I will get right to watching that video!

ocean wren
#

My first text-to-3D model generated with Luma Labs Genie model.. imported into blender..

#

Boots and arms are wonky, but.. not so bad for a first go

rich pendant
#

Using the AI perception with a sight config, is it possible to only have it sight pawns/players that are reachable on the nav mesh?

lyric flint
#

Have anyone ever had it where there is nav mesh and it has holes where objects are placed. However the ai character kinda doesn't see the holes in the nav mesh

#

But it does kind of see edge of the nav mesh

ocean wren
#

Did epic add an automated rigger yet for skelmesh? or wasn't that in 5.3?

rich pendant
harsh storm
#

Though, an easier approach would be to just check if a path exists once the sight does see them.

lyric flint
#

I'm bassiacly on tsw editor and obvs the level of cooked content

rich pendant
lyric flint
#

Would that could any issues do you know like would my ai character have issue seeing the nav mesh probably?

rich pendant
uneven cloud
rich pendant
rich pendant
# harsh storm Doesn't appear so

That's a shame. I figured as much as creating the BPs from the bases seems to miss anything meaningful. I just wanted to make sure I wasn't missing something.

dense owl
subtle shoal
#

super simple question.
If I run a behavior tree as a sub tree, can it have more blackboard keys than the parent or does the parent need to have all the same blackboard keys as their sub trees?

dense owl
#

That doesn’t mean that your main tree needs to use every bb key inside the blackboard tho

subtle shoal
dense owl
subtle shoal
#

gotcha

dense owl
#

But again just use that big blackboard for both, the main tree doesn’t need to use every key in it

subtle shoal
#

I was hoping it wasn’t necessary, I’ve seen some massive blackboards before and was hoping to avoid going down that road as much as possible

dense owl
#

You could run a separate behaviour tree with a separate blackboard, I think. Just can’t be a subtree inside the other

subtle shoal
#

like swapping between trees entirely?

dense owl
#

Sure

#

You could stop logic and run another BT

#

Could also live dangerously and run 2 trees at the same time 😈

#

But idk if either of these is ideal, Luthage will prly throw something at me later 😅

subtle shoal
#

I just moved all the variables to the tree and it works like a dream, I just hate the idea of having a large blackboard

#

Oh, and to double check, the “Teams” in the Perception component are indeed locked behind C++?
I’ve already worked around this, but it feels wack not being able to use core systems in this way

uneven cloud
uneven cloud
pallid mica
#

Should a NavMesh not save between editor restarts?

#

We have Automatically building Nav turned off, and if I manually trigger it via Build -> Build Paths, then save the RecastNavMesh Actor and restart the editor, the NavMesh is gone again

misty wharf
#

Feels like it should be saved into the recast mesh actor, I thought that was more or less the whole point of it existing there

#

Pretty sure it holds the navdata in itself

halcyon dagger
#

having enemy "peripheral vision angle" equal to 90

how do you know what is the distance at which enemy can see someone right in front?

rich pendant
#

Edit: I've gone tackled my issue.

rich pendant
#

I'm currently having an issue with my AI not stopping. So in my state tree I have a state group with a state inside that has a wait task. When the AI has a gameplay tag, it moves to this state. I've added a debug print and can see it goes to this state when it's supposed to but the AI still moves.

I've tried called 'Stop Movement' as well but that doesn't seem to make a difference. Does anyone have any ideas what might be causing the issue?

#

If it helps, this is the state tree.

misty wharf
#

Is it the Stunned state that's the problem?

#

Or rather, StunWait

dense owl
rich pendant
rich pendant
# misty wharf Or rather, StunWait

This is the StunWait setup. The debug text shows and shows until the state it changed (Stun ends) but the AI is still moving for some reason, even after calling 'Stop Movement' on he AI controller after the gameplay tag for stun is added.

misty wharf
#

I would start by verifying all the things you expect are happening

#

Eg. check that the stop movement call happens, and also check that no additional move calls happen. You can also use the Visual Logger to get informtion on the state tree, eg. whether it is changing to some other state or not

rich pendant
#

I think i've actually figured it out. Instead of calling the stop movement node. I stored the move task and end it if it's active when exiting the state.

misty wharf
#

visual logger should tell you if any move requests are being done in additon to the ST info

#

Ah, I would have thought the task would be aborted if you call stop movement đŸ€”

rich pendant
distant snow
misty wharf
#

I wish people would actually write things you can easily skim instead of making 40 minute videos which are barely edited

#

It's great that people do at least something, but... :D

#

I really should start writing articles again but frankly with all the other things I'm busy doing it feels like to make this worth my while there needs to be some return value from it

#

and unless people are willing to pay to get access to well written information on UE features that are otherwise more or less undocumented, it doesn't feel like it's worth my time to do that at the moment đŸ€”

harsh storm
#

I was planning on doing more stuff for the AIModule - but I just don't have the time

misty wharf
#

Yeah. I used to write articles a while back, even paid to do so, and I had an online course, so it's something I'm kinda good at but yeah with actual gamedev and dayjob I don't have that much interest on it, unless people were paying for it

#

I should start asking people if they'd pay say 10 bucks a month to get access, maybe with a second tier where they could submit requests for new articles

dense owl
misty wharf
#

Yeah it's partially youtube's fault for sure

rapid obsidian
#

Maybe dumb question... What's the difference between a state tree and a behavior tree?

dense owl
#

2 very diff systems

#

And that’s my contribution for the day 😅

rapid obsidian
#

thanks!

#

im watching video mentioned above now

dense owl
#

Tbh ik little of State Trees other than they’re still kinda buggy

#

I should educate myself too

misty wharf
#

They don't really seem to be buggy outside the sub property binding stuff

#

and that's something that's ~reasonably easy to work around

dense owl
#

Oh well that’s good

#

I’d seen people ranting about them in here 😀

misty wharf
#

They just have a lot of confusing behavior that looks like a bug but it actually is working as intended, it just doesn't tell you and it looks like it's just failing for no reason

#

for example if a global task returns success instead of running the entire tree just halts there and then and you get absolutely no indication of why that happened unless you just happen to know what could be causing it

#

as these corner cases are I think all completely undocumented anywhere, it can be frustrating trial and error to figure things out

dense owl
#

Yeah, I’ll bet

#

BTs don’t necessarily have much in that regard either, except for old posts from Mieszko on the forums and the help you get in here

misty wharf
#

I don't recall running into these types of issues with BT's

#

I think the bits that seem to confuse people most are selector vs sequence and how decorators' results affect it

#

And at least the selector vs sequence is explained even if you just hover over the node

dense owl
#

Likely easier to narrow down tho

misty wharf
#

Ah

#

Yeah I don't think BT's have any particularly confusing behavior when it comes to that

#

The debugger functionality of the BT editor usually work to tell you what's going on, and visual logger has additional information on it as well if needed

#

It shows you pretty clearly what caused a certain branch to not activate or switch, instead of just saying "yeah I'm running" and then dead silence

#

lol

dense owl
#

Visual logger doesn’t help with STs eh?

misty wharf
#

It depends. It does log the state activation/deactivation sequences and things like that, but it doesn't log all of the edge cases like the aforementioned global task thing

#

The ST debugger does also show you at least some information, but it also isn't always helpful

#

And it seems to be a bit more fickle on when it actually works

#

Generally the best way to debug ST's seems to be to have a level where you have no other ST things running than the one you want to debug

#

at least in the difficult cases

iron phoenix
#

How would I get a reference of a global task in a state tree component?

misty wharf
#

You don't

iron phoenix
#

Ah

misty wharf
#

There might be some really hacky way to do it in C++ but it's not really intended to be used in that way

#

What are you trying to achieve by getting a ref to one?

iron phoenix
#

I've made a task to move to a location, I want to location in the task to be changed based on where I tell it to go

#

Pretty much I have an ai that follows me around, but then when I press a button and look somewhere on the map, it stops following then moves to the location i looked at

misty wharf
#

The way you could do that is by storing the location you want it to go to in your AI controller or such, and then have your state tree task pull the data from the AI controller

iron phoenix
#

Yeah that's good, thank you. I'm guessing this is the limit of state trees and being for more generic stuff

misty wharf
#

Yeah as far as I can tell.

#

It seems designed to work this way, you can for example get a ref to the controller or pawn easily through GetExternalData at least in C++

iron phoenix
#

That's a function within the component?

misty wharf
#

state tree task

iron phoenix
#

Gotcha

#

Thank you

misty wharf
#

or rather, it's a function on the Context struct that gets passed to the functions in the task struct

ebon belfry
#

First time using the discord formatting so i apologize if this comes out bad. I'm trying to get the AI to use a smart object, but it's not working when called from c++, I checked and the claim passes fine into blueprint with an interface and if i use the BP node there it works without issue, wondering if anyone here has any idea what i might be missing in order to get the function to work.

`//Property just for the sake of my fear that somehow this got garbage collected
UPROPERTY()
UAITask_UseGameplayBehaviorSmartObject* SearchTask;

SearchTask->UseClaimedGameplayBehaviorSmartObject(Controller, Claim, true);`

iron phoenix
#

What would be the best way to control for example 50 AI in an area that would walk randomly but only be confined to walk along the sidewalk and crosswalks. I was thinking to use an EQS for each AI but I'm not sure how performance heavy that would be

misty wharf
misty wharf
#

EQS is timesliced so it shouldn't have a big perf impact, I'd imagine you don't need to call it all the time, only whenever one of them has reached whatever destination it had previously, so it could also be a good solution. You will have to test to find out

ebon belfry
#

@misty wharf That's all im doing to create it, i don't know of any way to create it diffrently i can't find a single thing in the docs

misty wharf
#

Okay, you're actually not creating it then, so you're calling the function on a nullptr

#

Look at the header file for the AITask class, it should have a static function that returns an instance of the task

#

Call it, and Task->ReadyForActivation() or whatever it was called

#

You also don't need the property unless you need to reference it later for some reason

ebon belfry
#

im struggling to figure out how to create the aitask tbh

#

im gonna have to manually find the header file, my vs is slow as heck

#

i dont know how there isn't a single google result for any of this

misty wharf
#
static UAITask_UseGameplayBehaviorSmartObject* UseSmartObjectWithGameplayBehavior(AAIController* Controller, FSmartObjectClaimHandle ClaimHandle, bool bLockAILogic = true);
ebon belfry
#

My challenge is that i don't know how to call the function though

#

i think i have to do maybe something with the NewAITask<> maybe?

misty wharf
#

NewAITask is used inside the static func

#

You can call it using UAITask_UseGameplayBehaviorSmartObject::UseSmartObjectWithGameplayBehavior(controller, claim handle)

ebon belfry
#

That doesn't work, thats what im saying

misty wharf
#

It also has static UAITask_UseGameplayBehaviorSmartObject* MoveToAndUseSmartObjectWithGameplayBehavior(AAIController* Controller, FSmartObjectClaimHandle ClaimHandle, bool bLockAILogic = true); if that one is more what you're looking for, you call it the same way

#

It doesn't work meaning what specifically?

ebon belfry
#

it still has the AI not moving, but maybe its because i didn't use the Move version. Let me see if thats all it was

misty wharf
#

Ah, yeah that might be the one you need if you want it to move

ebon belfry
#

has no member error 😭

#

maybe typo

iron phoenix
ebon belfry
#

Well im perplexed because sure as the sky is blue its in the doc online, unless they renamed it or something from 5.1

#

ahh 404

misty wharf
#

Is it an actual compile error or is it just VS saying so

ebon belfry
#

compile error too

#

theres no doc for 5.1 but the file exists..

#

gonna have to dig real quick

misty wharf
#

Yeah best to check the header. If it has a BP node which does it then you should be able to use it from C++ too

#

There is some other bits in there but I'm on 5.3 and they have deprecation warnings on them

ebon belfry
#

ah

#

yep, doesn't exist in 5.1

#

UseClaimed still exists but it probably doesnt have the movement

#

but still thats weird cause it clearly has a bp function

#

that handles the movement??

#
{
    if (Controller == nullptr)
    {
        UE_LOG(LogSmartObject, Error, TEXT("AI Controller required to use smart object."));
        return nullptr;
    }
    
    AActor* Pawn = Controller->GetPawn();
    if (Pawn == nullptr)
    {
        UE_LOG(LogSmartObject, Error, TEXT("Pawn required on controller: %s."), *Controller->GetName());
        return nullptr;
    }

    return UseClaimedSmartObject(*Controller, ClaimHandle, bLockAILogic);
}

UAITask_UseGameplayBehaviorSmartObject* UAITask_UseGameplayBehaviorSmartObject::UseClaimedSmartObject(AAIController& Controller, const FSmartObjectClaimHandle ClaimHandle, const bool bLockAILogic)
{
    UAITask_UseGameplayBehaviorSmartObject* MyTask = UAITask::NewAITask<UAITask_UseGameplayBehaviorSmartObject>(Controller, EAITaskPriority::High);
    if (MyTask == nullptr)
    {
        return nullptr;
    }

    MyTask->SetClaimHandle(ClaimHandle);

    if (bLockAILogic)
    {
        MyTask->RequestAILogicLocking();
    }

    return MyTask;
}
misty wharf
#

If it moves I would assume there is one which creates an AITask_MoveTo for moving

#

That's what it does in 5.3 anyway

ebon belfry
#

yeah i found it in the Activate

#

Maybe i have to manually call activate

misty wharf
#

You need to call ReadyForActivation

#

Then the tasks system should handle the rest

ebon belfry
#

if this works ill be shocked, guffawed, astonished, and quite possibly catywompus and flabbergasted

#

son of a

#

welp

#

Zee Oh Em Gee. You Are a Gee

misty wharf
#

lol

ebon belfry
#

it worked

#

classic unreal, spend 4 hours looking through files and unfinished or outright 404'd documentation pages and trying random things and all i was missing is a function hidden 2 layers of headers deep that i didnt even realize existed or needed to call. The ancient texts held the answers

#

thank god you knew that cause my ass would've been calling Activate() for another 2 hours otherwise

misty wharf
#

Yeah the tasks systems aren't particularly well documented... there's some articles you can find if you happen upon the right dark rites

ebon belfry
#

ah yes, the dark rites. I haven't stumbled upon those since the great wiki migration. So much data lost to time..

misty wharf
#

Everything that extends UGameplayTask work in this manner from C++ btw, so if you need to create any GameplayTasks, AITasks or AbilityTasks this is how you use them

ebon belfry
#

Thanks dawg, made my day lol

misty wharf
#

You're welcome

simple abyss
#

so i am trying to build a nav mesh in ue 5.3.2 in a world partition level, but when doing it in editor i get the error message "missing world name" and when doing it via the commandlet in windows powershell it builds without error but doesn't show up in the editor. Does anyone have idea on how to fix this? would be very much appreciated!

lyric flint
#

How can i make the animal move left and right?

#

Instead of instantley turning like 90 degrees in a second

terse panther
#

and make sure to turn this off...
you can find it in the class defaults on you animal bp

lyric flint
#

yeah i alr have them on

#

what you sent me is to make animal rotation smoother instead of snapping to target

#

but as you saw it doesn't use the move left and rigth anims

#

it just rotates

#

to some impossible degrees

proven elm
#

Good ressources on coding real time strategy AI like AoE or Stronghold has?

#

how does that work

celest python
#

You'll fight with engine constantly

#

However I think main choice for having RTS unit AI is the command pattern or command design, idk whats the actual name of it or how its described

#

Red Alert and Generals games using it

proven elm
#

mhhhhh

#

why will i fight the engine constantly?

#

i sadly have about 1% experience in making RTS

celest python
#

Because of the high count of enemies are pain to achieve

proven elm
#

or do you mean AI tasks

celest python
#

More like pawns

#

even if you use #mass just moving an actor in the world is still very expensive for a RTS that has more than 200 units or so

#

so you'd engineer your project towards optimizations a lot

proven elm
#

interesting

#

so that is a bottleneck

celest python
#

and making units form a shape is also a pain

proven elm
#

what is main issue

#

navigation?

celest python
proven elm
#

i already got this covered

celest python
#

You can make them form a shape on a specific location easily but making them keep that shape is difficult while moving

proven elm
#

pack simulation

#

i see

#

very interesting

#

i ask myself how AI will work

#

how can it control units and place buildings

#

how is that possible

#

that was always so strange to me

#

smoke and mirrors

celest python
#

Well its easy to explain to a programmer but like anything else in gamedev you require a bit experience to understand

proven elm
#

try me

#

i am struggling to find ressources

celest python
#

there was an open source RTS project on github

#

and was very comprehensive

proven elm
#

Is this finally the time for behavior trees?

celest python
#

dependsâ„ąïž

proven elm
#

age of empires?

proven elm
#

ok downlaoded

#

id have to reinstall ue4 tho

#

but thanks

celest python
#

or just update to 5.n through 4.27 version

proven elm
#

it has a plugin

#

id have to recompile it?

celest python
#

or just read from github

#

either just take the plugin and import to your own ue5 and compile or read from github

#

up to you

#

project content looks empty

proven elm
#

nono it has assets

celest python
#

though I cany confirm or deny its design is good

#

I didnt read myself

proven elm
#

absolutly horrible

#

thanks tho

ebon belfry
#

wallahi why are there protected delegates in the smartobjectgameplaytask

#

gg

#

longshot but is there any way to bind to a protected delegate outside a child class without modifying plugin code? 😭

#

what were they thinking here? Like i don't understand why make tasks with OnFinished, OnFail etc. delegates if i literally cant even use them outside blueprist

#

to make me sad?

#

I guess

#

Just a vent but i feel I have to : Make a c++ component, Use the smart object in BP and broadcast a delegate function on the component from the already created delegate pins for success off the node, bind to the delegate from the component in c++ and now i can tell if the function that completed completed.

#

I know it's partially experimental still, but this just makes no sense to me. If it weren't for the built-in debugging and visulization of smart objects idk why I would use it at this point.

celest python
# ebon belfry wallahi why are there protected delegates in the smartobjectgameplaytask
struct ProtectedAccessHack : public USmartObjectGameplayTask
{
  // FORCEINLINE is required to enforce function call be optimized away and protected access will be replaced 
  template<typename... Args>
  FORCEINLINE ReturnType& Access(Args&&... inArgs) { return WhateverYouWantAsProtected(Forward<Args>(Args...); }
}
auto WhateverYouWant = reinterpret_cast<ProtectedAccessHack*>(SOGameplayTaskPtr)->Access(YourParams);
#

Though its being protected hints API is prone to radical changes upon time

#

Knowing from statetree it will probably happen

ebon belfry
#

true, thank you sir

#

i'll probably use bp hack for now just for safety, but this is a sacred text at this point

celest python
#

You can make a PR and ping mieszko here

ebon belfry
#

its confusing cause the SmartObjectBehaviors Module is experimental but the Smart objects are not

lyric flint
#

So can someone answer me

ebon belfry
#

which is funny cause i don't really know how you'd use one without the other, but im sure given time it'll get fixed. Thank you Eren

celest python
lyric flint
#

What is strafe

celest python
#

the movement style you want

#

pawns move without rotating

#

to right and left

lyric flint
#

My animal rotates but i want it to move left and right not to rotate

lyric flint
#

task is random roam

#

where do i find ballow strafing

dense owl
#

Either way, allow strafing is in the same place

paper sparrow
#

'Play Montage' task in AI Controller not showing for some reason on clients...

Networked environment, Actor replicates OK, montage and 'DefaultSlot' setup correctly... Do I have to call a multicast from the AIController?

#

I thought the montage would replicate (being called on 'OnPosses')

misty wharf
uneven cloud
uneven cloud
paper sparrow
#

That makes sense, thanks. I've called my generic 'play multicast montage' event on my replicated character and it works fine

#

Was trying to be nice and tidy with code and use the 'completed' and 'interupted' execution lines

uneven cloud
#

I recommend using GAS as it handles the replication, keeps the animations synced and handles edge cases like a new client connecting

celest python
#

If you're familiar with C++, replicating (as in doing the same, not the networking code) what GAS donig to sync animations is not very difficult. You can have a AnimationReplicator component in your pawn and does what base GAS root motion task doing - which is pretty much a CMC hook to drive FRootMotion thingy

#

But ofc if you're already utilizing GAS it should be the choice

paper sparrow
sleek oriole
#

hey guys, following question:

I want to have a simple AI that chases the player when it sees them. If it loses sight of the player, the AI should run to the position where it last saw the player.

Accordingly, in the Behavior Tree, there are two paths that use the MoveTo node (as seen in the image). Moving towards the destination works perfectly for me; however, I've noticed that when there is a switch from the left path to the right path or vice versa in the Behavior Tree, the AI briefly comes to a stop (as seen in the streamable video: https://streamable.com/hnfd88).

How can I prevent this? I want the AI to smoothly run to the new destination without any pauses.

#

my guess is that the stop happens, because somewhere in the node classes aborting a task also aborts the move and afterwards executes / starts the new one?

uneven cloud
proven elm
#

Ok so for my RTS i finally ran into the problem

#

When i have 50 soldiers on the screen the game thread goes up heavily

#

How can i optimize this

dense owl
proven elm
#

it seems like its the physics of the units

#

timescale iterations

#

for simulation

#

i guess using character movement wasnt a good idea

uneven cloud
#

You don't optimize with guesses

proven elm
#

yee

dense owl
proven elm
#

I actually did it

#

100 units move with under 20ms

#

damn

dense owl
#

so, what was the issue

proven elm
#

i cant believe i reached that

#

physics

#

it calculated something

#

i set the movement to navmesh walking

#

at game speed 2 i still get under 20ms basicly

dense owl
#

yeah, that's a common optimization

proven elm
#

i need to tweak it further for the skeletal meshes

dense owl
#

you'll just have to monitor the navigation, as it is no longer checking for collisions themselves iirc

proven elm
#

thats no problem i am using obstacle invokers

#

that means i can still have pathfinding and new objects

#

big victory

#

100 units with skeletal meshes

#

and when i tell them to move into formation somewhere it doesnt start to lag at all

#

its fluid

#

thats workable 🙂

mellow zenith
#

Anyone got any idea why my behaviour tree task gets stuck/doesnt execute

dense owl
#

did you run the game and it shows that specific branch constantly highlighted?

mellow zenith
#

I look at the BT while it is running

#

yeah

dense owl
#

hit Pause

#

and go back into

mellow zenith
#

Other guy helped me figure it out tho

#

Yeah I do that

#

But its cus I was casting to the wrong thing

#

in the task

dense owl
#

ah yeah, you need a finish execute on both ends

#

you should have a finish execute on the cast failed regardless, just in case it ever grabs the wrong thing

mellow zenith
#

Yeah I should do that

#

Yep that fixed my problem

#

I wrote this script ages ago

#

but I came back to it to notice this bug

#

and was a little confused

#

glad im just stupid

dense owl
#

haha

#

that happens with old code

mellow zenith
#

The bug was literally stopping ingame progress as well so it had to be fixed quickly

#

Was for an old uni assignment but when I put it on my portfolio and played it I was like "Huh?" Wtf is it doing

boreal tundra
#

Is there any guide to make a PROPER AI? It seems like the world doesn't know how to do more than patrol, chase.

I want my chaser to play an animation when he spots you behind his back.

Not being stuck in random sofas, doors.

A proper roamer like in outlast. Not even

misty wharf
#

All of those behaviors are just combinations of the basic behaviors

#

Spots you behind their back is basically just perception + check direction to spotted target + play appropriate animation

#

Not getting stuck in random things is ensuring your navmesh is correctly being affected by objects like those so the AI can navigate around them correctly

#

etc.

boreal tundra
uneven cloud
misty wharf
boreal tundra
#

At the moment when you're behind the killer, the moment he decides to turn (without animation, just changing direction and walk) he will spam spot you with event tick like kind of every ai you see on youtube. When he is in the same line of your direction he starts to chase

mellow zenith
mellow zenith
#

ah nvm lol

#

also thats really bad I didn't even know there was a loop node

#

and I've done patrolling AI like hundreds of times lmao

boreal tundra
#

I'm trying to implemetn a playanimation task

#

but the character just stays still when he sees me

#

and remain on playanimation task until I don't leave

uneven cloud
#

There already is a play animation task

molten cairn
#

How can I make my AI move to a location without the path being visible to the player, even if it's a longer?

#

I thought of implementing an array of nav modifiers within a volume to adjust costs based on player visibility, thereby influencing the AI pathfinding but I don’t think you can change the cost of it in runtime

dim river
#

I am working on converting some basic AI tasks to StateTree and I templated them out in BP during 5.2 but recently upgraded to 5.3 and am moving them to C++

I have the struct built and ready to go but I have not been able to find how to make it so I can add it as a task on the state tree in the editor.
Can someone point me in the right direction or explain how to use a StateTreeTask built in C++ to be used on the StateTree in the editor?

Here is my MoveToTask.h I have built

USTRUCT(meta = (DisplayName = "SI Move To Task"))
struct SI_PROTOTYPE_API FSI_StateTreeTask_UpdateMoveTo : public FStateTreeTaskBase
{
    GENERATED_BODY()

    using FInstanceDataType = FStateTreeUpdateMoveToTaskData;
    
    FSI_StateTreeTask_UpdateMoveTo() = default;
    FSI_StateTreeTask_UpdateMoveTo(const FName InName) { Name = InName; }
    virtual ~FSI_StateTreeTask_UpdateMoveTo() override {}
    
    virtual EStateTreeRunStatus EnterState(FStateTreeExecutionContext& Context, const FStateTreeTransitionResult& Transition) const override;
    virtual EStateTreeRunStatus Tick(FStateTreeExecutionContext& Context, const float DeltaTime) const override;
};```
dim river
#

I resolved that issue it is now showing in the State Tree Schema BP

I had the parent class incorrect

public FStateTreeTaskBase```
needs to be 
```cpp
public FStateTreeTaskCommonBase```
misty wharf
#

fwiw you probably don't need those constructors and destructor on it either :)

near flame
#

hi guys i just made the behaviour tree for the wolf and i want to add 2 more animals rabbit and wild boar

#

how can i do this,do i need to create everything from scratch to those animals?

#

i want the rabbit to run from the player when he sees him and the wild boar to have a bigger damage ,thats it

dim river
misty wharf
#

Did you define GetInstanceDataType or whatever it was called?

#

It needs to return YourInstanceDataType::StaticStruct()

dim river
#

I did not where would I define that

misty wharf
#

In your state tree task struct

dim river
#

so I have this in the same .h file. Is this what you mean. I am sorry this is all really new to me and I am starting to grasp it but its still very new.

USTRUCT(BlueprintType)
struct FStateTreeUpdateMoveToTaskData
{
    GENERATED_BODY()
    
    UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="StateTreeData")
    float AcceptanceRadius;
    
    UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="StateTreeData")
    FVector MoveToLocation;

    // Constructor to initialize default values.
    FStateTreeUpdateMoveToTaskData()
        : AcceptanceRadius(0.0f)
        , MoveToLocation(FVector::ZeroVector)
    {
    }
};```
misty wharf
#
    virtual const UStruct* GetInstanceDataType() const override { return FInstanceDataType::StaticStruct(); }
#

You need to put this into the actual task struct, the one which inherits from FStateTreeTaskCommonBase

dim river
#

I knew I had seen it before. I tried that using the GetInstanceDataPtr() using a UClass instead of a UStruct.
Do you know the differences / advantages to using a UStruct vs a UClass version of the data?

misty wharf
#

No idea tbh. It seems intended to be used with structs, so I would assume something in UE is going to complain if you do something else

#

from the C++ perspective there's no difference between the two, other than struct members are public by default, but UE makes some distinctions internally between how they are used

dim river
#

Ok. I saw it used that way in one of the StateTree classes in the engine code so I tried using it but came up with the same error at runtime.

#

Thank you for your help!

misty wharf
#

np I went through all the trouble of figuring this out also and there's very little info for any of it annoyingly

dim river
#

Its that top tier Unreal Documentation we all love

misty wharf
#

best bet to look at the engine builtin tasks and such

dim river
#

yeah I have been digging through them. I Just get frazzled after a few hours.

#

I found the class that uses the UClass version
StateTreeTask_PlayContextualAim.cpp

here is a function from it.

EStateTreeRunStatus FStateTreeTask_PlayContextualAnim::EnterState(FStateTreeExecutionContext& Context, const FStateTreeTransitionResult& Transition) const
{
    UInstanceDataType* InstanceData = Context.GetInstanceDataPtr<UInstanceDataType>(*this);
    check(InstanceData);

    return InstanceData->OnEnterState(Context);
}```
And how it is defined in the struct on the .h side
```cpp
USTRUCT(meta = (DisplayName = "Play Contextual Anim"))
struct FStateTreeTask_PlayContextualAnim : public FStateTreeTaskCommonBase
{
    GENERATED_BODY()

    using UInstanceDataType = UStateTreeTask_PlayContextualAnim_InstanceData;

    FStateTreeTask_PlayContextualAnim();

    virtual const UStruct* GetInstanceDataType() const override { return UInstanceDataType::StaticClass(); }


};```
#

here is part of the UClass is uses

UCLASS()
class UStateTreeTask_PlayContextualAnim_InstanceData : public UObject
{
    GENERATED_BODY()

public:
    UPROPERTY(EditAnywhere, Category = Input)
    TObjectPtr<AActor> PrimaryActor = nullptr;
};```
misty wharf
#

Oh, that's interesting

#

I wonder why it would be done that way

dim river
#

BlueprintBase side maybe? It looks like the BlueprintBase classes of state tree have quite a few uses of it this way

misty wharf
#

Actually I think it's so they can bind dynamic delegates to it

#

they require the target to be a UObject

#

good to know this also works, there's a few cases where it might've been useful to do that that I worked around via other methods

dim river
#

ahh yes I think you are right here is one from that UClass

    UFUNCTION()
    void OnNotifyBeginReceived(FName NotifyName, const FBranchingPointNotifyPayload& BranchingPointNotifyPayload);
misty wharf
#

Yeah it binds them in the enter state

dim river
#

Thanks for your insight!

dim river
#

How did you manage to reference your ControllerHandle via TStateTreeExternalDataHandle<AAIController> Mine keeps throwing an error here:

    typename T::DataType& GetExternalData(const T Handle) const
    {
        check(Handle.IsValid());
        checkSlow(StateTree.ExternalDataDescs[Handle.DataViewIndex.Get() - StateTree.ExternalDataBaseIndex].Requirement != EStateTreeExternalDataRequirement::Optional); // Optionals should query pointer instead.
        return DataViews[Handle.DataViewIndex.Get()].template GetMutable<typename T::DataType>();
    }```
misty wharf
#

You need to declare the handle as a property, then link it in the Link function, and it should work using GetExternalData(handle) after that

dim river
#

I had tried that before but it didnt work I will give it another shot now that I am pretty sure I have the rest of it setup properly now.

#

does it need to be a UPROPERTY()?

misty wharf
#

No

#

I have something like this for example:

    TStateTreeExternalDataHandle<AShEnemyController> ControllerHandle;


bool FShSTT_GetAIAttackTarget::Link(FStateTreeLinker& Linker)
{
    Linker.LinkExternalData(ControllerHandle);
    return true;
}


    const AShEnemyController& Controller = Context.GetExternalData(ControllerHandle);

dim river
#

I thought so, that is what I had before.

misty wharf
#

Is your state tree in an AI Controller?

dim river
#

I have it on the Character right now.

misty wharf
#

That might be the problem. If you check the code in UStateTreeComponent it sets the external data refs from there

#

If it's an AI Controller type, it assumes it's an AI Controller or otherwise it can't set anything, so that might cause the crash if the data isn't there

dim river
#

I think I had it setup wrong before. It didn't crash after I put it back in. But i am going to move it to the controller anyways I dont know why I put it on the Character to begin with.

uneven cloud
near flame
uneven cloud
near flame
sleek oriole
#

hey guys, inside of my RecastNavMesh i wanna permanently change the "Agent Radius" property from 35 to 15, but every time i reopen my unreal project, the value gets reset to 35.

i tried setting the property Project Settings > Navigation Mesh > Agent Radius to 15, too but it didn't help.

is this a known bug or can someone help out? 🙏

near flame
sleek oriole
#

then lets pray that someone might know a solution to the problem!! 🙏

misty wharf
#

If you set them up in project settings it should be using those settings to regenerate

#

Try deleting the recast mesh actor after making sure it's correct in settings and then rebuild paths

sleek oriole
#

ok, the following steps seem to help.
Project Settings > Navigation System > Supported Agents - create a new agent.
inside of that new agent set "Nav Agent Radius" to 15

boreal tundra
uneven cloud
uneven cloud
sleek oriole
boreal tundra
boreal tundra
uneven cloud
uneven cloud
# boreal tundra XDDDDD true

Have you tried debugging it with the visual logger? Does it stay in that task looping the animation? Or does it loop because the tree restarts?

boreal tundra
#

after the animation is completed, it does set speed and bt find and chase and then restart in loop

boreal tundra
next umbra
#

Hi guys, what strategy should i follow to choose the best target for the AI vs others AI? For example to attack the nearest AI and choose other Target when dies(instead continue attacking until actor is destroyed)

surreal jolt
#

So does anyone know why ProjectPointToNavigation will return a point off the navmesh if you're searching from a point off the navmesh?

dim river
#

Has anyone ran into this issue when trying to create a StateTreeEvaluator in C++?
"Malformed evaluator, missing instance value."

uneven cloud
uneven cloud
surreal jolt
uneven cloud
surreal jolt
#

Then yea I dunno, seems like it's finding something but not adjusting the location

surreal jolt
# uneven cloud Correct

Yea, so my teapot is clearly off navmesh but it's location and the "NavLocation" are returning the same X,Y the only difference is Z = 20 for the navmesh but is 0 for the teapot actor location

uneven cloud
surreal jolt
uneven cloud
surreal jolt
harsh storm
haughty coral
misty wharf
#

At least it's something lol

simple abyss
#

I've tried to build a static nav mesh for world partition and followed the online documentation 1 by 1, the generation and everything else works, but i only get as it seems one cell with nav mesh:

#

using 5.3.2, any idea what i might be missing out?

simple abyss
simple abyss
simple abyss
near flame
#

Guys i am experiencing a problem that i cant solve,i need the rabbit to run from player when he sees him but he runs to me instead and he stops after some time

#

Maybe the issue is in task

deep grove
# near flame Guys i am experiencing a problem that i cant solve,i need the rabbit to run from...

The find look rotation finds the rot towards the rabbit from the player and then gets the forward vector of that rot and then multiplies it by a negative I'd start by making that multiplyer a positive as I'm pretty sure that isn't what it's supposed to be worse case scenario if that doesn't work do a line trace to the vector after the multiply and see where it's leading the bunny to for troubleshooting

dense owl
#

Dot product might come in handy here, EQS has a test for it too

deep grove
#

lots of good options

harsh storm
dense owl
#

You mean we’ll get to program with code CDPR pushed? I like it

misty gale
#

Sign me up

harsh storm
#

I mean, other AAA studios upstream their changes/fixes as well.

celest python
#

I wanted to submit an application to CDPR once but after layoffs and rumors of continuing crunch culture scared me away

misty wharf
#

I know a guy who works in level design there, don't think he's had any complaints but who knows

sleek oriole
#

hey, what are you thoughts on the stability / reliability of EQS right now? it feels like quite a few tests are heavily bugged and can't filter, just score (like the overlap or trace test) or is it just me?

misty wharf
#

They work just fine

#

I'm using the overlap test for filtering in my project currently without any issues and I'm pretty sure I've used the trace for it as well

#

I don't think I've had a single issue with EQS with regards to it not working the way it's supposed to... the only issues I've had with it relate to trying to make the EQS queries more dynamic because sometimes passing data into it is a hassle

sleek oriole
#

nice to hear!
regarding the overlap test: if i set the test purpose to "Score Only" it works just fine (see the first image)
if i set the test purpose to "Filter only" nothing gets filtered out though (see the second image)

am i missing something?

misty wharf
#

Hm I don't recall what it was but sometimes it works a bit counterintuitively so maybe you need the bool match to be in a different setting

#

considering the spheres are all a little bit inside something it seems likely that they would be all overlapping

#

so you might need to also change your generator so that it moves them up once it has projected them

sleek oriole
#

setting "Bool Match" to true, just filters out the nearest left sphere

#

it seems so troll 😄

#

i've set the sphere offset Z to +50, so that the spheres dont hit the ground

misty wharf
#

ah

sleek oriole
#

i whish i could see what the items are colliding with. do you know where i might look that up?

misty wharf
#

visual logger has some details on EQS execution but not sure if that much... you could potentially breakpoint the test's function for it but I'm not sure if it has that info because it might be using the function that doesn't return collision info since it's faster than the one which does

sleek oriole
#

i wasnt able to see in the visual logger, what the items are colliding with

#

you could potentially breakpoint the test's function for it
that would be the last resort, not sure if worth it though

#

and for you, everything works just fine, right?

misty wharf
#

Yeah although I feel like I had this exact problem for a moment and then I toggled the bool match and it started working lol

#

Let me check the query settings I had with this filter...

#

I have it like this in my case and it works

#

The idea being it filters out the ones which are too close to geometry

sleek oriole
#

yeah, i want to filter out points, that are too close to walls, too but even with your settings, everything is green

#

ue5 5.2.1 btw

misty wharf
#

Did you try wiggling the EQS testing pawn? Sometimes it doesn't seem to really redo it unless you move it

#

Oh- try changing it to all matching

#

Actually if I put it on single best item it suddenly shows the overlaps as green for me as well

sleek oriole
#

everything stays green, doesnt matter where the pawn is

sleek oriole
misty wharf
#

on the eqs testing pawn

#

querying mode

sleek oriole
#

ok, that seems to be more correct

#

so, its just a visual debugger bug? 😅

#

does work correctly? i'm confused

misty wharf
#

Hard to say, you would probably have to test it to find out for sure

#

I'm using the query in all matching mode in this case and at least for that it does work, but not sure about the single modes if it's a visualization bug or an actual bug

sleek oriole
#

okay, im already afraid of the errors i will encounter by testing 💀

#

thanks for you help!!

misty wharf
#

np

dense owl
#

Have you watched the 4th pinned link video yet ? @sleek oriole

sleek oriole
#

yes i did start with that 😄
visualizations seem to properly work in that video

dense owl
#

So what’s left to fix now, I noticed it was all green before but no longer

sleek oriole
#

i think its just a visualization bug in the testing pawn. calculations seem to be fine so far

dense owl
#

Ah ok 👍

sleek oriole
#

unrelated question regarding EQS:
the documentation says that EQS is an experimental feature and that epic doesnt recommend shipping games with it.
what do you think about that? would you ship a game with EQS or not?

harsh storm
#

Yes

#

Plenty have

#

It's only experimental because the UI/UX isn't how they want it.

sleek oriole
#

thats nice to hear, ok 😄

harsh storm
#

And this is coming from the person who wrote the system.

sleek oriole
#

oh wow, ok 👀 😄

#

thanks for the answer!

dense owl
#

He means from MieszkoZ 😀

sleek oriole
#

ok i see ^^

simple abyss
dense owl
#

It usually isn’t an engine bug

simple abyss
dense owl
#

Oh nice, guess that’s an exception. Looks like they gave you a fix

simple abyss
dawn schooner
#

Hi people! I am working on navigation for different agents, in our game we have small agents (individual units or heroes) but also big agents (battalions of multiple soldiers or big monsters).
Currently, our navigation system doesn't take that into account, so battalions get too close to corners of buildings or obstacles, which makes them look a bit stupid kappa
Ideally, I am trying to find a way in which further away paths are preferred so that:

harsh storm
#

Are you using UE's built in nav stuff?

dawn schooner
harsh storm
#

Add agent types in the project settings. The nav stuff automatically tries to match the profiles to the agents based on their agent stuff

dawn schooner
#

Cool, I'll research that! ❀

indigo siren
#

what is a good max speed adnd accelleration speed?

harsh storm
#

Whatever fits your game

indigo siren
#

i want the enemy to not be like able to bumrush the player from spawning, but i dont want them to be like left in teh dust when th eplayer moves

harsh storm
#

Literally no way anyone can answer this becaue it varies so much

#

It's 100% game specific

indigo siren
harsh storm
#

W/e is on the character

indigo siren
#

i changed it and forgot what it was lmao

#

the game is literally a first person dont get hit by the enemy type game

harsh storm
#

So just...look at what the character default is?

dense owl
#

Isn’t there a reset to default arrow next to it?

indigo siren
#

i forgot there was a default button

ashen trail
#

Does the pawn sensing component only work on pawn/character that is possessed by an ai controller? Adding it to a plain actor won't work?

misty wharf
#

You should be using AI perception instead

wise sluice
#

Hello ! Anyone already used those flags to store gameplay information?

#

I'm wondering if it is safe to store data inside it
Edit : it seems to be used entirely by FNavMeshNodeFlags đŸ€”

halcyon dagger
#

Should I print GetPathFollowingComponent()->OnRequestFinished.AddUObject

before or after MoveToActor(actor, AcceptanceRadius)

or it doesn't matter?

misty wharf
#

It probably makes no difference, except potentially if the path immediately finishes. Not sure how it would handle that

halcyon dagger
shell mirage
#

Hi, I am having trouble with bUseControllerDesiredRotation and SetControlRotation. I think I have done everything I need so that the ai enemy use the provided direction as opposed to its movement direction. However, in my case the enemy will pepetually face the same direction while circling around its target (strafing). I've added debug drawing and the provided vector is ok.

Any ideas what I'm missing?

// AI Component
void UAIComponent::BeginPlay()
{
    Super::BeginPlay();
    auto world = GetWorld();
    COURAGE_ENSURE_OR_EXIT(, world);
    Controller = world->SpawnActor<AAIController>();
    Controller->Possess(Character);
    Controller->bAllowStrafe = true;

    Character->Movement->bUseControllerDesiredRotation = true;
    Character->Movement->bOrientRotationToMovement = false;
}

// Hostile state tree task
EStateTreeRunStatus FHostileRotationTask::Tick(FStateTreeExecutionContext& Context, const float DeltaTime) const
{
    STATETREE_HOIST(DATA, RESOURCE, SRC_COMMON, RUNTIME, RUNTIME_TGT, TGT_POS, TGT_MOV, AI)

    data.Direction = sourceForward;

    float dot = FVector::DotProduct(
        XY_(source.GetLastMovementInputVector().GetSafeNormal()),
        sourceMovement.Velocity.GetUnsafeNormal());

    dot = (dot + 1) / 2; // normalize dot as a measure of similarity
    data.Direction = (dot * XY_(source.GetLastMovementInputVector())) + ((1 - dot) * sourceForward); // use dot as weight to negate direction change by knockback
    data.Direction = XY_(data.Direction);

    // weigh pursue direction against strafe direction
    data.Direction =
        (runtime.StrafeSteeringWeight * (targetPosition - sourcePosition)) +
        ((1.0f - runtime.StrafeSteeringWeight) * data.Direction);

    DrawDebugDirectionalArrow(source.GetWorld(), sourcePosition, sourcePosition + data.Direction.GetSafeNormal() * 50, 10, Courage::RedColor);

    ai.Controller->SetControlRotation(data.Direction.ToOrientationRotator());
    return EStateTreeRunStatus::Running;
}
dense owl
#

@tough tulip you can put the service on a selector above the task, for example

tough tulip
dense owl
#

You can also use EQS queries as tasks

tough tulip
tough tulip
dense owl
#

I mostly echo Luthage and others, whenever I don’t rmbr things wrong 😅

tough tulip
rich pendant
#

Has anyone got any tips on how to handle doors for AI/NPC's? There's are doors the player would interact with to open/close. If I have the AI move to a spot on the other side of a closed door, how could I detect this to have them perform the relevant actions to open it?

harsh storm
#

Could just do a line trace on tick. Probably the easiest solution.

#

Or have doors with box colliders. When AI overlaps with that, shoot out the linetrace to see if it is open or closed.

sudden field
#

linetrace isn't really required here at all, a box collider would be fine

harsh storm
#

Or just tell them if the door is open or closed on overlap

sudden field
#

yeah

harsh storm
#

Just throwing out options

waxen portal
#

bros not moving im trying to get hi to patrol across 4 points is there anything wrong?

sudden field
#

your acceptance radius appears to be set to 234 million units

#

which is 2340 kilometres

#

your AI will finish moving if they get within Acceptance Radius units of their destination

#

and if that radius is 2340 kilometers... they're going to always be in that radius, so they will never move

#

lower the radius to like... 50 units. that's 0.5 metres

waxen portal
#

dang you a genius

#

i though it was just the reachable radius around the ai

#

works

sudden field
#

glad to hear

sudden field
# waxen portal i though it was just the reachable radius around the ai

for that kind of behaviour, you want GetRandomReachablePointInRadius. you give it an origin point to search from and a radius to search in, and it'll return a random point that your AI can navigate to.
if you make the origin = the AI's current location, then the AI will pick a random point in a circle around them

dusky lodge
#

Does anyone know if there is a way to force a Dynamic Generating Navmesh to stop generating ever.

#

The only reason I am using Dynamic Navmesh, is because of loading in level instances procedurally dont seem to be able to include their static navmesh.

#

Once the level instances are loaded, they generate navmesh dynamically. After they are all loaded, I dont need the navmesh to do that anymore.

dense owl
#

just gotta not have things with can ever affect navigation turned on moving about 😄

dusky lodge
#

That doesnt seem to be the case

#

Im seeing a really large overhead on the navmesh build stats when nothing is happening

dense owl
#

Weird, maybe Luthage or Duro will know

dusky lodge
#

Also for some reason there is a massive difference in the overhead of packaged build vs editor

#

The editor is smooth as, but packaged its dogshit.

#

lol

#

Seems there is AddNavigationBuildLock

#

Takes a Custom flag as input

#

The other flags seem to be for editor and an initial lock.

#

Maybe locking with the Custom flag after all the levels are loaded might stop it entirely.

dense owl
dusky lodge
#

Yeah go figure

uneven cloud
uneven cloud
dusky lodge
#

However the Lock system i described above should be sufficient for now.

uneven cloud
#

That's a hack, not a fix. Now you are going to have code lock dynamic navigation, which makes it look broken when you do want to change the nav mesh.

uneven cloud
dusky lodge
cyan cairn
#

Someone knows why my AI is not moving till i will uncheck anything in self component. It's working only in the moment when i will uncheck any of the checkboxes in self

opal torrent
#

Hey I’m starting out the an AI system for the first time, just trying to get the basics down so I can develop upon it, I want to set up a behaviour tree, blackboard, and some kind of sensing code all in in c++ or mostly c++ avoid blueprints as much as possible. Are there any good tutorials or GitHub c++ links someone can send me to learn from?

#

I basically just want to have an AI see my character and move to it.

severe flower
misty wharf
north oriole
#

Probably noob question but: how can i have a more detailed navmesh(smaller cell size) in one specific point of my map?if i just add a new navmesh volume, i still have only one RecastNavMesh actor from which i can set cell size, but it does it for all navmesh volumes

misty wharf
#

Is there some particular reason you only want it in a particular part of the map?

north oriole
#

Yeah because the corridors there are very narrow so i need a very low cell size(7 - ish) to generate a path there, but i don't want all the map to be so precise and maybe cause performance issues @misty wharf

misty wharf
#

Ah I see

#

You probably won't have perf issues with it I don't think

north oriole
misty wharf
#

Well even on dynamic it shouldn't regenerate more than the portion of the mesh which was invalidated

opal torrent
north oriole
misty wharf
#

Yeah it's gonna be a lot simpler that way. If you do run into perf issues later you can always change it then, although I still doubt it :)

north oriole
misty wharf
#

That is a very good question. You might be able to use a second navmesh, but if not, you would probably need to modify the underlying recast navmesh implementation which could get quite complicated

north oriole
misty wharf
#

Oh good find, yeah that sounds like it could solve it

#

Looks like that might be a new feature in 5.3, no wonder I had never heard of it

north oriole
#

Can confirm it works like a charm!just have to place a modifier volume and override the resolution in that area

rapid obsidian
#

I am trying to make my AI forget an actor after 3 seconds. I have it set up like this and I run out of the sight radius and i see it count down for 3 seconds and disappear but this never prints. am i doing something wrong?

dense owl
vapid night
#

Is there a built-in nav system that works with a grid? more specifically hex grid?
or is it best to just make my own?

misty wharf
#

Check if there's an A* implementation in engine, that would probably be your best bet

#

iirc there's some grid navigation thing but I've never really looked at it, and seems it might not work with a hex grid, just a "regular" grid

rapid obsidian
uneven cloud
foggy sequoia
#

I Made a EQS that checks for Line of sight using a distance and visability test. But I would rather get the current Bots held weapon range and feed that in to the eqs to use on the distance check as the weapons can change . is this possible

misty wharf
#

Easiest way to do it would probably be to create a custom test which can pull the weapon through the querier

#

You can more or less just copypaste the distance test code and add in the logic to get the weapon range

rapid obsidian
misty wharf
#

Unless the distance test allows passing the distance as a parameter, but can't remember if it does

dense owl
foggy sequoia
#

But cant see it in BT .

misty wharf
#

Is it not in query config?

#

If not, then you might need to create a custom BT node to run it. You should be able to set the parameters on the EQS instance

foggy sequoia
#

Only seem to have these options

dense owl
#

You’d likely need to make your own test, that one is specifically used to get the actual distance.

foggy sequoia
#

Stupid thing is Im sure I did this way back . and might have made a cutom query that This list Couls be set to

#

will open up old project

dense owl
#

Why not just get that output and check compare it against a var/bb key that has a dynamic range

#

Your can set that default test to check for the maximum range you could ever have on a weapon, and filter down from there with a comparison

#

Might be better ways to do this, including writing your own test in cpp tho 😅

foggy sequoia
#

Seem to have done this here WAAAYY back

dense owl
#

Ah, I thought you’re trying to filter by specific ranges

harsh storm
misty wharf
#

Yeah thought I had heard of something existing in somewhere

foggy sequoia
#

I am . I want a range of 1 meter - max range of weapon. so it changes position based on the weapon eg pistol range rifle and melee

#

Would be nice if I could just expose that filtered Value max to the BT so I can set that from the BB value

rapid obsidian
#

any way i can set my target to none or null or something

foggy sequoia
dense owl
#

You may have to manually update the bb key depending on whether the tree will get reevaluated right away or where this is being checked next

foggy sequoia
#

Does the name in the first pic need to be identical? to The BB value. maximum range

#

param name

tight kindle
#

Im making a 2d game and as far as I know I cant get Navmesh to work so im trying to essentially create it from scratch but im not sure how

#

Id like the slime to be able to move but only within the red lined area

#

Im trying to use Blackboards and AI trees as well, but Im not sure if thats possible without a Navmesh

misty wharf
#

If it's purely top down 2D, you could get navmesh working on it I think, by effectively just treating the terrain as a "floor" and your camera from above it

#

If you're not using navmesh and you want actors to navigate (eg. be able to go around obstacles etc. rather than moving in straight lines) then you would need to implement some custom navigation solution, such as tilemap based A*

tight kindle
#

It uses the X and Z axis so all the characters are essentially flying
If its easier to change the axis to allow navmesh then Ill probably do that

uneven cloud
misty wharf
#

At least regular Paper2D sprites can be put into any orientation, I don't know what this is using but I don't see why it wouldn't be possible

rapid obsidian
tight kindle
#

Id probably just have to rotate everything 90 degrees and change how the character movement is set up

foggy sequoia
uneven cloud
foggy sequoia
#

Exactly what i WAS TRYING TO DO

uneven cloud
foggy sequoia
#

Would you mind explaining your concern .

uneven cloud
# foggy sequoia Would you mind explaining your concern .

Hard coding means that your variables are set up in a way that can't be altered without changing the code. BP is code and many of the best practices are relevant.

Some of the many ways it's bad for your use case is having to change the code when altering the EQS. They are now tightly coupled. And any EQS with query params you will need a corresponding BT task.

The built-in BT task does what you want to do without the problems.

dusky lodge
uneven cloud
deep grove
#

I'm trying to wrap my head around giving my AI ships formations and using a vector I can give some basic formations with spacing but more advanced formations in 3D space seems to be much more difficult. If I wanted to have the ships surround an enemy in a cloud I was thinking I'd probably need something more complex than a Vector but I'm not sure what đŸ€” đŸ€” đŸ€” any advice?

dense owl
#

It wont necessarily handle the Z axis but it’ll get you started

deep grove
dense owl
#

Doing AI movement in 3 dimensions is difficult given the navmesh only allows for 2D

#

You can kind of hack your way around with relative pos or build your own system

deep grove
harsh storm
#

The simple way:

  1. Have a volume
  2. Subdivide that volume into little boxes of X size (w/e you need really)
  3. Place a point in all of the subdivided boxes with a point for AStar
  4. Use AStar (like the navmesh does) to path around your boxes
#

Depending on your needs - this may be sufficient enough

dense owl
#

Interesting

deep grove
dense owl
#

How does it path on Z axis tho if the navmesh is a plane

harsh storm
#

What do you mean?

#

Pathfinding on a navmesh is just using AStar

#

It just automagically generates the points for you

#

Collision avoidance is the RVO/Detour stuff

#

So being aware of other agents

dense owl
#

Oh this is not using navmesh bounds, just this AStar ?

deep grove
#

Well and for me I don't need the ships to do much pathfinding beyond basic collision avoidance which I can easily program myself

harsh storm
#

This is a simple way to do 3D navigation/pathfinding.

dense owl
#

One day when I go back to my rts project this will come in handy 😅

harsh storm
#

I'm not saying it is perfect or the best way to do it as an FYI.

deep grove
#

For sure I'll be giving it a lot of thought I appreciate the insight đŸ€˜

dense owl
#

Maybe, but when I was playing with floating ships in that project the best way I could come up with is changing the relative location of the mesh which is
 not ideal^

#

Using AStar def sounds more like actual 3d nav

rapid obsidian
#

So on forget i set my state to passive which is just a wait command currently and I clear my target but the ai continues to follow me even though it shows it is going into the different state

#

oh well i just tried "stop movement" and that fixed it

uneven cloud
rapid obsidian
#

just wanna say some of you sit in here all day and answer our questions and I really appreciate it

deep grove
sudden field
#

is there a definitive source of info on navmesh settings for optimising navmesh generation? I've read some of the advice here but it hasn't helped much.

I honestly don't really need a navmesh, I think - my project is essentially 2D top-down, except I'm using sprites kinda like Cult of the Lamb. the world is procgenned (which I now got working! twas my first C++ class ever) using PaperGroupedSpriteComponents in a parent actor. running procgen places approx. 900-1500 sprites with very simple collision (literally just boxes).
I can read out the procgen data to make navmesh myself, if that's a thing? I've implemented A* pathfinding in unreal previously so if that's what I gotta do, I'll do it

also worth mentioning that the procgen re-runs during gameplay, so I need to be able to regenerate the navmesh. I am currently committing the sin of dynamic navmesh to facilitate this. I'm not using world partitioning or level streaming, since the playable space is quite small, but the world is still broken up into separate levels (that are always loaded) for ease of editing for the rest of my team.
the current navmesh is in the persistent level, but even with the settings I've changed (larger cells, tiles sized to between 32-64 cells per side, making cell height = nav bounds height so that there's only one level of cells), I haven't been able to significantly improve generation.

A How-To guide on how to optimize the Navigation Mesh generation speed.

lyric flint
#

any able to help with this issue please

#

when I have a tile load in so part of the world my AI Character doesn't seem to conform with the nav mesh in terms of where there is gaps in nav mesh because of an object is there the AI Character still trys to walk through it

#

rather then pathing around the object

#

for a world composition type of thing is there something I should do on my Behavior Tree or my AI Character so they know what nav mesh they need to conform to ?

lyric flint
#

something else to mention is this is using TSW editor so the content from game is cooked and only stuff I add is uncooked so I don't now if when level loads back in something is messing up

next umbra
lyric flint
#

like I say if I run in PIE and run the AI it's fine

terse panther
#

i too used a custom eqs test to check for some custom values

#

here i can cast the CoverItem to my actual class to test for more values.....

next umbra
sudden field
sullen lake
#

Hello!
I have a Navmesh covering my play area, and there is a large part of the Navmesh that the AI doesn't like to move on to.
And when they do, they seem to lose track of me and just keep walking straight.
If you divided the map up into 4 columns, it'd be the left most column that the AI has trouble with.

As soon as I go into the left side of the map, the AI starts to lose track of me, they clump up, or will even walk right past me off the map.

If I go back to the right, some will follow me back, others seem eternally lost.
Why is a part of my map a wasteland for the AI? It's all the same mesh, and there are no height changes.

The task they're following is a very basic one, so I don't think that's the problem. They should just be walking towards me all the time.
(And as long as I stay off this side of the map, they do.)


I have replaced the Navmesh multiple times, with no change.

I should add, I've made games and maps with much larger Navmeshes with this and never had this problem before.
And I've been googling and looking for tutorials on this and haven't found anything yet.

misty wharf
#

Looks like it should work based on the screenshots. Do your AI characters and player character have "can affect navigation" turned off? This has been known to cause erratic behavior if it's enabled on actors that use navigation themselves

#

If it's off, I'd check in Visual Logger to see if navigation is generating any warnings/errors there

sullen lake
#

"can affect navigation" was off by default, so I tried enabling it on the player and enemies, and nothing changed, so I turned it back off again.

As far as the Visual Logger,
When it's following me normally, I had a few of these pop up.

But when it's bugging out and refusing to go towards me, there's only the top line.
No warnings.

It's like it loses track of where I am on that part of the map, it's not seeing me as a player anymore so stops trying to go towards me.
I could be completely wrong about that, but that's what it looks like to my low-level of understanding, lol.

tough tulip
#

So just in case anyone else is struggling with this; If you are wondering why the aborting of a BT task isn't actually aborting any task, it might be because you haven't hooked up any functionality to the "Receive Abort AI" event đŸ« 

dense owl
uneven cloud
# sudden field bump, I would massively appreciate any advice or links to advice

There is no such thing as a definitive answer to optimization, because the needs of each project is different. What you haven't done is explain why you think you need heavy optimization. What is the actual problem?

You could spend your time making your own navigation solution. It's unlikely to be faster given you just made your first C++ class.

tough tulip
uneven cloud
dense owl
#

There are some vis log nodes you can use, to draw shapes and such

sullen lake
#

Isn't that the Visual Logger? O.o

dense owl
#

It is

sullen lake
#

Is there more I can do with it?
I was just reading what it was putting out in the bottom right corner as I went through it.

dense owl
#

But there are also vis log bp nodes you can use to get more data

#

Then when you go to your vis log and select the controller or w/e you will get that extra info

#

And make sure when you look at it you click on the different categories and frames

sullen lake
# dense owl And make sure when you look at it you click on the different categories and fram...

Yep, I was doing that, that's where I took the screenshot above with the text, it was the only real blip along the frames and that blip didn't appear when it was bugging out.

But I guess I need to look into adding these vis log nodes.
I see one for "Enable VisLog Recording" - would that be something I put into a begin play event inside the AI's Bp?
Or would that need to go elsewhere? (or should I be looking for something else entirely?)

It just seems so weird to me that I've never had this AI problem before, even on larger maps.
But I make a simple map, with a super simple AI, and it suddenly bugs out. >.<

dense owl
sudden field
# uneven cloud There is no such thing as a definitive answer to optimization, because the needs...

the navmesh needs to be updated at runtime, as the same function that procedurally regenerates the environment will also spawn NPCs that need to walk around this environment. the player won't ever be in the procgenned area while it is generating - in fact, the area will be offscreen, and will be a 5-10sec walk to get back to the procgen area - but NPCs walking with outdated nav data can cause them to get stuck or be unresponsive.

before reworking my procgen into a C++ class, regenerating the nav data took 20-40 seconds. it currently takes much longer. like, minutes. no idea why because the geometry of what's being placed isn't any different.

#

35 seconds for "comp" (composition? I have no idea, no results from google) for a single tile. I have 48 tiles. navmesh gen does run in parallel but it still takes a long ass time
and... 808 million tris? I have no idea what's going on there, that has be a garbage value, right?

#

an example of a generated navmesh (with all the colliding geometry hidden)

#

and an example of a single tile

#

like this is not normal, right

dense owl
#

It is not

sudden field
#

the only things in this environment are sprites that are part of a PaperGroupedSpriteComponent. those sprites aren't using shrinkwrapped collision, they just have boxes for collision

dense owl
#

I haven’t seen triangles in my mesh before

#

Then I guess that might be a dynamic nav thing

sudden field
#

no, it's a debug option

dense owl
#

Oh interesting

#

What’s your cell size

#

And how do you enable that option?

#

I want to compare mine

sudden field
#

Draw Triangle Edges on recastnavmesh
Draw Tile Build Times for that other debug info

tough tulip
#

Anyone any idea why the red circled task wouldn't have its "Receive Abort AI" event fired when any of the green arrowed tasks abort the lower prio tasks?

sudden field
dense owl
#

bear in mind this is static not dynamic

#

if you enable the tile heat map, is it all red? 😄

dense owl
sudden field
dense owl
sudden field