#gameplay-ai

1 messages · Page 58 of 1

misty wharf
#

I think you would probably want to keep the calculations etc. in the controller, with the behavior tree doing the higher level choices like choosing the target towards which the car is driving or things like that

rich wolf
#

yeah i suspected that

rich wolf
#

so basically i have to move many of my AI variables to blackboard

oblique basin
#

Anyone writing custom C++ BT tasks, I'm finding it tricky to use delegates to control tasks as it seems that both Node Memory and Owner Comps are a) only directly accessible when using task virtual functions and b) changeable such that memory addresses for the above objects are subject to change before task completion, so saving pointers during execute is inconsistent. For example, I have a callback to when my character changes state, but binding a task function disables being able to pass node memory around. How do people handle this?

glad snow
#

So here's my Event graph. I'm trying to get A.I. walk from point A, to B, to C, and when it gets to D it stops how do it fix so it walks around the whole area in a loop

dapper crest
#

So I'm getting the impression services in the path to the current task don't run during the execution of a long task? But decorators in the path to that task are still being evaluated etc.?

wooden stag
#

Anyone here work with smart objects? I can't get any of the nodes related to tags to work. I am providing a valid slot handle/smart object handle, but it seems like these nodes just do nothing currently.

"Get Slot Tags" and "Get Instance Tags" always return nothing, even if I input the same slot handle I use to get the slot location, which does work, and required filtering via tag, so I know the slot handle is valid and has the tag, but using these nodes to print the actual tag(s) returns nothing

oblique basin
wooden stag
# oblique basin What's an AI task? Google refers me to BT tasks only.

From forums

AI tasks are an extension of gameplay tasks and are mean as main communication layer between all sorts of logic sources (BT, FSM, level scripting, extermal-induced reactions, etc) and the AI entity itself. In 4.14 I’m going to flip the switch and BT tasks by default are going to spawn AI tasks instead of directly messing with AI agents’ internals. Both Paragon and Fortnite have been successfully using AI tasks for some time now, and Gameplay Tasks are also a super set of Ability Tasks used by Gameplay Abilities System

https://dev.epicgames.com/documentation/en-us/unreal-engine/API/Runtime/AIModule/Tasks/UAITask?application_version=5.3

oblique basin
oblique basin
#

UBehaviorTreeComponent* OwnerComp = Cast<UBehaviorTreeComponent>(GetOuter());

This is the answer.

fierce carbon
#

What type of optimization methods should I consider with mass AI?

fiery epoch
#

Guys, AI pawn sense doesn't sees me through the wall on the first time. But when I get sight than ai always follows me. Only way to stop it is getting behind pawn sense. So just after chase starts the walls can't help, why?

#

I wathed few tutorials and this problem only happens with me. I just don't understand why that happens

#

If getting behind the ai wouldn't work. Than I would understand the problem, but the fact that walls won't help after first sight cracks me

vague hollow
#

Hey guys, silly question about State Trees.

I have an STT that outputs a vector (variable is set as output).
I want to grab as an input that variable in another STT that is not a child of the previous one. How can I do that ?

I'm always able to get the variable from one STT to another if the latter one is a child of the first STT but not if they are siblings

misty wharf
vague hollow
misty wharf
#

Global tasks or evaluators mostly I guess

#

Possibly extend the schema to support additional parameter values you can store

light void
#

I have made a base AI I am satisfied with. How can I create offshoot of that AI? Like, make other AI that have the same base functions but with the option to override a function or event if I think it's necessary for the other AI? What is the clean way to do so?

fiery field
#

Is there a way to debug the the sight sense for an AI ? Like, see the sight cone basically
Because when I tick show > senses in the viewport, it doesn't show anything

misty wharf
vague hollow
fiery field
keen crow
oblique basin
uneven cloud
uneven cloud
uneven cloud
fierce carbon
#

I am trying to find ways to optimize my AI (heaps of zombies). If I was to unposses the AI controller, will that disable character movement/ticks? I am trying to disable far away AI and only enable the ones near the player.

steel moat
#

This is the behaviour tree of that AI, at first the player is not in sight so it is doing the task on the right most of the behaviour tree when it comes in sight it switches to the task in middle to follow the player. Now when player jumps even tho it didnt lost the sight AI goes back to roaming

#

the first video and the 2nd video are not same

dense owl
fierce carbon
dense owl
fierce carbon
uneven cloud
steel moat
dense owl
uneven cloud
dense owl
#

Ok

#

Guess I thought if the object is unloaded by WPO/streaming there’s no way the AI that possesses it would be running, but every day is a lesson

rare ruin
stoic cove
#

Hello. I'm facing an issue with UE 5.4 I migrated my project and suddenly I get a crash / error saying that my nav mesh bounds are too large. I have a very large open world and want AI to work anywhere. So what I did in my old project is just place a massively huge navmesh bounds volume because that seemed to be the only way to have invokers be created around AI pawns. This never gave me any issues, until now in 5.4. So what is the alternative / better way to make AI work in a massively huge open world?

#

What I don't really understand is why the tooltip for "generate navigation only around navigation invokers" says "this will make the entire world navigable" yet it doesn't, because it only does when you still place a nav mesh bounds volume that you have to scale extremely large, which then results in the above error. So how does one truly enable open world navigation? The tooltip seems to be incorrect?

static crystal
#

Ever find a solution to this? project wont compile because of the missing AIMODULE_API

azure pulsar
#

Was wondering, can the default cost of NavAreas or the override cost of NavFilters be changed at runtime?

stone walrus
#

Idk what's setting called

regal drift
#

I solved Async Pathfinding and got it to work so i will post my current solution. Is there any way which i can batch several pathfinding request?

tidal mantle
stuck oar
#

I have 3 doors. The player clicks on the door and has an ai walk the camera to the door. When I click on the left door, it walks straight. I am peprplexed

severe kayak
#

Hey, does ue5 support sharing of a behavior tree and blackboard across multiple agents? I am wondering how BTs can handle large number of entities all at once

dense owl
#

You can also have subtrees if you want only certain branches to be shared (must have same blackboard tho)

severe kayak
# dense owl You can also have subtrees if you want only certain branches to be shared (must ...

But what i am missing (and remember that I have 1k actors), is that there is a BT assigned to an AIController whoch is assigned to my actor. And if I remember correctly, there is a ahed cap of 20/30 ai conteollers at a time.
So I sont understand how BTs can scale to those levels.
And it is totally okay of they are not, I kust want to make sure I am not developing something that is already supported 😀

dense owl
severe kayak
obtuse igloo
#

Anyone able to figure out this out? #gameplay-ai message

I might have to use a different method if not, I’m stuck LOL

misty wharf
olive prism
#

I have a problem, when my AI makes attacks, due to root motion, it often stays above my character and loses the vision sensor, therefore it enters the passive state

How can I prevent me from losing the character that is in focus when stop seeing him?

keen crow
#

So, what's with the BT nodes API issue in UE5.4? I've updated my project from 5.3.2 and all of a sudden I get compilation error pointing to engine's nodes (I assume because I inherited them in some of my own BT nodes). I remember facing this issue when 5.4 only came out in preview and I rolled back to 5.3.2, but back then somewhat of a solution was to manually override all non-exposed methods (OnBecomeReleant. InitializeMemory, etc) just for the sake of it. Is there any better solution now?

keen crow
#

so, uh, do I get it right that epics messed up BT nodes code, dragged it from 5.4 preview to 5.4 release, and 2 months in the problem isn't fixed in EGS engine version and nobody in epic isn't doing anything about it? 🙊

boreal tundra
keen crow
#

maybe it's too dark inside. jokes aside, maybe you have incoherent settings in CMC nav agent capsule shape settings, actual character capsule shape and the one in project settings in navmesh section which is used for generating navmesh?

boreal tundra
#

I'm sure nav mesh could be better since mine does its job but it's super bad looking

keen crow
#

your navmesh is fine, NPC should be able to pass there

#

but incoherent nav agent (any AI that can walk on navmesh) can still be a problem, because navmesh generation takes it into account

boreal tundra
#

Like here the sphere shows the area where he should look aroun which is small but in-game he was walking towards the corner on the left

#

@keen crow nav mesh goes over objects sometimes like bed and chests.. AI still doesn't walk over them so it's fine but maybe it triggers some problems?

keen crow
#

well, again, there can be several reasons why can AI's movement on navmesh look ugly, I can only suggest you check on some of the possible reasons, but giving you a 100% correct answer is just a matter of trial and errors in your project. so I would

  1. check that navmesh generation nav agent size, actual character capsule size and CMC size are coherent. If you didn't adjust any of those, you can ignore it, as default should work
  2. check that all relevant meshes have Can Ever Affect navigation set to true if they actually should
  3. Check that in your BT/ST it doesn't happen that AI is constantly switching destination or something
  4. Maybe you've enabled RVO in your NPC's CMC settings and set some big avoidance radius and hence your NPC is constantly trying to avoid player while it's path lies through the player
boreal tundra
#

One is its normal capsule, another is to trigger stuff when touched

#

What's CMC?

#

What is RVO?

#

How do I check that nevmesh generation nav agent size? Didn't you say that the nav mesh is fine?

keen crow
keen crow
# boreal tundra What is RVO?

Reciprocal Velocity something something avoidance, it's a mechanism built in CMC (considered outdated) that allows NPCs to avoid other characters (or I guess any actor having velocity) when moving. It's known to produce errors in navigation because it doesn't take navmesh into considerations when it moves the nav agent a bit to the left or to the right to avoid obstacle, also in my experience it can introduce some jitter for the NPCs. CMC has a set of parameters for RVO, but AFAIR it's disabled by default

keen crow
# boreal tundra How do I check that nevmesh generation nav agent size? Didn't you say that the n...

The navmesh looks fine but you must understand that navmesh is generated for a nav agent of some radius with some max step height and max step angle properties. You can have multiple nav agent types (small NPCs, big NPCs) and they could have different nav mesh. So it is possible that you have a default navmesh generation settings but for gameplay reasons you've made your NPC capsule bigger for whatever reason. Judging by your answers it's not the case but I'm just sharing my considerations on what I would have checked had I your problems

boreal tundra
boreal tundra
keen crow
boreal tundra
keen crow
# boreal tundra Okay I have it on false

well, then you can try either

  1. for testing purposes shrink the NPC's capsule component radius to half the size just to see if it starts to pass smoothly through narrow gaps after that. If so, maybe either tweak the navmesh generation properties or perhaps change the level design to widen those narrow parts
  2. if that doesn't help and if it happens not only in narrow paths but everywhere, then try to see if the AI is actually constantly changes final destination point, maybe you have multiple EQS services running at the same time and updating the same blackboard property or something
boreal tundra
frigid vine
#

I'm not at my computer but so figured I'd shoot message in here just for rough idea/direction.

Currently my fps grapple game uses a lot of NAV links to handle enemies jumping to the different platform.

Say I had two equal size platforms side by side, one raised higher. If I wanted to enemy to jump down/up when following player is there any easier/better way to handle this dynamically then just placing a bunch of NAV links around the platform?

misty wharf
#

Easier? Doubt it. Better? Maybe, but get the feeling it would be kinda complicated to set up in a way that works reliably the way you want. You could for example attempt to do some kind of custom test to determine whether the unreachable position where the player is was possible to reach via jumping or something. I think there was also some code in one of the published UT codebases that automatically placed navlinks so you don't need to manually do it

