#gameplay-ai

1 messages · Page 34 of 1

next hedge
#

Yes. I'm using a Move To task inside the BT. I have a service that is measuring the distance from the AI to the player on tick, and I want it to stop movement when it gets within an attack range, which I'm measuring with that same service. The service is working but the only way the Move To node is aborting is when it gets to its acceptable radius

#

I guess it's doing that because Move To isn't checking that key on tick?

dense owl
#

It’s doing that because MoveTo is designed to run its course before moving on

dense owl
#

And self or both

next hedge
#

Yeah I can get it to stop the MoveTo if I set my blackboard condition to abort self but the rest of the logic must be wrong because it skips over my attack sequence. Hmmm.

dense owl
#

Show

next hedge
#

Screenshot? Or can blackboards be put into a pastebin?

dense owl
#

Just do a snapshot I’m on mobile and pastebin and blueprint UE is crap for it

next hedge
dense owl
#

Oh

#

Well with sequence if one fails they all fail

next hedge
#

ah. So should that be a selector then?

dense owl
#

Yeah

next hedge
#

Cool. One sec. Trying

next hedge
# dense owl Well with sequence if one fails they all fail

Awesome. That's working a little bit closer to my intension. So when a selector gets done going through it's possible branches, does it shoot back up to the parent branch or does it try to keep cycling through all selections? Ideally, if the player is still targeted, but out of range, I want the AI to go back to the MoveTo task until it's in range again.

next hedge
#

So theoretically, if moveto aborts, and it goes into the attack sequence and then that aborts, it should go back up to the selector

dense owl
#

Yes

next hedge
unborn sphinx
#

😭 🤣

dense owl
#

Excellent lol

unborn sphinx
#

hmmm but wait

#

we are getting warm

#

whatever it is I am looking at, it's not working as intended

#

digging into it, it seems like the effect causer of a gameplay effect is not properly being set... possibly in blueprints

dense owl
unborn sphinx
#

i commented out this line from LyraHealthComponent.cpp and nothing seemed to change grr

    // Register to listen for attribute changes.
    AbilitySystemComponent->GetGameplayAttributeValueChangeDelegate(ULyraHealthSet::GetHealthAttribute()).AddUObject(this, &ThisClass::HandleHealthChanged);
    AbilitySystemComponent->GetGameplayAttributeValueChangeDelegate(ULyraHealthSet::GetMaxHealthAttribute()).AddUObject(this, &ThisClass::HandleMaxHealthChanged);
    HealthSet->OnOutOfHealth.AddUObject(this, &ThisClass::HandleOutOfHealth);

    // TEMP: Reset attributes to default values.  Eventually this will be driven by a spread sheet.
    AbilitySystemComponent->SetNumericAttributeBase(ULyraHealthSet::GetHealthAttribute(), HealthSet->GetMaxHealth());

    ClearGameplayTags();

    //OnHealthChanged.Broadcast(this, HealthSet->GetHealth(), HealthSet->GetHealth(), nullptr);
    OnMaxHealthChanged.Broadcast(this, HealthSet->GetHealth(), HealthSet->GetHealth(), nullptr);
unborn sphinx
#

lmfao wtf

#

oh nvm the check was not hitting lmao

unborn sphinx
#

it seems the problem is that the instigator-getting function is never ever called for some reason even tho the line that calls it is executed...

#

I think it is somewhere in the damage gameplay effect blueprints grrr

#

this is no longer AI related I will stop tlaking lmao

lyric flint
#

I just saw that Cropout Sample runs Behavior Tree directly on BP_Village (AI) instead of on a custom AIController. Why? Each tutorial about using BTs creates an AIController child

celest python
#

it just exist to represent the brain of the AI

dense owl
#

Or they don’t want to modify the default in case they want a different one later

dusk pewter
#

@polar rose sup dawg?

polar rose
#

@dense owl Yeah. I started yesterday, but it's a 10 day jam.

dusk pewter
#

unluckily i had 7 cases of AI tests in a 5.1 project, but i just deleted that like a day ago

polar rose
#

So I don't want to waste an entire day. And 8 hours of work is a lot to redo when the project is new. lol

#

But yeah. I might try to package later today to see if that's the issue.

#

Honestly the AI stuff is pretty simple so if state trees have issues still then I'll just move everything to blueprints.

dusk pewter
#

Well if it's a cache issue, it's just a matter of making a new project and migrate everything to it or cloning

#

that fixes like 99% of cases

#

OR

#

make a new AI tree and just copy noodes

#

and get rid of old one

#

because it is either a project cache issue or an asset cache issue @polar rose

#

is the project on Git and shared with others?

polar rose
#

Okay. Good to know.

#

Nah. It's all local.

dusk pewter
#

ok, then chances are it will work

#

I wish i could help more but my 4 year old wants to play dinosaurs so I'll check back later 😉

polar rose
#

I just finished downloading 5.3. What are the major issues with it? I might just clone my project to 5.3 and see if I run into the issues there.

dusk pewter
#

a lot of stuff broke

#

check release notes

dusk pewter
#

"known issues"

polar rose
drifting zealot
#

I want to implement AI hand-holding and walk together with player, I've tried some ways like using physics constraint.

unborn sphinx
# unborn sphinx it seems the problem is that the instigator-getting function is never ever calle...

to follow up on my AISense_Damage not working in Lyra: it is a known(ish) issue in replication/propagation of attribute changes, in regards to gameplay effect contexts which don't pass the instigator along... bla bla bla. the solution I found was to "fix" this helper function in LyraVerbMessageHelpers.cpp:

FLyraVerbMessage ULyraVerbMessageHelpers::CueParametersToVerbMessage(const FGameplayCueParameters& Params)
{
    FLyraVerbMessage Result;
    
    Result.Verb = Params.OriginalTag;
    Result.Instigator = Params.EffectContext.GetInstigator();
    Result.Target = Params.EffectCauser.Get();
    Result.InstigatorTags = Params.AggregatedSourceTags;
    Result.TargetTags = Params.AggregatedTargetTags;
    //@TODO: Result.ContextTags = ???;
    Result.Magnitude = Params.RawMagnitude;

    return Result;
}

Change the instigator line to Result.Instigator = Params.EffectContext.GetInstigator(); which will return the actual player state of the instigator, instead of (incorrectly?) the same data as the target...

Then on the Hero Mannequin, refactor the reporting of damage.

#

top: broken, old lyra. bottom: fixed message-based implementation

dense owl
#

Well done

unborn sphinx
#

oh shit I should probably switch on authority tho

#

lmao

unborn sphinx
# dense owl Well done

thanks for helping me with sanity checking. You provided the confidence that I needed to look into lyra not the ai setup lmao

dense owl
unborn sphinx
#

i am a masochist

#

now how do I get ai hearing working lmfao. Is it just manually sending "sound" events at locations with radii?

unborn sphinx
#

yeah it had that all set up but when I swtich the EQS to only hearing they sense nobody

dense owl
#

🤔 check range ?

unborn sphinx
#

ohhh nvm it was set up on pawn but not on AI controller

dense owl
#

But also is the AI perception configured

#

Hehe ok

unborn sphinx
#

still doesn't work hmm. what are the general steps to get eqs hearing working? it should just respond to sound? maybe the sounds don't exist except to the client facing stuff?

#

I have to use a report noise event doh

#

should I put the report noise event on the GCN_Weapon_Pistol_Fire etc for each weapon? ugh!!

#

should I ensure has authority in the GCN!? only the authority should report noise, right?

dense owl
unborn sphinx
#

k thanks I will stop bothering u lmao

#

but I do need to report noise? It is not deduced from actual sound in the game?

dense owl
#

No bother, I don’t know enough about multiplayer and replication is all

#

I don’t think you need to report it

#

Iirc you want to play sounds using multicast but when it comes to AI perception stimuli and multiplayer idk tbh

#

Ik you need to report damage but the sound is caused by a stimuli so you shouldn’t need to report

unborn sphinx
#

yeah I have a feeling the sounds are not replicated and are only played for clients. I will likely have to report the noise. especially in a dedicated server there would be no reason to play noises

dense owl
#

Ah maybe then

#

I’ve only really touched on sight so far and even then I haven’t gone as deep as Lyra probably does

unborn sphinx
#

oh lyra does not go deep on sight or anything but they go deep on replication and other weird nonsense lmao

#

thank you for the help i gtg for now be back later reporting back how my reporting noises went

limber prawn
#

Is there a way to mirror the direction an EQS cone goes without rotating the actor? I'm looking for the query to shoot out behind the actor instead of in front

unborn sphinx
#

looks like a GCN is not a good place to tie into for AI perception... I think. Though it might work since AI is only run on the server...

vestal gale
#

Just going to bump this, still curious which is best

unborn sphinx
#

actually maybe a GCN is a great place to do it, because while all clients might not receive it reliably, the server is the only one that cares about receiving AI perception stimuli

#

clients never run ai controllers... right? lmao????

unborn sphinx
#

yeah it seems to work properly with a client and listen server on the same pc. proper player gets detected by ai if its client or server

upper terrace
#

I'm still looking to find of how can i turn my wheel with ai. I mean ai turn it left and right.

