#gameplay-ai

1 messages ยท Page 123 of 1

viscid oasis
#

I'm using Floating Pawn ol' chum

#

Though I've heard of Detour, but know nothing about it.

deep reef
#

It's too slow atm i feel but not 100% sure how i turn the speed up

#

I've tried upping the walk speed but that's not doing much, i'm assuimg it's because the animations work on root motion.

supple stump
#

Hey guys, does anyone know if there is a AI plugin / package / system to get something like Arma Alive mod ? Or something like Ghost Recon Wildlands. I mean, having a "life" in a big map with AI bien able to fight, gather resources etc ... in a persistant world and also has the multiplayer checkbox checked :p

rustic sinew
viscid oasis
#

er, so to get crowdAI I have to create a child of that from my AIController?

#

Is that right?

dark hollow
#

Does this section do anything? I've plugged in some extreme values to check and it hasn't altered navigation at all

#

I'm trying to prevent the navigation from putting the point to move to right next to a wall and I figured tweaking the collision size would do that

pine steeple
#

that just determines what navmesh it uses

wheat talon
#

hi has anyone ever experienced an issue where your bot thinks it's reached a destination but it hasn't?

#

I'm setting a target in AIMoveTo that is unreachable -- the navmesh is broken up by geometry

#

the bot will approach the edge of the navmesh, and once it hits the edge the node returns Success as the Movement Result

#

HasPartialPath returns false, so it should never think it's at the target unless it is right?

pine steeple
#

ofc, its reached as far as it can

wheat talon
#

how do I specify that I want the movement to Fail if the target is unreachable?

pine steeple
#

turn off partial path

wheat talon
#

hm yeah I did try that, but same result

pine steeple
#

it wont move if the target is not reachable

#

and will return fail

wheat talon
#

haha yeah one would think

#

like I said HasPartialPath is false, which definitely seems weird

pine steeple
#

behaviour tree move to?

wheat talon
#

I'll try turning off partial paths again, maybe my editor didn't pick it up

#

nah this is just the blueprint node

pine steeple
#

ok

wheat talon
#

yeah turned it off again, restarted the editor, bot still walks toward the wall and stops

#

maybe a bug? is there anything else I need to do for that setting to take effect?

misty holly
#

are you using bt?

wheat talon
#

just to kick off the logic BP

misty holly
#

try using the built in moveto and see if you get the same results

#

also does path exist is a built in node as well if you need it

wheat talon
#

same result with BT MoveTo node

#

oh interesting, how do I get a Navigation Testing Actor?

rustic nova
#

@dark hollow If you want to change the agent's radius, go to Project Settings > Navigation System > Supported Agents add a supported agent and edit the values there

verbal violet
#

Hi people, I am trying to make weakspot/armorpart system (just as Damage Modifier for my characters/enemies), problem is that my capsule collider hide weakspots inside and i cant shoot them. I am tried to make mesh root component and on some way disable and remove capsule but unsuccessfully. If i disable collision on capsule and enable on mesh, my character drop down through the floor. So I decided to put small capsule on bottom character (as pisvot) and enable mesh collision and it works , BUT i have a fealing it's not a right way? Do you anybody knows something more about it?

solemn viper
#

Hello, do you know how to dynamically set the time in a wait node in a behavior tree?

solid bane
#

@pine steeple Hey, could you elaborate on your implementation for what you had said previously about large navmesh agents registering themselves as crowd obstacles?

So all agents need to use the same names
Navmesh
@Tanoran#5405
Way we have it set up in our game. Big agents don't use crowd avoidance logic but register themselves as obstacles to the crowd following comp. Normal agents use crowdnfollowing as normal but will avoid obstacles including big agents. Just big agents don't avoid the normal agents so we ended up using rvo only on the big agents to avoid.```

I'm at the point where this is necessary (and know a little C++) so if it's not too complex I want to see if I can manage it.
#

Right now I have small enemies (which are using an AI Controller that inherits from DetourCrowdAIController) that are moving through larger enemies because the large enemies cannot use the crowd system (due to the one nav agent limitation).

verbal violet
#

Do you have Nav Modifier (as obstacle) on enemies? Maybe that...? I tried DetourCrowdAIController but my enemies start with some crazy rotation glitches...so I postponed that for later

solid bane
#

Setting the large enemies to be nav obstacles broke their navigation. Since they're always on a part of the navmesh marked as an obstacle they don't move how you would expect. They're basically always trying to move away from themselves, so they move pretty randomly.

#

Making large enemies ignore nav cost would fix the strange movement, but I'm not sure how to do that.

pine steeple
#

CrowdAvoidance has options

#

one of them is SetCrowdSimulation, it has three things, Full, Obstacle Only and disabled

#

this is how we setup our crowd simulation

#
    {
        if (bDisableCrowdSimulation)
        {
            UAIC->SetCrowdSimulationState(ECrowdSimulationState::ObstacleOnly);
        }
        else
        {
            //Below is hacky cause i got pissed off with it.
            if (AvoidanceQuality == ECrowdAvoidQuality::ECAQ_Low)
                UAIC->SetCrowdAvoidanceQuality(ECrowdAvoidanceQuality::Low);
            else if (AvoidanceQuality == ECrowdAvoidQuality::ECAQ_Medium)
                UAIC->SetCrowdAvoidanceQuality(ECrowdAvoidanceQuality::Medium);
            else if (AvoidanceQuality == ECrowdAvoidQuality::ECAQ_Good)
                UAIC->SetCrowdAvoidanceQuality(ECrowdAvoidanceQuality::Good);
            else
                UAIC->SetCrowdAvoidanceQuality(ECrowdAvoidanceQuality::High);

            UAIC->SetCrowdAnticipateTurns(bAnticpateTurns);
            UAIC->SetCrowdObstacleAvoidance(bObstacleAvoidance);
            UAIC->SetCrowdSeparation(bCrowdSeperation);
            UAIC->SetCrowdSeparationWeight(CrowdSeperationWeight);
            UAIC->SetCrowdSlowdownAtGoal(bSlowdownAtGoal);
            UAIC->OnRequestFinished.AddUObject(this, &AMonsterControllerBase::HandleRequestFinished);
        }```
#

big monsters have the bool bDisableCrowdSimulation set

#

which registers them as Obstacle to the crowd following component

solid bane
#

Ok. This is set up in your enemies then?

pine steeple
#

for crowd following yes

#

i had to expose some stuff

#

cause CrowdFollowing exposes nothing to BP

#

which sucks

solid bane
#

Gotcha. Ok, well this gives me something to go off of. My brain is pretty fried for the day but I can start looking into this tomorrow. Thanks so much!

wary ivy
#

are you satisfied with the crowd sim stuff? Last time I tried it it seemed to produce quite erratic movement for pawns, rotation wise at least

pine steeple
#

@prime saffron this is not the channel to advertise.

smoky summit
#

@prime saffron Please see #old-rules, specifically rule #6

prime saffron
#

Sor

#

Ry

obsidian oracle
#

So I'm building an ai who as part of it's behavior tree functions needs to chase a sensible enemy (done) and then follow it's owner if it cannot

#

What's a good way to find a reference to a certain actor?

#

I've tried a tag approach but I can't store the reference I get from that it seems

crude loom
#

Hello ๐Ÿ™‚

#

I'm a total beginner with AI and was wondering if it was possible to make the AI not being able to see through collision

worldly flame
#

Any way to detect when exactly AI loses sight of you in VR?

wary ivy
#

it's possible with the ai perception system

#

there are events that are fired when the ai loses and gains sight of some target

glossy spire
#

he folks, trying to work out order of operations here.. does possess always happen before any begin plays?

#

if i spawn an AI pawn for example

#

with an AI controller class set

pine steeple
#

no

#

i mean its dependent

glossy spire
#

I have values on a pawn which are calculated during its begin play

#

and i need to assign those values to a blackboard

#

but the blackboard can't be accessed until the pawn is possessed and the controller has begun play

#

i'd prefer having it always work the first time, as opposed to some kind of handshake thing

pine steeple
#

set them in possessed?

#

then start the BT, that is what i do for my AI

worldly flame
warped elm
#

what would be the need to have 2 versions of "Event Receive Execute" .. where the 2nd version has AI at the end ?

pine steeple
#

i always just use the AI ones

#

think it was intending for BT that doesnt run on AI Pawns

#

but ๐Ÿคท never tested

fallow hound
#

hi all, how do I alter NPC decelleration as it gets close to a move to goal?

bleak raven
#

In AI controller, how I can get controlled pawn? No, GetControlledPawn node does not work. I need data from main blueprint of mob on EventBegin to setup certain initial data of blackboard.
In this case I spawn mob with information where it should go just after spawn. When it reaches that first location, internal location determination takes over.

fallow hound
#

what do you mean getcontrolledpawn doesnt work?

#

what does it return?

#

you may need to cast the actor to your actor

#

it returns a generic AActor or APawn, I can't remember

bleak raven
#

thats the thing, it returns nothing

#

I know it should be casted but cast fails

#

and I don't know why, google says it should work, AI otherwise works

cyan sigil
#

Can anyone point me towards an AI tutorial that's a little more advanced?

#

I know what tasks, decorators, and services are but I want to see how to put them together in a sophisticated way.

fallow hound
#

if I want NPCs to avoid pathing near my player, is attaching a nav modifier volume to the player an acceptable idea?

#

glad you solved it @bleak raven , also nice Spider pic

orchid star
#

Guys, I am trying to find the best approach for simple traffic AI and moving along splines would be the best option I guess. My question is how would you approach building navigation grid using splines? I need to have a full network with capability of tagging individual segments (max speed, stop, triggering certain events when vehicle hits a certain segment). Is my design idea correct for what I want to achieve? Do you have some experience in creatin AI traffic that you can share?

distant cedar
#

help my ai wont move

warped elm
#

anyone know why there is "Event Receive Execute" and "Event Receive Execute AI" .. what is different between the 2 ?

distant cedar
#

HELP ME

warped elm
#

show the black board

distant cedar
#

its fine why would it be related to the black board

warped elm
#

because could be some variables not set properly or such

distant cedar
#

thats imposible

#

i triple checked that

warped elm
#

looks like everyone is either busy or unavailable

distant cedar
#

;-;

warped elm
#

They must be all playing games in their home !! lol

distant cedar
#

yup

slow vessel
#