harsh storm
misty wharf
#

5.4 seems to be the most broken release in a while...

keen crow
#

fascinating

dense owl
#

There’s a 5.5 on the branch? Neat

scarlet kayak
#

Anyone else experiencing behavior tree problems with 5.4? My enemies work fine in PIE but don't move around at all in the packaged game

harsh storm
#

When do you start the behavior tree?

scarlet kayak
harsh storm
#

That didn't answer the question

#

When do you call "Run Behavior Tree"

scarlet kayak
#

event begin play > run BT

harsh storm
#

Don't do it in BeginPlay

#

Do it in OnPossess

scarlet kayak
#

ok thank you!

harsh storm
#

Things may not be valid when BP runs in this case.

#

That's why

scarlet kayak
harsh storm
#

yes

scarlet kayak
#

thank you! I greatly appreciate it 🙂

#

interesting that it wasn't an issue when I used 5.3

harsh storm
#

It could have been an issue

#

You were just lucky to not encounter it

#

There is no guarantee that you'll have a Pawn when the controller's BeginPlay is ran.

scarlet kayak
#

I see... so the ai controller was loading before the pawn was

harsh storm
#

Not necessarily

#

It is a matter of BeginPlay's order not being guaranteed

scarlet kayak
limpid shore
#

| might have solved this kinda
~~Hi, I'm trying to make a function that detects what's in a image (a cat, a dog, a car etc)
I've come through this thing called "neural network inference" the newer version is called "neural network engine", and some stuff have changed, the tutorials from 2 years ago are all outdated,
only tutorial I can find is this, https://dev.epicgames.com/community/learning/tutorials/34q9/unreal-engine-nne-quick-start-guide-5-3
but I've having trouble understand it, should I put the script in an actor or an object?
the old tutorial: https://www.youtube.com/watch?v=LX1w_etaftY
said I need to put the code in a "neuralNetwork" class, which doesn't exist in ue5.3.
why are there red lines under stuff like "INNERuntime" am I missing a dependency? am I missing an include, if so, what is this include.
hoping for directions.~~c

Epic Developer Community

Learn about all the steps required to run a neural network on CPU inside Unreal Engine.

In this video we will show you how to setup a basic scene in Unreal Engine 5, add plugins and logic to run machine learning in your projects.

Unreal 5 Release Notes on the NNI Plugin: https://docs.unrealengine.com/5.0/unreal-engine-5-0-release-notes#neuralnetworkinference
Unreal 5 Setup: https://docs.unrealengine.com/5.0/installing-unreal-engin...

▶ Play video
harsh storm
sonic yoke
#

I'm having a bit of trouble with my nav mesh agent radius. I've changed it in my project settings, but it has no effect since I have a RecastNavMesh-default actor (which spawned by itself?) which changes the value. It doesn't seem to matter if I change the value on it since every time I restart UE it resets to a default value. How do I change this so the change sticks?

dense owl
sonic yoke
#

Thank you

feral sedge
#

I have this problem. I asked about it before, and was also told to look at the VisLogger. Can't be sure since I don't know much about it, but I didn't seem to find any answers in there. IIRC, the log is too big to post here.
I mean, nobody seems to know anything about it anywhere on the interwebs. It happens randomly to only some of my AI, usually after going across my map in World Partition. Like you, it seems that the Navmesh is there, but some AI stop moving towards my Player and only attack when you get close (as if no Navmesh). On reload in the general area of the problem (from savegame actor), the same AI enemies or areas then work perfectly.
I've been struggling with this for months. My demo will be in NextFest this week, and I have to accept that this unwanted behavior can't be avoided at the moment, which is a bummer.

scarlet kayak
scarlet kayak
uneven cloud
pine steeple
#

Can also turn on log lognavigation verbose and log logpathfollowing verbose

#

For more detailed logs

spring scaffold
#

Hi guys
I have couple questions about navigation's weird behavior. First of all why does ai doesn't choose the shortest path but hugs walls instead? Every time i use unreal navigation i get results as on first picture where car rides on the red path instead of blue. Is there easy way to change it? I really don't want to write my own local navigation because i already had to write my own global navigation using Dijksta.
Second thing is that agent radius parameter in recastnavmesh is always set to 35 in runtime even though i set it to another value in editor. It doesn't matter if i'm using regular navmesh but it does when i use "Generate navigation only around navigation invokers". When i use this option the radius around obstacles is always set to default value. Can i change it someway?

misty wharf
spring scaffold
misty wharf
#

It definitely should be following it at least on the left side

spring scaffold
misty wharf
#

Did you configure a supported agent?

#

It seems sometimes to be a bit inconsistent about which setting it follows and may require one

#

(or it might be I never paid enough attention to how I have configured it in my projects where I needed to do that lol)

spring scaffold
misty wharf
#

there is a setting called supported agents

spring scaffold
#

Do you have any video where agent takes the shortest path instead of huging the walls? At this point i'm almost sure they do this every time

misty wharf
#

try adding one into that list if you don't have yet, and configure the radius there

#

I don't have videos of it but I've not noticed this behavior in any of my projects. I'm not using nav invokers or such though, so I don't know if it's some weird issue with them

spring scaffold
misty wharf
#

I've heard invokers are problematic but can't really say for sure since I've not used them myself 🤔

spring scaffold
#

Tbh my issue with ai not taking the shortest path appears even when I'm not using nav invokers.

#

Thanks fpr your help anyway 🙂

untold quiver
#

Hello, I'm trying to write a move to task at the end of my "EnterState" Function in a C++ State tree task. I need to bind to the result of that task to return the correct value of EStateTreeRunStatus. However when I bind a lambda to the Path Following component's OnRequestFinished delegate I get compile errors. Is there a way to do this or am I stuck using the blueprint state tree tasks?

#

Okay nvm I found a good example of it in the "PlayContextualAnim state tree task

spring scaffold
#

It's just goes to the green ray, not the red ones

swift bolt
#

When it comes to the heuristic weight/scale, what effect does that have on navigating a path from point A to point B? What should the moving objects behavior be if the heuristic weight is zero versus one versus two and in between

ruby shard
#

how to cutomize FNavigationQueryFilter ? why the hell is there wrapper over wrapper ? i just want to override some functions for dtQueryFilter

#

🤔

wooden coral
#

Hey, I'm trying to use RegisterNavigationInvoker() for my player cause it's really suitable for my game design, but it doesn't seem to be working cause I don't see any Nav geometry rendering after pressing P in the editor, and my NPCs just stuck unable to do any pathfinding
Using a NavMeshBoundsVolume worked fine for me but I really want to switch to invokers

I call RegisterNavigationInvoker() in player's BeginPlay(), and UnregisterNavigationInvoker() in the EndPlay()
I also set bGenerateNavigationOnlyAroundNavigationInvokers to true
Don't know if that's all for the setup

uneven cloud
sullen plume
#

I'm recreating the AIMoveTo Blueprint Node in C++ here's the C++ code, however, the character is stationary, and when I look at the behavior tree which uses the C++ task, it is instantly calling and ending it repeatedly (specifically im tryna have the player wander so pick a random location within some radius and move there)

#

And here's the blueprint which I'm trying to recode (the blueprint works fine btw):

#

Me a couple hours later...
I was recommended to just derive from the BTTask_MoveTo so I did that, and I'm more lost than ever,

NodeMemory barely makes sense, apparently I'm supposed to make custom structs to store values?

I can make my own struct sure but when I look at the example MoveTo Code there's just way too much going on for me to understand.

Like one second the code uses NodeMemory and the next its like fk it we using the BlackboardCompoennt now

#

when i'm referencing the code ^ I mean like Unreal's "Tasks/AITask_MoveTo.h"

uneven cloud
median socket
#

Id clash in non Game and non PIE world. This should be incredibly rare!

#

Does anyone have experience with hitting this ensure when using NavLinkProxy components in Level Instances?

#

And does it matter?

#

It started happening in 5.4 I believe.

#

For context, we have a door blueprint with a smart navlink component. This door is being used in level instances for houses.

#
// During PIE or game we just generate a new Id, this is most likely to be from a runtime (non editor placed) prefab like a level instance but could be from 
// a legitimate but extremely unlikely Id clash after loading.
// If this occurs in EWorldType::Editor world it's a legitimate ID clash, currently we do not handle this edge case here as it should be incredibly unlikely to occur
// and we do not save changes when cooking or building paths running a commandlet etc.
#

This comment is above the ensure.

ancient wedge
uncut rune
final thicket
#

somebody can help me with my AI Enemy? i took a project where i'm not the first dev so im lost with a dumb ai that dont even know whats happening

#

i can show the project tho

spring scaffold
steel moat
#

is it possible to attach the AI controller to a skeletal mesh component i have attached with the pawn instead of directly attaching the controller to pawn? Whenever the character is comes in sight of the AI the whole body turns to face it, I only want the skeletal mesh component(Head) to face the character

misty wharf
#

There's nothing automatic that turns anything "when character comes in sight of the AI" so if you have logic there that turns the whole actor, then that's what's gonna happen

steel moat
misty wharf
#

try using one of the other focus priorities if it turns the whole actor

#

I'm fairly sure I used this in my project and it turned just the head but I don't recall the specifics

hallow compass
#

is there somewhere a BT and ST pros & cons ?
i find it very hard to find what would fit the best and whats the most "optimized" and "modular"

dim lynx
#

hi, did you solved it?

#

can you help me with this? I also try to have the AI ​​flank the player 😅

misty wharf
hallow compass
misty wharf
#

You can write BT tasks just fine in C++

#

Although personally I find I often write them in BP's since there's often at least some latent actions occurring in them, and those are a bit less of a hassle to work with in BP's at least in my opinion

hallow compass
#

okay

sullen plume
sullen plume
#

even if i do that, my issue is that I'm unsure how to make the ai move. Like the code seems to work but the actual actor ain't moving at all.

#

I've tried the deriving from the BTTask_MoveTo and doing it myself, the actor stays in place

harsh storm
#

Honestly - it is wild that your solution is to rewrite that instead of investigating why it isn't moving

#

Considering the thousands of games that have released with this exact setup (one task to find a point and another to move to it using the MoveTo task) - something is wrong with your setup

sullen plume
#

okay if i'm given an actor location

#
  • target location
#

how do i move to that

#

like even if i do the setup ur recommending i still dunno how to get to that point

harsh storm
#

Store it as a BB key, then use the move to task and set the target to that key

#

Make sure you have a valid navmesh as well

sullen plume
#

when you say use the move to task

#

which func do i call?

harsh storm
#

None

sullen plume
#

and do i just pass in the default ownercomp and nodememory

harsh storm
#

It is a built in task with the engine

sullen plume
#

oh that one

#

okay just to confirm

#

are these accurate? if (moveResult == EPathFollowingRequestResult::AlreadyAtGoal) { return EBTNodeResult::Succeeded; } else if (moveResult == EPathFollowingRequestResult::RequestSuccessful) { return EBTNodeResult::InProgress; } else { return EBTNodeResult::Failed; }

uncut rune
# sullen plume ^

Can you show your behavior tree? Did you try to debug it if it's even firing? You can look into Behavior Tree to see the flow.

sullen plume
uncut rune
#

and Wander is with that AiMoveTo node?

harsh storm
#

Do the setup that you've been told at least 3 times now.

sullen plume
#

ikik thats my old tree

uncut rune
#