#

If anyone know. About it pls share it

lunar grove
#

I have already twice , fail to implement myself

upper terrace
#

So finally now my ai can turn the wheel

#

I want to know how can i tell the ai if the player is in left or right. So that it can turn according the wheel to it

upper terrace
#

Hello when I have opened ai debugging and pressing key 0 or 1 Or 2 Or 3 or 4 none of them work I want to see ai perception but i still not activating when I press the key

#

Anybody know why it is not working

ivory lantern
fading field
#

I'm trying to make a context to make my AI look for cover. I need to pass an actor from within my AI into that query context. Any idea how that should be done, I can't seem to figure it out.

#

Wait I think I got it

#

Okay next question 😄 Can I somehow use a coordinate instead of an actor as context?

upper terrace
ivory lantern
# upper terrace Yes

If you are using UE4,
there is a bug with the Ai debugger
sometimes it doesn't show,
Usually it always fix itself after I close and reopen ue4 many times,
I do not know the amount of times but that's what happens

upper terrace
#

Then it's on my luck

full wing
full wing
#

Ok so i just deleted the sight sense and then added it again and it works 🙃

full wing
#

Also this fixed this problem, i think the problem was with "Auto success Range from last Seen Location" that it somehow worked, even tho it was set to -1?? but reseting this sense fixed it.

uneven cloud
uneven cloud
uneven cloud
jade steeple
#

Anyone know how to get the debug overlay for AI to come up in VR? When I hit apostraphe it gives me the "press 1-4" dialogue in the upper corner, but when I press say 4 for perception - there is no overlay in VR.

upper terrace
fading field
wild nova
#

how do I make the PerceptionComponent continuously update the Player's location after the OnTargetPerceptionUpdated event is emitted?

fading field
#

The EQS debug is also very buggy, not sure if that's an unreal thing or if I'm doing something wrong

uneven cloud
uneven cloud
wild nova
#

in my case the enemy moves towards the player, but then doesn't follow after reaching the position where the player was first seen, only if it unsees and sees the player again will it move again

#

I'm updating the player location in a method that I bind to OnTargetPerceptionUpdated

fading field
uneven cloud
wild nova
uneven cloud
upper terrace
#

@uneven cloud I'm using find look at rotation node to make the ship look at my character but I'm facing a problem it is not behavior like a enemy like when it moves it sometimes goes too far and doesn't come back to me. I want my ai ship to follow it to attack on it. But the problem is that. I can't find a way to tell it that ai move to that location

#

Or chase it

upper terrace
dense owl
upper terrace
dense owl
#

if you @ someone, you're pinging them

unborn sphinx
#

is there a better way to spawn a dummy actor so that gunshot locations can have an instigator actor but not reveal the shooter's position immediately, but still draw attention to the location of the bullet hit?

Is there a better empty actor to spawn than static mesh? I have no mesh and I set the life as 5 seconds.

dense owl
unborn sphinx
#

hearing sense needs an instigator actor or it won't be sensed

#

and so I want that actor to be at the location of the gunshot

#

I could probably figure out how to use the spawnd niagare emitter or something but that seems hard

dense owl
#

yeah, just spawn an empty actor with a stimuli source I guess

unborn sphinx
#

oh yeah and that doesnt exist on the server

unborn sphinx
#

but is there a better dummy actor? something more performant? seems to work fine with the empty static mesh actor

dense owl
#

no need for a mesh then, if you just need a location

unborn sphinx
#

yeah there is no mesh it is just the empty actor

dense owl
#

dw about performance until you need to

unborn sphinx
#

yeah true

#

LMAO

#

moving on

#

they get cleaned up in 5 seconds anyway

#

the impact noise report is to abort enemies into the targetting subtree so they are more likely to see and respond to the shooter if they see them or hear them too

#

it would be weird to be peppering the NPC with missed shots and they stand there in idle state as if nothing is happening

#

I don't think it is recommended to use it at this point, is it? from what I heard it is too early unless u wanna build out all the functionality

#

buuuuut I forget what they said was missing lmao

dense owl
#

idk, someone was trying to learn how to use it for a 10-day game jam, so that should be interesting

unborn sphinx
#

oooof

#

i'm on day like 330 of my 90 day game jam

dusk pewter
#

@polar rose did it work out in the end?

polar rose
uneven cloud
unborn sphinx
#

Tell me if I'm wrong: So that the hearing report can be given an instigator actor (required) that is no the player that shot the bullet, and is at the impact point. I can easily make the sound appear at the impact point, but without an actor I can't divert the npc attention away from the shooter and towards the bullet impact.

uneven cloud
unborn sphinx
#

Well I want it so that if a bullet hit is heard, but the shooter is so far away that the gun shot is not heard, only the bullet impact, then only the bullet impact draws attention. I might then do a special "trace from the bullet impact to possible shooting locations" or something

uneven cloud
#

Reporting a noise event when the bullet hits using the bullet's instigator (the player that shot it) does that.

unborn sphinx
#

I am using EQS to just add the perceived actors to a key for the NPC to look at. I am putting this report in the gameplaycuenotify triggered when the gun is shot. From there, I can easily add the shooter as the instigator, but I have no easy to get actor at the impact point (that is definitely for sure on the server, as effects are not spawned on the server)

#

If I add the shooter as the instigator, the NPC immediately are given the actor, not the impact location

#

well, I bet I can use some blueprint logic somewhere to get the noise location, right?

#

with eqs it seems to just set the instigator as the key and that is all

#

a simple EQS node or service

uneven cloud
#

You can get the location from the perception component if you have a target.

unborn sphinx
#

ah ok so if I make a custom eqs generator I can filter and add the noise location and set it as a movegoal or something?

#

without an actor, tho, the "setfocus" stuff won't work?

#

with an actor the npc ruthlessly stares down the actor

#

with a vector it just goes there looking straight ahead

#

there is some nice turn-in-place animation on the character, so having the setfocus precisely turn the controller to look at the impact is pretty nice looking

#

please please let me know if this is not the best approach

#

important is that this is multiplayer reliable

uneven cloud
#

Set focus works with an actor or a location

unborn sphinx
#

when I set focus on a location it seems to not look up and down

#

setfocus lets the controller point RIGHT at it

#

setfocus on an actor rather

uneven cloud
#

Set focus doesn't look up or down, unless you've added look at.

unborn sphinx
#

ohhh

#

well it does look up and down with an actor in my case dunno if that is something weird with my proect lmao

#

is it better practice and simpler to make a custom eqs generator to extract location, and do those things, instead of spawning that temporary dummy actor?

uneven cloud
#

You either added it or started with a template that has it. That means you can edit it to work with locations.

unborn sphinx
#

using lyra

uneven cloud
#

Yes it's better to use the systems as intended than to try weird hacks.

unborn sphinx
#

but then I did change how the CMC controlls the rotation or whatever, so that I can limit the rotation speed

uneven cloud
#

Look at is likely in the animation BP.

unborn sphinx
#

is there a big red flag with the way I spawn the actor?

#

ohh is there ai related logic in the abp?

uneven cloud
#

Look at really isn't AI

unborn sphinx
#

oh ok right

#

but what is the distinction between setfocus on a vector vs an actor?

#

where does that logic shift?

uneven cloud
#

There is no shift in logic. On the AI side it works the same. Like I already said, it's the LOOK AT FUNCTIONALITY that is handling it differently. Which is animation and not AI

unborn sphinx
#

is it because I am projecting the vector to the navmesh?

#

ok thanks lemme look

uneven cloud
#

Why would you project it to the nav mesh before setting focus?

unborn sphinx
#

well i guess that is on the move to node

#

sorry i am new to this lmao

#

no you know what maybe I am confusing scenarios here

#

I am thinking of the difference between move to vector and move to actor. I do not know if I tried the difference between setfocus vector vs actor.

paper sparrow
#

Is there a good guide or doc or example on best practices for writing production-ready AI / behaviour tree code? There seems to be a lot of 'beginner's' tutorials but nothing more advanced

I've had a look at lyra, but is there anything else for more 'persistent ai?

unborn sphinx
#

yeah that seems better than running eqs as a service on some node tbh

#

then any hearing will just come through no matter what and abort anything it needs to

#

oh wait how do we deduce what kind of sense it is?

uneven cloud
unborn sphinx
#

ah so maybe eqs is better actually, running like every half sec?

uneven cloud
unborn sphinx
#

there are lots of talks from gdc and the like but not really about UE specifically that I know of

#

I kinda like my dummy actor idea. I want the bullet hits to be more like distraction mechanics than alerting to the player. The gunshot itself is meant to report the player

uneven cloud
unborn sphinx
#

but I don't see an easy and clean way to get that?

#

eqs just adding the dummy actor works easy

uneven cloud
#

Stimulus location.

unborn sphinx
#

but you said you wouldn't do it that way lmao. ok so say I do like the graph I had above. How do I filter based on only hearing sense?

uneven cloud
#

I said I wouldn't do it on perception updated.

unborn sphinx
#

any better event?

#

I am new to this not familiar with what event to use

uneven cloud
#

No. The EQS or a service

unborn sphinx
#

oh wait ok so you can just break the stimulus from an eqs thing hm lemme see