Make sure your pawn is actually possessed by the controller (if the pawn is spawned you need to call SpawnDefaultController). Check in the runtime debugger if the BT is even running.

#

make sure your AI Controller subclass is selected for the pawn to use

fallow hound
#

@warped elm I think things that arn't ai can use tasks

mossy nexus
#

@fallow hound untrue, I got a camera using tasks and a BT/BB

fallow hound
#

hmm? I said can

mossy nexus
#

oh

#

my bad

fallow hound
#

no prob

#

but you need controller right?

mossy nexus
#

what for?

fallow hound
#

to sue the BT?

#

use

mossy nexus
#

no sir

fallow hound
#

really?

#

you need a braincomponent?

mossy nexus
#

yeah but the BT derives from a braincomponent

#

all the controller does is instantiate the BT and set it up

fallow hound
#

so you have an actor with a BT comp?

mossy nexus
#

yes

fallow hound
#

haha I didn't know

#

I've got controllers in my world for non-AI BT use

mossy nexus
#

I mean I went and created a custom derived class for my BT that I could expose to BP

#

same with BB

#

basically the custom BT component handles its own setup. there's already functionality to scan for BBs, but you also set it up manually

#

I was really surprised how simple everything turned out to be

fallow hound
#

interesting, thanks for sharing

mossy nexus
#

yea no worries

fallow hound
#

yeah I spawned pawns/with controllers to run BT logic

mossy nexus
#

oof

fallow hound
#

which worked fine but isn't very elegant

mossy nexus
#

yea

#

I mean don't get me wrong here, I'm not a master cpp programmer, I know a little but mostly work with blueprints

#

I just didn't want to get stuck using controllers like that

#

because my thinking was that I'd potentially paint myself into a corner

#

if you need any assistance setting it up though let me know

#

but I definitely urge you to take a look at UBehaviorTreeComponent

fallow hound
#

thanks!

warped elm
#

Still wondering why there is EXECUTE and EXECUTE_AI

halcyon tusk
#

dunno myself but execute ai gives convienient access to the pawn and its used in every tutorial ive seen

warped elm
#

reason i ask is because my boss does not use the AI version of it and all seems to work properly

fallow hound
#

Hi all, kind of a design/performance philosophy question. Let's say I have an AI who can have their weapon knocked out of their hand. I could have a GatherInfo service that is checks if they are armed or not every tick and sets the BB value, I could also manually set the BB value whenever they loose their weapon in the game logic.

#

The service seems so much easier to maintain... a nice central location for gathering data for decisions.

#

but the event based one seems more performant

pine steeple
#

if you already have a service running, then use it

#

services don't have to tick, i have a service that runs, that binds to events

fallow hound
#

ah, good to know

#

yeah I plan on having a service running anways

#

thanks ๐Ÿ‘

mossy nexus
#

I have a design question as well. If I have information that is being reacted on per frame in a task, what is the best way to supply this task with that information outside of the task itself? preferably without stopping the task too

halcyon tusk
#

ontick

#

if something runs per frame the only thing else that runs every frame is tick

mossy nexus
#

that's not what I am asking though

slow vessel
#

I have tasks that bind event listeners while they execute. For example, a "UseAbility" task binds an event that waits for the ability to end, which will fire from the pawn it's listening to. Otherwise you could also poll the info off the pawn or controller in the task's tick depending on what it is.

mossy nexus
#

yeah dynamic event listeners isn't a bad call, don't know why I didn't think of that. do you manually unbind them as well?

#

I have to essentially poll some math that due to the constraints of the system can't put in the same place

slow vessel
#

Yeah i unbind everything myself usually on end, not sure if the task is reused.

mossy nexus
#

I see

#

in my case it's the lowest priority task

#

externally I wouldn't be able to communicate values through anything but the blackboard, even if I e.g. put a service on a task or some such, correct?

slow vessel
#

Technically you can move things however you want. You can interact with the pawn or controller directly from within the task. But if you mean pushing things to the task directly, no I don't think so

mossy nexus
#

yeah okay

slow vessel
#

Seems like you wouldn't want things referencing a specific task instance anyway though

mossy nexus
#

the issue is I can't have the values being read and set in the same execution thread

#

as it's causing me a ton of issues currently

#

no, true

#

the blackboard is just a hassle to use... on the other hand, if there is no alternative...

slow vessel
#

Yeah, I don't like the "stringly typed" key names you need to use... Sounds like some other architectural things are also contributing too in your case

mossy nexus
#

in an ideal situation I'd be able to hook up two tasks independently in a sequence, and then arbirarily restart the sequence when necessary

#

the last/lowest task is never intended to finish, but it could be abort to reset the sequence

#

but that would stop the execution of the last task

#

for perhaps a frame or more

#

which I am not sure is consistent enough

slow vessel
#

Gotcha. Random thought I have reading that is to try a service that you know will stay running and can update a BB key. Have a simple task on the end that kills the sequence when that key is flipped. ๐Ÿคทโ€โ™‚๏ธ

mossy nexus
#

hmm

#

I don't think I need to kill the sequence, I can just decorate with an abort lower

#

unless that for some reason wouldn't work?

warped elm
#

Ah, i finally know the difference between Event Receive Execute and Event Receive Execute AI. the AI version provides owner controller and controlled pawn as outpout, then with Event Receive Execute an actor is provided !!!

tall rock
stoic kelp
#

Hi guys, is it possible to get all parent nodes and all children nodes in Behavior Tree?

pine steeple
#

in c++?

stoic kelp
#

yes

pine steeple
#

sure, but why do you need too?

stoic kelp
#

Im building an AI spawning system that have requirement overlapping between each spawner

pine steeple
#

ok?

stoic kelp
#

I wanna have a node that congregate all the requirements in my AIController as a manager. All the requirements are placed on individual nodes.

#

So the node will go to all children, get their requirements and send it to AIController.

wraith eagle
#

Say you wanted to cut off certain bits of nav mesh, without using nav modifiers... how would you generally go about doing that? ๐Ÿค”

#

If it's even possible

vagrant wolf
#

Iโ€™m making a civilian ai for my game right now what would be the best way to make my civilian stick to roads when travelling?

stoic kelp
#

Im building an AI spawning system that have requirement overlapping between each spawner
@stoic kelp Nvm I solved it.

#

But I have another question. Behavior Tree does not support convergence?

olive pond
#

@wraith eagle Why without nav modifiers? Those are generally the main way you would cut off parts of the nav mesh other than putting actual collision hulls in it.

wraith eagle
#

Cost of rebuilding really. Working on another solution now anyways

olive pond
#

This might be a long shot but you could include in your AI, checks over an array of structs or Actors that contain the location and radius or bounding box of areas you'd like to exclude, but which don't actually change the navmesh itself.

#

But that only prevents them from selecting locations in such areas, it doesn't prevent them from pathfinding to them unless you modify the pathing algorithms in C++

#

With very large, open worlds, it is recommended to use a dynamic nav mesh rather than a pre-computed one.

#

Especially if you're using level streaming with world composition

#

But I'm not sure how you get reliable pathing in that situation.

#

Over large distances anyway

pine steeple
#

use nav invoker

#

then you dont need to generate a huge mesh ๐Ÿคท

spring inlet
#

anyone has an good example for AI getting out of my way on collision?

#

kinda want them to go away for a few seconds (which works so far) and then return to their old position

#

but somehow pathfinding to the old location fails sometimes, and they wont recover their rotation

#

i've tried saving the focal point before moving out of the way, and setting it back when returned, but they wont take their old rotation vector

mossy nexus
#

will they match forward vector?

spring inlet
#

uhm, no idea

#

so theres nothing that would handle the interpolation for me for a smooth transition?

#

i mean, i can do it on my own, just would like to avoid it if not necessary xD

mossy nexus
#

don't think so no, not automatically

obsidian oracle
#

Is there any way to pass a blackboard key (like an actor) to a BTTask BP?

#

I want it to teleport to a passed actor

solemn viper
#

just discovered that calling MoveToLocationOrActor from the AIController "OnPossess" event will fail if the controller is spawned from the beginning (for instance because the pawn is manually placed in the level). Is this expected behavior? (UE 4.23.1)

pine steeple
#

@obsidian oracle check out Blackboard Keys

wheat talon
#

does anyone know why my navmesh wouldn't package into a cooked build properly?

#

Im using static navmeshes, and everything works perfectly in the editor

#

but when I cook a windows build the recastactors exist, but seem to contain no nav data

#

despite the fact that the mesh should exist around my character

slow bobcat
#

Hi!
This might have been asked before here, but can't find an answer for it: Detour Crowd Control, how to register/unregister ai agents?
In our game we have something we call Distance Based Optimizations. It's a process we run that checks how far AI is from the player and, depending on the distance, we apply different settings. When close everything fully works, when far, we disable ticks and other things.

Now I'm playing around with the Crowd Control and I want to un-register the AI (or pause, not sure the right terminology here) when it's far from the player, enable it again when it's closer.
But I'm failing. I can't figure out the right way to re-enable it.

To enable crowd control, I found thin in the wiki (RIP wiki, thanks a lot Epic....) : Super(ObjectInitializer.SetDefaultSubobjectClass<UCrowdFollowingComponent>(TEXT("PathFollowingComponent")))
You have to place this line within the AI controller constructor.
Good, that works.
The Register/Clean functions are within that component and they are protected, so I wrote an extension with public wrapper functions that call those protected functions.
So the line looks like this now
: Super(ObjectInitializer.SetDefaultSubobjectClass<UMyGameCrowdFollowingComponent>(TEXT("PathFollowingComponent")))

And this are the wrapping functions I wrote and that I call

void UMyClassCrowdFollowingComponent::RegisterAgent()
{
    Initialize();
}
void UMyClassCrowdFollowingComponent::UnregisterAgent()
{
    Cleanup();
}

But this doesn't work. The Unregister works but, when I call register (initialize) I can see that AI doesn't behave the way it should again (avoidance is missing).
Also, it feels like I'm re-inventing the wheel.

#

Funny enough, there's a way to do this for actors that need to be avoided and that are not part of the crowd control (like players).
This is a comment from the CrowdManager

 *  Actors that should be avoided, but are not being simulated by crowd (like players)
 *  should implement CrowdAgentInterface AND register/unregister themselves with crowd manager:
 *  
 *   UCrowdManager* CrowdManager = UCrowdManager::GetCurrent(this);
 *   if (CrowdManager)
 *   {
 *      CrowdManager->RegisterAgent(this);
 *   }
 *

