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
#gameplay-ai
1 messages · Page 34 of 1
It’s doing that because MoveTo is designed to run its course before moving on
Try changing observer aborts to on value changed
And self or both
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.
Show
Screenshot? Or can blackboards be put into a pastebin?
Just do a snapshot I’m on mobile and pastebin and blueprint UE is crap for it
ah. So should that be a selector then?
Yeah
Cool. One sec. Trying
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.
It aborts upwards
So theoretically, if moveto aborts, and it goes into the attack sequence and then that aborts, it should go back up to the selector
Yes
Cool. Thanks man.
😭 🤣
Excellent lol
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
@limpid tapir apparently knows Lyra inside out, maybe he can help
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);
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
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
you dont need an AIController specifically
it just exist to represent the brain of the AI
Aside from most tutorials being crap, generally they extend the default one because they want to add stuff to it.
Or they don’t want to modify the default in case they want a different one later
@polar rose sup dawg?
@dense owl Yeah. I started yesterday, but it's a 10 day jam.
unluckily i had 7 cases of AI tests in a 5.1 project, but i just deleted that like a day ago
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.
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?
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 😉
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.
Ha ha enjoy!
"known issues"
Thanks. Will do.
I want to implement AI hand-holding and walk together with player, I've tried some ways like using physics constraint.
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
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
lol, you def came out of it better than most
i am a masochist
now how do I get ai hearing working lmfao. Is it just manually sending "sound" events at locations with radii?
StimuliSource with hearing sense
yeah it had that all set up but when I swtich the EQS to only hearing they sense nobody
🤔 check range ?
ohhh nvm it was set up on pawn but not on AI controller
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?
May need to ask #multiplayer about that
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?
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
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
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
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
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
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...
Just going to bump this, still curious which is best
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????
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
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
I have already twice , fail to implement myself
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
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
Did you press the apostrophe key first ?
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?
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
Oh damn
Then it's on my luck
Hi, does anyone know why my sight is not updating? I mean the sphere that is supposed to be one me but it just stays in this place
Ok so i just deleted the sight sense and then added it again and it works 🙃
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.
It's better to change the movement speed in a service using the relevance functions.
To find out if the player is to the left or right, you use the dot product with the right vector.
Yes you can use a location instead of an actor for the context
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.
I have setup another thing now my aiship will rotate In that direction where the player is. But it still not completely ready the thing I want
Thanks! I found a workaround but I ran into another problem. EQS isn't returning results for me and I don't know where the issue is.
how do I make the PerceptionComponent continuously update the Player's location after the OnTargetPerceptionUpdated event is emitted?
The EQS debug is also very buggy, not sure if that's an unreal thing or if I'm doing something wrong
The EQS doesn't return immediately. You need to bind to the finished delegate.
The EQS is not very buggy.
The perception component updates the location each frame that the target is seen.
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
Ooooooh I didn't know, thank you so much! ❤️
Then you need to update your player location variable from the perception component.
any tip on which method/delegate I can use for this? if I understood correctly that delegate I'm using is only broadcast when something is seen/unseen, but only once
There is no delegate for it. If you are using the BT, you can use a service to update it.
@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
How I. Mean just add dot product it will work?
dude don't triple ping people, be patient
Not pinging just asking another question answer.
if you @ someone, you're pinging them
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.
why do you need an instigator then
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
yeah, just spawn an empty actor with a stimuli source I guess
oh yeah and that doesnt exist on the server
no stimuli source needed on the actor just purely empty as a thing for the BT to set as an actor key to set focus
but is there a better dummy actor? something more performant? seems to work fine with the empty static mesh actor
no need for a mesh then, if you just need a location
yeah there is no mesh it is just the empty actor
dw about performance until you need to
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
idk, someone was trying to learn how to use it for a 10-day game jam, so that should be interesting
@polar rose did it work out in the end?
I've just been adding and removing print strings to get by for now. lol. I'll package the game up here soon and see if it works in a packaged build.
Why are you spawning an actor for that?
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.
It should be the player who shot the bullet. Not the bullet or a dummy actor.
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
Reporting a noise event when the bullet hits using the bullet's instigator (the player that shot it) does that.
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
You can get the location from the perception component if you have a target.
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
Set focus works with an actor or a location
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
Set focus doesn't look up or down, unless you've added look at.
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?
You either added it or started with a template that has it. That means you can edit it to work with locations.
using lyra
Yes it's better to use the systems as intended than to try weird hacks.
but then I did change how the CMC controlls the rotation or whatever, so that I can limit the rotation speed
Look at is likely in the animation BP.
is there a big red flag with the way I spawn the actor?
ohh is there ai related logic in the abp?
Look at really isn't AI
oh ok right
but what is the distinction between setfocus on a vector vs an actor?
where does that logic shift?
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
Why would you project it to the nav mesh before setting focus?
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.
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?
So, like this then?
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?
Not how I would do it, because you need to update the location.
ah so maybe eqs is better actually, running like every half sec?
There is not. Tutorials are made by non professionals.
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
Your dummy actor idea is a hacky way to do what I told you to do. The sensed location will be where the bullet hit.
but I don't see an easy and clean way to get that?
eqs just adding the dummy actor works easy
Stimulus location.
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?
I said I wouldn't do it on perception updated.
No. The EQS or a service
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?
There’s tests, no?
You can create a generator that only gets the stimulus location
i want that lmao
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
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.
ok lmao i do have to create a better generator... so that the enemies don't hear themselves because ugh ok i am dumb
oh lmaoao nevermind I just had the key still set to selfactor
You have to call a function on the navigation system. I think it's something like on navigation bounds updated
found it lol thanks
when would a stimulus not be succesfully sensed but got from actors last sensed stimuli?
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)
had to change from perceived hostile actors to just perceived actors so I can sense team damage/events and retaliate if needed lmao
Interesting, would you be able to expand a little more? Why a service over a task?
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.
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
If you’re using a BT, there’s a rotate to face BB entry node. Otherwise, you can use find look at rotation in normal bp
Can’t read the numbers on your nodes, but I’m guessing your right branch is blinking?
I did that but the problem is that it only rotate when my character change position
And u know players will take benefit of this
Which one did you do
Find look at rotation
You’d have to show code to see what’s happening
Ok wait
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?
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
You don’t need BTs to use MoveTo, just use AIMoveTo from bp
You can just make it use the value of the desired bb key
but I wanna be able to change it per-task
Wdym? Describe your goal
well, I did
: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
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
i cant "just change the float bb" when I don't have any input field to do it outside of the task itself
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
Not impossible, but you would either have to do it in cpp or use the AIMoveTo node in normal bp
I thought you’re talking about custom tasks not the MoveTo
it is a custom task
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
In a custom task you can get the BB and use the get value as nodes
i asked in cpp and they said it would be hard to do
but I would have to set it somewhere
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
Yep in another task or outside the tree
using BB keys kinda loses the entire point of what I'm trying to do
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
I mean the default MoveTo node already does this
Yeah but you can’t change it dynamically
I want the same thing just have a range instead of a constant
Oh
cpp people said it's too hard to do for someone who doesn't know cpp
Like a random value?
Hard is relative, you’ve come a long way in cpp in a short time
I literally just made structs and enums
:D
Why not just use a function that gets you a random value and then run it against that value
More than half the server has 😀
because I need to set a specific range for each case
In one BT branch I wanna set 100-200, in another I need 10-20
Ah, well Luthage will prly know the exact way to do this so I’m gonna hide under the table now
for example
A service guarantees that you can set/unset something if you use the relevance functions. Using a task you can't guarantee that it sets it back to the default.
Debug it using the visual logger
You add a variable to the task and make it public.
LMAO
@dense owl we were seriously overthinking this 😂
THANKS
I feel super dumb now
I mean, yes but I got confused when you mentioned the MoveTo node and how you don't want to use bb keys 🙂
well there is the MoveTo node inside of the function, and it's not using bb keys
:D
I completely forgot that variables do that in a task
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
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.
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.
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
Sorry for chiming in, I didn't get the whole convo, but what do you mean by this? When using a service, can you guarantee that a value will be set/unset before the node aborts? Or did you mean something else sorry I am new.
A service has functionality for on become relevant and on cease relevant. Those functions are called when the entering and exiting the underlying nodes. Even when a node is aborted.
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
Just override the functions
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
woah we can make services in c++ eh hmmm
You can make anything in cpp
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
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.
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
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.
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
they can only find a path if other side of the rock is covered with recast navmesh
detour makes no difference here
Hmm yeah since detour is for avoidance of other AI right. Recast navmesh? Never heard about that term before
Thanks. 👍
That's certainly a hot take
I recommend going through the AI with Blueprints course on the learning library. That sequence isn't a good idea.
Do you have partial paths set to true?
What does eqsrequest with run mode: all matching do?
It returns all the items that aren't filtered out
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?
Because a task can be aborted but aborting a subtree will trigger those functions?
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
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
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?
Hey yeah, you're right
Usually means your service keeps firing and aborting/rerunning your branch. There’s a setting on it, can’t rmbr which exactly rn.
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
Dunno, never tried making a print task in BT given there are much better ways to debug. Was there an issue or are you just trying stuff
This is my first AI that does more than just walk in a random direction 😅
Print was just what I used for blueprints, so I figured it's gotta work with AI trees too
But if there's a better way, I'd gladly hear about it
Just try making what you’re trying to make.You can use Gameplay Debugger (‘ key) at runtime or visual logger if something goes awry
Will try that 👍
thanks
One image is using the pawn sensing and the other is using the perception component. Pawn sensing is deprecated and should not be used.
Yeah, I've noticed by now. Unfortunately, I couldn't find a tutorial which would achieve what I want with Pawn perception, so sensing it is...
Tutorials are pretty garbage. Look at the AI with Blueprints course on the learning library
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
hello my ai character moves acording to xy but doesnt go acording to z the variable is vector
comon i have to go after 1 hour i need help with this so i can start polishing my game finally
AI move to uses navigation, which is restricted to the ground.
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?
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"
Detour. Can ever affect nav makes holes in the navmesh, so use that for stuff like walls
ah I see, that makes sense, I'll go with detour then
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
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
I see, I'll give it try then, thanks
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?
Hi, anyone here have any idea why AI might work in-editor but fail to even move in a packaged build?
Is the actor the door?
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'
pretty sure you need it to be on the navmesh, or have a nav link where the door is
so I just tried it but it doesn't seem to work at all, the DetourCrowdAIController that is
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
ok so this is interesting, no matter what the value I set for the radius, it always defaults to 34
those are the settings at runtime
Yeah that’s odd
and on the BP, they are:
Try swapping off detour and use CCD instead
hmm not sure how do I do that?
ok gonna give that a try
on the NPC character settings? because I dont see this option on the controller
or you mean the player character settings?
Uh sry might be on the cmc
Checking now
Sry I meant RVOAvoidance not CCD
It’s on the CMC
on npc or player character?
The npc
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
ok I think something broke, now MoveToLocation is not working anymore 🤔
I havent even done anything yet
If profiler points at anim, it’s prly the anim
You changed the AIcon
yea I changed it back to AIController
from ADetourCrowdAIController
its the same anim the skele meshes are playing vs the npcs though?
on the left is a few giving me 40fps
on the right is a few hundred giving me 80
If you change back to detour it works?
trying that now
ok yep, wtf 😄
Something is tied to it
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 🤔
Pretty sure it has to be either or not both
yea, having on both is causing issues
having on NPC only does nothing though
No I mean detour or RVO not both
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
I’m not sure sry
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
Ideally, yeah
seems like there's alot of conflicting answers online
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
I usually go by what Luthage says and iirc she said don’t use both
yea UE docs also say this
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
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
I’ve only worked with AI on AI so far, so I could be missing something
Odd that the agent radius is locked tho
So you’re setting a value before you obtain it?
I could be reading that wrong, my cpp is not as good
yea that part is also making think something else is off, I cant even edit it from the editor at runtime
Well no you can’t edit it at runtime
let me look into that ha
But you should be able to edit it before running the game
I mean the field is editable at runtime, it just always reverts to those values
tried that too, but it keeps reverting to those values at runtime
No I already spawned it here. It should have the Location
check if ThisPawn is not nullptr
on it
its not null.
it even goes through the ai controller here
do you get any errors? crash message?
yea this:
im pulling up the callstack on crash now. been staring at this issue for hours..
check the logs on the logs folder
also
check if GetBlackboardComponent() is not returning null and if GetPawn() is also not returning null
figured it out why it reverts to those values at runtime
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?
this seems to point to that SpawnActor function
ARobotSpawner::SpawnRobotActor()
check inside there
this is what that function looks like
I think that SpawnActor function is failing
maybe Robot is null
its spawning a physical actor
the actor wouldnt move so i adjusted collision then it still wouldnt move...
where is Robot being set?
should i be in begin play?
yea
tick may be called before BeginPlay in some situations
Considering can ever affect nav cuts holes in the mesh under you, fairly certain
I was able to fix my issue finally using RVO
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
Yes, with Detour you are supposed to relinquish control of the pawn and let the system handle their movement.
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.
Hey guys any exceptional c++ ai tutorial’s ?
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
oh hell yeah! lmao thank you
that suits my game great
Its super fun if you make the NPCs get annoyed at the player like in the gifs I included
I was so happy the first time my pawn went flying into a death pit by accident
Yeah its net predicted
Any one ?
tell me, quickly, how bad is it that I set CMC max walk speed in a run ability?
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
do I have to do something different for prediction?
Yeah that breaks engine design
You can look at my other free plugin to see the right way
https://github.com/Vaei/PredictedMovement/
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?
Yeah Lyra does a lot of stuff that you shouldn't do
In fact their entire locomotion setup is broken by engine bugs
which parts?
It does need that, and a lot more, have a look at the source
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
The first issue is tedious but not a big deal, just use more re-entry states until its impossible to retrigger them all while still blending out. See screenshot.
Second issue I haven't looked at yet, but 99% chance it requires changes to engine source. I will probably have to do this for my own purposes either way. It might be either very easy or borderline impossible or anywhere between.
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:;
}
}
I haved limited rotation movement in my cmc I wonder if that hides the issue a bit for me?
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
hmm I am using stock lyra animations on meathumans lmao
Yeah Lyra has such high quality anims
You'd be silly not to use them
so I suppose the issue becomes authoring a suitable complex set of animations to match?
Which issue?
and maybe making the system a wee bit more robust
just in general
the limitations
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
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?
It was specifically designed for a player colliding with AI, it doesn't affect the AI, only the player
So I haven't tested if that works
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
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:
- Dynamically create spline from AI_ACTOR to Player, and move AI_ACTOR by spline points
- Setup EQS, but I don't get how to create curve-like EQS
Any idea? Are there any best practices?
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
Did you test your vectors as mentioned to you yesterday?
@dense owlok im on pc now
You have a lot of choices that aren't regening the nav mesh anytime a character moves.
Detour doesn't automatically to the player. You need to set that up.
sorry I dont understand, can you expand on this? my understanding is that for NPCs to avoid players I only have 2 choices at the moment:
-
Set NPCs "Can ever affect nav" to true (works the best, but is heavy since it regens navmesh tiles)
-
Use RVO and enable it on both the player and npc, but make the player not avoid the NPC, instead its the NPC that should avoid the player
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?
- Is not a reasonable choice.
The player can be added to detour as something the NPCs will avoid.
how do I add it?
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
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.
Can you add your player to the group?
that's what I'm already doing with RVO, except I'm doing it in the editor
So RVO is working then ?
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
yea, my issue is solved with RVO
was just curious about what Luthage said that detour can be used aswell
Prly same as the RVO but you have to code the groups and add to them via cpp
yea although its strange, they accept GroupFlags, not groups individually
probably using bitshifting
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?
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
I believe I told you to manually check your vectors a couple of times, did you do that yet?
heres the vector when it should go upstairs
Don’t show it to me, test by placing an actor upstairs and comparing the Z coords
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?
Hi, anybody knows of some guide or something to setup smart objects in c++?
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
Why would it search upstairs if it has a Z vector?
Ah, didn't know that. Was watching videos on game ai before jumping into it. Any reason he mentioned that, though if they have a Z vector?
Idk tbh, was that an official Epic video?
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.
Oh right just AI basics and stuff
Yeah, just basics and stuff
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 😀
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?
Sure, that seems valid.
Ok, thank you
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.
Ok not sure what you’re trying to show, moving too fast and did not see any BT in your vid
at 3:23 time
BT showed for PlayerActor value is None and i have also set value which show in video in handl sight funct
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
Ok
@dense owl did you saw mistake in sight function for PlayerActor Value set but not set in BT ?
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
Besides adding tests to filter out/score base on Z distance, I have heard of some games use the navmesh to simulate noise propagation. Basically, instead of finding straight line distance to a sound, find the path on the navmesh to it and use that so simulate obstacles attenuating the sound
In that way, you can have the AI prefer sounds that are closer in navmesh navigation
That sounds more like something done on purpose than an unexpected result tho
That only really works indoors tho... large outdoor areas might be weird
@lunar grove are you following some tutorial or where did you come up with this
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
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
@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.
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
Idk what that means
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
you should check out that video, instead of trying to fix whatever that is, it’s a wonder it’s doing anything at all rn tbh
Sure
[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?
A trace ?
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?
It sounds like you’ve answered your own question
Good rubber ducking tho
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)
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
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 🙂
Cause it’s easy
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
Less is more, usually
What do you mean a trace? a physic trace?! That's a lot less efficient and won't necessarly hepl me find the navmesh?
nevermind, sounds like I cant use RVO either, because it causes really bad network corrections
(on the player)
I meant a regular trace and ProjectPointToNavigation but I guess that’s trickier when it comes to multiple floors
If you are concerned with NPC to NPC avoidance you might wanna enable it for the NPC
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.
yea NPC to NPC is not an issue actually
NPC to player is the issue
and yea I know players can move away
but
I want to avoid players purposefully blocking NPC paths
did you see this? https://github.com/Vaei/PushPawn
yea but its not what I want, I want the npc to simply go around
trying to avoid players purposefully blocking NPC paths
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
the issue here is that I want the NPC to be able to avoid/detour players, but to do this that means I also have to enable RVO on the player itself, which makes no sense since its a controlled pawn, and that ends up making the server send corrections to the client
the ideal scenario would be enabling RVO on NPC only
but that doesnt work
must be applied on both NPC and player
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
ok I think I found a solution
what is it?
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
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
yea I noticed, but that is good enough for me
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
I guess for NPC to NPC it works
And then as a service or something watch for a player getting within a radius, predicting their movement and avoding it in the BT
for NPC to players the issue is just the server corrections
that is just my newb guess at how to fake it for network
but my change fixes it
What did you change?
and the network...
yea I tested on a client
yep
interesting
but I am also not moving
?
that is a pretty big distinction but that is good to know you can get that to work
thats the exact case I want to avoid
what happens if you move?
even better, because then you probably are no longer blocking the NPC's path
I do not think this will work well because all the clients might desync?
as I said, my use case to avoid players blocking NPC paths
not really an issue, in my case I'm simply doing Controller->MoveToLocation
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
how many clients might be interacting with the npc at one time?
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
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
yea as long as the NPC avoids the player I dont care how
it can slide, or bump into other stuff, I dont really mind
I would love to know if it works out with multiple clients without lots of rubber banding
a little bit is fine lmao
I would expect it to be alot of sliding around and weird movement, but I dont really see why would it rubber band, theres no reason for it
each client is seeing their own version of the truth. If it is suddenly being changed by other clients it will rubber band
its not being changed by other clients
well, it will correct positions
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
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
no it is exactly rubber banding
rubber banding was happening to the player itself, before I made my fix
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
because the player was constantly receiving corrections
yeah that is the dream
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
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
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
RVO only runs on the server
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
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
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
yeah this is for you to decide. There might be more corrections than you'd like is all I'm worried about
this is the alternative #gameplay-ai message
havent used AISenseprediction before
u need to test with more clients
is there docs on it AISenseprediction
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
yea I know it will look silly as I said before but I'm willing to take that instead of the alternative of being blocked
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
not using it is already game breaking 😛
cant have players blocking npc paths
players ar eway more used to blocking NPC and they lookin goofy vs rubber banding like a seizure
that depends
you definitely want some kind of avoidance
you can just sense the player, and use a deterministic position to move away
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
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
yea, those are all risks I'm willing to take compared to the alternative of being blocked but I will look into AISenseprediction regardless
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
I have some stuff working like this, but this specific case I was showing on the video, was just a simple AIController->MoveToLocation
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.
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.
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?
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?
Use a task in the task add an animation montage and use a wait node
If the animation montage is 5s set the wait time to 5 seconds
Use the play animation task
lmao
I mean it works for me
See pinned 3rd link
use a service to look for an active gameplaytag applied in a montage and abort when tag is gone?
Sure, just hardcoded af
Sometimes...that's all you need
You might need it if you want to jump to different sections in an animation montage
Fair enough
Except if play animation task can also do it
No. You do understand that the nodes are stateful and you should stay in the task while the animation plays.
I mean aren't you staying in the same task before the 5s wait ends?
No. The task that plays the animation.
🤔 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.
Sure noted 🫡
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
You should not use begin play in the controller. Use on possess instead.
got it thanks
OnPossess() didnt work sadly
What do you mean by didn't work?
Are you getting the pawn before or after calling the super?
ohhhh so call super on OnPossess()?
You must call super in every virtual function
No they are 2 separate events, the controller possesses the pawn after the former has “spawned” in, hence why you were advised to use OnPossess so you know your pawn is possessed and thus not null
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
@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
Sorry, no idea who's here.
Oh well 😦
Thanks for letting me know
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
IM me directly with the details.
Thanks
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.
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
If you want something to run constantly and abort mid-tree I think it’d have to be a service
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
Which part is confusing?
i dont know where to begin with making it
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
Okay thanks
@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.
You can add, modify and move the bounds volumes and then call On Navigation Bounds Updated in the navigation system. I'm not sure how subclassing the navigation system would make that easier.
Using level streaming for the nav mesh.
Your priorities are backwards. You want your highest priority (chasing the player) to be on the left.
Mostly so I don't have to spawn the AMeshBoundsVolume directly at runtime and generate the brush
I hear about level streaming as a ue4 concept, and that ue5 has alternatives and almost recommend against streaming... does navmesh level streaming fit in with ue5 workflows?
World partition is still level streaming.
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?
It does that for you
rad
Okay thanks!
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...
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
You can use rotate to face bb entry on a simple parallel
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
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.
Yeah, def a tricky one
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
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
Yeah, I had the same result again, Ai Movement always beats me
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.
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?
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
If you’re gonna use a service I’d do the rotate to face on it. MoveTo on a service is like calling AIMoveTo on tick
but setting movegoal in tick is ok right?
Yeah,
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)
@crystal hatch https://udn.unrealengine.com/s/question/0D52L00004lucgFSAQ/dynamicruntime-ai-jumping-generating-offmesh-links-without-navlinks do you have any information on this? The "Edge" links?
protip: when actively editing a comment in a BT, saving with ctrl+s will cancel any changes you had made to the comment 😐
I haven’t really made any comments in my BT, generally I just name the composite nodes accordingly
I am just doing the layout for a new bt
not usign the correct nodes/composites tho
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
Nothing out of the box afaik
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
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?
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.
Doesn’t seem like a good idea to do it that way especially if you have more than one ammo type
You usually only need to do one check, like isSet and put the fallback behaviour on the right branch, assuming you’re using a selector
Yeah I will strive to do that. thank you
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.
Doing all of that for an ai seems very involved and a bit of an overkill
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.
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.
Yeah, it does that but it’s a quick refresh if you click on each task that uses it iirc
That's a whole lot of task clicking... 😮
Name your bb keys properly to begin with and np 😀
There might be a better way to mass refresh idk tho
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
Priority is always left to right in BTs. If blue always appears to take priority, it generally means it is failing. Try pausing the tree at runtime and use the arrows to step back. Should show you what is happening
I'm trying to debug it but I can't find the reason
all of the decorators in the red section are "pass"
yet it doesn't switch over to it
Need a better res screenshot to read but step through each step using the pause if you haven’t