lol then show updated? xd

sullen plume
#

I'm doing ur strat

#

dw

harsh storm
#

The snippet of code in a vacuum means nothing really.

uncut rune
#

This behavior tree Wander task is written in C++?

sullen plume
#

hmm

    EBTNodeResult::Type result = Super::ExecuteTask(OwnerComp, NodeMemory);
    if (moveResult == EPathFollowingRequestResult::AlreadyAtGoal) {
        return EBTNodeResult::Succeeded;
    }
    else if (moveResult == EPathFollowingRequestResult::RequestSuccessful) {
        return EBTNodeResult::InProgress;
    }
    else {
        return EBTNodeResult::Failed;
    }```
#

better?

#

im in a class that dervies from teh moveto

#

task

sullen plume
harsh storm
#

You are doing absolutely useless work

sullen plume
#

ouch

harsh storm
#

Just do the setup you have been told

uncut rune
#

It's better to first create prototype that is working, and then translate it into C++ for example. Right now you have no idea what is wrong, if its the behavior tree setup, code or maybe you dont have even ai controlleron your pawn

sullen plume
harsh storm
#

Use 👏 the 👏 built in 👏 move 👏 task

#

It literally does all of this for you

sullen plume
#

EBTNodeResult::Type UBTTask_Wander::ExecuteTask(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory)
{
    EBTNodeResult::Type result = Super::ExecuteTask(OwnerComp, NodeMemory);

    if (moveResult == EPathFollowingRequestResult::AlreadyAtGoal) {
        findNewTargetLocation();
        return EBTNodeResult::Succeeded;
    }
    else if (moveResult == EPathFollowingRequestResult::RequestSuccessful) {
        return EBTNodeResult::InProgress;
    }
    else {
        return EBTNodeResult::Failed;
    }

}```
harsh storm
#

All you have to do is provide a location or actor

sullen plume
#

i know

#

but let me at least try to do it in c++

harsh storm
#

No, you don't seem to know

#

Make the task to get a random navigable point in C++

#

If you want to use C++

sullen plume
#

Alright I did all that and my ai still aint moving
Do I need to setup player input component by creating the move, look, and jump bindings? Does the AI use those when moving around the level or does it use something else

#

and i have tried with both moveto and movedirectlyto

harsh storm
#

Use Move To

Do you have a nav mesh?

sullen plume
#

yeah ofc

#

uk how for player to move wasd u gotta setup player input?

#

does ai need me to setup wasd?

#

or does it use some other form of moving around

misty wharf
#

AI doesn't care about keyboard inputs or anything like that

#

It should work for navigation if it's a Character. If it isn't a Character, it needs to have a compatible movement component added to it

sullen plume
#

yeah it has a char movement component

#

weird i msut be missing smth

misty wharf
#

look in visual logger

#

movement failures are usually shown in there

uncut rune
#

Why won't you put that Move To node task that is already built in and just check if it's the code problem or not first? xD It's 5 seconds

#

maybe your code is right and you didnt set something else

#

did you tell your npc to run behavior tree?

sullen plume
#

thats

#

what i did!

#

yeah i did tell him to run behavior tree

#

i first trieed moveto

#

then movedirectlyto

#

both same result

uncut rune
#

show us code inside these nodes

sullen plume
#

the moveto is just default whatever

uncut rune
#

and how are you setting black board key inside find new?

sullen plume
#

the blackboard key works fine like i see the value changing to a valid location

#

but here it is anyways

#
EBTNodeResult::Type UBTTask_FindNewWanderLocation::ExecuteTask(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory)
{
    if (auto pawn = OwnerComp.GetAIOwner()->GetPawn()) {
        if (AAIController* AIController = Cast<AAIController>(pawn->GetController())) {
            FVector actorLocation = pawn->GetActorLocation();
            auto navSystem = UNavigationSystemV1::GetNavigationSystem(GetWorld());
            FNavLocation targetNavLocation;
            navSystem->GetRandomPointInNavigableRadius(actorLocation, 10000, targetNavLocation);
            OwnerComp.GetBlackboardComponent()->SetValueAsVector(GetSelectedBlackboardKey(), targetNavLocation.Location);
        }
    }
    return EBTNodeResult::Succeeded;
}
uncut rune
#

2 things:
show me in Ai Controller on Begin Play your setup
run game, click P and do screenshot of your nav mesh, is it green where it should be?

sullen plume
#

yup everything green:

#

the guy getting scaled is the ai

#

and yes aibehavior is set in the blueprint

uncut rune
#

Try to lower Radius of points, maybe it's choosing some crazy number and cannot go there

sullen plume
#

maybe

uncut rune
#

and inside Character did you set Ai Controller Class?

#

in the Pawn category

sullen plume
#

yeah

#

maybe he's just lazy

sullen plume
#

or like the visual studio output i get while building?

misty wharf
#

Tools->Debug->Visual Logger in UE

sullen plume
#

ainavigation is red?

#

what am i supposed to be looking for?

#

nth else is red

misty wharf
#

Press record, then play in editor so that the BT stuff runs. It should show a timeline of sorts about different events that occurred during the PIE session

#

If you then click on the events or use the time marker to move around, it should display more info

harsh storm
#

Did you set it so that the controller possess on spawn and on placement?

#

Also, don't run the BT on BeginPlay, do it on possession

misty wharf
#

That suggests it's attempting to move at least

sullen plume
#

yeah

sullen plume
#

I made a test blueprint function that uses Controlled Pawn i'll provide img of the workflow
When I play i get the below error

PIE: Error: Blueprint Runtime Error: "Accessed None trying to read property K2Node_Event_ControlledPawn". Node: AI MoveTo Graph: EventGraph Function: Execute Ubergraph Test BTTask Wander Blueprint: BTTask_Wander

signal island
#

we recieve Payload in statetree only in c++?

sullen plume
harsh storm
#

Well that points to a different problem

sullen plume
#

yet somehow in the world I do see my controller just chilling in the center of the actor

#

oh wait

#

i dont nvm

#

it aint using my aicontroller

#

just the default one

dense owl
#

You need to set it to use the correct controller

sullen plume
#

does this look right? tghis is my bp_aicontroller class defaults

#

cuz rn like everything seems to be working excep the behavior tree which never runs

harsh storm
#

That's because you're not running it

#

What is the controller for the pawn

mellow zenith
#

Can anyone help me out with some issues im having with my AI

#

would be easier if it was in call to show properly what the issue is

dense owl
mellow zenith
#

I can describe it but showing screenshots will be hard as I need to show its movement in action

#

Effectively though while the AI moves it is like spam sensing and forgetting the player even when infront of them

#

and its causing the AI to freak out between patrolling and attacking in the behaviour tree

#

Have 0 clue what is causing this as ive done this type of AI tons in the past

misty wharf
#

Typical causes for this are something blocking the LOS, or the AI's movement logic making it turn enough to lose the player from its sight cone

#

If you've f.ex attached guns or other meshes into either character, they can also block the LOS trace

mellow zenith
#

@misty wharf So does AIPerception only percieve the player and not attatched components?

misty wharf
#

Perception attempts to do a trace to the target actor, if it hits something before the target actor, it considers the target hidden. It doesn't check if the hit actor is attached to the desired target

mellow zenith
#

Hmmm

#

Lemme screenshot some stuff in an attempt for you to assist lmao

#

cus im not really sure what is causing it to bug out

#

oh wait

#

hang on

#

On a controlled AI, where does the AI percieve from

#

if its a character

#

the AI Pawn is the top

#

and the bottom one is the player

#

Looking at it now I think it might be the static mesh on the character

#

as we used that instead of a skeletal mesh so we could avoid re-coding its basic movement stuff

misty wharf
#

It's possible. Try setting all the meshes to No Collide

#

Also, the collision channel for LOS checks is Visibility by default I think... it's configurable from project settings

mellow zenith
#

ah okay

#

I didnt realise I could change that

#

thanks

#

Ill try them out

#

Yeah it was the mesh

#

such a stupid bug lmao

sullen plume
#

figred it out thanks

uneven cloud
uneven cloud
uneven cloud
fluid ingot
#

Can someone explain to me like I'm 5 what "Services" are for and some examples of how or when to use them?
I can't understand them no matter how much I have read already.

sullen plume
uneven cloud
sullen plume
#

yeah i didn't do that ill fix it rn

#
            bool bSuccess = navSystem->GetRandomPointInNavigableRadius(actorLocation, searchRadius, targetNavLocation);
            if (bSuccess) {
                OwnerComp.GetBlackboardComponent()->SetValueAsVector(GetSelectedBlackboardKey(), targetNavLocation.Location);
                return EBTNodeResult::Succeeded;
            }
        }
    }
    return EBTNodeResult::Failed;


#

perfect

uneven cloud
sullen plume
#

i know i've asked this before and i've been told its way too complicated but does any1
know how to, in a C++ BTTask, make the AI Move to some FVector location?

sullen plume
#

bcuz i've been told just set the blackboard value in C++

#

and then in the behavior tree just use the built-in MoveTo and pass in the blackboard key location

#

what I want to do is do that in one step, in c++

#

this is one of my attempts:

EBTNodeResult::Type UBTTask_LessOldWander::ExecuteTask(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory)
{
    if (targetNavLocation.Location == FVector::ZeroVector) {
        findNewTargetLocation(OwnerComp);
    }
    EBTNodeResult::Type moveResult = Super::ExecuteTask(OwnerComp, NodeMemory);

    if (moveResult == EPathFollowingRequestResult::AlreadyAtGoal) {
        //targetNavLocation.Location = FVector::ZeroVector;
        return EBTNodeResult::Succeeded;
    }
    else if (moveResult == EPathFollowingRequestResult::RequestSuccessful) {
        return EBTNodeResult::InProgress;
    }
    else {
        //targetNavLocation.Location = FVector::ZeroVector;
        return EBTNodeResult::Failed;
    }

}
#

the guy doesn't move at all

#

oh u probably gonna need findNewTargetLocation too

void UBTTask_LessOldWander::findNewTargetLocation(UBehaviorTreeComponent& OwnerComp)
{
    if (auto pawn = OwnerComp.GetAIOwner()->GetPawn()) {
        if (AAIController* AIController = Cast<AAIController>(pawn->GetController())) {
            FVector actorLocation = pawn->GetActorLocation();
            auto navSystem = UNavigationSystemV1::GetNavigationSystem(GetWorld());
            FNavLocation newTargetNavLocation;
            navSystem->GetRandomPointInNavigableRadius(actorLocation, 10000, newTargetNavLocation);
            targetNavLocation = newTargetNavLocation;
            OwnerComp.GetBlackboardComponent()->SetValueAsVector(GetSelectedBlackboardKey(), targetNavLocation.Location);
        }
    }
}

#

I thought that by setting the blackboard value and then calling super the super would look at that blackboard val and go there, but it wont 😭

#

other option was using like NodeMemory but since I'm deriving from MoveTo and MoveTo has its own struct i dunno if its safe to overwrite it without ruining Super::ExecuteTask

uneven cloud
#

If you don't set the BB key selector in the BT it will default to self. So that's what the base move to will use.

#

So it doesn't move because it's trying to move to itself

sullen plume
#

i dont think thats the problem

#

ignore the right side of the selector

#

that dont matter

#

I'm guessing its on the C++ end

#

don't see any1 succeeding to do this on the web either

uneven cloud
#