Anybody with experience in this? or that has solved this similar problem?
Thanks!

slow bobcat
#

Ok, this was a rubber duck situation... As soon as I hit enter, I realized it was much easier than I thought and everything was there...
This is how the wrapper looks like.
Anyway, fi you know about this and I'm re-inventing the wheel, let me know please. Uncharted waters for me

void UMyGameCrowdFollowingComponent::SetCrowdManagerEnabled(bool Enabled)
{
    bRegisteredWithCrowdSimulation = false;
    if (UCrowdManager* CrowdManager = UCrowdManager::GetCurrent(GetWorld()))
    {
        ICrowdAgentInterface* IAgent = Cast<ICrowdAgentInterface>(this);
        if (Enabled)
        {
            CrowdManager->RegisterAgent(IAgent);
            bRegisteredWithCrowdSimulation = true;
        }
        else
        {
            CrowdManager->UnregisterAgent(IAgent);
        }
    }
}
static crater
#

Hi, so anyone knows its possible to cover a 6x6km map with navmesh?

pine steeple
#

why couldnt you?

#

would be terrible

#

but possible

#

i would use nav invokers and have navmesh generated around the agents

boreal mortar
static crater
#

i seen, however, when generating at runtime, ai cant move out of its radius size right?

tame knot
#

if you want free roaming agents, attach the invoker to the ai pawn

#

then it'll generate navmesh around it as it moves

solemn viper
#

hi there, do you know if there is a way to specify the waiting time in the wait node in behavior tree?

dusk kite
#

@solemn viper There's the wait time property field in the details panel. Unless you're talking about changing it in real time, then I don't know haha

solemn viper
#

In editor Time it's fine! I did not see it, will check again. Thanks !

solemn viper
#

About the wait Time, I dont need to change it at Runtime but still need to set it per instance :/

karmic goblet
#

Ok, I need help. Am I just not understanding how the BT Cone Check decorator works? If I have an enemy and I want to know if the player is within a cone coming out of the enemy's forward vector, the BB vectors would be the enemy's world location for the Cone Origin, the enemy's forward vector for the Cone Direction, and the player's world location for the Observed... right?

karmic goblet
#

Cone Check always returns zero and lets the execution through even though I can clearly see my BB vector keys should return a non-zero number.

wraith sand
#

Anyone had problem that Simple Parallel task does not tick?

#

ExecuteTask happens once and that's it

#

nvm... it seems that ticktask is by default false, had to do bNotifyTick = true;

static crater
#

Hey, so as my navmesh is pretty large, and takes a while to rebuild i was looking for a way to enable disable the navmesh without removing the data.. any idea how?

vocal sinew
#

Guys, I have dynamic navigation, but it does not update when I add component, however, it does update when I spawn an Actor with same component. How Do I update navigation so it can see my new components?

fallow hound
#

Is there a way to attach tasks to using a navlink? I'm thinking of instructing an NPC to open a door before the proxy is valid.

pine steeple
#

@static crater why did you not use NavInvokers on a big map?

#

that is the primary purpose of them

#

@fallow hound no, i use smart links, when the ai reaches a smart link (in my game for example), the AI destroy the door, then proceed through

#

if the door is destroyed the navlink is removed.

fallow hound
#

Cool, I'll look into them ๐Ÿ‘

pine steeple
#

smart links can be toggled on and off

#

which is nice

pastel gyro
#

Hello! My BehaviorTree task is constantly run (and succeeds), but the tasks afterward never go into effect. Does anyone know a fix to this?

static crater
#

@pine steeple im still kind of good with not using nav invokers ๐Ÿ™‚ still thinking of use them maybe though

#

my map is around 4x4 or so, only the navmesh takes some time to build thats all (and yeah, the game load is affected, but thats ok)

simple crest
#

random observation: I've always wondered if one was making a game like Arma, you obviously need some sort of invoker style local nav area being built around the AI, but how do you get it to handle things like pathfinding across a bridge from one corner of the map to the other as well? need multiple "layers" of navigation data, or high-level and low-level nav data somehow I guess?

grave coral
#

question, how do i get the ai to move around the player instead of head butting the player until the player moves away?

pine steeple
#

set the stopping distance

#

and have some logic that makes him move around the player?

#

or use crowd avoidance

#

and register the player as an obstacle

worldly flame
#

any idea why my BT doesn't go below the root?

pine steeple
#

something else below is blocking it?

#

if there is no valid path, it will stay on the root node.

#

a valid path is a path to a "task"

#

if there is no valid path to a task, nothing will execute.

worldly flame
#

inside getenemy im setting this:

#

and when i print out... it gets set to it too

#

@pine steeple so it should either go to enemy is set or not set

#

in the beginning it goes right away to not set for some reason then when that chain finishes executing

#

it gets stuck on root

pine steeple
#

whats below those noses

#

nodes*

#

the task ones

worldly flame
#

the right side executes once

#

then thats it

pine steeple
#

well your nodes are wrong

worldly flame
#

why?

pine steeple
#

sequence executes left to right

#

and returns on failure

#

its gonna fail on the first node on the left side

#

you want to use a selector

#

CanShoot is false, the whole left side wont execute

worldly flame
#

like this?

pine steeple
#

Selector = Execute each node till a node returns success.

#

Sequence = Execute each node till a node returns failure or all node returns sucess

worldly flame
#

ah

pine steeple
#

your Fire should be a selector

#

aswell

#

๐Ÿคž it works ๐Ÿ˜„

worldly flame
pine steeple
#

yh

worldly flame
#

works much better.!

#

thank you

pine steeple
#

np

fallow hound
#

if I want a door to spawn a navlink on it when I drop it into the editor.. how would I do that?

#

navlink appears to be an actor, not a component

#

I could do beignplay, but I'd liek to be able to see the navlink actor in the editor

pine steeple
#

i made my own custom smart link component

#

in c++

#

and its a component on the actor

fallow hound
#

hmmmm

#

I just noticed that the naclink actor has nice functions like to resume pathfinding, and delegates for when npc reaches the proxy

#

did you remake those in component?

pine steeple
#

yeah

#

like this ๐Ÿ˜„

fallow hound
#

Cool, thanks

#

So I just need to override functions really?

meager bobcat
#

does anyone know any good AI solutions or something for UE4?

#

it doesnt feel like theres any good solutions for AI built into ue4 though.

fallow hound
#

I think hundreds have games have shipped using UE4s BTs, what's lacking for you?

meager bobcat
#

adding more tasks/branches gets really unwieldly

#

and trying to figure out what will actually run is kinda a head scratcher

#

the article i linked talks about this some more

#

As mentioned in the intro we had some issues with using Behavior Trees once the number of available tasks per Agent increased. Every new task could influence the other parts of the tree without this clearly showing up until you ran the tree through some actual playing. It requires a certain way of thinking to create effective trees and allow for easy extension which can be hard to get into. We also found it can be difficult to get back into a tree you havenโ€™t touched in a while.

#

i dont want to say that behavior trees are bad, i just find them really frustrating ๐Ÿ˜ฆ

fallow hound
#

They do have a learning curve, but rolling your own AI solution will be an even larger learning curve

meager bobcat
#

thats why i want to know what everyone else is using

#

if theres any other alternatives or if anyone has found any good free plugins or something

fallow hound
#

I think AI is just hard haha

#

Dunno if there's a magic solution

simple crest
#

I've been working on my own utility ai solution for months. Months I could have been actually building a game but I am stupid and won't let myself give up on it HaroldHaha

meager bobcat
#

is ur code public?

simple crest
#

Not right now, might make it public once it hits a state I'm actually using it

lyric flint
#

I been using this for the ai to find a random points to run at when i enter his radius

#

But is there a way he can ran away from in a direct line?

#

The ai is an animal i want him to run away from me ;d, and some times he run towards me cuz of the random point

#

Any thoughts? and thanks โค๏ธ

fallow hound
#

probably use EQS? It will generate a bunch of random points, and you can do some math to choose a point that is away from the player

#

@lyric flint

lyric flint
#

@fallow hound Thanks for pointing that mate, but i heard some people using dot product and find look at rotation node for that some how

#

you ever tried something like this?

fallow hound
#

if you used EQS dot product would be a good way to test the points

#

you'd get direction of animal to point

#

and direction of animal to player

#

and run a dot product on them, which tells you if they are same or different direction

lyric flint
#

I will test it out now hope it work out

#

thank you!!

pine steeple
#

a dot product would work tho aswell, but we do ours with EQS (for things like Evade) etc

#

as it has a Dot test

fallow hound
#

oh ahha I didn't know eqs had a built in dot test

worldly flame
#

my AI is too accurate right now. I tried randomizing his spread but it didnt help

pine steeple
#

heh

worldly flame
#

how can i make them a little less accurate but still be good

#

this is what i have for the end location of their line trace

pine steeple
#

use Rand cone

#

and pick a point

worldly flame
#

this?

pine steeple
#

yeah

#

this will create a spread

#

meaning the shots are not straight

worldly flame
#

and degrees should be something like 5-10?

pine steeple
#

you just adjust the end point

#

depends, i normally run like 5-20

#

depending on how long its been firing for

worldly flame
#

and cone direction is the actor location? or should i get a specific socket on the mesh for a better result

pine steeple
#

you adjust the end point of the trace

#

where it hits the player

#

by the random vector

worldly flame
#

thank you... will try it out

worldly flame
#

@pine steeple its coming wayy off

pine steeple
#

its normalized

#

you are shooting from tthe muzzlew

worldly flame
#

checked actor location and and the gun location and there are good

pine steeple
#

i said the end point

#

the end of your trace

#

you adjust

#

not the muzzle loc

worldly flame
#

i may be understanding this wrong but this is what i have @pine steeple

pine steeple
#

you cant do that

#

you need to have some range

#

say 10000 units, then apply a random cone to the end result of the line trace

#

you need to do the trace first

worldly flame
#

so i can my original logic to get the line trace

#

then apply random cone to the end of that?

pine steeple
#

yes

rotund anchor
#

how do i select a blackboard key

#

nevermind i did it

rotund anchor
#

why dont i have return node in my decorator as an option

#

ive checked old decorators ive made and its clearly there

fallow hound
#

Prob need to override the right function

lyric flint
#

Really need help its killing me

#

It was working fine this morning i dk what i missed up

#

Am checking with the error coming from

#

but still no clue