#

with that same get actors perception node

#

ok so then I need the target like u said is that easy to get?

dense owl
#

There’s tests, no?

uneven cloud
#

You can create a generator that only gets the stimulus location

unborn sphinx
#

so this is one of those custom BP generators then not like the generic eqs generator?

#

with the dummy actor I could simply run this as a service and get all the behaviour I need. no?

#

like I suppose it would be weird that the npc is investigating the bullet impact more thoroughly than the distance but heard gunshot sound

#

they would quickly discard the impact site as a point of interest, because the dummy actor has a 5 second life span and also the other things can blank that key given conditions

#

I could even do it so it prefers distant sounds to investigate

#

that would then give priority to the gunshot if heard, then impact if not

bitter wyvern
#

Hey does anybody know if there is a way to resize, or move the navmesh bounds at runtime? I have changed the runtime generation to dynamic and the bounds are moveable, but when I update the location of the bounds the generated space does not change. I am trying to make an endless linear level, so I just want to move the navmesh bounds along as I spawn in new chunks of the level.

unborn sphinx
#

oh lmaoao nevermind I just had the key still set to selfactor

uneven cloud
bitter wyvern
#

found it lol thanks

unborn sphinx
#

when would a stimulus not be succesfully sensed but got from actors last sensed stimuli?

unborn sphinx
# uneven cloud You can create a generator that only gets the stimulus location

I took your advice and broke it out into two EQS generators: one for location of all noise reports, and one for actors of gunshot sounds. This way the AI can track the exact location to spook the player better briefly, then investigate in a less heightened state the locations they heard the noises from. Thank you. No more dummy actors (they didn't work anyway, they were ignored)

unborn sphinx
#

had to change from perceived hostile actors to just perceived actors so I can sense team damage/events and retaliate if needed lmao

vestal gale
upper terrace
#

So far I was able to turn my ai ship to my ship whenever I change the location. But the problem is that it is only changing rotation when my character change location. I want it to automatically detect my ship location and then rotate towards it.

lunar pulsar
#

hi so my behavior tree looks like this, but when my ai reaches me, it just stops and when i press the ";' key it shows that it is constantly switching between parts 13, 14, 15 and 16, and they are constantly blinking

dense owl
dense owl
upper terrace
#

And u know players will take benefit of this

upper terrace
dense owl
#

You’d have to show code to see what’s happening

upper terrace
slim egret
#

Hi people, is there a way to fire a BTTask without using BTs? Say I want to use the MoveTo task, do I need to implement this manualy with querying the nav mesh system and finding path if I want to do this outside of BT?

finite gyro
#

Is there a way I could make a custom input float in one of these?

#

like when you make an input for a function, just for a task

dense owl
dense owl
finite gyro
dense owl
finite gyro
#

:D

#

like a function input

#

just in a task

#

and i can then copy the task 10 times and write a different float for each instance

dense owl
#

You would just change the float bb key to something else before you run it

#

Having said that, BT might be the wrong tool to use here

#

Hence why I asked to describe your actual goal (not how you think of achieving it). Like what is the actual purpose

#

Also, copy pasting stuff is bad programming in general, not only with tasks. You can always run subtrees after you’ve set a value for the bb key

finite gyro
#

the goal is to make a custom "MoveTo" node where I can set my own acceptance radius as a random number between two floats

#

instead of a constant number

#

so I can then use it throughout the BT and set my own values to whatever I need in that place

#

exactly like inputs in a function work, just with tasks instead

#

but i guess it's impossible unfortunately

dense owl
dense owl
finite gyro
#

with AIMoveTo node inside of it

#

I want the exact same functionality, just be able to change the acceptance radius to a range instead of a constant

dense owl
#

In a custom task you can get the BB and use the get value as nodes

finite gyro
#

i asked in cpp and they said it would be hard to do

finite gyro
#

i want to use it like you would a function, just plop a copy of the function and change the input to whatever you want

dense owl
#

Yep in another task or outside the tree

finite gyro
#

using BB keys kinda loses the entire point of what I'm trying to do

dense owl
#

Not necessarily. I’m not saying this is the right way to do it but you can get the BB and set value of a bb key from outside the BT, then run that subtree

finite gyro
#

I mean the default MoveTo node already does this

dense owl
#

Yeah but you can’t change it dynamically

finite gyro
#

I want the same thing just have a range instead of a constant

dense owl
#

Oh

finite gyro
#

cpp people said it's too hard to do for someone who doesn't know cpp

dense owl
#

Like a random value?

finite gyro
#

so I'm trying a workaround

#

yeah random value in range

dense owl
finite gyro
#

:D

dense owl
#

Why not just use a function that gets you a random value and then run it against that value

dense owl
finite gyro
#

In one BT branch I wanna set 100-200, in another I need 10-20

dense owl
#

Ah, well Luthage will prly know the exact way to do this so I’m gonna hide under the table now

finite gyro
#

for example

uneven cloud
uneven cloud
uneven cloud
finite gyro
#

@dense owl we were seriously overthinking this 😂

#

THANKS

#

I feel super dumb now

dense owl
finite gyro
#

:D

#

I completely forgot that variables do that in a task

dense owl
#

yeah, I kept saying bb keys when what I really meant is the public vars used by the nodes

#

good thing we have Luthage to keep us from stumbling around in the dark lol

uneven cloud
#

Using BB keys is better, but to add a BB key you just add a public variable to the class. Same way as adding any variable.

finite gyro
#

This is all I wanted to do

#

I'm just an airhead sometimes

uneven cloud
#

It's not exactly explained anywhere that BT nodes are special in that you only need to add a member variable. Most other classes don't work like that.

unborn sphinx
#

holy crap when a good BT comes together it is fun and feels emergent lmao. I have it so that the "neutral" NPC who don't have gunns will remember anyone who hurt them and if they ever get a gun they will shoot the person who hurt them if they see them lmao

#

so thanks for the help haha

unborn sphinx
uneven cloud
unborn sphinx
#

Oh nice I did not know that thank you very much that is wild. I guess we implement that in the event graph?

#

This is like world changing lmao

uneven cloud
#

Just override the functions

unborn sphinx
#

That is friggin amazing so basically I can have it so whenever a service is relevant/active, the npc can be performing a run ability, and then reliably cancel the run ability when the service is not active...

#

I guess that is the whole service lmao. no tick needed

#

Does that seem like an appropriate use of it or no?

#

this functions, right? Well... this explains a lot. I had some big gaps in knowledge and was using this activation event as if it was ticking... oops

unborn sphinx
#

woah we can make services in c++ eh hmmm

dense owl
#

You can make anything in cpp

unborn sphinx
#

true yeah but I usually just do what is generally advised sometimes the docs don't tell you to use c++

#

interesting thanks that makes sense with the ticking and all

#

I was so proud of my BT when I went to bed last night and suddenly I realize it is pure crap lmao how does it even manage to work at all

hexed plank
#

So, I'm new to stuff like behavior trees and AI's in general.
I wanna make sure I got this correct.
Tasks are called from left to right (1-how many you have)
So if I wanted to make a function for an AI that wanders until they see a chair and sits on it, I'd do this with a sequencer?
1: find a random location.
2: move to random location.
3: if there's a chair in a 10-meter radius around the AI it will have a 50/50% on either continue wandering, or to continue to next task.
4: move to chair.
5: sit on chair for 20 seconds - 3 minutes.
6: get up after x-amount of time, and repeat task 1.

patent hornet
#

Sequence, not a Sequencer

#

and yes, you can do it that way, note that any failed task will just restart the BT from root

#

so you do not need to do repeat task 1

#

just get up and let the BT rerun

gilded tree
#

Hey guys. I'm using the Ai Detour Crowd controller, but if I move behind a rock, and the AI isn't able to cross the rock, they just stand on the opposite side waiting for me to move. How can I ensure that he'll find an alternative path, i.e around the rock? Using the MoveTo BT node for movement.

patent hornet
#

for the tree to restart

#

also note that if you wish to do 50/50 in a task (service + decorator would be more natural fit, but task can do it) you need to call FinishExecute with Success false

patent hornet
#

detour makes no difference here

gilded tree
#

Hmm yeah since detour is for avoidance of other AI right. Recast navmesh? Never heard about that term before

patent hornet
#

press P in editor viewport

#

or type ShowNavigation in the console

uneven cloud
#

That's certainly a hot take

uneven cloud
uneven cloud
gilded tree
#

Let me check 🙂

#

Where do I actually enable that?

unborn sphinx
#

move to node

#

(i think)

dense owl
unborn sphinx
#

What does eqsrequest with run mode: all matching do?

uneven cloud
unborn sphinx
#

I suppose we can not set that as a BB key and it is just useful for debugging? Or if using the EQS in c++ or without a bt?

vestal gale
hexed plank
#

Not sure where this'd go, since this is technically a animation issue. But could be tied to blueprints.
But anyway, I'm trying to swap animations for this sequence in this AI's main BP. It was working with the previous animation, but now with the new one it just A-poses when it tries to do the animation. Even though the Animation Sequence is playing the animation just fine.

#

Wait, I'm dumb. Don't mind me

unborn sphinx
#

btw a gameplay cue notify is NOT a good place to do anything with sending AI Perception stimuli if you intend to use dedicated servers. they run on listen servers but not dedicated ugh

daring locust
#

I've been following a tutorial made in UE4 while I'm in UE5 and I'm having an issue where we don't have the same nodes as each other. Does anybody know how to get the "target perception updated" in UE5?

dense owl
lunar pulsar
#

Ah

#

If you remember tell me pls

daring locust
#

I think I found a bug? I have these custom tasks set up. All they do is print text. I used them to see what my enemy is doing at any given time, but they reset to a default "Hello" whenever I restart the editor

#

Not sure what to do about it. Just wondered whether it's known or not

dense owl
daring locust
#

But if there's a better way, I'd gladly hear about it

dense owl
uneven cloud
daring locust
uneven cloud
distant snow
#

How do I access the handle of a Smart Object Component, if I have a reference to the component itself?
For example, I have a smart object component on a chair for sitting. If the chair is upended, I want to disable the smart object

rare stump
#

hello my ai character moves acording to xy but doesnt go acording to z the variable is vector

rare stump
#

comon i have to go after 1 hour i need help with this so i can start polishing my game finally

uneven cloud
vernal jacinth
#

I have an NPC that I'm moving with AIController->MoveToLocation, however if a player character is standing between the NPC and the location, the NPC will move against the player character as if he's not there, I have fixed this by setting the player character's mesh "Can ever affect navigation" to true

#

but now I'm learning about the "DetourCrowdAIController" and that it can also be used to avoid these types of situations

#

from a performance standpoint which is better to use? The DetourCrowdAIController? or simply having "Can ever affect navigation" set to true on the player character?

hushed lodge
#

This may drive me nuts, anyone ever create a BT and it just keeps running moveto over and over, but the actor never moves? I set a breakpoint and can see it passed in a vector.... Feel like I'm missing something

#

Nevermind, I got it, I think I left the variable not "instance Editable"

dense owl
vernal jacinth
#

what would you recommend for moving vehicles?

#

at the moment I'm also using "Can ever affect nav"

#

but that too causes alot nav mesh regen to happen

#

cant really use detour for those though

dense owl
#

Yeah that’s very expensive (mesh regen)

#

You can try CCD if detour doesn’t work

#

Should still work tho, might need to change some settings like agent radius tho

vernal jacinth
#

I see, I'll give it try then, thanks

stoic flame
#

Does anyone know why my eqs wont pick up on the actor? I understand the root of the actor is out of the nav mesh, but I have tried adding a collision to make it be detected?

fresh vortex
#

Hi, anyone here have any idea why AI might work in-editor but fail to even move in a packaged build?

stoic flame
#

Yes, the actor is the door but it also has a collision box within the actor (overlapping into the nav mesh) with the collision as 'Query and Probe'

dense owl
#

pretty sure you need it to be on the navmesh, or have a nav link where the door is

vernal jacinth
#

I'm calling ADetourCrowdAIController->MoveToLocation

#

trying to move the npc to that green sphere you see on the video

#

but he doesn't dodge the player, he just keeps moving through him, as if he's not there

dense owl
#

Try increasing his nav agent radius or yours

#

Or both

vernal jacinth
#

those are the settings at runtime

dense owl
#

Yeah that’s odd

vernal jacinth
#

and on the BP, they are:

dense owl
#

Try swapping off detour and use CCD instead

vernal jacinth
dense owl
#

Use normal AICon

#

And turn on CCD in its settings

vernal jacinth
#

ok gonna give that a try

vernal jacinth
#

or you mean the player character settings?

dense owl
#

Uh sry might be on the cmc

#

Checking now

#

Sry I meant RVOAvoidance not CCD

#

It’s on the CMC

vernal jacinth
dense owl
#

The npc

graceful panther
#

I have some npcs with completely unplugged event ticks/behaviour trees animation blueprints etc that are causing large frame drops... I can have hundreds of the same skele mesh animating with almost no effect on framerate -- anywhere I should look? In profiler it seems like the anims are what is causing the spike but its the same anims

vernal jacinth
#

ok I think something broke, now MoveToLocation is not working anymore 🤔

#

I havent even done anything yet

dense owl
dense owl
vernal jacinth
#

from ADetourCrowdAIController

graceful panther
#

on the left is a few giving me 40fps

#

on the right is a few hundred giving me 80

dense owl
vernal jacinth
#

trying that now

vernal jacinth
dense owl
#

Something is tied to it

vernal jacinth
#

now MoveToLocation is working again

#

I havent tried RVO yet though

#

I was going, but moving back to AAIController broke it

#

going to try RVO now

#

oh

#

turns out its already checked

#

has been checked all along

#

I tried checking it on the player character too and now it works, but it causes other issues, like my controlled character automaically dodging the NPC, which is expected, so not a solution 🤔

dense owl
vernal jacinth
#

having on NPC only does nothing though

dense owl
#

No I mean detour or RVO not both

vernal jacinth
#

ah

#

I see

#

let me try again to see if I can go back to AIController then

#

I think its BP corruption, because of the Crowd Following component

#

changing its type but not recreating the controller BP might be an issue

#

ok yep

dense owl
#

I’m not sure sry

vernal jacinth
#

blank details tab

#

Failed import: class 'CrowdFollowingComponent' name 'PathFollowingComponent' outer 'Default__BP_ShooterController_C'. There is another object (of 'PathFollowingComponent' class) at the path.

#

its ok I can recreate the BP

#

but maybe I'll try unchecking RVO on NPC first and see if the DetourCrowdAIController works

#

ok, nope, seems like DetourCrowdAIController has no effect whatsoever, even with RVO disabled

#

I wonder if its something to do with my agent radius always reverting to 34 on runtime even though I change it on the BP to higher values

#

although 34 is correct since thats the radius of my capsule component

#

going to try RVO now with AIController

#

ok so I recreated the BP now

#

just using AIController instead of DetourCrowdAIController

#

and RVO

#

but still doesn't work

#

only thing that "works" is if I enable RVO on both NPC and Player

#

but then that has other issues

#

I guess I'm only supposed to enable on the NPC

dense owl
vernal jacinth
#

some say DetourCrowdAIController + RVO should be used

#

some say its incompatible

#

I guess it has changed alot over the years

#

looking at the source of UCrowdFollowingComponent (which DetourCrowdAIController uses), I can see references to RVO though

#

that said, I've tried to use both at the same time and both individually, but none seem to work 🤔

#

same result as the video

#

so I'm not sure if I really have any other choice but to use "Can ever affect nav" although I really wanted to avoid that

dense owl
#

I usually go by what Luthage says and iirc she said don’t use both

vernal jacinth
#

none seem to work me although if I could choose, I'd choose RVO since it seems to be more lightweight since it doesnt use the navmesh

polar inlet
#

I have a ai I am spawning and when it runs GetBlackboardComponent()->SetVAluesAsVector("StartLocation"), GetPawn()->GetActorLocation());