There's absolutely no reason to do what you are trying to do

sullen plume
#

😭 thats what the other guy said

#

alr alr

#

ill stick with the basics ig

#

thanks for trying

steel moat
uneven cloud
steel moat
uneven cloud
steel moat
#

which function are u talking about...?

#

this is what i'm doing currently

SetControlRotation(FMath::Lerp(GetControlRotation(),rotation , time / 0.1));
TurretPawn->Attachment->SetWorldRotation(FMath::Lerp(TurretPawn->Attachment->GetComponentRotation(), rotation, time / 0.1));
#

the second line is setting the head rotation, and this is in the controller and im calling it on the tick

#

When i set the world rotation of the head it works as i want but the cone of the AI perception doesnt rotate until i use the set control rotation

uneven cloud
steel moat
#

;-;

steel moat
uneven cloud
steel moat
#

u said to override the pawn function that gets the view location and rotation

uneven cloud
steel moat
uneven cloud
steel moat
#

i was looking in the blueprints....my bad

steel moat
# uneven cloud Yes

so i have to override those functions and return the head's socket rotation and location?

steel moat
steel moat
#

i want to check if a given position is navigable or not by the turret, i searched the internet and forums and found that there are two functions that does something similar to what i want, TestPathSync and ProjectPointToNavigation

#

but i couldnt figure out which one is the optimal? there are mixed opinions on the internet]

uneven cloud
steel moat
# uneven cloud Project point only checks if the location is on the nav mesh. Test path checks ...
if (UNavigationSystemV1* NavSys = UNavigationSystemV1::GetCurrent(GetWorld()))
{
    FPathFindingQuery Query;
    Query.StartLocation = GetActorLocation();
    Query.EndLocation = RadialSearchCentre;
    if (NavSys->TestPathSync(Query, EPathFindingMode::Hierarchical))
    {
        if (GEngine) GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Emerald, FString::Printf(TEXT("Centre valid")));
    }
    else
    {
        if (GEngine) GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Emerald, FString::Printf(TEXT("Centre Invalid")));
        RadialSearchCentre = GetActorLocation();
    }

}

I tried this but it still prints centre valid even if theres no path

fluid ingot
steel moat
#

I dont want my AI to go to the location that has been blocked off and instead stay still, so far ive tried Test Path and FindPathSync but they all work the same as shown in the video. Is there anything else i need to setup like navmesh or that modified volume i used to block the path for AI?

fluid ingot
#

How do I avoid the AI getting stuck with each other?
Like, I would like it to detect "hey, there is another actor in front of me, I should get another path".
Is there a way to mark a moveable actor as an obstacle in realtime?

fluid ingot
#

I figured it out, I implemented Reciprocal Velocity Obstacles Avoidance, the results are kind of iffy, but it will do for now.

dense owl
fluid ingot
granite robin
#

I just want to simply FREEZE my AI -

#

this doesn't have the effect I want

sullen escarp
sullen plume
#

I am using unreal engine's MoveTo in my behavior tree, however, I want it so that even if the player is unreachable the ai will try to get as close as possible to the player. Right now, when the player goes to an unreachable place (still in nav mesh), the AI just stops.

harsh storm
#

Going back to this - I integrated GAS into my project yesterday. Took all of like, one day to integrate 😅. I spent last week learning it though. Was easy to integrate because my game's architecture was already like what GAS wanted. The main difference between my stuff and GAS is that I pretty much just had Abilities and Effects combined into one object.

sullen escarp
# sullen plume I am using unreal engine's MoveTo in my behavior tree, however, I want it so tha...

I'd run an Environment Query with scoring test on Distance to weigh points closest to the Player and filter test out any points the AI can't pathfind to.
https://dev.epicgames.com/documentation/en-us/unreal-engine/eqs-node-reference-tests-in-unreal-engine

Epic Developer Community

Describes how to use Tests within EQS to generate the "best" option.

uneven cloud
tidal mantle
#

it always returns true idk why, i even tried the blueprint node AI move to, its also returning success even when AI is blocked off

vestal olive
#

When using a UNavLinkComponent, are there any event callbacks for when a unit enters the link from either side? I know there's some sort of delegate called from an ANavLinkProxy. (when using smart links at least..)

I'm to the point of just spawning Link Proxies in begin play but this feels like functionality that should be inherent to the component version?

uneven cloud
uneven cloud
vestal olive
#

Ahh I see, smart links are designed exactly for performing extra logic anyway, can I not set up a smart link via a component though?

#

Seems to only be a feature on the actor proxy variant

uneven cloud
#

You should however be able to make a nav link proxy to be your base class.

sullen plume
#

is there a simple way to check if some point is reachable by my AI? In C++ preferabbly

narrow mason
#

Is there a way I can tune the accuracy of pathfinding and pathfollowing?

I'm using the standard FindPathSync but with a custom pathfollowing algorithm, but the agents don't seem to follow the best path. They get to the desired location but take a longer route than I'd expect

sullen escarp
sullen plume
# sullen escarp ```cpp bool UNavigationSystemV1::TestPathSync(FPathFindingQuery Query, EPathFind...

for the numvisitednodes parameter what do i set that as? do i hardcode it or sdo something like this:

        //while (!bSuccess) {
        //    val *= 100;
        //    bSuccess = TestPathSync(someparams..., val);
        //    // makingg sure no infinite loop
        //    if (val >= 999999.0f) {
        //        UE_LOG(LogTemp, Display, TEXT("inf loop we out FIXASAP"));
        //    }
        //}

With hardcoding my game works fine, but I assume for larger distances to travel the AI will just stop moving? (correct me if i'm wrong. )
Using the loop, however, just makes my game freezes, I'm guessing TestPathSync takes hella cpu resources so looping that causes problems. Any suggestions on how to proceed?

open swift
#

Hey guys, I saw an interesting post somewhere about getting the tests for a specific EQS query in c++ and running them manually against an item from a previous query to determine if the query needs to run again or if the previous result is still valid, but I'm having trouble figuring out what's actually going on here.

I've got this far, but no idea how to actually check whether the test passed or whether passing in an FVector (CurrentMoveLocation) is going to work for the AddItemData call. Anyone done this before? I can't find the post now that was doing this.

misty wharf
#

It works fine but I think it still has some bugs in particular with the property binding system, but I think there are reasonably easy workarounds

#

The biggest "problem" with it is that some of its behaviors are not entirely self explanatory so it may take a bit of learning and digging to figure out why it does what it does

uneven cloud
uneven cloud
open swift
#

because then i would have to add that generator to every different query, seemed cleaner to do a catch-all that just checks all the tests for whatever query you want to use

narrow mason
# uneven cloud Given that you wrote your own pathing algorithm, only you can fix it. Are you n...

Let me clarify. I'm using custom pathfollowing, not the usual AI/PathFollowingComponent combo.

I'm taking the raw path generated from FindPathSync and moving the agent along it from point to point.

The problem is that sometimes the agent takes a long route around some obstacles instead of going through a gap that I made wide enough for it.

I don't know if there's any step I'm missing to find shortest path after generating the path to target. Or if its the path generated that isn't just optimal

uneven cloud
open swift
#

well im only checking tests that filter (or filter and score), im not sure what scenario i would want to skip a test that does filtering

uneven cloud
#

We use the EQS to find targets. The tests that are run first to check if a target is valid is different than the ones that are for picking a target. Because otherwise, they don't change targets in appropriate situations. For our location quarries, we don't test the path again, because the nav mesh isn't dynamic.

open swift
#

ah

#

you make a good point about path testing

#

i was only using this for specifically locations

uneven cloud
#

Doing it manually just gives you so much more control

open swift
#

i guess so

sullen plume
#
FVector UBTTask_MyMoveTo::getClosestNavigablePoint(FVector targetLocation)
{
    UNavigationSystemV1* navSystem = UNavigationSystemV1::GetCurrent(GetWorld());
    if (!navSystem) return FVector::ZeroVector;

    FNavLocation navLoc;
    navSystem->ProjectPointToNavigation(targetLocation, navLoc);
    return navLoc.Location;
}

I want to the ai to get as close as possible to the player bcuz rn if the player enters a closed like box or something in the level, the AI just freezes instead of reaching the outer edges of the box and stopping. Unfortunately, this function doesn't work

stray widget
#

hey devs!! I am having some issues with the AI... so they are supposed to do the following things:

start at a position,
follow the spline
on reaching the last point, find a random point near the target
and Attack

in order to find a random point near the target, I am making use of EQS... but the problem is that they are trying to take the same spot despite trying to maintain a certain distance from each other... currently I am running the EQS only once... do I need to run it in loop until they find a suitable spot??

uneven cloud
sullen plume
#

I'm not well-versed in EQS and from the videos i've seen its Blueprint-Based

#

thus trying to integrate between blueprint and c++ will be another hurdle id rataher not deal with

uneven cloud
#

It's a data asset, not BP

sullen plume
#

any good tuts on it?

uneven cloud
#

Yes. The intro to AI course in the learning library has a section on it.

sullen plume
uneven cloud
uneven cloud
stray widget
uneven cloud
stray widget
uneven cloud
stray widget
#

as of yet I have only done tests from the querier... but didnt know we could do for others as well

uneven cloud
stray widget
#

yes

uneven cloud
#

That's how you get it

#

Use a context to get them

stray widget
#

so is it like asking... is any of these enemies are closest to that chosen destination?

#

if there is any.. than choose a different spot

uneven cloud
#

I usually do it as "is this item within x distance of an ally" if yes, filter out

sullen plume
uneven cloud
dense owl
hoary vortex
#

Hello, how do I make a floating AI that follows the exact path the player was in a second a go?

#

like an actual precise copy of the locations

obtuse dome
#

Has anyone run into issues with AI Move To getting verticality wrong before? I have an NPC set to walk to the pink sphere on the first floor using AI Move To (its acceptance radius is 10, same as the debug sphere's radius), but a fraction of the time the NPC will walk to that location on the 2nd floor instead of the 1st floor and say movement is complete (success)

dense owl
#

Is the pink debug sphere your projected goal location?

obtuse dome
#

Yes, it is the Destination param for AI MoveTo

dire jungle
#

Can anyone point me in the right direction? I have some movable actor obstacles in a level, and i would like them to obstruct the nav mesh as they are moved, so that the AIs dont try to walk across them. What's the right way to go about this? the first thing that comes to mind is to enable runtime generation on the navmesh, but maybe theres a cheaper way to do it?

tidal mantle
#

yea

uneven cloud
obtuse dome
#

Here's a video. Normally the NPC runs straight through the door to go to the first floor (pink sphere target), but occasionally it stops right out front of the 2nd floor door (immediately above the pink sphere) rather than going to the first floor. It's rather concerning that the behavior isn't consistent

uneven cloud
dire jungle
#

theyre basically these big cubes that can get pushed around the nav mesh, and the ai shouldnt try to go through them. by modifiers only, you mean project settings -> navmesh->dynamic modifiers only + dynamic obstacle checked on the actor

tidal mantle
stray widget
#

am not sure if I am doing this right:

steel moat
#

i searched about it and it seems like i need to set it false

uneven cloud
uneven cloud
steel moat
#
FPathFindingQuery Query;
Query.StartLocation = Pawn->GetActorLocation();
Query.EndLocation = Origin;
Query.bAllowPartialPaths = false;

bool bIsNavigable = NavSys->TestPathSync(Query, EPathFindingMode::Hierarchical); 

This is how i am doing

sullen plume
# dense owl Using only cpp is just as bad as using only bp

I do also use blueprint but only for animations / basic logic, its just I've seen videos of the crazy difference in performance between blueprint and c++ and for something like AI whose pathfinding is resource intensive, I think C++ would be the wiser choice

sullen plume
steel moat
#

EQS

#

u mean?

sullen plume
#

YEAH

#

*yeah

steel moat
# sullen plume YEAH

can u pls ping me if u able to fix that issue? im facing similar issue its just i dont want my AI to move if the path doesnt exist and call a different function when that happens

#

but my AI keeps going there trying to reach that point

sullen plume
#

my ai just gives up

#

and stops moving

#

are you using like directlymoveto?

#

hvnt tested that

#

movedirectlyto

steel moat
steel moat
sullen plume
steel moat
#

i fixed it, had to change some more variables in the FPathFindingQuery Struct and then do TestPathSync

sullen plume
#

hol up

#

r u using the normal moveto

steel moat
#

yes

sullen plume
#

or did u create a bttask that derives from moveto

#

oh

steel moat
sullen plume
#

but found it easier just to call super::executeTask and see if that returned failed

steel moat
#

oh

sullen plume
#

if it did, I do my own thing

#

if it didn't ill just end it right there

steel moat
#

im testing path in another task

#

not in the move to

#

                    FPathFindingQuery Query; 
                    Query.StartLocation = Pawn->GetActorLocation();
                    Query.EndLocation = Origin;  
                    Query.bAllowPartialPaths = false;
                    Query.SetAllowPartialPaths(false);
                    Query.NavAgentProperties.AgentHeight = 80; 
                    Query.NavAgentProperties.AgentRadius = 80; 
                    Query.Owner = AIC; 
                    const ANavigationData* NavData = AIC ? NavSys->GetNavDataForProps(AIC->GetNavAgentPropertiesRef(), AIC->GetNavAgentLocation()) : NULL;
                    Query.NavData = NavData; 


                    DrawDebugSphere(GetWorld(), Query.StartLocation, 100, 12, FColor::Green, false, 10, 0, 3);
                    DrawDebugSphere(GetWorld(), Query.EndLocation, 100, 12, FColor::Red, false, 10, 0, 3);

                    bool bIsNavigable = NavSys->TestPathSync(Query, EPathFindingMode::Regular);
                    if (bIsNavigable)
                    {
                        if (GEngine) GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Emerald, FString::Printf(TEXT("Centre valid")));
                    }
                    else
                    {
                        if (GEngine) GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Emerald, FString::Printf(TEXT("Centre Invalid")));
                        Pawn->RadialSearchCentre = Pawn->GetActorLocation();
                        Origin = Pawn->GetActorLocation();
                    }
                    OwnerComp.GetBlackboardComponent()->SetValueAsVector(GetSelectedBlackboardKey(), Origin);
                    Pawn->bReachedCentre = true;