languid gulch
#

i think you need an "isvalid" node

#

the error suggests that the code is trying to do something with the actor after it is destroyed @lyric flint

lyric flint
#

but NuN why all zombies

#

playing animation with same time

#

It was working fine i dk what happened

languid gulch
#

they use same code? im not good at it. I would think once one of them dies or so, it cant send all information to all actor. I think "isvalid" could be the solution. I have no real knoweledge buddy, so i wish you good luck ๐Ÿ˜„

bleak plume
#

Hi! Where can i find more information about crowd system?

grave coral
#

google

fallow hound
#

can a service do something like force a success on the node its attached to?

pine steeple
#

no

#

well it possibly could but not in BP at least

fallow hound
#

how might it be done in c++?

pine steeple
#

tricky, you would have to get children underneath the service

#

and call abort

#

or grab the running task (i think there is a way) and call abort.

fallow hound
#

cool, I'll look into it

#

thanks

pine steeple
#

if you don't get it sorted, when i have some free time ill take a look

#

you could cheat

#

have a bool blackboard key

#

and an abort node

#

i mean a blackboard decorator

#

and abort when the key is set

#

service can just set that key

#

on same node as service

fallow hound
#

yeah I was thinking the same thing

#

one way or another I'll get it

#

for a bigger picture, I'm running a move to, and want to go to the next task in the sequence once the move to destination is in sight

whole fern
#

I have a pawn moving in my level but it twitches/jerks very badly when moving. These are my settings.

1: NavMesh is set to generate dynamic.
2: Extended from APawn class.
3: Uses custom made movement component inherited from UFloatingPawnMovement.
4: Capsule component has Can Affect Navigation enabled.

#

If I disable Can Affect Navigation there is no twitching/jerking but then pawns are not avoiding each other. Floating pawn component doesn't have RVO avoidance.

wary ivy
#

I don't think pawns should affect navigation, it causes a navmesh update in the tile it is in

whole fern
#

But then how will I make the pawns avoid each other.

jaunty peak
#

crowd avoidance.

pine steeple
#

or RVO for very basic avoidance

#

but be warned RVO can cause off navmesh issues

whole fern
#

Floating pawn movement doesnt have RVO avoidance

pine steeple
#

why you using FPM with navmesh?

whole fern
#

@pine steeple I inherited from FPM to make my own custom movement component which is far more simpler than character movement component.

#

Plus I'm using pawn

pine steeple
#

will have to write your own avoidance system then

#

could kinda borrow what RVO does in the CMC

whole fern
#

Looks like that is my only option.

#

But theres a lot going on in there.

wary ivy
#

there are also quite a bit of whitepapers for reciprocal velocity obstacles (rvo) on the internets if you want to read more about it

whole fern
#

Thank you @wary ivy. I'll look into it.

ocean fractal
#

The guy can't move. If I lift him up and place on nav area nearby, he starts to move just fine

#

Any tips on how to fix this via config, or even better - can I somehow track this particular scenario in my cpp tick and if that happens - try placing him on some random spot nearby? How do I catch this particular scenario in code?

fallow hound
#

I haven't looked in depth into it, but in the robo recall mod creator you get the full robo recall source code. They had logic in there to help AI find navmesh again when off it.

#

I think it was in the npc base controller class?

ocean fractal
#

Thing is, he is on nav mesh
You can see that on the left, he's NavMeshWalking

fallow hound
#

oh found it, its in void AOdinCharacter::Tick(float DeltaTime)

ocean fractal
#

When you put an AI off the navmesh, it goes into Walking

#

and I check that in tick and put him back on it
but it thinks that it's on navmesh, and yet fails to walk :)

#

thx I'll check it out

fallow hound
#

you could also mess w/ navmesh settings, like cellsize if you want

#

also why are you using navmesh walking, performance?

#

just curious

ocean fractal
#

I'll mess with cellsize, thx. Gotta find the docs on it
I've had them get stuck off the navmesh if they were Walking, due to RVO
I changed it so that I force NavMeshWalking, and this allows me to instantly catch when they got thrown off the navmesh - they switch back to Walking. I catch that and find nearest point on nav mesh (taking into account the navAgent size). Has worked very well so far

#

At least considering that this thing above is a separate bug altogether

fallow hound
#

yeah I'd def look into the robo recall solution

#

sounds like epic ran into same issue, I imagine their solution is good haha

rare nest
#

how can i check if a certain vevtor is reachable by a ai pawn

short swan
#

hello everyone! How do you do vehicle AI movement? I need moveTo logic. I'm writting car deathmatch game, where I need AI controlled car to drive to position. Seems like the only way is to override "RequestDirectMove" in NavMovementComponent

meager bobcat
#

i hate AI so much

#

im calling MoveToLocationorActor on an AIController but it doesnt seem to do anything

#

i dont get a request failed or a move finished

rare nest
#

do u have a nav mesh?

meager bobcat
#

yeah

#

so like my guard does a patrol and a chase

#

and after its done chasing and it goes back to patrol, sometimes it just gets stuck in a loop and does nothing

#

and pathfinding doesn't seem to work

rare nest
#

make sure the event is being called in the first place and the loop would only happen because of faulty logic

meager bobcat
#

yeah so its being called

rare nest
#

i would double check the logic then

meager bobcat
#

hmmm okay

#

yeah so it gets called and then my AI just stands in place

rare nest
#

move to location or move to actor

meager bobcat
#

move to location or actor is the node

#

but i have it set to an actor

rare nest
#

is the actor valid

meager bobcat
#

yeah

rare nest
#

is it in bluprint

meager bobcat
#

wym?

rare nest
#

is it in c++ or bp

meager bobcat
#

C++

#

the guard has a reference to the actor in blueprint

#

and my AI accesses that reference and tells the guard to move to it

rare nest
#

hmmm

meager bobcat
#

yeah its really fucking weird

#

so task 777 is the patrol task

#

and its supposed to move

#

oh also my nav mesh is valid

#

the weird thing is that path finding always works with chasing the player but not going to the waypoint?

meager bobcat
#

TURNING OFF continuous goal tracking fixed it

#

fucking hell

#

why does continuous goal tracking break it???

silk vapor
#

I know it's a pretty broad question but

#

does anyone know how to make an ai good for multiplayer using eqs?

#

or did anyone find any good tutorials on it?

pine steeple
#

ai is server only

#

you don't need to care if its multiplayer or not

#

everything is done server side.

timber estuary
#

Somebody give me some advice! How can you interact with the enemy by grabbing a certain part of his body, like his throat? Any thoughts on that?

pine steeple
#

get the neck bone world location

#

and grab it there

timber estuary
#

@pine steeple Can you explane? Or give some video?

quartz lark
#

hi

#

am working on PawnSensingComponent component

#

but OnHearNoise is not working anybody can help me with this

pine steeple
#

@quartz lark don't use Pawn Sending

#

use Perception System. Pawn Sensing is pretty garbage.

lyric flint
#

For some reason

#

The awarness of the ai

#

is too slow

#

if its only 1 ai he will react fast

#

but if there is multiple it will take time

#

any reason for that?

supple trout
#

Is there a good way to create an AI that follows a distinct pattern, unless a special rule is met?
For example, the AI must follow the grid and cover every coordinate unless the following happens: The coordinate directly to the left or to the right has a higher value than the current one has.

I am generating a grid that covers the area of the patrol and depending on the size the dynamic path changes. If the pawn detects objects of interest, then the pawn should head straight for the object, but that is easy to fix.

The only thing I can think of is to not use the AI tree and code it myself in blueprint or something with goto commands.

olive delta
#

When the ai hears a sound he goes to the location but if i want to make a new sound while he is in the middle of the behavior, how do i abort/restart a behavior

fallow hound
#

How can I get information about the path a controller is following? Through the path following component? I'm looking to check if smartlinks are involved in the path for instance.

pine steeple
#

yeah but its not that easy to get if its a navlink

lyric flint
#

Am trying to make the player chase the an imal in a stright line

#

i did everything chasing etc but the animal is getting a random point to go to as i enter the radius

#

I want him to run away from me cuz in random point he might come to me ;dd

#

Any thoughts? and thanks

olive delta
#

@lyric flint i hade the same problem. Do you mean, if the player gets near the animal the animal can sometimes get a random point near you so it looks like the animal is running towards you.

lyric flint
#

@olive delta

#

Yea mate i want the animal to run away from me ;dd

#

You managed to solve this problem?

#

its killing me meh

olive delta
#

Okay so I solved it : D @lyric flint sorry for not replying so fast I was trying to confirm your problem

#

The blue dot is the animal, and green dot is a random location he can go to and a red dot is a location you donโ€™t want the animal to go to. Yellow is you character

lyric flint
#

am with you ๐Ÿ˜‚

#

Nice explaining tbh hehe

olive delta
#

So to solve the problem you need a node called something like random cone in degrees

lyric flint
#

this one ?

olive delta
#

Yeah I think thatโ€™s the one

#

I so bad to help arm cuz Iโ€™m in a car

#

Hahah

lyric flint
#

ohh really thanks mate ๐Ÿ˜„

olive delta
#

But Iโ€™ll try my beat

#

Best

lyric flint
#

What i can do with this?

#

If you are super busy its ok mate

olive delta
#

Wait just like 5 min just have to remember how I did it

#

Haha

lyric flint
#

ok take your time am here ๐Ÿ˜„

olive delta
#

Itโ€™s ok : D I will help you

lyric flint
#

been searching for an answer

#

for a while now

olive delta
#

@lyric flint okay, still here?

lyric flint
#

Yup am here mate

olive delta
#

Hahah ok same

#

cuz I searched like forever and asked here and got an answer

#

Hahah so I will transfer the knowledge from me to you lol

#

That sounds weird but okay

#

So

#

Something like that

lyric flint
#

๐Ÿ˜‚

#

So you been here where am at hehe

olive delta
#

Yup hahah

lyric flint
#

So by this the animal

#

will run away from me yea?

olive delta
#

Okay so what you need to change here

lyric flint
#

am reading the node atm

#

yup?

olive delta
#

And 180 = 360 so set the cone value to something like 60

#

Depends on how you want it

#

Wolf ref in my picture is just a wolf, but in your case set it as your character

#

I think I did it like, get player character-> get forward vector-> random cone (60) -> multiply (5000)

#

When the animal saw me and not wolf

lyric flint
#

oh man really thanks

#

that was amazing

olive delta
#