it fails. I think it has something to do with the actor location because thats when it fails

dense owl
#

Odd that the agent radius is locked tho

dense owl
#

I could be reading that wrong, my cpp is not as good

vernal jacinth
dense owl
#

Well no you can’t edit it at runtime

polar inlet
dense owl
vernal jacinth
vernal jacinth
polar inlet
vernal jacinth
polar inlet
#

on it

vernal jacinth
#

this is me changing at runtime

#

but it reverts

polar inlet
#

it even goes through the ai controller here

vernal jacinth
#

do you get any errors? crash message?

polar inlet
#

yea this:

#

im pulling up the callstack on crash now. been staring at this issue for hours..

vernal jacinth
#

check the logs on the logs folder

#

also

#

check if GetBlackboardComponent() is not returning null and if GetPawn() is also not returning null

polar inlet
#

ill check both of those now

#

here is my call stack while i check

vernal jacinth
#

this was checked

#

unchecked, now I can change it freely

#

but same issue remains

#

@dense owl are you sure I can use DetourCrowdAIController with "Can ever affect nav" unchecked?

vernal jacinth
#

ARobotSpawner::SpawnRobotActor()

#

check inside there

polar inlet
vernal jacinth
#

maybe Robot is null

polar inlet
#

its spawning a physical actor

#

the actor wouldnt move so i adjusted collision then it still wouldnt move...

vernal jacinth
#

where is Robot being set?

polar inlet
#

its spawning a blueprint of enemyCharacter

vernal jacinth
#

and you're sure that is not null?

#

also you seem to be doing this in Tick?

polar inlet
#

should i be in begin play?

vernal jacinth
#

yea

polar inlet
#

ill try begin play

#

why not tick?

#

wait...i just answered my own question

vernal jacinth
#

tick may be called before BeginPlay in some situations

polar inlet
#

it worked

#

you are a genius my friend

dense owl
vernal jacinth
#

turns out, RVO actually has to be enabled on both the NPC and player

#

not just the NPC

#

the solution was to use avoidance groups

#

the player is Group 0

#

the npc is Group 1

#

I set the npc to avoid group 0

#

but set the player to NOT avoid any groups

#

the examples I saw online all showed examples using the exact same NPCs avoiding eachother