sullen plume
#

my goal is if fail, make the ai move to the closest navigable location in respect to target

#

ic

steel moat
#

earlied the test would be come true even when there was no path

sullen plume
#

yeah

#

exactly like that

#

my ai will follow me, except if I jump onto the blue box (img), because the blue box doesn't have a like nav mesh. So in that scenario I want to go to the closest green area

uneven cloud
uneven cloud
steel moat
#

if i dont set it it will get the default value

uneven cloud
#

Instead you should get the nav agent properties first and set the Query.NavAgentProperties to that.

#

Also, in UE never use NULL. Use nullptr

steel moat
coral mesa
#

im trying to do custom boids

#

anyone got any experience with it?

stray widget
real agate
#

When I use the Simple Move To BP node I get a missing component warning, anyone here know what would cause that?

misty wharf
#

What component does it say is missing?

real agate
misty wharf
#

Show your graph with the simple move to

real agate
misty wharf
#

This is in a BT task right? What kind of pawn does the controller have? Does the pawn have a movement component?

real agate
misty wharf
#

Does that inherit from a movement component of some type or is it just a plain actor component?

real agate
#

Which I assume is a movement component, another team member sat this up so I cant be 100% sure.

misty wharf
#

Check what it inherits from then - For the MoveTo's to work, there needs to be something that is a movement component, this is typically something like Character Movement Component, Floating Pawn Movement Component, or other such builtin component type

#

Also can you paste the exact warning you got