Did it work

lyric flint
#

am going to try it and let you know how to gose

olive delta
#

Ok

lyric flint
#

am testing it atm ;d

olive delta
#

Ok

#

Good luck

#

๐Ÿ˜€

rotund lintel
#

Hello, I am trying to have a path that a player can place down that pawns then can access to move from one place to another. I've never really tackled this topic before so was wondering if anyone could give me a nudge in the right direction?

olive delta
#

@rotund lintel do you mean patrolpath?

rotund lintel
#

Hey that looks really helpful, thank you!

olive delta
#

Ah cool! Hope it will help

fallow hound
#

kaos, what makes it hard to find a navlink in a navigation path?

#

Also for future reference do you mind being pinged?

pine steeple
#

if ya dont ping me, i won't always see your message

#

as long as its not a random ping ๐Ÿ˜„

#

been a while since i tried to detect if a navlink is on a path

#
        const FNavPathSharedPtr& NewPath = PFC->GetPath();
        if (NewPath.IsValid())
        {
            FNavMeshPath* NavMeshPath = NewPath->CastPath<FNavMeshPath>();
            if (NavMeshPath && NavSys)
            {
                for (int32 LinkIndx = 0; LinkIndx < NavMeshPath->CustomLinkIds.Num(); LinkIndx++)
                {
                    INavLinkCustomInterface* const CustomNavLink = NavSys->GetCustomLink(NavMeshPath->CustomLinkIds[LinkIndx]);

                    URTSNavLinkCustomComponent* NavLinkComp = Cast<URTSNavLinkCustomComponent>(CustomNavLink ? CustomNavLink : nullptr);

                    if (NavLinkComp)
                    {
                        const float DistToLink = (MyPawn->GetActorLocation() - NavLinkComp->GetOwner()->GetActorLocation()).SizeSquared();
                        if (DistToLink < FMath::Square(InnerNavLinkClaimRadius) && !MyPawn->bCooldownNavlinks)``` could give you some ideas ๐Ÿคท
#

something i did about year and a half ago

#

@fallow hound

fallow hound
#

Thanks for the code ๐Ÿ‘

forest brook
#

does anyone know if i can somehow have a navmesh on a BP? i have 50+ maps, dont wanna have to go through each of them everytime i change some config

#

everything i need to share betweem maps is in a bp, but then suddenly a navmesh is not possible \๐Ÿคทโ€โ™‚๏ธ

silk vapor
#

How do you make an AI detect multiple enemies/players?

lyric flint
#

@pine steeple am trying to get my zombie Object field

#

So i can get its forward vector

#

but what should i put in the object field as there is no other actor here ;d

pine steeple
#

Please don't randomly ping me :/

#

And you need a reference to your zombie. How you get that is down to your game. You want magically just get a zombie. If there is only 1 you can use get all actors of class and get the zombie. If there is more than 1 you have to store reference to it. Villager should know what zombie is chasing it.

lyric flint
#

okay mate

#

thanks for the tip sorry for pinging you

brisk zinc
#

if an AI character is stopped, blocking a hall/doorway, is there any way to have other AI pathfind an alternative route around them?

e.g. A wants to get to Goal, but B is blocking the doorway to the most direct path. A could go around but instead A just bumps into B and waits there forever.

    ------
A   B       Goal
    ------
upbeat shoal
#

Hello, I was having a problem with AI Spawning animation not working except the Idle. Would anyone know how to solve that?

pine steeple
#

@brisk zinc use crowd following or RVO

brisk zinc
#

@pine steeple crowd following and RVO are both ineffective if one of the actors is stationary

pine steeple
#

i never had issues

#

i also have bump detection

#

if two ai bump each other X amount of times, they move out the way

brisk zinc
#

if one of the AI doesn't (currently) move, then they can't move out of the way

pine steeple
#

why can't they?

brisk zinc
#

stationary character

pine steeple
#

if they get bumped, they can switch behaviour tree, or the one whos moving, if he bumps, he can run a eqs query to find a way around the obstacle

brisk zinc
#

yeah I think the EQS query might be the way to go

#

maybe

pine steeple
#

but stationary AI

#

i mark as Obstacles

#

in the Crowd Following Component

#

then they walk around them

brisk zinc
#

hrm

pine steeple
#
        {
            UAIC->SetCrowdSimulationState(ECrowdSimulationState::ObstacleOnly);
        }```
#

no way to do that in BP though

brisk zinc
#

@pine steeple thanks, I'll look into this

lyric flint
#

Hi guys!
I'm having a weird issue, I have a behaviour tree on an ai character, I find the location of the player char, and feed it into a MoveTo in the BT, yet the AI is not walking to the point I give it. It actually seems like it's walking as far away from the point as possible.
When i track the AI as i walk around some obstacles it seems to be hugging the outer walls of the arena.

Running 4.24, Anyone have any ideas as to why this is happening?

pine steeple
#

@brisk zinc that post does not say anything about him using CFC or RVO.

#

RVO is a no go here

#

CFC always works for me

#

i never get this issue

brisk zinc
#

@pine steeple is CFC different from inheriting from or using Detour Crowd AIController?

pine steeple
#

CFC is Detour crowd

brisk zinc
#

hm

#

I guess I need to figure out how to do that obstacle setting thing in C++ then

meager bobcat
#

is there a way to disable an AI from giving move inputs

#

i tried Set Ignore Move Input and it doesn't seem to work

faint lava
#

Is there any guide on how to setup an array on a Blackboard? I understand that you have create a custom C++ Class that inherits from UObject and stores the TArray there. But how do assign the custom UObject to the Blackboard? I want to have a service that gathers information about the player and store the information on the Blackboard. One of the key things that I want to gather has to be stored in an TArray. Thanks!

brisk zinc
#

@pine steeple here's a screencap of what I'm seeing, does that look like what you would expect if I wasn't setting that obstacle flag?

#

the character seems to go off in the right direction at first, but then can't seem to decide what to do

#

makes me think I have borked a setting. That's using standard character with both AI Controllers set to DetourCrowdAIController. Made capsule a bit wider for both characters. The left hand character is set to MoveTo the position at the end of the hallway. New project so all default settings otherwise.

crimson umbra
#

@brisk zinc It looks like that ai is learning to dance

safe hinge
wary ivy
#

how are you generating them?

simple crest
#

@faint lava just a hint, think of it this way: the blackboard can only store basic data types or references to existing objects created and stored elsewhere. So somewhere else, like in your aicontroller class, you will need to create an instance of your storage class and assign it to the blackboard. If you're working in cpp note that the blackboard does not save objects from garbage collection so you need to actually create and store it in a UPROPERTY

safe hinge
#

@wary ivy fixed it by using reachablee instead of navigable weird....

polar furnace
#

how can i create a custom data binding for scoring factor?

polar furnace
#

never mind i got this

stone cobalt
#

Hi so im new to ue4 and ive only been working on a horror gam for about a month now and ive ran into a problem. I found a fully working AI online and i have already created a map and everthing i just need to make the AI damage and kill the player but i have no clue how to do it. If anyone can help and is willing to help me solve this problem please dm me.

#

I am using the "Horror Engine" project on the marketplace btw and a AI i found online that works really well and matches the map aswell

silver scarab
#

Hey, is there a way to make the ai to follow a custom pattern while following the player (like zigzag)?

pine steeple
#

not out of the box no

#

you could make an EQS query

#

which adjust points

#

but no way to do that out of the bxo

past stone
#

Hi all. I've been having some trouble with follow AI for a WoW style pet, which aims to keep it at their master's side. In the master character class I'm spawning/attaching a TargetPoint actor for the MoveTo position to the master's left side which is then exposed to the pet's blackboard (I tried using a vector instead, offset from the master's location, but MoveTo seems to be very jittery when the location is a moving target and not an actor). The issue I'm having is that the pet will move to the nearest ground location to the TargetPoint. So if the master stands near a ledge, the pet will run down to the ground level instead of just moving closer to the master up on the ledge. I was considering making a custom actor class which detects ground collision etc. but does anyone know a simpler solution?

prime vessel
#

could you just have the pet check if the new point is past a certain difference in z-height, if not, dont move to it? Or something along those lines

#

*zheigt from the character

stone cobalt
#

\

#

sdwasdwa

#

d

#

dwa

#

sorry my macro activated

past stone
#

@prime vessel Thanks, but If the master then jumps off wouldn't the pet then be stuck up on the ledge?

#

Actually, come to think of it the point would never be different in z-height since it's attached to the master character and maintains a constant relative location. It's unreal's AI code which is generating a point that's lower unfortunately. Not sure if that would be accessible.

prime vessel
#

ah I see. true true

#

stairs and AI arent friends

pine steeple
#

just make the "actor" the pet uses as tracking

#

do a check to the floor, if its too high, position itself closer or behind the player

stone cobalt
#

If anyone is willing to help me out on a call i really need to figure out how to make my AI damage my player cause im very new and have no clue

#

DM me plz

pine steeple
#

or ask your question in here. no one is going to jump and call you to help.

stone cobalt
#

ok thanks

past stone
#

@pine steeple That was my plan B but wanted to make sure there wasn't a simpler approach already in the engine. Will just go with that I think - Thanks!

gleaming kettle
#

How do I make a simple 2D boids sim?

#

I've got a fully blank, clear scene

lethal tartan
#

Is there a variable to check if the AI is running a Behaviour tree?

pine steeple
#

not a variable no

desert bison
#

Does anyone have any resources regarding AI Design patterns? Perhaps some recommendations to games( particularly shooters) that have good AI which I could study to improve my own project? Many thanks

lean cliff
#

Hi all

Is there a default implementation for IAISightTargetInterface::CanBeSeenFrom(const FVector& ObserverLocation, FVector& OutSeenLocation, int32& NumberOfLoSChecksPerformed, float& OutSightStrength, const AActor* IgnoreActor = NULL) const Other than in the .h for the interface? I notice it's called from UAI_Sight and I'd be interested in overriding it to add some Stealth strength multipliers to give an output result with an actual value other than 1.0

pine steeple
#

the default is not to use that

#

and does its own trace inside the sight sense

#

AISense_Sight.cpp lines around 308 onwards

high tide
#

@lyric flint Do you use the 2 vectors to make a direction?

#

Then use the direction to point a spawner

#

then cast the ray

#

then it will definitely hit

lean cliff
#

@pine steeple AISense_Sight calls it during the update function does it not? I haven't got it in front of me right now, but that was the reason I was looking to override

It looked like it was calling that to check, and then doing line traces within the if statement. The default for the function returned false...

Come to think of it, was the if statement checking for !true?

#

If so, I'll just make my own class inheriting from Sight sense and override the Update function. Keeping it almost identical but adding additional checks in for other custom class' stealth vars

lean cliff
#

Also. think you mistyped and meant line 208

#

Ah I see what you mean now, I missed the if (Target.SightTargetInterface !=Null) wrapped around it. So by default there is no SightTargetInterface, so we do the tests ourselves. Therefore my best option is to create a child class of AISense_Sight and do custom tests in that else bracket

Cheers

pine steeple
#

well

#

you could kinda copy it out

#

and do it on the specific class

#

so you don't break stuff

pseudo breach
buoyant bison
#

I just want basic following

#

Ping me

midnight scroll
#

@buoyant bison PawnSensing isn't working, Cast Isn't working, or your Pawn isn't in a NavArea.

little pebble
#

@desert bison You may have already seen them, but I found these useful:
Halo
https://www.gamasutra.com/view/feature/130663/gdc_2005_proceeding_handling_.php
F.E.A.R.
https://alumni.media.mit.edu/~jorkin/gdc2006_orkin_jeff_fear.pdf
This video has some useful tips for style
https://www.youtube.com/watch?v=Qq_xX1JCreI

GDC

In this 2017 GDC talk, Bobby Anguelov, Mika Vehkala, and Ben Weber outline core principles to get the most out of your behavior trees while avoiding common issues.

Register for GDC: https://ubm.io/2yWXW38

Join the GDC mailing list: http://www.gdconf.com/subscribe

Follow GDC...

โ–ถ Play video
desert bison
#

Thanks for that GDC talk and those articles ๐Ÿ™‚ @little pebble

safe hinge
#

I've got 300 pawns and my game runs pretty well, only problems is when I close the game it takes very long to shut down. It come from the AI perception component event with an empty bt and no code on the perception update. Anybody know some tricks ?

buoyant bison
#

@midnight scroll is there any way i could know which one or pair of problems it is?

midnight scroll
#

@buoyant bison Put print strings in places. Before the cast and after the cast.

worldly flame
#

@pine steeple still trying to get my AI random spread to work... i have tried doing this:

#

its still shooting a bit off to the left

pine steeple
#

you need to adjust the end point

#

after the trace

#

ie, trace, get impact point

#

adjust inpact point with cone

worldly flame
#

so i need to call the fire spread function after line trace by channel?

pine steeple
#

yes

#

with the impact point

#

that is how i have always done it

#

or you adjust the very start point with a small number

#

and have it fire

#

but i normally ensure the first bullet is straight

#

then subsequent bullets start missing

worldly flame
#

this looks good?

pine steeple
#

two seconds let me look at my code

#

ah sorry i got it wrong

#

i do stuff in c++

#

yeah you need to do it before the trace, let my just do this in bp quickly

#

gimme sec

worldly flame
#

ok

#

yea i def need to do it before... after the trace... its always accurate

pine steeple
#

something like this

#

or just like that if you dont want to set variables

worldly flame
#

thanks let me try it out

pine steeple
#

could use the weapons forward if you have it set up right, but using control rotation forward is always forward of the way the AI is facing

#

which is why i use it

worldly flame
#

the trace is behind for some reason

pine steeple
#

so its firing backwards

worldly flame
#

yea

pine steeple
#

what did you use for the forward

worldly flame
pine steeple
#

why 5000

#

on the actor forward?

#

just plug forward straight in

#

dont multiply

#

Direction is a unit vector

worldly flame
#

now to the side it goes

#

when i hook it in directly

pine steeple
#

set your cone half angle to 0

#

and see if it still does it

worldly flame
#

yea it does

pine steeple
#

right

#

issue is your using actor forward

#

is that of the gun?

#

Owner == gun?

worldly flame
#

owner = controlled pawn but let me make sure

#

yea its controlled pawn

pine steeple
#

so look where your actor is facing

#

compared to gun

worldly flame
#

gun may be a little offset

#

let me see

pine steeple
#

use the gun forward vector

#

and see if its any better

#

without seeing all your code

#

it could be anything

#

maybe teamviewer or screenshare would be easier ๐Ÿคท

worldly flame
#

not bad

pine steeple
#

ya need to ik that hand to gun ๐Ÿ˜„

#

first things you want to do is make sure all your params are valid

#

i would draw some debug lines on tick to see where things go

steady dust
#

Hey all, stupid problem I can't find an answer for. I can get an AI character to sense and chase the player, but getting two NPC's to see and chase each other results in fail. Anyone around that might have a second to point me in the right direction?

crystal grotto
buoyant bison
#

Sorry i have no idea how this thing works

#

Op nevermind

#

I had an idea and it worked

glossy spire
#

Hey folks, having a little issue with Character Movement. When I switch movement modes from None to Walking (via a task), my character is snapped to the floor if he's a certain distance from it.

#

I want to remove the snapping, and always have gravity naturally pull him down

#

Right now, it applies gravity as you'd expect if they're above this distance

#

I'd like to know if / how I can modify the snapping distance in BP

#

Okay, obvious answer of course. I had to set the movement mode to falling, and it automatically becomes walking when he touches down. ๐Ÿ™‚

stark zealot
#

@crystal grotto No ๐Ÿ˜ฆ you make them move to a location with a simple move to. Then adjust a setting in the player movement to prevent players from hanging off ledges and that seems to solve the issue. That's the best I've come up with

pine steeple
#

@stark zealot you can enable partial path in that situation

#

my ai keep following regardless if im off the navmesh or not

dull hatch
#

Hey folks, I've been stuck on a problem with my AI perception setup. I have both Sight and Hearing setup as senses. The issue is that the Hearing stimulus always appears to be "current" whereas the Sight seems to stop being current immediately. This means, if my player disappears round the corner, the AI instantly stop and turn to the location they think is current: the last place they heard the player. This seems really broken. Am I missing something or is the AI perception system not really fit for purpose?

#

Here's my current Tick

void AFPSAIController::Tick(float DeltaSeconds)
{
    Super::Tick(DeltaSeconds);

    AActor *Player = UGameplayStatics::GetPlayerPawn(this, 0);

    TArray<AActor*> Actors;
    PerceptionComponent->GetKnownPerceivedActors(nullptr, Actors);
    for (AActor* Actor : Actors)
    {
        APawn* TargetPawn = Cast<APawn>(Actor);
        if (TargetPawn == nullptr) continue;
        if (!TargetPawn->IsPlayerControlled()) continue;


        const FActorPerceptionInfo* Info = PerceptionComponent->GetActorInfo(*Actor);
        FVector Location = Info->GetLastStimulusLocation();

        if (Info->HasAnyCurrentStimulus())
        {
            UE_LOG(LogTemp, Warning, TEXT("%s Has Current Stim"), *GetName());
            MoveToLocation(Location, AcceptanceRadius);
            SetFocalPoint(Location, EAIFocusPriority::Gameplay);
        }
        else
        {
            UE_LOG(LogTemp, Warning, TEXT("%s Has Stale Stim"), *GetName());
            ClearFocus(EAIFocusPriority::Gameplay);
            MoveToLocation(Location);
        }
        return;
    }
    UE_LOG(LogTemp, Warning, TEXT("%s Has No Stim"), *GetName());

    StopMovement();
    ClearFocus(EAIFocusPriority::Gameplay);
}
#

If I disappear round the corner without ever having made a noise then "Has Stale Stim" is printed. If I have shot a gun then disappear I will always for ever after get "Has Current Stim".

pine steeple
#

o_0

#

let me re-read that

#

@dull hatch i would bind to the perception delegate for performance for a start

#

it fires whenever a perception updates

dull hatch
#

True but that shouldn't change this behaviour I reckon

pine steeple
#

no, so what actually happens

#

you play noise (like foot steps) right?

dull hatch
#

Gun shot in this case. Basically the shot takes priority over sight once you go out of sight. I would expect that the last seen location would take priority.

pine steeple
#

but the last location is where the shot was?

dull hatch
#

And the sight is the dominant sense

pine steeple
#

Dominant Sense == broken

dull hatch
#

Ah, that makes sense.

pine steeple
#

i ended up just using the perception system, to generate aggro

dull hatch
#

I'm looking at whether to teach this to students but it looks a bit too broken to teach.

pine steeple
#

it works, and its better than PawnSensing

#

but there is quirks with it

#

let me dig out my perception stuff i did

dull hatch
#

So you say dominant sense doesn't work. How would you go about getting the location of the youngest stimulus?

pine steeple
#

gimme sec,

#

ah

#

so what i did was, detect the sense

#

if it was sight, i cached the last known sight location, as last seen location

#

in the controller

#

this was my fallback location

#

when other senses didn't detect anything

#

i wrote a small function, to convert sense id to enum

#
{
    if (SenseID.IsValid()) {
        FString SenseName = SenseID.Name.ToString();
        SenseName.RemoveFromEnd(TEXT("_C"));
        int32 SeparatorIdx = INDEX_NONE;
        const bool bHasSeparator = SenseName.FindLastChar(TEXT('_'), SeparatorIdx);
        if (bHasSeparator)
        {
            SenseName = SenseName.Mid(SeparatorIdx + 1);
        }

        if (SenseName == TEXT("Sight"))
            return EPerceptionSense::EPS_SIGHT;
        else if (SenseName == TEXT("Hearing"))
            return EPerceptionSense::EPS_HEARING;
        else if (SenseName == TEXT("Damage"))
            return EPerceptionSense::EPS_DAMAGE;
        else if (SenseName == TEXT("Proximity"))
            return EPerceptionSense::EPS_PROXIMITY;
        else
            return EPerceptionSense::EPS_NONE;
    }
    return EPerceptionSense::EPS_NONE;
}```
#

so i could detect exactly what sense it was

dull hatch
#

Makes sense. Basically move the broken functionality to controller. Thanks that's helpful.

#

Gotta go have dinner will pop back in later.

pine steeple
#

if the sense was sight, i cache the stimuli location

#

but if ya need more @ me

#

cause i thought with this system for about a year

#

i know it inside out

dull hatch
#

Thanks"

crystal grotto
#

you can enable partial path in that situation
@pine steeple
How would i do that ?
I just get to this point inside of my AI-Controller ```cpp
GetPathFollowingComponent()->HasPartialPath();

pine steeple
#

its passed in as part of the move?

crystal grotto
#

I also tried already to update PlayerLocation with each tick where i set the .Z value to the ground height.
But that was also a thing which didn't worked to solve this problem

lyric flint
#

Is there an event that is sent out when AI uses a Nav Proxy Link? I am trying not to execute commands to an AI that accidentally walk over one, would rather have an AI that actually needs to use it execute a command. Any help?

pine steeple
#

@lyric flint not for a normal Nav Proxy link

#

you want a Smart Link

lyric flint
#

Oh ok and what event will be called when AI uses smart link? @pine steeple

pine steeple
#

OnSmartLink Reached

#

you have to make a smart link actor

#

agent is your pawn

lyric flint
#

Thank you so much! This helped me out tons! @pine steeple

dawn loom
#

Does anyone have a good link that has a comparison of c++ vs behaviour trees performance?

#

I'm wondering which ones I should use (knowing myself I'll probably prefer using c++)

#

I'm following an Ai course but it has been full blueprints to some extents that are making my inner optimization freak die

pine steeple
#

Well I use behavioral trees with 100 ai on screen and uses around .6ms game time which is .006ms per ai

#

Behaviour

#

And that is a complex but. But behaviour trees are smart and only run what they need too.

#

I couldn't imagine spending hours and hours writing code for something I can do in 5 mins in a behaviour tree.

#

Especially when you have around 20 unique enemies

real umbra
#

can anyone explain why my AI thinks it sees the player when I'm running in simulation and no player exists? They act normal for a few seconds then run to 0,0,0 and start swinging... Assuming that's because the Vector key is empty, but why do they think they see me?

velvet tinsel
#

looks like initial commit for machine learning support

#

there are python scripts "meant to extend Open AI Gym

pine steeple
#

it was literally just mentioned above

#

if you would have looked

flint trail
#

machine learning.. That's doesn't tell me much

pine steeple
#

well what is machine learning

flint trail
#

right, it's a very broad term.. I mean, what does ML have to do with AI in UE4 and how it all looks like in regards to game AI and Blueprints, in UE4 particularly

sullen escarp
#

Exposes means of having external agents query world and game state and control in-game agents

flint trail
#

@sullen escarp thanks

near jetty
#

@flint trail its for stuff similar to unity ML agents

#

all this kinds of ML agents are basically soemthing like

#
input = calc_input(game_state)

#

the plugin lets you easily define whats that game state, and connect that input to actual game actions

#

for example if you are writing a racing car, your state could be where you are in the track, + some raycasts aginst walls

#

and input is acceleration/turning

flint trail
#

@near jetty so basically all the "thinking" is done externally and fed into UE4 ?

near jetty
#

yes

#

the idea is that you connect it to Tensorflow and other AI machine learning toolsets in python

#

on unreal side you just setup an input that basically gives you an array of floats

#

and you ship that into the ML stuff

#

and it gives you back a list of floats for inputs,which you send to unreal

#

the important part is that this is lockstep

#

i think

#

so it basically goes

#

unreal does a frame -> exports data -> python ML stuffs -> thinking.... -> input back to unreal -> next unreal engine frame

flint trail
#

I wonder if that would help building Westworld-like world for Quest, having all the heavy AI stuff done on dedicated hardware instead of HMD

lyric flint
#

Hi, so... I have a parent AI controller which has some "Set value has" for the blackboard, but no "Run Behaviour Tree", the "Run Behaviour Tree" is in the child. I then created a Behaviour tree for Patrol(which runs good no problems), and created a Behaviour Tree for the child which has a "Run Behaviour" of the BT_Patrol. The problem is that the child goes to the first patrol point and then doesnt go anywhere. Am i doing something wrong?

#

What i have on the AI controller

#

And what i have on the AI controller of the child

#

I tried adding a "run behaviour tree" on the parent AI controller, and it has no problems

lyric flint
#

Found the problem

#

this fixed it ๐Ÿ˜›

lyric flint
#

@worldly flame add a branch with print string

tepid cove
#

Hey guys, I'm trying to make some simple moveTo's with BehaviorTrees and such for my AI's to go and attack one tower, but they always go to the same side, even if I rotate the target, and also it isn't the shortest path. Could this be an issue with the crowd manager?
https://i.imgur.com/5J9KqQj.mp4

lethal tartan
#

Anybody know why when changing the Agent Radius to lower value than 30, my AI character just stops work (doesnt move to desired location like it usually does).
I have to set it to a lower value because once the player hugs a wall to hide, the player becomes invisible to AI perception, I assuming because there is not nav mesh up tight to obstacles.

lyric flint
#

Is CrowdManager usable for making units in a strategy game?

#

Can it make multiple pawns move in formation towards an objective?

lyric flint
#

Or is it more for hordes of enemies that just don't want to collide with each other, like Zombies?

lyric flint
#

Does the default AI controller not take pawns into consideration when path-finding at all? And is that what the Crowd Manager adds to it? Ability to see other pawns and some smart ways of navigating around them?

buoyant idol
#

Hey guys, I've googled a lot about this question from which I thought it would be actually more present, but the threads I found didn't really gave me answers. I'm starting digging into AI atm and my question is actually very simple. Is there a way to control / manipulate / interpolate a movement value in an AI Pawn or Add Movement Input manually? (at a player controlled pawn it would be the axis value).

Or is this something I would have to create on my own like a custom MoveTo Task where I tell my AI Pawn that he has to move to this direction and manually fire a timed event into a movement input? I just would like to control / manipulate / smoothen the AI start/stop movement (and give it a bit random strafing, but thats another story)

wary ivy
#

@lyric flint default path finding only does path finding against the navmesh

#

pawns don't affect the navmesh

#

and I don't think crowd controller does formations, you have to come up with your own system for that

#

it's meant for crowds and resolving pawn to pawn collisions

lyric flint
#

Cool thanks

wary ivy
#

for formations you essentially want to have a formation leader pawn and then calculate desired move goals (the spots in the formation) relative to the leader

#

and then move the pawns towards those points

lyric flint
#

@wary ivy looking at documentation for Detour, it supports formations by writing a custom behavior: "Flocking behavior. Agents behaving that way will behave like a flock, or a herd. This basically means that they will try to stick together as they move, heading in the same direction, and without bumping into each other."
https://masagroup.github.io/recastdetour/classdtFlockingBehavior.html

wary ivy
#

yea you'd have to program the behaviour

gleaming kettle
#

How do I make a simple boids behaviour?

hollow pendant
#

Just upgraded to 4.25 preview7. Has anyone had issues with AISystem.cpp catching issues with the check statement when registering and unregistering components? (check(BlackboardDataToComponentsMap.FindPair(&BlackboardData, &BlackboardComp) == nullptr);)

high summit
#

@tepid cove you can make some target points around tower and in behavior tree logic you can get all target points and move players to random target points

#
itch.io

A free experiment with flocking behaviour

gleaming kettle
#

@high summit I've downloaded the itchio one, how do I work with it?

high summit
#

@gleaming kettle these are only project files, you need to extract and copy this into your project folder

gleaming kettle
#

do I just drag the folder into unreal

#

?

high summit
#

you are importing into wrong version of unreal, these files are created with older version of unreal.

#

no, you need to copy these files into your project/content folder and restart the editor, (not to import direct)

tepid cove
#

@high summit thank you! For now what I've done is a donut EQS, checking for overlaps with other bots, and navigation. As every AI is doing that EQS I think that your aproach would be way better, specially with big amounts of bots running around.

Do you guys know if there's someway to set an EQS' config while using blueprints? I just see the run eqs node and that's it ๐Ÿ˜ฆ

gleaming kettle
#

yeah, it's worked. thanks a ton @high summit !

slow bobcat
#

hi!
Anyone here knows how to make the AI properly decelerate when using MoveTo/AIMoveTo ?
We have our own extension of the CharacterMovementComponent and we override GetMaxBrakingDeceleration to return a different MaxBrakingDeceleration value depending on the Movement Mode (we have some custom movement modes).
Within the BT, we call Stop Movement Immediately, which zeroes the velocity, so no deceleration applied.
What is the right way to decelerate? Is there a Stop Movement function for AI that actually applies the MaxBreakingDeceleration?

Thanks

#

Also, all I can see in the NavMovementComponent in regard to Stop Movement, is calling StopMovementInmediately()

slow bobcat
#

Update:
I just discovered that there're more parameters for path following breaking that I knew. Like the breaking distance

slow bobcat
#

Update #2: I was missing this settings. Seems to work now. Just needs hell lot of tweaking

tepid cove
#

is there any way to pass parameters to EQS while using blueprints? have been searching around but I just find stuff regarding C++ and BTs

slow bobcat
#

is there any way to pass parameters to EQS while using blueprints? have been searching around but I just find stuff regarding C++ and BTs
You have to extend the c++ functionality. it's very easy. All you need is already there.

header

#pragma once

#include "EnvironmentQuery/EnvQueryManager.h"
#include "MyGameEnvQueryManager.generated.h"

//-----------------------------------------------------------------------------------------------------//

DECLARE_LOG_CATEGORY_EXTERN(MyGameEQSManager, Log, All);

//-----------------------------------------------------------------------------------------------------//

USTRUCT(BlueprintType)
struct FEQSParam
{
    GENERATED_BODY()

    UPROPERTY(EditAnywhere)
    float PropertyValue;
};

//extension of the Env Query Request so we can access info hiden by the engine
USTRUCT()
struct FMyGameEnvQueryRequest : public FEnvQueryRequest
{
    GENERATED_BODY()

    FMyGameEnvQueryRequest() : Super() {}
    FMyGameEnvQueryRequest(const UEnvQuery* Query) : Super(Query){}    
    FMyGameEnvQueryRequest(const UEnvQuery* Query, UObject* RequestOwner) : Super(Query, RequestOwner) {}

    const TMap<FName, float>& GetNamedParams() const { return NamedParams; }
};

UCLASS(config = Game, defaultconfig, Transient)
class UMyGameEnvQueryManager : public UEnvQueryManager
{
    GENERATED_BODY()

public:
    UFUNCTION(BlueprintCallable, Category = "AI|EQS", meta = (AdvancedDisplay = "WrapperClass"))
    static UEnvQueryInstanceBlueprintWrapper* RunEQSQueryWithParams(UObject* WorldContextObject, UEnvQuery* QueryTemplate, 
        UObject* Querier, TEnumAsByte<EEnvQueryRunMode::Type> RunMode, TSubclassOf<UEnvQueryInstanceBlueprintWrapper> WrapperClass,
        TArray<FEnvNamedValue> EQSParams);
};
#

CPP

#include "MyGameEnvQueryManager.h"
#include "GameFramework/Controller.h"
#include "VisualLogger/VisualLogger.h"

DEFINE_LOG_CATEGORY(MyGameEQSManager);

UEnvQueryInstanceBlueprintWrapper* UMyGameEnvQueryManager::RunEQSQueryWithParams(UObject* WorldContextObject, 
    UEnvQuery* QueryTemplate, UObject* Querier, TEnumAsByte<EEnvQueryRunMode::Type> RunMode, 
    TSubclassOf<UEnvQueryInstanceBlueprintWrapper> WrapperClass, MyGamerray< FEnvNamedValue> EQSParams)
{
    if (QueryTemplate == nullptr || Querier == nullptr)
    {
        return nullptr;
    }

    UEnvQueryManager* eqsManager = GetCurrent(WorldContextObject);
    UEnvQueryInstanceBlueprintWrapper* queryInstanceWrapper = nullptr;

    if (eqsManager)
    {
        bool validQuerier = true;

        // convert controller-owners to pawns, unless specifically configured not to do so
        if (GET_AI_CONFIG_VAR(bAllowControllersAsEQSQuerier) == false && Cast<AController>(Querier))
        {
            AController* controller = Cast<AController>(Querier);
            if (controller->GetPawn())
            {
                Querier = controller->GetPawn();
            }
            else
            {
                UE_VLOG(controller, MyGameEQSManager, Error, TEXT("Trying to run EQS query while not having a pawn! Aborting."));
                validQuerier = false;
            }
        }

        if (validQuerier)
        {
            queryInstanceWrapper = NewObject<UEnvQueryInstanceBlueprintWrapper>(eqsManager, (UClass*)(WrapperClass) ? (UClass*)WrapperClass : UEnvQueryInstanceBlueprintWrapper::StaticClass());
            check(queryInstanceWrapper);

            FEnvQueryRequest queryRequest(QueryTemplate, Querier);
            queryRequest.SetNamedParams(EQSParams);
            queryInstanceWrapper->SetInstigator(WorldContextObject);
            queryInstanceWrapper->RunQuery(RunMode, queryRequest);
        }
    }

    return queryInstanceWrapper;
}
#

@tepid cove we I did that months ago (we rely heavily on EQS) and 0 problems

#

keep in mind that you will need to make sure your EQS params have unique names. It's very common that you add 2 Distance Tests and their params are named the same

tepid cove
#

Even if they use the same value?

#

well anyway, thank you very much sir ๐Ÿ™‚ I will check it out later โค๏ธ

slow bobcat
#

Had to delete my previous message sorry.

THIS IS CRUCIAL. If you don't fix this, you will have a lot of errors due trash values.
AIDataProvider_QueryParams.cpp

void UAIDataProvider_QueryParams::BindData(const UObject& Owner, int32 RequestId)
{
    UEnvQueryManager* QueryManager = UEnvQueryManager::GetCurrent(&Owner);
    if (QueryManager)
    {
        FloatValue = QueryManager->FindNamedParam(RequestId, ParamName);
        // neither does float to int....
        //original code -> IntValue = *((int32*)&FloatValue)
        IntValue = static_cast<int32>(FloatValue);
        //OriginalCode -> BoolValue = *((bool*)&FloatValue);
        BoolValue = FloatValue >= 1.f;
    }
    else
    {
        IntValue = 0;
        FloatValue = 0.0f;
        BoolValue = false;
    }
}

EnvQueryManager.h

// This is wrong, you can't convert an int to a float doing that
//ORIGINAL -> FORCEINLINE FEnvQueryRequest& SetIntParam(FName ParamName, int32 Value) { NamedParams.Add(ParamName, *((float*)&Value)); return *this; }
FORCEINLINE FEnvQueryRequest& SetIntParam(FName ParamName, int32 Value) { NamedParams.Add(ParamName, static_cast<float>(Value)); return *this; }
#

they are doing a bad conversion of values. EQS params are always floats that get converted to int/bool if necessary. The original code will give you 1.f = 16660686 (int) and shit like that.
It's a must to change that code

#

@tepid cove Even if they use the same value?
If the use the same value it's fine, but it will be confusing if not and nothing guarantees that, with 2 params with the same name, the right one will get the value you want

tepid cove
#

got it ๐Ÿ™‚ thank you!

gilded tree
#

Hey. I'm working on a zombie AI, in which should move to the player if detected by AI Perception. I have set it's field of view to 90, but when it gets close and at odd angles it sometimes loses track of the player. Any typical errors that could be causing this?

jaunty coral
#

Is there a way to get a navmesh character to prefer to turn in place instead of moving in a wide circle? ๐Ÿค”

opaque lance
#

Hey gusy , i have an Ai that would attack regardless of whether its attacks would go through or be obstructed by an object say a wall or a pillar , how would i go about solving this issue? I thought of using a trace to check before attacking but the tricky party is making the Ai move to a place where its attacks would go through you know?
I'm not sure on how to implement that, i thought of just making it move to different sides but its not consistent solution so i'm kinda stumped , any help would be very much appreciated

gilded tree
#

@opaque lance You could run a check to see if the player is within range and then do the attack, which would trigger a linetrace to check if you hit or not? If your AI is supposed to attack, have it move towards the player until its within range. Are you using AI Perception and behavior tree?

opaque lance
#

No no , its a ranged attack , it doesn't need to have the player move , if the player is in its sights it will attack by using projectiles. Range isn't the problem , the problem is if the player is for example standing behind a pillar and the AI sees him , it would attack the player but the attacks will be blocked by the pillar , i thought of using env queries but i lack the experience to express it in such a way.\

gilded tree
#

Env queries could do a check if the line of sight is blocked, if I'm not mistaken

rocky raptor
#

Hi everyone!
I have a problem with navigation system. Tell me please, if this thread is not a proper one.
My problem: In my game you have to control few characters by switching between them and point and click where to go or which item to use and so on. And big part of this game is controlling this characters inside a flighing ship. So navigation is completely broken whenever your ship is flighing not really slow (with 15+ms speed navigation is already shitty).
What I have now, why and what i tried: I have a huge world with level streaming, so making a gigantic NavMesh with updating only around invokers not a solution, because it still completely ruines performance. Also there is a bug, when you have a tall navmesh it don't generate navigation data after some height which is really weird. I also tried to have some NavMeshes for eash character and attach this navmeshes to them, but it still works really weird with invokers, so some of them don't work and it's too difficult to make them always generate data, so it ruins performance too. And the only solution i found is to have a medium navmesh which kinda holds all the characters (they don't need to go really far away from ech other) and move it, when my characters walks from it center for some distance. It works on the ground quite well, but as I mentioned it's really bad on moving objects.
Any suggestions for how to make it work on moving objects too or how to make navigation that can solve my needs is welcome!

slow bobcat
#

Only thing that comes to my mind is: are you using dynamic nav-mesh?

rocky raptor
#

Ofcourse.

slow bobcat
#

if you run the command to show the navmesh during gameplay, do you see it re-generating while your chip moves?

rocky raptor
#

yes, but it glitches a lot when it is moving, so navigation data is kinda behind the ship.

slow bobcat
#

keep in mind that the debug you see is not 100% accurate, so take it with a grain of salt.
Does you AI fail to move or misbehaves then?

rocky raptor
#

Their behavior seems like this debug is accurate enough. They triyng to move but really glitchy. For example if you'll go on the end of ship they'll try to move, and with really glitchy movement they'll jump out of it. (they'll try to move to a dot, which for navmesh will be behind ship already).