#

which is not my case

#

I have 2 completely different characters: Player and NPC

#

I think the DetourCrowdAIController might be the same, it probably has to be applied on both the "entities" that want to avoid eachother, so I dont think it would ever work for player controlled characters or moving vehicles controlled by other players

#

DetourCrowdAIController is probably only for NPCs to avoid eachother, not to avoid players

oak gyro
#

Yes, with Detour you are supposed to relinquish control of the pawn and let the system handle their movement.

unborn sphinx
#

I am using RVO in a multiplayer scenario, and yeah, it works nicely (in my experience) in a single player scenario, with it enabled on both player and NPC... if you don't mind it feeling like enemies are covered in vaseline and you go sliding off them at high velocity. bring that into a multiplayer environment and you basically have to disable it on the player, due to weird rubber banding for clients avoiding their own RVO capsule thingy. But, leaving it enabled on NPC allows them to avoid each other MUCH better than with it disabled. But, they might fall off the navmesh when they do it.

I found that I had to change the avoidance radius from the default setting to get any results. I settled on 150, iirc.

visual dawn
#

Hey guys any exceptional c++ ai tutorial’s ?

tawdry zephyr
# unborn sphinx I am using RVO in a multiplayer scenario, and yeah, it works nicely (in my exper...

bring that into a multiplayer environment and you basically have to disable it on the player, due to weird rubber banding for clients avoiding their own RVO capsule thingy
Feel free to grab my free plugin here, it will let the AI push the player away, if that suits your game
https://github.com/Vaei/PushPawn

GitHub

Allows pawns to push each other, uses GAS to prevent desyncs that often occur when colliding with AI due to lack of net prediction between Characters. - GitHub - Vaei/PushPawn: Allows pawns to push...

unborn sphinx
#

that suits my game great

tawdry zephyr
#

Its super fun if you make the NPCs get annoyed at the player like in the gifs I included

unborn sphinx
#

I was so happy the first time my pawn went flying into a death pit by accident

tawdry zephyr
unborn sphinx
#

YES!

#

and GAS too!?

#

nice

tawdry zephyr
#

Yeah its net predicted

visual dawn
unborn sphinx
#

tell me, quickly, how bad is it that I set CMC max walk speed in a run ability?

tawdry zephyr
#

I actually prefer the collision feel because its like a soft collision rather than a hard one, kind of like if you do your best to run into a real person

unborn sphinx
#

do I have to do something different for prediction?

tawdry zephyr
unborn sphinx
#

damn because even Lyra does it this way with their ADS ability

#

I will look into this thank you so much

#

guessing you have to do the savedmove thing?

tawdry zephyr
#

Yeah Lyra does a lot of stuff that you shouldn't do
In fact their entire locomotion setup is broken by engine bugs

unborn sphinx
#

which parts?

tawdry zephyr
unborn sphinx
#

Yeah I have seen a few tiny weird things, nothing that dramatic tho. I feel, especially for me as a newb, it is way way way good for my needs. Hopefully they improve and truly do make it the best-practices guide they said it was going to be

tawdry zephyr
#

Some code if you're actually curious

void ULMAnimInstance::ThreadSafePivotReEntryTrigger(float PivotAngle)
{
    TempPivotReEntryState++;  // This aborts the previous pivot state
    TempPivotReEntryState %= 4;  // We have 4 re-entry states
    TempPivotStartAngle = PivotAngle;  // We don't need this for the previous anim state, inertialization will "dump" it entirely

    // Determine state for anim graph usage
    bPivotReEntry0 = false;
    bPivotReEntry1 = false;
    bPivotReEntry2 = false;
    bPivotReEntry3 = false;
    switch(TempPivotReEntryState)
    {
    case 0:
        bPivotReEntry0 = true;
        break;
    case 1:
        bPivotReEntry1 = true;
        break;
    case 2:
        bPivotReEntry2 = true;
        break;
    case 3:
        bPivotReEntry3 = true;
        break;
    default:;
    }
}
unborn sphinx
#

I haved limited rotation movement in my cmc I wonder if that hides the issue a bit for me?

tawdry zephyr
#

The reason the low rotation rate triggers it more for me is that it causes the character to strafe when turning
So if you don't have a strafe locomotion setup due to using forward movement, you won't have issues

unborn sphinx
#

hmm I am using stock lyra animations on meathumans lmao

tawdry zephyr
#

Yeah Lyra has such high quality anims
You'd be silly not to use them

unborn sphinx
#

so I suppose the issue becomes authoring a suitable complex set of animations to match?

tawdry zephyr
#

Which issue?

unborn sphinx
#

and maybe making the system a wee bit more robust

#

just in general

#

the limitations

tawdry zephyr
#

Oh. Lyra is only suitable for that specific strafing shooter movement, nothing else

#

You can definitely learn from how they implemented distance matching to extend the techniques to other systems

unborn sphinx
#

yeah like with the hips twisting

#

I am definitely learning a LOT. I was forced to dig into animation the other day and wow yeah. It's a lot, but it's not bad... fun to tinker with, and it's nice that you can just play a montage and it somehow just works

#

I had to sort out making walking the default, and all the blend state data that relied on using the ADS state as a metaphor for walking

#

one remaining bug with all that is while unarmed, and falling, with ADS active, your arms are straight down really weirdly in a locked pose

#

sorry I am rambling now this is not AI related any longer

#

LMAO reaing your github page for pawn pushing, I love the note about instigators. THat is such a weird term I am never sure what it means lmao

#

fixing the AI damage sense in Lyra... I don't know why they didn't listen for the normal Lyra.Damage.Message, but it seems to work. The OnHealthChanged cannot provide an instigator because of some non-predicted attribute thing

#

can you do a mutual pawn push? So the pusher loses some of their velocity?

#

this starts to seem like the rocket league kickoff problem of two platers trying to hit the ball at nearly the same moment

#

Hmm yeah if it is AI bumpoing into a player, the AI is not gonna wanna hear from the player "ohh yeah you bumped into me so ur position is now wrong" or can that work?

tawdry zephyr
unborn sphinx
#

You would have to have the server also predicting the hit too now... or something I dunno how it works down there

#

I definitely will implement at least the one way push you have because that is great on its own

rough rain
#

Hello guys, I want to program more complex AI movement than just running for the player. For example: I want AI to move by long curve to player, or by zigzag, but has no idea how to realize it. I tried:

  1. Dynamically create spline from AI_ACTOR to Player, and move AI_ACTOR by spline points
  2. Setup EQS, but I don't get how to create curve-like EQS

Any idea? Are there any best practices?

rare stump
#

Hello im trying to make my ai character to move up stairs and the stairs have working nav mesh but it thinks its downstairs could anyone help me

dense owl
rare stump
#

@dense owlok im on pc now

uneven cloud
vernal jacinth
#

I thought detour can only be used NPC vs NPC

#

for NPC's to avoid eachother

#

what would I need to set up to make detour apply to the player? do I need to subclass UCrowdFollowingComponent and make changes to it?

uneven cloud
vernal jacinth
#

looking at the source I only see: UCrowdFollowingComponent::SetAvoidanceGroup, maybe this is what you mean?

#

but seems like its using RVO so it would end up similar to solution 2) I suppose

uneven cloud
#

It is not using RVO. I don't remember how you have to add it. There's a function in the avoidance manager. Go look there.

vernal jacinth
#

I'm looking at the functions but the closest I see is:

dense owl
#

Can you add your player to the group?

vernal jacinth
dense owl
#

So RVO is working then ?

vernal jacinth
#

the code I posted above is from the source of the UCrowdFollowingComponent (which detour is using) so thats what I mean when I say that detour seems to be using the RVO system

vernal jacinth
#

was just curious about what Luthage said that detour can be used aswell

dense owl
#

Prly same as the RVO but you have to code the groups and add to them via cpp

vernal jacinth
#

yea although its strange, they accept GroupFlags, not groups individually

#

probably using bitshifting

crystal sequoia
#

since updating to 5.3 I get a lot of warnings in my log at level startup about Adding an oversized dirty area to the nav mesh. It doesn't seem to actually cause problems but makes the log a pain to go through

LogNavigationDirtyArea: Warning: (navmesh: RecastNavMesh-Default) Added an oversized dirty area | Tiles marked: 4 | Source object = StaticMeshComponent /Game/Maps/TowerAreas/TowerZero/_Generated_/684FGQP61MW2QVK1FPX8VZ25R.TowerZero:PersistentLevel.building_GEN_VARIABLE_BP_Dome_01a_C_CAT_1621362746.StaticMeshComponent7 | Potential comp owner = BP_Dome_01a_C /Game/Maps/TowerAreas/TowerZero/_Generated_/684FGQP61MW2QVK1FPX8VZ25R.TowerZero:PersistentLevel.building_GEN_VARIABLE_BP_Dome_01a_C_CAT_1621362746 | Bounds size = X=454.476 Y=454.475 | Threshold: -1

#

anyone encountered similar?

rare stump
#

hello i need help so i made this ai that moves to vector array setted areas but first it goes to stairs

#

but then it thinks its the location is the hallway

#

but it needs to go upstairs right here

dense owl
rare stump
dense owl
#