real agate
real agate
#
/// Movement component intended for animate actors such as humans and animals. Typically organic movement is characterized by quick acceleration to a maximum
/// speed (where most of the movement happens) and quick deceleration to a stop again. Physical forces like air resistance are being ignored with this type of
/// movement due to their negligible influence. This implementation is not limited to bipeds or any particular collision shape.
UCLASS(ClassGroup = "Movement", BlueprintType, Blueprintable, meta = (BlueprintSpawnableComponent))
class GMCCORE_API UGMC_OrganicMovementCmp : public UGMC_MovementUtilityCmp, public IRVOAvoidanceInterface
```It does seem to inherit from a movement component.
misty wharf
#

Hmm based on the error message the problem is that your AI Controller is missing a path following component

#

I was wondering what causes it and looking at the source code, it outputs that exact error if it can't find a path following component from the controller

real agate
#

Weird since it has one

misty wharf
#

Give this a try: In your AI controller's BeginPlay, get the path following component and check if it's valid

#

This kind of smells like BP corruption

real agate
misty wharf
#

Nah, that just means the path following comp isn't something you'd normally be able to read in a BP graph

#

it's accessible via C++ just fine though

real agate
#

Hmmm... Well I cant check if is valid because of that.

misty wharf
#

Try using get component by class and set the class to path following component

real agate
#

Ok

misty wharf
#

That's peculiar 🤔

#

Can you show the graph you used to check the validity?

#

It's probably fine but just to double check because I'm not quite sure why it would be complaining about this

real agate
#

Yeah sure

misty wharf
#

Yeah that's fine all right..

#

In your BT task, maybe do the same check there

#

also I think there should be a node called get path following component you can use

steel moat
#

I m facing this weird bug in my AI sight Perception, it doesnt happen every time but sometimes when the Target detected by AI goes out of its lose sight radius, none of these functions gets called. Usually they do but only sometimes they dont give the call when target goes out of sight. I was unable to figure out the what causing that bug

real agate
misty wharf
#

Well that makes even less sense then lol

#

Do any of the other movetos work?

real agate
misty wharf
#

Oh, I wonder why does the get component by class return a valid result then 🤔

#

But in this case this does sound like blueprint corruption. I would try recreating the controller from scratch and see if that helps

real agate
#

Alright will do! Thanks!

misty wharf
steel moat
#

i set the max age as 0.1

#

i only know that setting related to this

misty wharf
#

Maybe try setting it to 0 which is the default and see if it affects it at all

steel moat
#

the tooltip says

misty wharf
#

Yes that's what it says but that is the default

#

I've never had this problem and I've never changed it from the default, so it's worth a try :)

steel moat
#

lemme try

misty wharf
#

👍

steel moat
misty wharf
#

have you tried adding prints into the perception updated to check that it isn't running or how did you determine it doesn't work?

steel moat
#

This is the bug, as you can see when player goes inside the sight of AI, the head looks in that direction and then when it goes outside its still looking at the poistion where AI last seen the target and also theres a boolean variable in BlackBoard which i am changing when player is detected and player is lost "Player Detected" when AI goes out it should be false and true when its in sight, but here its staying true even when Target is outside and when i go inside and come out again it becomes false. Im changing the value on TargetPerceptionUpdated function and also on Perception updated function

steel moat
fluid ingot
solid wedge
#

well it's time to convert 3 year old AI blueprint into a State Machine

fluid ingot
solid wedge
#

I'll basically paste these different commented groups into different Task Nodes

#

with my conditionals as decorators on branches

plucky hearth
#

Will it work the new “500 Animations” Motion Matching sample with ai?

tidal mantle
misty wharf
fluid ingot
tidal mantle
#

no i mean delete the recast thing in the outliner and then go to the build menu and click on build paths

#

im not sure if it it works

#

did u try it before?

fluid ingot
#

Oh, no, I haven't, I will see if it works

fluid ingot
#

Oh, I made the slope smaller (by increasing the ramp size in one axis) and it generated the mesh correctly.

tidal mantle
#

oh

#

maybe it was something to do with nav agent properties

quaint wedge
#

Hey guys, not an ai specific issue but I'd like to know if anyone ever encountered issues with Level Sequences and Level Streaming.
Let's say I have LevelSequenceActors (that does some cosmetic transform changes on objects) in some streamed levels, and sometimes after getting streamed/unstreamed/streamed, the sequence is frozen, nothing moves anymore, no matter if I call Play manually or set is as Autoplay.

hollow tapir
#

I could use some help, In UE4, the AI Perception fully STOPS sensing players its already sensed, if it detects a new player.
Ex: Player 1 gets sensed, AI moves to Player 1. If it spots player 2 it will NEVER be updated/sense Player 1 again, at all. It wont even trigger the Ai Perception

uneven cloud
hollow tapir
uneven cloud
hollow tapir
uneven cloud
hollow tapir
#

But thats not necessarily the issue, the going to the player works fine. But I dont understand why the perception itself stops working

uneven cloud
harsh storm
#

Can't say I've ever ran into this issue either to be honest.

hollow tapir
#

I didnt know that, thank you

harsh storm
#

I use On Target Perception Updated and run some logic based off that for my stuff currently.

#

Luthage's advice is still the better approach overall - but I'd still be interested in seeing your code

hollow tapir
harsh storm
#

My game is multiplayer as well

hollow tapir
#

Interesting, could I maybe see how yours is set up? The On Target Perception, that is

harsh storm
#

No. Because I don't have the project opened. Show yours

hollow tapir
uneven cloud
#

You don't get the updated event every time a target is sensed. It's only for new sensed targets. And losing sight of one doesn't trigger it. Just better to get all the sensed targets on an interval when you have multiple targets.

#

No.

uneven cloud
#

Well the silver character is behind it. What do you mean the vision half angle isn't doing anything?

#

Can you show your sight sense settings

#

With that setting, it's not going to see anything behind it.

harsh storm
# hollow tapir

I may have a setting set where it forgets actors. I remember messing around with that.

hollow tapir
uneven cloud
#

Because it limits itself to 40 degrees on either side. So anything more it won't see.

harsh storm
uneven cloud
#

I missed that you added that. Not sure what to tell you, I have never used that setting.

olive prism
#

Has this ever happened to anyone?

After about 30 minutes, many of my artificial intelligences want to go to the same point, this causes them to get stuck and not try to look for a new point.

How can i fix this?

sullen plume
#

Any benefit to setting up UAIPerceptionComponent in AIController or AICharacter class?
Here is how ti would look in the AICharacter Class:

    perception = CreateDefaultSubobject<UAIPerceptionComponent>(TEXT("PerceptionComp"));
    UAISenseConfig_Sight* config = CreateDefaultSubobject<UAISenseConfig_Sight>(TEXT("SightSenseConfig"));
    
    perception->ConfigureSense(*config);
    perception->OnTargetPerceptionUpdated.AddDynamic(this, &AEnemyAICharacter::onSeeActor);

And this is how it would look in the AIController class:

    if (UAISenseConfig_Sight* sightConfig = CreateDefaultSubobject<UAISenseConfig_Sight>(TEXT("Sight Config"))) {
        SetPerceptionComponent(*CreateDefaultSubobject<UAIPerceptionComponent>(TEXT("Perception Component")));
        
        auto perceptionComp = GetPerceptionComponent();
        GetPerceptionComponent()->SetDominantSense(*sightConfig->GetSenseImplementation());
        GetPerceptionComponent()->OnTargetPerceptionUpdated.AddDynamic(this, &AEnemyAIController::onActorDeteected);
    }
tidal mantle
#

backward offset and near clipping just increases the vision of AI by extending the vision cone slightly behind ur AI

#

the peripheral angle to 90

tidal mantle
tidal mantle
#

cuz AI is the one controlling pawn, so the sight and all should be in controller only

#

and that way u wont need to add perception component in every AI u make

steel moat
#

how can i activate my AI debugger tool right from the start?

#

throught code, is that possible?

plucky hearth
misty wharf
uncut rune
#

Is it possible to get EQS Context be set as value from key from blackboard? RIght now I'm casting to get that info from AIC, but I would prefer to take it from blackboard.

misty wharf
uncut rune
uneven cloud
uncut rune
wide robin
#

Does anyone know if this has changed?
Otherwise I'm doing something wrong. I have my main EnemyTree that is like this. The BB of the ClosestHostile tree inherits from the AIBase BB but still results as incompatible

misty wharf
#

Afaik it has not changed. I think the problem you're seeing is that you're using inheritance, when it specifically is unsupported for subtrees

wide robin
#

so i need to have the same BB for each subtree i want to use?

misty wharf
#

The BBs used in subtrees must be 1 to 1 compatible with the parent BB, that is, they can't contain any keys that don't exist in the parent and vice versa

#

Yes

wide robin
#

okay, that's a bit unconvenient

#

that means my BB will end up having a lot of keys

#

if i want to make a lot of subtrees

misty wharf
#

Keep in mind that you don't need to use the blackboard for everything imaginable

#

Your decorators or tasks can also access values directly in the pawn or controller if it's more convenient that way

wide robin
#

yes, that's a good point, i'll keep that in mind. Probably will try to use the BB as a main source of information and see where this leads

#

thanks for the answer!

sullen plume
#

This problem is ai/cpp so if u dunno cpp just ignore:
At 2:10 in this video the narrator says we cannot define enemies neutrals or friendlies via blueprint. How would I do so in cpp? https://dev.epicgames.com/community/learning/courses/67R/unreal-engine-introduction-to-ai-with-blueprints/D0e/setting-up-ai-perception

Epic Developer Community

This course introduces Unreal Engine's AI tools, exploring how AI agents work within a video game environment and the systems used to achieve realistic ...

wooden trellis
#

question - I made a waypoint system for my enemies so they can patrol areas, but for some reason they keep stopping at the waypoint for a few seconds before moving to the next one - when I want them to just immediately move to the next point. Any idea why this is happening? Not sure if there is some default affecting this or not

sullen plume
# misty wharf See here <https://zomgmoz.tv/unreal/AI-Perception/IGenericTeamAgentInterface>

I sort of got the logic behind that, but when I went to override / implement the GetTeamAttitudeTowards(const AActor& other) i am lost here is my bsed implementation bcuz the guides I found are creating like IDs and whatnot and like cuustom enums in the gamemode class:

ETeamAttitude::Type AEnemyAIController::GetTeamAttitudeTowards(const AActor& other) const
{
    if (other.ActorHasTag("Player")) {
        return ETeamAttitude::Hostile;
    }
    else if (other.ActorHasTag("AI")) {
        return ETeamAttitude::Friendly;
    }
    else {
        return ETeamAttitude::Neutral;
    }
}

sullen plume
#

I have setup two callback functions, the first is called properly when the ai sees my player but the second, the forgotten, aint ever getting called. What am I missing?

        perception->OnTargetPerceptionUpdated.AddDynamic(this, &AEnemyAIController::onActorDetected);
        perception->OnTargetPerceptionForgotten.AddDynamic(this, &AEnemyAIController::onActorForgotten);

#

why is the ai never forgetting my player?

sullen plume
#

Here's my BP_AIController:

uneven cloud
uneven cloud
uneven cloud
lyric flint
#

I have navmesh / volumes in a bunch of my levels. They are set to Dynamic Modifiers Only. When I PIE, they work fine and the AI move around. But when I run through the start screen which calls OpenLevel(...), the navmesh isn't loaded in. Is there a way to have "static" (read: dynamic modifiers only) navmesh while still loading different levels?

#

Actually, caveat to the above... some levels work fine. So I must be messing something up in my settings for certain navmeshes...?

crisp oar
#

#gameplay-ai message

I started following along with this to try and learn behavior trees because lord knows it's hard to get a good video tutorial, but it seems like this is very outdated.

#

will that cause any serious issues if I follow along with it?

sullen plume
uneven cloud
steel moat
#

I created the enum in AI Controller class

uneven cloud
uneven cloud
steel moat
uneven cloud
steel moat
uneven cloud
steel moat
#

i will try this

steel moat
#

nvm this function was added in 5.3, im using 5.0

dense owl
#

I feel like that’s prly the worst minor version to use

harsh storm
#

Meh - people say that every version

haughty coral
crisp oar
#

speaking of state trees, I know different tools work better for different jobs but what are people's opinions on state trees vs. behavior trees? I started learning behavior trees and the blackboard can get a bit clunky and I've heard state trees are better in that regard but I don't know what the tradeoffs are.

misty wharf
#

It seems like a decent system to me but not sure if it's inherently any better

#

There's some things with it like I'm not entirely sure how you're intended to do things like perform a latent action which results in some data and then use that data to choose what to do next or such

#

it's certainly possible to do it but some of it just feels a bit clunky so maybe I'm missing something

harsh storm
#

I haven't been sold on it yet personally

#

I still stick to BT or custom state machine

crisp oar
# harsh storm I still stick to BT or custom state machine

I'm still learning BT, quick question, what would be a simple approach to having an AI search for you after it loses sight of you for a short bit (like go to 3 different locations near where it last saw you or something?) I followed along with this to get started: https://dev.epicgames.com/community/learning/courses/67R/unreal-engine-introduction-to-ai-with-blueprints/D0e/setting-up-ai-perception

Epic Developer Community

This course introduces Unreal Engine's AI tools, exploring how AI agents work within a video game environment and the systems used to achieve realistic ...

harsh storm
#

So pick 3 random navigable points in X radius. Then just refine it from there

crisp oar
#

I mean behavior tree

harsh storm
#

It would be a behavior in of itself

#

So it would be its own sequence nodes

crisp oar
#

so like a separate task?

harsh storm
#

The most basic would be, far left side of the sequence (not the entire tree!) would be the Run EQS Query, then store the result in a BB key. Then use the Move To task to move to that position.

#

So like 2 nodes to get the most basic implementation working

crisp oar
#

so is it a completely new behavior tree?

harsh storm
#

But from there, you just iterate and add additional rules and all that

harsh storm
#

Then you can plug it in as a subtree in other BTs

#

For simplicity, I wouldn't bother though

crisp oar
#

I didn't know you could do more than one behavior tree, out of curiosity if you run a behavior tree inside a behavior tree will it temporarily stop the parent behavior tree?

#

and yeah just asking this part for curiosity

harsh storm
#

Doesn't stop it

#

It just becomes additional nodes for the parent tree to run

crisp oar
# harsh storm It just becomes additional nodes for the parent tree to run

So right now I have it set up where on the left it chases player and on the right it patrols randomly, but the left chases part has a decorator that won't run it unless a condition of whether it sees the player is true, and when it runs it aborts the random patrol and what not. I'm not quite sure how to add something inbetween that process (conceptually inbetween) and still ahve the previous system work.

signal island
#

Where do i put this code to Team perception to work UAIPerceptionSystem::OnEvent<FAITeamStimulusEvent, FAITeamStimulusEvent::FSenseClass>(GetWorld(), FAITeamStimulusEvent(GetPawn(), InEnemy, InEnemy->GetActorLocation(), TeamEventRange));?

harsh storm
#

BT's get evaluated left -> right

#

It is really a priority selector

crisp oar
#

alright

harsh storm
#

So the top most priority is chasing the player.

crisp oar
#

I think I get it, just need to set something up to track the player location while player is seen in a variable I suppose

harsh storm
#

You just need the last known location

crisp oar
#

oh you can just call on last known location?

#

is that EQS?

harsh storm
#

Yeah, it's just a vector

#

When the player leaves sight, store the location where they left sight at

#

Then feed that into the EQS

#

That's the position you want to search around

crisp oar
#

alright, I'll watch the tutorial on EQS then

harsh storm
#

Once you have the basics working, it is easier to iterate and expand upon

distant citrus
#

Hey all!

I'm doing some tile/grid-based 8 way pathfinding on a custom Recast Nav Mesh in C++

Pathfinding works fine enough for 4-way, but when I allow 8-way directional movement, it's almost like the A* pathfinding prefers the diagonal neighbors, making the path result a little... unwieldy lol

I'm finding the path using the following:
EGraphAStarResult AStarResult = PathFinder.FindPath(StartIndex, EndIndex, FGridPathFilter(*GraphAStarNavMesh), PathIndices);

Any ideas how I might be able to solve this or how I can have neighboiurs that are not diagonal preferred?

Thanks in advance!

simple verge
#

Is there a bug or trick to get AI Sight Perception working in a world partition level?

vivid fern
#

i would make diagonals cost more than 1

#

since in real physical space diagonals are further than cardinals anyway

distant citrus
wooden trellis
distant citrus
distant citrus
# vivid fern ime from writing a* algorithms by hand many times, whats probably happening is t...

I'm wondering if this is the right area...

struct FGridNavMeshPath : public FNavMeshPath
{
    FORCEINLINE    virtual double GetCostFromIndex(int32 PathPointIndex) const override
    {
        return CurrentPathCost;
    }

    FORCEINLINE    virtual double GetLengthFromPosition(FVector SegmentStart, uint32 NextPathPointIndex) const override
    {
        // We exclude the starting point so -1
        return PathPoints.Num() - 1;
    }

    double CurrentPathCost{ 0 };
};
vivid fern
#

AH i have never used it haha 😄 as i said from my own experience writing this sort of stuff from scratch, its what i've done in tactics games i've worked on (lamplighters league, battletech)

distant citrus
vivid fern
#

i'd start with maybe the path cost stuff, if you can find the place where the cost from one node to another is computed, you can add the additional diagonal cost there and it should straighten out your paths

#

i dont how recast handles corners over like open space but you also probably want to disallow diagonals in those cases too

#

in path solvers i've written i often do things like check for those literal corner cases over empty tiles so i can invalidate the diagonals haha

uneven cloud
uneven cloud
wooden trellis
# uneven cloud You need to figure out what is happening by debugging instead of being OK with "...

I think I fixed it? the issue was I was targeting the waypoint actor, but when I target the waypoint's location... it's perfectly fine and there is no delay... I don't know why there is a delay for when you target an actor but whatever 🤷 it seems to be baked into Unreal as the same thing happens in a completely new project

also, the initial reason for me posting here was if someone else knew why this was happening - now I know I can bypass it by targeting the location, but I still have no idea why there is a 10 second delay when you target an actor and I have no idea how to adjust that time for whenever I need to target an actor (granted, I can likely just use some other pathfinding method, but it still would be nice to know if and how I can change that delay - but whatever 🤷 ) and yeah, i found several ways around the delay issue, but it feels like they are all "overly complicated" when there likely is just a single variable somewhere hidden in some Unreal submenu or code that would likely adjust it instead - why it's not included in the event node is beyond me

uneven cloud
strange bay
#

So how could you have a small enough LLM to run in game, and where could you get one that isn't trained on copyrighted works etc.?

wooden trellis
# uneven cloud I've never seen a delay like that, so it's not inherent to UE.

when having an AI chase a moving actor, like the player or another AI - it's pretty unnoticeable. I only found all this out when having my AI patrol waypoints - granted the tutorial I followed had them target the destination (they didn't say why) and I figured it'd be quicker to target the actor instead (plus possible future-proofing in case I want the WPs to move or something). The delay is on the Success, when the AI enters the Acceptance Radius, the delay starts ticking - so I assume it would allow for a target actor to escape the radius, but if the target actor is stationary, you will have an awkward moment of the AI just standing perfectly still for a few seconds before it realizes it succeeded. This is really the only code running (aside from finding the WPs but again, that's just a for-loop)

this is also the same blueprint used in my completely new scene, with nothing else being touched. So if there is something else at play, I genuinely have no idea what it could possibly be or how I could find it.

*also, possibly clarifying a potential misunderstanding - the delay is with the success node, the BP continues perfectly fine when linking something to the Exec node, it's just that I only need to know when the AI reached it's destination

uneven cloud
wooden trellis
simple verge
vivid fern
#

maybe the perception system isnt being activated at the proper time (on posses?)

uneven cloud
vivid fern
#

fwiw i was wandering around the other day and saw that move to supports locations that move.. you can have it repath and move toward a location as it changes

uneven cloud
#

The BT move to task does that

vivid fern
#

yeah

uneven cloud
#

The tracking is different, because that is binding to changes to the blackboard.

vivid fern
#

nodnod

uneven cloud
simple verge
uneven cloud
#

Most of the sight perception issues is due to collision. The AI can't see something when it's visibility is blocked.

harsh storm
#

Looks neat. But not enough info in workflow and all that.

uneven cloud
#

They don't look very smart

#

I always find it a bit dubious when people start talking about smart AI when it's about architecture. Done well, a FSM can make smart AI

#

I'm well aware of the differences between the architectures.

simple verge
vivid fern
#

yeah... "smart" ai in games is mostly about the design and player feel, the system that backs it is only in service to those things and the performance constraints

#

basically ime game ai is very subjective and its mostly a "soft" target as to how it feels to plyaers. Game ai is more or less about fulfilling a very different need from "being actually intelligent"

#

the goal is to be fun, rewarding, and make the player feel like they are awesome while still presenting a challange or puzzle

#

like look at the enemies in mario games, not very complex, except maybe boss behaviors, no one would argue that these games arent great and fun for many people, and i rarely hear players complain about "oh the ai is bad".. maybe simple yes, but for those games its exactly what they need

#

ime too players can react badly to actually tactically clever AI, they'll say they're cheating or the level spawned them in behind the player, etc etc etc.. as ai programmers in games, you fill a very weird kind of engineering role that works less on logic and reason and more on feel and subjectivity x_x

silent fox
#

Figured it out, had to switch target base class to actor from object in blackboard. Kinda stupid I cant make AI look at an object with it

uncut rune
#

Can something like this be done in Tasks or should I rather create function in AI Controller for that?

#

You need to expose it and set public inside the task

dense owl
uncut rune
#

I let player set locations to which the unit will go. Something like patrolling.

dense owl
#

If it’s more than patrolling between A and B, BT might not necessarily be the way to go, since you’re manually directing the AI rather than letting it follow a behaviour tree and make decisions based on what happens

uncut rune
#

The key here is that AI is already moving between 2 points from 1 to 2 and then back. And on top of that I want to let player add additional Path Points in between. This node going back looks funny, I’m not sure if that is proper way to hack “do while” , but it works 😄

dense owl
#

There is a While node in bp

#

But not super great

uncut rune
#

Was just wondering if usually things like that are as functions inside BP of pawn or just as tasks.

dense owl
#

IMO, if it’s predetermined behaviour, task is fine. But if you’re giving direct control to the user such as manually placing a number of path points, that may need to stay outside of it, even if it ultimately changes a BB key, from which the AI can path

#

But this is just what I think, this supposition could be entirely false, as Luthage likes to remind me 😅

uneven cloud
potent iris
# strange bay So how could you have a small enough LLM to run in game, and where could you get...

Hey, would recommend the #generative-ai channel as there are people who are interested in LLMs and generative AI
Generally you won't find an LLM not trained on possibly copyrighted work because LLMs are pretrained on massive datasets which are impossible to properly filter
Unless you train your own (which takes an enormous amount of compute)

I think the best bet is using something like phi3 3B with 8 bit quantization (3GB of VRAM), should be able to run on a potato
Or llama3 8B Q4 (4GB of vram) for something beefier which still runs on a potato

Using GGUF converted models and embedding a GGML based inference backend like llama.cpp is I think your best bet

uncut rune
# uneven cloud If you put this functionality in the AI controller, then you need to add a bunch...

I basically Add Path Point and Remove Path Points (by Player Controller), from the Actor Component that is on the Unit. The task runs only when the Unit is generally set to ''Transport''. When there are no points, but unit is set to transport the task will just get finished without ''following path'', if there is point it will follow it first between already going from first point to second (like main objectives from building to building). I guess keeping in on task is fine?

fiery field
#

Hey guys. With the "senses", (sight hearing etc.), is it possible to get all the actors in sight at any given moment (if so, how ?), or do I have to build list of actors myself ?
Also, I noticed that when starting the game, the actors in sight at the start of the game don't trigger the perception

misty wharf
#

also I'm fairly sure that things immediately in sight should trigger perception 🤔

crisp oar
#

I'm currently trying to set it so that if the AI loses sight of the player it searches for them from by moving to three separate random locations in a reachable radius around the player. Two questions:

  1. Does this structure work for that (as in will it stop chasing and start the selector that will be searching for the player when the target actor is unset and then abort that and resume chasing if it sees them?)

  2. I can't quite figure out how to have EQS return more than one result, and have the result be a random selection from the list of possible locations. Suggestions?

#

but now that I look at it the parent one aborts when the target actor is unset so I probably need to make it not in the chase branch, however I also don't want it doing the searching for player constantly while it doesn't see them, so I'd need to find out how to make it only do the search both when the actor isn't set and only after it loses sight of the player and only once after that happens and allowing it again when it chases again.

#

I found the single random item from best% thing for run mode on the EQS but since it only returns one thing I imagine I'd need it to do a conditional loop or something but not sure how to make it only loop 3 times. My current thought process is I'd need it to loop until a blackboard boolean or other variable is unset, which maybe I could do a task that makes a value that starts at 3 go down by 1 each time it's run in the loop but also have the value reset when the loop finsihes...

#

if I run a task that has a variable that has a default value that changes during the task, will that variable's starting value reset to the default value when the task runs again?

#

sorry one more thing, but for some reason this new task I created is looking for target actor location and self actor even though the task doesn't even have those two blackboard keys in it. Really confused.

uneven cloud
uneven cloud
uneven cloud
uneven cloud
harsh storm
#

Hey @uneven cloud - would you mind if I DM you a question? Not specifically about UE per se.

crisp oar
celest python
vivid fern
# crisp oar I wanted the AI to search 3 locations before giving up, I'm still struggling to ...

the general way most games seem to do this is:

  • Move to last seen, play some look anim
  • Use an EQS or something to find points near by that are "suspicious" aka maybe around a corner out of sight etc, Move to that location, play the "look anim"
  • Repeat 2-3 (or however many times) or alternately wait for a time out, say when the perception age expires for example
  • Drop searching and resume a lower priority behavior (patrol? random wander? etc)
#

pretty much how i've approached that problem for years 😄

tidal mantle
#

isnt EQS still experimental?

#

is it safe to use?

uneven cloud
#

EQS has been experimental since at least 2016 and hasn't really changed since

tidal mantle
#

my goal was to do n number of patrol in r radius, the count for patrol and radius could be defined in BP, i used a conditional loop and BT Task to achieve this. I tried using EQS but with eqs i couldnt find how to make it dynamic

#

i setup my eqs to generate the patrol locations that out of Ai's sight

#

locations that r being blocked by sight

#

so if there wasnt any obstacle in its sight it wouldnt move

#

also i wanted to loop the eqs n times, the number of loop should be defined in BP

#

but i couldnt find a way to do that, i tried using custom bt decorator loop but didnt worked maybe i didnt properly set up but yea

#

@vivid fern did u encounter any issues like this in eqs and how did u solve it...
thanks and sorry for ping

vivid fern
#

in my own little prototype, i just use the EQS query to generate a singular destination randomly from the top 25% results, then i just rerun the query every loop to find the next search location, based on the last sight location, so they will end up sticking around the last seen location, but moving around positions near by until some exit condition happens

#

(run out of search loops, or run out of time)

tidal mantle
#

and assigning it to move to task

#

in a conditional loop

vivid fern
#

i just use a loop with a repeat count

bitter wyvern
#

Is there a way to place nav link proxy in a Blueprint?
or can you change the navlinkproxy position at runtime in the level?
I have not found any functions that let me change the point link positions at all

steel moat
vivid fern
#

honestly didnt look, however if not could probably write a decorator that could

steel moat
vivid fern
#

truthfully i'd probably derive just decorator but i've not looked at it

steel moat
#

well...

vivid fern
#

i havent looked at the loop decorator's code so couldnt say one way or the other

#

looks like UBTDecorator_ConditionalLoop might be a good one to use, override the CalculateRawConditionValue function maybe

#

like i mentioned i havent tried but seems a good starting place ¯_(ツ)_/¯

#

seems like it already tracks blackboard keys tho

hasty turret
#

in unreal's environment query system, any one knows why there is "bTestQueriesUsingBreadth" option provided? What are the pros and cons of running query tests seperately before it all finishes?

steel moat
spring scaffold
ancient wedge
spring scaffold
ancient wedge
spring scaffold
dreamy surge
#

Is there anything I can use to put chatgpt inside UE5 where it can have a mesh and answer voice commands?

misty wharf
#

Probably but that seems like quite a fair amount of work

distant citrus
vivid fern
#

sweet glad it worked out

sullen plume
#

Why is it that my btservice (Update Plyaer Location) isn't calling OnCeaseRelevant when its turn is finished?

#

(Previously was on the right side and the service was ticking properly then, after switching to left side ticking stops but onceaserelevant never called)

#

Here's code if it helps:

{
    NodeName = TEXT("Update Player Location");
    bNotifyBecomeRelevant = true;
    bNotifyCeaseRelevant = true;
}

void UBTService_UpdatePlayerLocation::OnBecomeRelevant(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory)
{
    Super::OnBecomeRelevant(OwnerComp, NodeMemory);
    auto blackBoardComp = OwnerComp.GetBlackboardComponent();
    if (APawn* targetPawn = Cast<APawn>(blackBoardComp->GetValueAsObject(TEXT("targetPlayer")))) {
        if (AHorrorGameCharacter* targetCharacter = Cast<AHorrorGameCharacter>(targetPawn)) {
            UE_LOG(LogTemp, Display, TEXT("HasBecomeRelevant"));
            targetCharacter->shakeCamera(60*60); // huge val (1hr)
        }
    }
}

void UBTService_UpdatePlayerLocation::OnCeaseRelevant(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory)
{
    Super::OnCeaseRelevant(OwnerComp, NodeMemory);
    auto blackBoardComp = OwnerComp.GetBlackboardComponent();
    if (APawn* targetPawn = Cast<APawn>(blackBoardComp->GetValueAsObject(TEXT("targetPlayer")))) {
        if (AHorrorGameCharacter* targetCharacter = Cast<AHorrorGameCharacter>(targetPawn)) {
            UE_LOG(LogTemp, Display, TEXT("HasStoppedBeingRelevant"));
            targetCharacter->shakeCamera(-1); // disabling camera shake
        }
    }
}

void UBTService_UpdatePlayerLocation::TickNode(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory, float DeltaSeconds)
{
    Super::TickNode(OwnerComp, NodeMemory, DeltaSeconds);
    UE_LOG(LogTemp, Display, TEXT("Tick"));
    auto blackBoardComp = OwnerComp.GetBlackboardComponent();
    if (APawn* targetPawn = Cast<APawn>(blackBoardComp->GetValueAsObject(TEXT("targetPlayer")))) {
        blackBoardComp->SetValueAsVector(TEXT("targetPlayerLocation"), targetPawn->GetActorLocation());
    }
}```
simple river
#