#

Also if speed ~25+ m/s movement is a disaster. They act pretty weird an noone can reach needed location/

slow bobcat
#

I worked on a game couple years ago where we had a similar setup: the level was a train that moved (we had a boat too) and we had many problems with movement. We had problems where AI would just fall out since the destination point was not there anymore (the boat moved), we had problems with physics and what not.
The solution was to leave the boat (and the train) static and move everything else around it to make it looks like it was moving.
I know this is not the solution, but sometimes the headache is just not worth it.

(they'll try to move to a dot, which for navmesh will be behind ship already).

I would try to move towards an actor (AIMoveTo accepts you to pass either a point or an actor. If it's an actor, the code updates the location automatically).
You can attach the actor to the ship mesh, so it moves along with it. Them just update the location relative to the ship (to make sure is on top of it). That way, even if you set it up to the limit of the ship, it will never go out, because it moves with it.

The other thing is: if your ai doesn't move, does it move along and stays in the same location while the ship moves?

If they move along the ship movement axis: do they move slower towards the front and faster towards the end? If that's the problem, you also need to compensate for that, because the CMC will not know. This was the main
problem we had in the game I worked and took long to fix (tons of physics). Add jump and you have the whole pack.

Illustrating example of what I mean:
https://www.youtube.com/watch?v=WSSMtNDm65Q

rocky raptor
#

Thank you for your reply! I thought about it too, but ship is actually is flighing physics based ship, so moving anything else would be not less problem.
Also I've already solved a problem how to move to a point on moving objects. I create an actor in point of click, attach it to clicked actor and move to this newly created item. So the only problem is a bad navigation. While flying my actors trying to move, but do it really bad. Also they act normally if they just stand on a moving ship.

slow bobcat
#

umm if are already moving the actor with the ship I would suggest to print all the debug info you can for nav mesh, velocities etc

#

I'm not sure what could happen except your AI is covering more space than the expected by the path following component. Check also if you are using NavWalk in your AI

pine steeple
#

i just don't think the AI system was designed to handle a moving base

slow bobcat
#

in my experience, it's not. But that was with 4.14-to-4.16. Took a lot of effort to get that right. Maybe there are different tools/functions to make it work easily.
You can always create your own Movement Mode and override the Physics movement function to write the compensation there. So "on moving platform->SetCursomMovementMode(MovingNavMode)"

worldly flame
#

i have a move to node in my AI BT... which keeps running even though the AI is already at the location

#

any idea why?

sullen escarp
#

There's an IsAtLocation decorator you can use

wise iris
vale rose
#

hi guys, do you know if there is some way to avoid a character to slow down when performing a MoveToLocation?