Don’t show it to me, test by placing an actor upstairs and comparing the Z coords

lunar niche
#

Anyone have advice for this scenario?

In the video, he mentioned limiting reliance on audio stims as much as possible, but we cannot avoid using them all the time, right? I can see myself trying to get an ai to walk towards a noise they heard the player make (ex: searching for supplies in a locker too quickly), so I would use that knowledge to have the ai figure out a path downstairs to search the area. But what if the ai decides to search upstairs instead?

slim egret
#

Hi, anybody knows of some guide or something to setup smart objects in c++?

lunar grove
#

I do manage flow of BT in update percep function ?
becoz i'm fight with my own logic and i don't understand this function lol.

#

and where to move logic AI move to logic instead of tick func

dense owl
lunar niche
dense owl
lunar niche
#

Don't believe so. It was in the pinned section for this channel, though. He did mention he worked with the Unreal Engine a bit before this.

dense owl
#

Oh right just AI basics and stuff

lunar niche
#

Yeah, just basics and stuff

dense owl
#

Yeah, it’s good to watch those videos but rather than trying to anticipate what may happen before you’ve dipped your toes in, better to actually try to make it and see what happens, it’ll keep you sane

#

Chances are you’ll encounter stuff that was not covered and not encounter stuff that was 😀

lunar niche
#

Okay, I have an hour left of it. I will just finish it up then dive right into it

#

He mentioned this structure, though:
-Knowledge/Perception (visual/sound stimuli)
-Decision Making (should ai do this or that)
-Actions (moving, attacking, investigating etc)

He said actions should never influence knowledge/perception/vice versa. Seemed like decision making was the middle man based off what he was saying. Decision Making can handle the pathfinding then call the action to move to the position. Is it okay to continue with that approach?

dense owl
#

Sure, that seems valid.

lunar niche
#

Ok, thank you

lunar grove
#

How can I clean this mess and controll flow of BTree.
"PlayerActor" Value is not reflected on BT Value .

#

and tips clean design principle for AI and stop to much flickering will be great help.

dense owl
lunar grove
#

at 3:23 time

dense owl
#

Ah ok

#

For starters

#

Don’t do that

lunar grove
#

BT showed for PlayerActor value is None and i have also set value which show in video in handl sight funct

dense owl
#

The root is a fake node, don’t put stuff right on it

#

Put a selector under it and go from there

#

So you have an actual fallback behaviour

lunar grove
dense owl
#

Maybe that’s a complete shitshow ngl lol

#

I saw a get player char plugged into a select with a default asset as the 2nd option, plugged into a set blackboard value node

unborn sphinx
#

In that way, you can have the AI prefer sounds that are closer in navmesh navigation

dense owl
#

That sounds more like something done on purpose than an unexpected result tho

unborn sphinx
#

That only really works indoors tho... large outdoor areas might be weird

dense owl
#

@lunar grove are you following some tutorial or where did you come up with this

lunar grove
#

yes, i follow 3 to 4 series and tried add own blend to control tick function and keep bbkey value to close to 👀
I end up here

dense owl
#

Yeah most unofficial tutorials are garbage and mixing several together can lead to… well this. Try watching the 3rd pinned link video in full instead, it’ll teach you how to use perception and BTs properly

lunar niche
#

@unborn sphinx Thank you. He did mention that as well. I kinda decided that I would use whichever one is simple and gets the job done cause he threw some reality checks in there where he basically said to go with simple over something complex even if it's "better"? But players only care about the results at the end of the day and basically just save time where you can.

lunar grove
#

Atleast Now i have some control on flow add Bool everywhere
I have seen it 3-4 time 🙂

#

but if i get stuck check once this video

#

ignore my english

unborn sphinx
# lunar niche <@219176737949483008> Thank you. He did mention that as well. I kinda decided th...

Yeah just filter/score base don Z and call it a day lmao. Like, if it's one story above, and closest to the npc in x/y, it could be somewhat acceptable to be alerted by it... so just massage those numbers until it feels right.