Hi! Does anyone have any ideas as to why my AI's path following state randomly goes to idle while its pathing? Basically it stops moving abruptly and I can't pinpoint why

What I've looked at so far

  • Nav mesh covers whole area, its inconsistent regardless so it can sometimes path without issues
  • Behavior tree is correct and still on the follow task
  • Blackboard target is correct

it just seems like it randomly fails navigation and doesn't retry

#

yeah the path seemingly gets aborted and never tries to repath. This gets hit

harsh storm
vivid fern
#

also is the player in a space where the ai cant build a path to?

#

like you go up a ramp, is it wide enough for the ai nav radius

simple river
#

but shouldnt it try and repath after going back into an area the AI can path to regardless?

vivid fern
#

hard to tell whats happening in your video tbh

simple river
#

It basically seems like it isnt trying to repath after failing once

#

you actually are right, it seems like the ramp isnt navigatable for the AI. But then after I leave the ramp back into navigatable area it doesnt repath

#

bWaitingForRepath gets set to false for some reason, meaning it doesn't try and repath

vivid fern
#

yeah it probably hits a fail state and gives up

#

you could probably do some kind of fall back: fist try to path, if it fails, try to find a nearby point to path to, else enter some kind of wait state until destination is reachable

steel moat
terse panther
# simple river Hi! Does anyone have any ideas as to why my AI's path following state randomly g...