Because yeah, relying on navmesh, unless it is a very specific scenario, will lead to unexpected results at some point. (Picture a big open space, with multiple vertical levels... the wide open space should transmit sound perfectly, but the navmesh to get from the top of one tower to the other would be very long

dense owl
lunar grove
indigo field
#

[Recast] [Native]
I have a point floating high up in the air. I want to snap it to the navmesh below, which might have different levels of it (think a building).
How can I ensure that it returns the highest and therefore the closest (Z wise) navmesh location?

Currently using ProjectPointToNavigation(PointInAir, ..., FVector(100.0f, 100.0f, FLT_MAX)) sometimes returns a point below the highest even though the navmesh is generated properly.
Note tried to use Raycast() but it need a starting and ending location already snapped to navmesh....

Anything that acts like well a Probe?

hushed lodge
#

So still learning here, I wanted to dig into Behavior trees. I want a unit(AI) to go to a location, harvest stuff, bring it back to storage, repeat till I get tired of looking at it. 🙂 I can make him move to the thing to harvest, but how do youguys normally deal with this? Do I really have to make an inventory system for the AI? could I just have him doing some mining animation (For example) and have a int on him that counts up while he is in the collision area? Max/current resources and the opposite when he gets to storage?

dense owl
#

Good rubber ducking tho

hushed lodge
#

I know that would work, but not sure why I wouldn't do it like that - and I dont know what rubber ducking is?

#

I just googled it, I got it

#

(Rubber ducking, I mean)

dense owl
#

I’d keep things as simple as they can and no simpler. An inventory system is overkill for just collecting a resource at a time

hushed lodge
#

there are not many tutorials I can find about NPC Harvesting stuff, but my lord if I need a NPC to follow me, I got 93024 of those out there 🙂

dense owl
#

Cause it’s easy

hushed lodge
#

Ok, thanks, just wanted to make sure before I started playing with it

#

that sounded bad

#

I thought I was making progress and then opened up a file today that was a "basic" melee system and got really dissapointed because my lord that was a huge group of blueprints.

#

made me think I was oversimplifying it

dense owl
#

Less is more, usually

hushed lodge
#

in that case, I'm your man. 😉

#

lol

#

Thanks, Neo.

indigo field
# dense owl A trace ?

What do you mean a trace? a physic trace?! That's a lot less efficient and won't necessarly hepl me find the navmesh?

vernal jacinth
#

(on the player)

dense owl
unborn sphinx
#

Bumping into a player can resolve itself by the player taking action. The problem solves itself unless you REALLLLLLLY need them to "avoid" for some reason but it's not really avoidance as much as it is crudely bumping around.

vernal jacinth
#

NPC to player is the issue

#

and yea I know players can move away

#

but

#

I want to avoid players purposefully blocking NPC paths

unborn sphinx
vernal jacinth
#

trying to avoid players purposefully blocking NPC paths

unborn sphinx
#

Having a server predict a collision with a player, and avoid it smoothly might be tough. To reliably avoid, it would have to predict a large radius to avoid, due to possible mispredictions, latency, etc

vernal jacinth
#

the ideal scenario would be enabling RVO on NPC only

#

but that doesnt work

#

must be applied on both NPC and player

unborn sphinx
#

I think you will find it is a difficult problem to solve across a network. If the single player results of RVO are good enough for you, you might be able to find a way for the NPC to predict that. Isn't there an AISensePrediction? Not sure what it does but I guess it's for projectiles, not networking. Could still make it work perhaps

vernal jacinth
#

ok I think I found a solution

unborn sphinx
#

what is it?

vernal jacinth
#

I was looking at the CMC function CalcAvoidanceVelocity

#

this is where the "avoidance" logic is

#

but my issue is, I dont want any avoidance logic running on the player, only on the NPC, its the NPC that avoids the player, not the other way around, but with the current system that UE is using, for the NPC to recognize the player as "something to avoid", the player needs RVO enabled, but if I enable it on the player, all that avoidance logic starts running too which causes those corrections

#

so on my subclass of the CMC, I changed this function a little

#

so that I can keep RVO enabled for the player (making the NPC detect him as obstacle), but not run any "avoidance logic" inside the CalcAvoidanceVelocity function for the player

#

I just added a boolean like bDisableAvoidanceLogic, that does an early return on that function, so that its not running any avoidance logic, but I still have RVO enable so the NPC can detect me

unborn sphinx
#

I think of RVO as more of a capsule around anyone with RVO enabled that allows other RVO-enabled characters to slide off. They are not avoiding. They are sliding off a capsule that they literally can not walk through

vernal jacinth
unborn sphinx
#

exactly but the current implementation does not work over network lmao

#

so you can get probably close results by seeing if the AiSensePrediction can give you an estimate of where the simulated proxy is

#

/will be

vernal jacinth
unborn sphinx
#

And then as a service or something watch for a player getting within a radius, predicting their movement and avoding it in the BT

vernal jacinth
#

for NPC to players the issue is just the server corrections

unborn sphinx
#

that is just my newb guess at how to fake it for network

vernal jacinth
#

but my change fixes it

unborn sphinx
#

What did you change?

vernal jacinth
unborn sphinx
#

oh I see

#

Does the NPC actually avoid you tho?

#

and it works over the network?

vernal jacinth
#

yea, it "slides" to the side

#

which is the normal behaviour with RVO

unborn sphinx
#

and the network...

vernal jacinth
#

yea I tested on a client

unborn sphinx
#

with latenct/packet loss emulated/

#

?

vernal jacinth
#

yep

unborn sphinx
#

interesting

vernal jacinth
#

but I am also not moving

unborn sphinx
#

oh wow

#

dude

#

lmao

vernal jacinth
#

?

unborn sphinx
#

that is a pretty big distinction but that is good to know you can get that to work

vernal jacinth
#

thats the exact case I want to avoid

unborn sphinx
#

what happens if you move?

vernal jacinth
unborn sphinx
#

I do not think this will work well because all the clients might desync?

vernal jacinth
#

as I said, my use case to avoid players blocking NPC paths

vernal jacinth
#

previously if a player standed in the way, the NPC kept walking agaist the player as if he was not there

#

and could not reach the location

#

but now he can

unborn sphinx
#

how many clients might be interacting with the npc at one time?

vernal jacinth
#

there's no fixed number, depends how many are there, but it really doesn't matter, when I do Controller->MoveToLocation, what matters it the NPC reaches the location, I dont care exactly how

unborn sphinx
#

it seems like u very much care how... by avoiding the player, that's how

#

and if there are potentially many players there will be problems

vernal jacinth
#

the green sphere is the location

vernal jacinth
#

it can slide, or bump into other stuff, I dont really mind

unborn sphinx
#

I would love to know if it works out with multiple clients without lots of rubber banding

#

a little bit is fine lmao

vernal jacinth
unborn sphinx
#

each client is seeing their own version of the truth. If it is suddenly being changed by other clients it will rubber band

vernal jacinth
unborn sphinx
#

well, it will correct positions

vernal jacinth
#

only the server is changing it

#

its an npc

#

players have no control

unborn sphinx
#

yeaaaaaah

#

but I don't think it works so easily lmao

#

the NPC has to be able to calculate this avoidance

#

it is constantly also correcting its idea of the player positions

#

based on their inputs

vernal jacinth
#

yea so they will be able to see alot of sliding around happening as I was saying, but that is very different from rubber banding

unborn sphinx
#

no it is exactly rubber banding

vernal jacinth
#

rubber banding was happening to the player itself, before I made my fix

unborn sphinx
#

like lets say on one client the npc "avoids" the player one way, but on the server it is different, on the other client it is different still

#

someone is gonna rubber band

vernal jacinth
#

because the player was constantly receiving corrections

unborn sphinx
vernal jacinth
#

there's no more corrections happening though, so what you see is the RVO logic running

#

which will no doubt look silly when alot of players are around

unborn sphinx
#

there is no logic

#

it is basically a collision

vernal jacinth
#

right, I just meant that the adjustment of the NPC position is the result of the RVO logic running ( CalcAvoidanceVelocity function in CMC), whether that logic uses collision or not, it doesnt matter to me

unborn sphinx
#

each client will be running that with their different versions of the simulation

#

so they will desync

#

like, yeah, the server is authoritative and is telling the proxy on the clients what to do

vernal jacinth
unborn sphinx
#

but they have to interpolate it

#

exactly so the RVO only responds to the server's version of the truth

#

the clients will have different versions and will be synced

#

if it is ONLY server actors beign affected or avoided

#

then it works because the server just does what the server does

#

but if they are avoiding clients, then the clients position comes into play

vernal jacinth
#

well yea ofc, the server will be constantly changing velocity/position/rotation, etc... and the clients receive it, if theres many players close by it will look silly as the NPC might be constantly sliding around or changing direction but this is much better than the alternative

unborn sphinx
#

let's compare a different method. Say you use the AISenseprediction, or some way to "predict" where the player will be, and then the behaviour tree responds to this in a deterministic way, then there is no collision happening that might differ on clients. The server is just choosing a vague location. It might actually collide with a player but it is a balance you need to achieve

unborn sphinx
vernal jacinth
vernal jacinth
unborn sphinx
#

u need to test with more clients

vernal jacinth
#

is there docs on it AISenseprediction

unborn sphinx
#

I have never used it either but I assume it is for predicting player movement so you can "throw" or "shoot" a projectile where the player will be not where they currenttly are

vernal jacinth
unborn sphinx
#

It might look more than silly it might feel game-breaking to players

#

test that early before you commit lots of time to this solution

vernal jacinth
#

cant have players blocking npc paths

unborn sphinx
#

players ar eway more used to blocking NPC and they lookin goofy vs rubber banding like a seizure

unborn sphinx
#

you definitely want some kind of avoidance

#

you can just sense the player, and use a deterministic position to move away

vernal jacinth
#

if you have important game logic that depends on an npc reaching their target location and players block the npc, that is pretty game breaking, and sliding around would be preferable

unborn sphinx
#

if it were only sliding around that would be great I agree

#

the NPC might end up teleporting all over around players and players getting pushed through walls etc

#

physics with unlimited force sending things to the moon

#

with the new atmosphere system you could make that look pretty good tho

vernal jacinth
#

yea, those are all risks I'm willing to take compared to the alternative of being blocked but I will look into AISenseprediction regardless

unborn sphinx
#

u might not even need prediction

#

you might be able to set a specific radius around a player that the npc will just kinda do a routine, pick a random point away from the player, move, another point, move, until they get around them then carry on with their goal

#

the clients can all be moving around, you just need a big enough radius and enough service ticks to keep track of the clients in the eyes of the NPC

#

"eyes" or whatever lmao

#

There might still be occasional collisions, but the NPC will be actively working to avoid it in a deterministic way. IE: Am I in this radius? stop, pick a point away from here and move there. Am I in a radius again? do it again?

#

you could have them set focus on the player while they do this, so it looks like they are looking at the players they are avoiding

#

with turn-in-place animation, and allowing strafing, it might look downright great

#

The radius would have to kinda be large tho

#

It could lean into the idea when you walk into the same path as someone on the sidewalk, then you both step aside the same way and block each other again, and do a little dance before you make ur way around each other

#

Imagine one client bumps an NPC off the navmesh, but on another client that NPC just barely stays on the ledge. The NPC is gonna teleport back up to the top of the ledge

vernal jacinth
azure pulsar
#

Hello!

I'm having some issues with forcing an AI character's rotation to be aligned with the hips.

At the moment, if I force a specific rotation, the head of the character will move but the body will lag behind (this is useful when doing a look-at, but not when a specific alignment is required). In practice, this means when I do a "Get Actor Rotation", I get the head/controller rotation rather than the hips/root rotation.

Is there any functionality to force the head and body to align? Or basically, a way to disable head-tracking when required.

primal pebble
#

Hey guys whats the typical way to wait for an AI to play an animation before resuming behaviors in a behavior tree?
I was thinking I'd just add a service that checks "Is animation completed" and just have it sit at a "wait" node but that feels wrong? Not sure what the usual method is.

unborn sphinx
#

I guess I could try and find out but: what happens if you have a service that tells the npc to move somewhere, while also doing a task that is telling the npc to move somewhere else? Does the move to task fail as soon as the tick sends a different move to?

#

what about dueling services each sending move tos?

hasty lake
#

hey ppl. i'm wanting to do a basic ai for my game. is there a quick start guide or some basic docs i can read?

ivory lantern
unborn sphinx
#

lmao

ivory lantern
unborn sphinx
#

use a service to look for an active gameplaytag applied in a montage and abort when tag is gone?

dense owl
harsh storm
#

Sometimes...that's all you need

ivory lantern
dense owl
#

Fair enough

ivory lantern
#

Except if play animation task can also do it

uneven cloud
ivory lantern
uneven cloud
ivory lantern
uneven cloud
# ivory lantern 🤔 sure

Your version is a hack at best. It also doesn't actually work. The reason why you want to stay in the task that plays the animation is so you don't have to hard code the length and you can abort the animation when needed.

polar inlet
#

When I manually place a blueprint of my AI then when I call GetPawn() in begin play it works.

However when I spawn My AI then call GetPawn() in the controller it is always null

uneven cloud
polar inlet
#

got it thanks

polar inlet
uneven cloud
polar inlet
#

when I call GetPawn() from my AI controller it is null

#

in OnPossess

uneven cloud
#

Are you getting the pawn before or after calling the super?

polar inlet
#

ohhhh so call super on OnPossess()?

uneven cloud
#

You must call super in every virtual function

polar inlet
#

got it

#

I shouldnt have to call OnPossess() in begin play should i?

dense owl
tawdry zephyr
# vernal jacinth trying to avoid players purposefully blocking NPC paths

This doesn't have an easy solution
At a guess, you may have to grab the location based on prediction time for all player agents and path based on that
But my plugin should still achieve what you want:

  • Use RVOAvoidance and whatever you like, as if you were making a single player game
  • Implement PushPawn and let it handle the "collisions"

The pathing will still use non-predicted location, and therefore fail to accurately walk around a moving player with latency
But for 99% of games I imagine it would be adequate?

#

PushPawn, on its own, doesn't make the AI shove the player or react in any way, its literally just a net predicted soft collision

#

Personally, I would even use it in a single player game because the collisions feel way more natural

#

@pine steeple if you see fit, could you just pin that for me

tawdry zephyr
#

@crystal hatch sorry to bug you over something mostly irrelevant to you, but are there any Epic animation devs (coders, not animators) on this server, I need a change and don't have a good way to get their attention, I don't know how they would want the change implemented so PR is last resort

tawdry zephyr
#

There is a bug as well they probably aren't aware exists because you need the change I need to ask for before its apparent
Unfortunately I don't think I'm going to win this uphill battle

crystal hatch
#

IM me directly with the details.

tawdry zephyr
#

Thanks

hexed plank
#

https://www.youtube.com/watch?v=Ww4FafWXZz8
Hey, so I'm following this tutorial for a function that can flipflip between 'chase player' to 'follow patrol route' with a keyboard bind.
I believe I followed their tutorial, but I must've missed something as the AI is bugged when I click the keybind.
I sent a video since it'd be probably easier to show the issue there and all of the tasks I believe may be part of the issue, then sending images.

dense owl
#

We miss you MieszkoZ, hope #mass is going well 😀

little hull
#

My I system what I want:

#

target actor(player) is not set -> AI no aggro or investigate. target actor is set then Ai immediately attack player

#

when target actor is not set but target location is set -> Ai starts investigate

#

How to set those observator aborts correct?

#

Currently when Ai hear player is finishes idle wait then starts walking to heared location

#

i want those to be immediately

dense owl
deep bough
#

I've tried looking this up elsewhere with no luck, so i'm hoping someone here can help. I'm making a fnaf game in ue5, and I need the AI movement. the idea is to move to specific points on the map. Instead of going to random points, I'm hoping it's possible to make it go in a specific order. any help is appreciated

deep bough
dense owl
#

From what you described you just need to feed some vectors into an AIMoveTo node

#

If you have no idea how to setup an AI in Unreal, look for the AI with blueprints course on the official learning portal

deep bough
#

Okay thanks

tardy ingot
#

@uneven cloud Do you happen to know the 'right' way to go about increasing the navigation bounds? I'm only generating navigation around invokers, but the system still relies on having bounds to capsulate the invoker zones. I'm torn between subclassing UNavigationSystemV1 to more easily add the new bounds since generating a ANavMeshBoundsVolume at runtime is a huge pain in the butt.

uneven cloud
#

Using level streaming for the nav mesh.

uneven cloud
tardy ingot
unborn sphinx
uneven cloud
unborn sphinx
#

oh ok right, so that will stream in the navmesh as needed

#

I guess we might have to ensure it is chunked correctly to fit into the partition cells or whatever

#

or does it do that for us?

uneven cloud
#

It does that for you

unborn sphinx
#

rad

timber pecan
#

Hey friends, I've been wanting to do this for a while now, but I've never managed to make it work in practice, I really don't like the natural route that the AI takes in unreal, what I'm looking for is for the AI to be able to make turns while walking and not just rotate in place or rotate without changing the direction of movement, my idea is to make the ai move forward while rotating until it aligns with the new point of interest, and only stop after reaching that point if possible, something similar to this video:https://www.youtube.com/watch?v=yx8OjziZHjo&t=270s

In this video we're taking a look at a custom AI system built in Unreal Engine 4's Blueprints, designed for The Podlands.
The framework is designed for animal-like movement, restricting entities from moving sideways or backwards, instead emulating the natural tendency to move forward in almost every case.
Combined with a well-designed animatio...

▶ Play video
#

I was able to do something similar, but not perfect to this using blueprints, but I never found a complete solution, let alone a way to get this result in a behavior tree

dense owl
#

Only issue I’ve found is if the target is too close, it won’t have enough time to rotate, so I had to test for that and add it again when needed

#

I guess a dot product to test you’re facing the target when you’ve arrived and having it rotate again if not would work

strong cargo
# timber pecan Hey friends, I've been wanting to do this for a while now, but I've never manage...

This kind of behavior is hard to get right for AI. The biggest hurdle I've come across is you need a way to address the problem of them getting stuck in an endless loop around their destination when their turn radius is too low to align themselves with it, and if speed is a variable factor you get more complications because now you have 2 interdependent variables to make decisions on. Do you dynamically reduce rotation rate as their speed increases? Or do you slow them down to match a desired rotation rate? Which of those you do (or both) will depend a lot on your gameplay requirements.

dense owl
#

Yeah, def a tricky one

timber pecan
#

What I think complicates this more is that each AI will have a different rotation rate and movement speed, I think I can do some math to solve this, but the last time I used a simple parallel I ended up with a result where the Ai set a new point of interest before arriving at the starting point.

#

I tried to contact the creator of the video, but he's already worked on other projects and doesn't remember the method used very well

dense owl
#

Aka “I didn’t know wtf I was doing, just trying to get some views” like most people who make tutorials 😀

#

You might have been using simple parallel wrong in the case you mentioned though, very easy to do so tbh

timber pecan
#

Yeah, I had the same result again, Ai Movement always beats me

uneven cloud
#

If you are using world partition, then you follow the documentation on building navigation for world partition. It breaks up the nav mesh into grids and streams them in with the rest of the world.

unborn sphinx
#

Is there a benefit to using a simple parallel for the moving while turning vs a service?

#

I am caught up on services atm and need to know when/what reason to decide to use simple parallel instead

#

And what happens if parallel tasks or a service and a task both command move to. Which takes precdence?

#

IE can a service "inject" random moveto movement while a task is commanding a more general move to route to an actual goal

#

perhaps two services ticking, one doing random movement, the other setting move back to the real goal?

#

I suppose you would want only one active move-to, and simply watch the move goal value and it will update to any changed movegoals?

tardy ingot
#

Does anyone happen to know what might cause the nav tile generation to be offset from the actors by a signifigant margin? in my case I'm seeing them 1000s of unreal units below the levels im instancing

dense owl
unborn sphinx
#

but setting movegoal in tick is ok right?

dense owl
#

Yeah,

unborn sphinx
#

moveto node just has to watch value

#

ok this is gonna be rad lmfao

#

I am planning this all out from scratch and building everything for the purpose

#

(ie scrapping all leftovers from Lyra bots)

pine steeple
unborn sphinx
#

protip: when actively editing a comment in a BT, saving with ctrl+s will cancel any changes you had made to the comment 😐

dense owl
unborn sphinx
#

I am just doing the layout for a new bt

#

not usign the correct nodes/composites tho

sly plover
#

Is there a good resource for learning to do a flying AI in a space environment? Since I can't use nav meshes I'm trying a couple of alternatives, like simply adding movement input towards a fixed location, but I'm wondering if there's better options

pine steeple
#

Naming nodes is very very important

#

it makes using visual logger so much nicer

#

you can see exactly what node and where is causing issues, if you have a very complex bt

unborn sphinx
#

is it considered wasteful to have multiple decorators, one a child of the other, watching the same BB key? I suppose I should be able to refactor it to need only one watching. Is that considered important to maintain or is it fine to just hav another decorator watching?

unborn sphinx
#

can you use a single bool basically twice? You can set and unset it, and use that as one condition, and then set the bool as true or false and use that separately?

IE, HasAmmo is unset if the NPC has no weapons. If the NPC has weapons, then HasAmmo is set to either true or false based on... ammo.

dense owl
dense owl
unborn sphinx
#

Yeah I will strive to do that. thank you

primal pebble
#

How can I rinterp my AI's recoil compensation, but with error added to the rinterp as well as overshoot added to the rinterp?
I am trying to have my AI "correct" recoil that the gun applies to their hands, but I don't want them to perfectly correct it and want them to have minor errors in correction as well as overshoot the amount of correction needed like a human would.

I made a video of the issue, thank you to anyone who can help me with this!
https://www.youtube.com/watch?v=ywgfQJs1uWk

Thank you to anyone that can help. Posting this video in various forums and will add the solution in a comment if I find one.

▶ Play video
dense owl
#

Doing all of that for an ai seems very involved and a bit of an overkill

primal pebble
#

Its a VR, close quarters FPS where the AI's aiming is extremely, glaringly obvious.

#

And the huge majority of the AI's movement/aim is pure IK rig with on-tick vector/rotator decisions for their joints which allows for me to customize guns/recoil/handling incredibly easily so I'll be sticking with this system, just hit this sticking point.

lyric flint
#

Crazy question: is it expected that renaming a key in the blackboard, or changing its category, breaks my behavior trees? After doing a key rename, all my BTs reference a seemingly random key in my blackboard.

dense owl
lyric flint
#

That's a whole lot of task clicking... 😮

dense owl
#

Name your bb keys properly to begin with and np 😀

#

There might be a better way to mass refresh idk tho

finite gyro
#

I have an issue - the red and blue part can both be called when a certain set of BB keys is achieved, however for some reason the blue one always takes priority. I want the red one to take priority when those keys are in that state - how do I make this?

#

i have the red BB decorators set to "aborts both" and the blue one to "aborts self" though I'm not sure that's correct

dense owl
finite gyro
#

all of the decorators in the red section are "pass"

#

yet it doesn't switch over to it

dense owl
#

Need a better res screenshot to read but step through each step using the pause if you haven’t