try do a check of path, like if the path exist or not, if not abort the task, as the reason for the AI not recalculating the path as its still trying to go to an invalid path....
there might be one more issue here(not sure about that), that AI can't go on the ramp even if there is navmesh becasue of the capsule radius of the AI, sometimes you see navmesh in a certain AI, but depending upon the AI capsule size, that area might not be valid for the AI to travel....

fiery field
#

I have a character with a sight sense. It properly detects other characters, but not a simple actor with a mesh (an apple). I ticked all the affiliation (neutral etc.). Why doesn't it sense my basic actor ?

uncut rune
fiery field
#

Woops, I didn't register it for the specific sense I wanted. Sorry, it's working now

#

Thanks for the hint

uncut rune
#

If I switch Behavior Trees on actor, does the previous blackboards values of that behavior tree that actor was running gets reseted or will they be ''remembered''?

#

basically each BT has it's own BB, if they get reseted on Behavior Tree switch then I probably need to use the same BB if I don't want the values to reset?

vague hollow
#

Hey guys, do you have any idea why my perception system might not work when spawning an actor through a custom subsystem ?

If I manually place the actor on my map, it will work fine but It won't work if the actors are spawned throughout the game

vague hollow
#

It's kinda weird, I'm trying to compare both the placed in actor and spawned actor (comparing their AI_Controller and actor BP) and they both look indentical

misty wharf
vague hollow
#

fixed, thank you

#

this is some dumb shizz i had dw

misty wharf
#

heh :)

azure pulsar
#

Bit of a noob question:
I've noticed that Decorator functions are pretty much a superset of Service's
Since Decorators can have a OnTick override and can change blackboard keys, when should a Service be used instead of a Decorator?

misty wharf
#

Good question, not really sure if there's a big distinction

#

I guess it's mostly a question of splitting it for clarity

dreamy surge
#

How can I import chat gpt into my game so it can be inside my AI and respond to voice commands and see what I see in game?

vivid fern
#

maybe ask in #generative-ai ? otherwise, through a lot of work i imagine... game ai isnt the same thing as chat gpt fwiw

severe solar
#

that's for posting ai generations

severe solar
#

anyways, is it just me who finds using blackboard AI with C++ useless? Ain't it easier to code it yourself since, unlike blueprint, it won't look like a mess

dense owl
#

See channel description, Allora’s direction was the right one

severe solar
#

i mean shoot your shot but after hours category is for stuff mostly unrelated to ue

dense owl
#

Ig they had to put it somewhere. This channel is mainly for UE’s AI system, rather than what people call “AI” currently (GPTs)

vivid fern
#

what do you mean "using blackboard ai with c++ useless"

severe solar
severe solar
vivid fern
#

i guess the fact that its already there and integrated into the engine is a benefit, if you want a node graph for your nodes, its also already got that too

#

of course imo its pretty easy to write behavior trees from scratch too so i guess its whatever you feel like

uneven cloud
severe solar
#

?

#

elaborate

uneven cloud
#

The BB is how you data drive the BT.

misty wharf
#

Tbh I'm not entirely sure what does "blackboard AI with C++" even refer to specifically

#

If it's about behavior trees specifically, you certainly could write BT's in C++ also (although UE doesn't provide much of an API for it out of the box), but I don't really think it would be any less messy... it would just be harder to change

severe solar
#

yeah mb i must've mixed them up

misty wharf
#

Every time I come back to look at GameplayBehavior_BehaviorTree it makes me wonder how exactly was this even intended to be used... It seems to be missing like 95% of the actual stuff that you would need for it to make any sense... lol

#

The BT it runs can't even get access to the smart object

#

And funnily enough if you google it, you find some stuff that relates to cheating in fortnite lol

#

Oh yeah and it's actually not even calling Super::Trigger which makes it look even more like some sloppy implementation that was never used for anything...

vivid fern
coarse hornet
#

So I'm having a weird problem, for some reason when I remove the repetitive eqs query and add the one time one, it works, but like this it fails. Does anyone have any ideas? (Do ping me if you have a response please). Oh also if more context/screenshots are needed, I can 100% provide some

vivid fern
#

What do you mean "it fails" as well?

coarse hornet
#

Also I won't be able to respond for a bit, thanks for the help!

vivid fern
#

Whats the eqs centered on? Is it possible its reference location isnt set

harsh storm
uneven cloud
marsh fog
#

hi, does someone have any idea on how to make the AI climb the wall? the "move to" doesnt work....

elfin hinge
#

Hi, what could be the reason for Rotate to face BB entry to not work?

  • Animation is not set as** root motion**.
  • CMC Used controlled desired rotation is set to true.
  • It get's stuck at Rotate to face BB entry until AI faces at 0 angle player, anything but 0 angle will make the task stuck.
  • Target is found, looking at visual logger it's set as focus.

I'm not sure what else could cause this.

#

Ok, found issue. AI Controller Tick was disabled.

spring jetty
#

Hey I'm trying to build an RTS prototype and I have a weird issue with forming a formation with units. the units sometimes move to the correct position and sometimes not exactly and they stop their movement in an offset. (usually the first time fails and the subsequent attempts work just fine on a button click). I'm stuck at this for like a week..

#
TArray<FVector> ARTS_PlayerController::CalculateRectangularFormation(int numUnits, int unitsPerRow, float unitSpacing, const FVector& Origin)
{
    ensure(unitsPerRow != 0);
    TArray<FVector> Positions;
    Positions.Reserve(numUnits);
    int row;
    int col;
    for (int i = 0; i < numUnits; ++i)
    {
        row = i / unitsPerRow;
        col = i % unitsPerRow;
        //
        float unitX = col * unitSpacing;
        float unitY = row * unitSpacing;

        Positions.Emplace(FVector(unitX, unitY, 0.0f) + Origin);
    }
    return Positions;
}``` this is how I'm calculating the points, but it doesn't seem to be problem. I think it has something to do with AIController but I dunno what exactly..
#

these points are always forming a rectangle I have checked them

#
void ASoldierBase::MoveToLocation(const FVector& TargetLocation)
{
    if (AAIController* AIController = Cast<AAIController>(GetController()))
    {

        FAIMoveRequest MoveRequest;
        MoveRequest.SetUsePathfinding(true);
        MoveRequest.SetGoalLocation(TargetLocation);
        MoveRequest.SetAcceptanceRadius(1.f); // Adjust as needed

        FNavPathSharedPtr NavPath;
        AIController->MoveTo(MoveRequest, &NavPath);
    }
}``` and this is how I'm moving each unit.
#
UAIBlueprintHelperLibrary::SimpleMoveToLocation(SpawnedSoldier->GetController(), GoalLocation);``` tried this one first and then used the one above. both behave the same way..
#

Here is a short video showing the problem, the first button click doesn't arrange the units properly.

#

the behavior is the same with other formations as well, Triangular, linear..

misty wharf
#

Well that's a bit of a gotcha... Apparently calling PerceptionSystem->RegisterSource does... absolutely nothing unless you've previously registered sources with specific senses you want to register :P

olive prism
#

Does anyone know why the rest of my blackboard variables don't appear in the MoveTo node?

uneven cloud
# marsh fog hi, does someone have any idea on how to make the AI climb the wall? the "move t...

Climbing a wall is not functionality that is in the engine by default and you need to add it. You need to break it down into 2 separate problems:

  1. The AI needs to know that they can get from point A to B via climbing. The easiest way to do this is to use nav links.

  2. The NPC character needs to do the actual climbing. This typically includes animation + implementing the movement. If using nav links, you can get notified when entering and exiting a climbing link. How that needs to be set up depends on if you are using C++ or BP

uneven cloud
ruby granite
#

my ai does not seem to want to target my player

#

it can see me

vivid fern
#

what do you mean "doesnt want to target the player"

#

wont attack? wont follow? are you storing the target?

ruby granite
#

im new to the ai stuff so i followed the tutorial in the documentation, any issues i had i found solutions for but this

#

it can see me, it updates when i enter its los, but it will not change the bool in the blackboard

#

im sure its a very outdated tutorial, i just cant find out whats going wrong here

ruby granite
# ruby granite

before hand i hooked up a print string between each set value as bool which is this

#

i do have it set to neutral friendly and hostile

#

if i connect the print to tell me the bool coming out of the AND its false, which i assume is because of the player tag not working right

#

yes it is an actor tag not a component tag

#

even when i disable it tho, and it returns true, it still doesnt update any of the variables or start chasing

vivid fern
#

have you set a break point there to see what the value is?

spring jetty
misty wharf
#

Ugh, every time I poke around the smart objects system it's like ?????

#

"Hmm I want to get a list of slots from this smart object component, I wonder now that 5.4 has a lot of updates to it if I can now do it"