#gameplay-ai
1 messages ยท Page 123 of 1
https://streamable.com/hwg4j how would i make the movement better?
It's too slow atm i feel but not 100% sure how i turn the speed up
I've tried upping the walk speed but that's not doing much, i'm assuimg it's because the animations work on root motion.
Hey guys, does anyone know if there is a AI plugin / package / system to get something like Arma Alive mod ? Or something like Ghost Recon Wildlands. I mean, having a "life" in a big map with AI bien able to fight, gather resources etc ... in a persistant world and also has the multiplayer checkbox checked :p
why AI character stop chasing for no reason. i'm trying to move ai to character, but it stop chasing and behavior tree get stucked
er, so to get crowdAI I have to create a child of that from my AIController?
Is that right?
Does this section do anything? I've plugged in some extreme values to check and it hasn't altered navigation at all
I'm trying to prevent the navigation from putting the point to move to right next to a wall and I figured tweaking the collision size would do that
that just determines what navmesh it uses
hi has anyone ever experienced an issue where your bot thinks it's reached a destination but it hasn't?
I'm setting a target in AIMoveTo that is unreachable -- the navmesh is broken up by geometry
the bot will approach the edge of the navmesh, and once it hits the edge the node returns Success as the Movement Result
starts here targeting the red blob
ends here with success
HasPartialPath returns false, so it should never think it's at the target unless it is right?
ofc, its reached as far as it can
how do I specify that I want the movement to Fail if the target is unreachable?
turn off partial path
hm yeah I did try that, but same result
haha yeah one would think
like I said HasPartialPath is false, which definitely seems weird
behaviour tree move to?
I'll try turning off partial paths again, maybe my editor didn't pick it up
nah this is just the blueprint node
ok
yeah turned it off again, restarted the editor, bot still walks toward the wall and stops
maybe a bug? is there anything else I need to do for that setting to take effect?
are you using bt?
just to kick off the logic BP
try using the built in moveto and see if you get the same results
also does path exist is a built in node as well if you need it
same result with BT MoveTo node
oh interesting, how do I get a Navigation Testing Actor?
@dark hollow If you want to change the agent's radius, go to Project Settings > Navigation System > Supported Agents add a supported agent and edit the values there
Hi people, I am trying to make weakspot/armorpart system (just as Damage Modifier for my characters/enemies), problem is that my capsule collider hide weakspots inside and i cant shoot them. I am tried to make mesh root component and on some way disable and remove capsule but unsuccessfully. If i disable collision on capsule and enable on mesh, my character drop down through the floor. So I decided to put small capsule on bottom character (as pisvot) and enable mesh collision and it works , BUT i have a fealing it's not a right way? Do you anybody knows something more about it?
Hello, do you know how to dynamically set the time in a wait node in a behavior tree?
@pine steeple Hey, could you elaborate on your implementation for what you had said previously about large navmesh agents registering themselves as crowd obstacles?
So all agents need to use the same names
Navmesh
@Tanoran#5405
Way we have it set up in our game. Big agents don't use crowd avoidance logic but register themselves as obstacles to the crowd following comp. Normal agents use crowdnfollowing as normal but will avoid obstacles including big agents. Just big agents don't avoid the normal agents so we ended up using rvo only on the big agents to avoid.```
I'm at the point where this is necessary (and know a little C++) so if it's not too complex I want to see if I can manage it.
Right now I have small enemies (which are using an AI Controller that inherits from DetourCrowdAIController) that are moving through larger enemies because the large enemies cannot use the crowd system (due to the one nav agent limitation).
Do you have Nav Modifier (as obstacle) on enemies? Maybe that...? I tried DetourCrowdAIController but my enemies start with some crazy rotation glitches...so I postponed that for later
Setting the large enemies to be nav obstacles broke their navigation. Since they're always on a part of the navmesh marked as an obstacle they don't move how you would expect. They're basically always trying to move away from themselves, so they move pretty randomly.
Making large enemies ignore nav cost would fix the strange movement, but I'm not sure how to do that.
CrowdAvoidance has options
one of them is SetCrowdSimulation, it has three things, Full, Obstacle Only and disabled
this is how we setup our crowd simulation
{
if (bDisableCrowdSimulation)
{
UAIC->SetCrowdSimulationState(ECrowdSimulationState::ObstacleOnly);
}
else
{
//Below is hacky cause i got pissed off with it.
if (AvoidanceQuality == ECrowdAvoidQuality::ECAQ_Low)
UAIC->SetCrowdAvoidanceQuality(ECrowdAvoidanceQuality::Low);
else if (AvoidanceQuality == ECrowdAvoidQuality::ECAQ_Medium)
UAIC->SetCrowdAvoidanceQuality(ECrowdAvoidanceQuality::Medium);
else if (AvoidanceQuality == ECrowdAvoidQuality::ECAQ_Good)
UAIC->SetCrowdAvoidanceQuality(ECrowdAvoidanceQuality::Good);
else
UAIC->SetCrowdAvoidanceQuality(ECrowdAvoidanceQuality::High);
UAIC->SetCrowdAnticipateTurns(bAnticpateTurns);
UAIC->SetCrowdObstacleAvoidance(bObstacleAvoidance);
UAIC->SetCrowdSeparation(bCrowdSeperation);
UAIC->SetCrowdSeparationWeight(CrowdSeperationWeight);
UAIC->SetCrowdSlowdownAtGoal(bSlowdownAtGoal);
UAIC->OnRequestFinished.AddUObject(this, &AMonsterControllerBase::HandleRequestFinished);
}```
big monsters have the bool bDisableCrowdSimulation set
which registers them as Obstacle to the crowd following component
Ok. This is set up in your enemies then?
for crowd following yes
i had to expose some stuff
cause CrowdFollowing exposes nothing to BP
which sucks
Gotcha. Ok, well this gives me something to go off of. My brain is pretty fried for the day but I can start looking into this tomorrow. Thanks so much!
are you satisfied with the crowd sim stuff? Last time I tried it it seemed to produce quite erratic movement for pawns, rotation wise at least
@prime saffron this is not the channel to advertise.
@prime saffron Please see #old-rules, specifically rule #6
So I'm building an ai who as part of it's behavior tree functions needs to chase a sensible enemy (done) and then follow it's owner if it cannot
What's a good way to find a reference to a certain actor?
I've tried a tag approach but I can't store the reference I get from that it seems
Hello ๐
I'm a total beginner with AI and was wondering if it was possible to make the AI not being able to see through collision
Any way to detect when exactly AI loses sight of you in VR?
it's possible with the ai perception system
there are events that are fired when the ai loses and gains sight of some target
he folks, trying to work out order of operations here.. does possess always happen before any begin plays?
if i spawn an AI pawn for example
with an AI controller class set
I have values on a pawn which are calculated during its begin play
and i need to assign those values to a blackboard
but the blackboard can't be accessed until the pawn is possessed and the controller has begun play
i'd prefer having it always work the first time, as opposed to some kind of handshake thing
@wary ivy you mean this?
what would be the need to have 2 versions of "Event Receive Execute" .. where the 2nd version has AI at the end ?
i always just use the AI ones
think it was intending for BT that doesnt run on AI Pawns
but ๐คท never tested
hi all, how do I alter NPC decelleration as it gets close to a move to goal?
In AI controller, how I can get controlled pawn? No, GetControlledPawn node does not work. I need data from main blueprint of mob on EventBegin to setup certain initial data of blackboard.
In this case I spawn mob with information where it should go just after spawn. When it reaches that first location, internal location determination takes over.
what do you mean getcontrolledpawn doesnt work?
what does it return?
you may need to cast the actor to your actor
it returns a generic AActor or APawn, I can't remember
thats the thing, it returns nothing
I know it should be casted but cast fails
this is code with debug print
this is result in-game
and I don't know why, google says it should work, AI otherwise works
Can anyone point me towards an AI tutorial that's a little more advanced?
I know what tasks, decorators, and services are but I want to see how to put them together in a sophisticated way.
if I want NPCs to avoid pathing near my player, is attaching a nav modifier volume to the player an acceptable idea?
glad you solved it @bleak raven , also nice Spider pic
Guys, I am trying to find the best approach for simple traffic AI and moving along splines would be the best option I guess. My question is how would you approach building navigation grid using splines? I need to have a full network with capability of tagging individual segments (max speed, stop, triggering certain events when vehicle hits a certain segment). Is my design idea correct for what I want to achieve? Do you have some experience in creatin AI traffic that you can share?
anyone know why there is "Event Receive Execute" and "Event Receive Execute AI" .. what is different between the 2 ?
HELP ME
show the black board
its fine why would it be related to the black board
because could be some variables not set properly or such
looks like everyone is either busy or unavailable
;-;
They must be all playing games in their home !! lol
yup
Make sure your pawn is actually possessed by the controller (if the pawn is spawned you need to call SpawnDefaultController). Check in the runtime debugger if the BT is even running.
make sure your AI Controller subclass is selected for the pawn to use
@warped elm I think things that arn't ai can use tasks
@fallow hound untrue, I got a camera using tasks and a BT/BB
hmm? I said can
what for?
no sir
yeah but the BT derives from a braincomponent
all the controller does is instantiate the BT and set it up
so you have an actor with a BT comp?
yes
I mean I went and created a custom derived class for my BT that I could expose to BP
same with BB
basically the custom BT component handles its own setup. there's already functionality to scan for BBs, but you also set it up manually
I was really surprised how simple everything turned out to be
interesting, thanks for sharing
yea no worries
yeah I spawned pawns/with controllers to run BT logic
oof
which worked fine but isn't very elegant
yea
I mean don't get me wrong here, I'm not a master cpp programmer, I know a little but mostly work with blueprints
I just didn't want to get stuck using controllers like that
because my thinking was that I'd potentially paint myself into a corner
if you need any assistance setting it up though let me know
but I definitely urge you to take a look at UBehaviorTreeComponent
thanks!
Still wondering why there is EXECUTE and EXECUTE_AI
dunno myself but execute ai gives convienient access to the pawn and its used in every tutorial ive seen
@warped elm https://youtu.be/nshHCycft4A?t=2993
Announce Post: https://forums.unrealengine.com/showthread.php?135116
Mieszko Zilenski is back in action with Alexander to talk about how to get set up in UE4 with basic gameplay AI. We will be covering how to set up AI Controllers to properly handle your Behavior Trees and the...
reason i ask is because my boss does not use the AI version of it and all seems to work properly
Hi all, kind of a design/performance philosophy question. Let's say I have an AI who can have their weapon knocked out of their hand. I could have a GatherInfo service that is checks if they are armed or not every tick and sets the BB value, I could also manually set the BB value whenever they loose their weapon in the game logic.
The service seems so much easier to maintain... a nice central location for gathering data for decisions.
but the event based one seems more performant
if you already have a service running, then use it
services don't have to tick, i have a service that runs, that binds to events
I have a design question as well. If I have information that is being reacted on per frame in a task, what is the best way to supply this task with that information outside of the task itself? preferably without stopping the task too
ontick
if something runs per frame the only thing else that runs every frame is tick
that's not what I am asking though
I have tasks that bind event listeners while they execute. For example, a "UseAbility" task binds an event that waits for the ability to end, which will fire from the pawn it's listening to. Otherwise you could also poll the info off the pawn or controller in the task's tick depending on what it is.
yeah dynamic event listeners isn't a bad call, don't know why I didn't think of that. do you manually unbind them as well?
I have to essentially poll some math that due to the constraints of the system can't put in the same place
Yeah i unbind everything myself usually on end, not sure if the task is reused.
I see
in my case it's the lowest priority task
externally I wouldn't be able to communicate values through anything but the blackboard, even if I e.g. put a service on a task or some such, correct?
Technically you can move things however you want. You can interact with the pawn or controller directly from within the task. But if you mean pushing things to the task directly, no I don't think so
yeah okay
Seems like you wouldn't want things referencing a specific task instance anyway though
the issue is I can't have the values being read and set in the same execution thread
as it's causing me a ton of issues currently
no, true
the blackboard is just a hassle to use... on the other hand, if there is no alternative...
Yeah, I don't like the "stringly typed" key names you need to use... Sounds like some other architectural things are also contributing too in your case
in an ideal situation I'd be able to hook up two tasks independently in a sequence, and then arbirarily restart the sequence when necessary
the last/lowest task is never intended to finish, but it could be abort to reset the sequence
but that would stop the execution of the last task
for perhaps a frame or more
which I am not sure is consistent enough
Gotcha. Random thought I have reading that is to try a service that you know will stay running and can update a BB key. Have a simple task on the end that kills the sequence when that key is flipped. ๐คทโโ๏ธ
hmm
I don't think I need to kill the sequence, I can just decorate with an abort lower
unless that for some reason wouldn't work?
Ah, i finally know the difference between Event Receive Execute and Event Receive Execute AI. the AI version provides owner controller and controlled pawn as outpout, then with Event Receive Execute an actor is provided !!!
Any ideas why this pawn moves into the ground and then gets stuck? The vector its set to MoveTo is clearly on the same plane...
Hi guys, is it possible to get all parent nodes and all children nodes in Behavior Tree?
in c++?
yes
sure, but why do you need too?
Im building an AI spawning system that have requirement overlapping between each spawner
ok?
I wanna have a node that congregate all the requirements in my AIController as a manager. All the requirements are placed on individual nodes.
So the node will go to all children, get their requirements and send it to AIController.
Say you wanted to cut off certain bits of nav mesh, without using nav modifiers... how would you generally go about doing that? ๐ค
If it's even possible
Iโm making a civilian ai for my game right now what would be the best way to make my civilian stick to roads when travelling?
Im building an AI spawning system that have requirement overlapping between each spawner
@stoic kelp Nvm I solved it.
But I have another question. Behavior Tree does not support convergence?
@wraith eagle Why without nav modifiers? Those are generally the main way you would cut off parts of the nav mesh other than putting actual collision hulls in it.
Cost of rebuilding really. Working on another solution now anyways
This might be a long shot but you could include in your AI, checks over an array of structs or Actors that contain the location and radius or bounding box of areas you'd like to exclude, but which don't actually change the navmesh itself.
But that only prevents them from selecting locations in such areas, it doesn't prevent them from pathfinding to them unless you modify the pathing algorithms in C++
With very large, open worlds, it is recommended to use a dynamic nav mesh rather than a pre-computed one.
Especially if you're using level streaming with world composition
But I'm not sure how you get reliable pathing in that situation.
Over large distances anyway
anyone has an good example for AI getting out of my way on collision?
kinda want them to go away for a few seconds (which works so far) and then return to their old position
but somehow pathfinding to the old location fails sometimes, and they wont recover their rotation
i've tried saving the focal point before moving out of the way, and setting it back when returned, but they wont take their old rotation vector
will they match forward vector?
uhm, no idea
so theres nothing that would handle the interpolation for me for a smooth transition?
i mean, i can do it on my own, just would like to avoid it if not necessary xD
don't think so no, not automatically
Is there any way to pass a blackboard key (like an actor) to a BTTask BP?
I want it to teleport to a passed actor
just discovered that calling MoveToLocationOrActor from the AIController "OnPossess" event will fail if the controller is spawned from the beginning (for instance because the pawn is manually placed in the level). Is this expected behavior? (UE 4.23.1)
@obsidian oracle check out Blackboard Keys
does anyone know why my navmesh wouldn't package into a cooked build properly?
Im using static navmeshes, and everything works perfectly in the editor
but when I cook a windows build the recastactors exist, but seem to contain no nav data
Im getting this message too "too far from navmesh"
despite the fact that the mesh should exist around my character
Hi!
This might have been asked before here, but can't find an answer for it: Detour Crowd Control, how to register/unregister ai agents?
In our game we have something we call Distance Based Optimizations. It's a process we run that checks how far AI is from the player and, depending on the distance, we apply different settings. When close everything fully works, when far, we disable ticks and other things.
Now I'm playing around with the Crowd Control and I want to un-register the AI (or pause, not sure the right terminology here) when it's far from the player, enable it again when it's closer.
But I'm failing. I can't figure out the right way to re-enable it.
To enable crowd control, I found thin in the wiki (RIP wiki, thanks a lot Epic....) : Super(ObjectInitializer.SetDefaultSubobjectClass<UCrowdFollowingComponent>(TEXT("PathFollowingComponent")))
You have to place this line within the AI controller constructor.
Good, that works.
The Register/Clean functions are within that component and they are protected, so I wrote an extension with public wrapper functions that call those protected functions.
So the line looks like this now
: Super(ObjectInitializer.SetDefaultSubobjectClass<UMyGameCrowdFollowingComponent>(TEXT("PathFollowingComponent")))
And this are the wrapping functions I wrote and that I call
void UMyClassCrowdFollowingComponent::RegisterAgent()
{
Initialize();
}
void UMyClassCrowdFollowingComponent::UnregisterAgent()
{
Cleanup();
}
But this doesn't work. The Unregister works but, when I call register (initialize) I can see that AI doesn't behave the way it should again (avoidance is missing).
Also, it feels like I'm re-inventing the wheel.
Funny enough, there's a way to do this for actors that need to be avoided and that are not part of the crowd control (like players).
This is a comment from the CrowdManager
* Actors that should be avoided, but are not being simulated by crowd (like players)
* should implement CrowdAgentInterface AND register/unregister themselves with crowd manager:
*
* UCrowdManager* CrowdManager = UCrowdManager::GetCurrent(this);
* if (CrowdManager)
* {
* CrowdManager->RegisterAgent(this);
* }
*
Anybody with experience in this? or that has solved this similar problem?
Thanks!
Ok, this was a rubber duck situation... As soon as I hit enter, I realized it was much easier than I thought and everything was there...
This is how the wrapper looks like.
Anyway, fi you know about this and I'm re-inventing the wheel, let me know please. Uncharted waters for me
void UMyGameCrowdFollowingComponent::SetCrowdManagerEnabled(bool Enabled)
{
bRegisteredWithCrowdSimulation = false;
if (UCrowdManager* CrowdManager = UCrowdManager::GetCurrent(GetWorld()))
{
ICrowdAgentInterface* IAgent = Cast<ICrowdAgentInterface>(this);
if (Enabled)
{
CrowdManager->RegisterAgent(IAgent);
bRegisteredWithCrowdSimulation = true;
}
else
{
CrowdManager->UnregisterAgent(IAgent);
}
}
}
Hi, so anyone knows its possible to cover a 6x6km map with navmesh?
why couldnt you?
would be terrible
but possible
i would use nav invokers and have navmesh generated around the agents
@static crater I've done 2km x 2km, but it seems the better approach is to generate the mesh as needed at runtime. https://www.youtube.com/watch?v=0Nuuq-hDwUo
i seen, however, when generating at runtime, ai cant move out of its radius size right?
if you want free roaming agents, attach the invoker to the ai pawn
then it'll generate navmesh around it as it moves
hi there, do you know if there is a way to specify the waiting time in the wait node in behavior tree?
@solemn viper There's the wait time property field in the details panel. Unless you're talking about changing it in real time, then I don't know haha
In editor Time it's fine! I did not see it, will check again. Thanks !
About the wait Time, I dont need to change it at Runtime but still need to set it per instance :/
Ok, I need help. Am I just not understanding how the BT Cone Check decorator works? If I have an enemy and I want to know if the player is within a cone coming out of the enemy's forward vector, the BB vectors would be the enemy's world location for the Cone Origin, the enemy's forward vector for the Cone Direction, and the player's world location for the Observed... right?
Cone Check always returns zero and lets the execution through even though I can clearly see my BB vector keys should return a non-zero number.
Anyone had problem that Simple Parallel task does not tick?
ExecuteTask happens once and that's it
nvm... it seems that ticktask is by default false, had to do bNotifyTick = true;
Hey, so as my navmesh is pretty large, and takes a while to rebuild i was looking for a way to enable disable the navmesh without removing the data.. any idea how?
Guys, I have dynamic navigation, but it does not update when I add component, however, it does update when I spawn an Actor with same component. How Do I update navigation so it can see my new components?
Is there a way to attach tasks to using a navlink? I'm thinking of instructing an NPC to open a door before the proxy is valid.
@static crater why did you not use NavInvokers on a big map?
that is the primary purpose of them
@fallow hound no, i use smart links, when the ai reaches a smart link (in my game for example), the AI destroy the door, then proceed through
if the door is destroyed the navlink is removed.
Cool, I'll look into them ๐
Hello! My BehaviorTree task is constantly run (and succeeds), but the tasks afterward never go into effect. Does anyone know a fix to this?
@pine steeple im still kind of good with not using nav invokers ๐ still thinking of use them maybe though
my map is around 4x4 or so, only the navmesh takes some time to build thats all (and yeah, the game load is affected, but thats ok)
random observation: I've always wondered if one was making a game like Arma, you obviously need some sort of invoker style local nav area being built around the AI, but how do you get it to handle things like pathfinding across a bridge from one corner of the map to the other as well? need multiple "layers" of navigation data, or high-level and low-level nav data somehow I guess?
question, how do i get the ai to move around the player instead of head butting the player until the player moves away?
set the stopping distance
and have some logic that makes him move around the player?
or use crowd avoidance
and register the player as an obstacle
something else below is blocking it?
if there is no valid path, it will stay on the root node.
a valid path is a path to a "task"
if there is no valid path to a task, nothing will execute.
inside getenemy im setting this:
and when i print out... it gets set to it too
@pine steeple so it should either go to enemy is set or not set
in the beginning it goes right away to not set for some reason then when that chain finishes executing
it gets stuck on root
well your nodes are wrong
why?
sequence executes left to right
and returns on failure
its gonna fail on the first node on the left side
you want to use a selector
CanShoot is false, the whole left side wont execute
Selector = Execute each node till a node returns success.
Sequence = Execute each node till a node returns failure or all node returns sucess
ah
yh
np
if I want a door to spawn a navlink on it when I drop it into the editor.. how would I do that?
navlink appears to be an actor, not a component
I could do beignplay, but I'd liek to be able to see the navlink actor in the editor
i made my own custom smart link component
in c++
and its a component on the actor
hmmmm
I just noticed that the naclink actor has nice functions like to resume pathfinding, and delegates for when npc reaches the proxy
did you remake those in component?
does anyone know any good AI solutions or something for UE4?
i tried out like basic blueprint code, then behavior trees + EQS, and now im just writing up my own system based off of this: https://www.tomlooman.com/journey-into-utility-ai-ue4/
it doesnt feel like theres any good solutions for AI built into ue4 though.
I think hundreds have games have shipped using UE4s BTs, what's lacking for you?
adding more tasks/branches gets really unwieldly
and trying to figure out what will actually run is kinda a head scratcher
the article i linked talks about this some more
As mentioned in the intro we had some issues with using Behavior Trees once the number of available tasks per Agent increased. Every new task could influence the other parts of the tree without this clearly showing up until you ran the tree through some actual playing. It requires a certain way of thinking to create effective trees and allow for easy extension which can be hard to get into. We also found it can be difficult to get back into a tree you havenโt touched in a while.
i dont want to say that behavior trees are bad, i just find them really frustrating ๐ฆ
They do have a learning curve, but rolling your own AI solution will be an even larger learning curve
thats why i want to know what everyone else is using
if theres any other alternatives or if anyone has found any good free plugins or something
I think AI is just hard haha
Dunno if there's a magic solution
But this is a great article on BTs https://www.gamasutra.com/blogs/ChrisSimpson/20140717/221339/Behavior_trees_for_AI_How_they_work.php
I've been working on my own utility ai solution for months. Months I could have been actually building a game but I am stupid and won't let myself give up on it 
is ur code public?
im writing mine up here: https://gitlab.cactus.vg/nchalkley2/utilitysystem
Not right now, might make it public once it hits a state I'm actually using it
I been using this for the ai to find a random points to run at when i enter his radius
But is there a way he can ran away from in a direct line?
The ai is an animal i want him to run away from me ;d, and some times he run towards me cuz of the random point
Any thoughts? and thanks โค๏ธ
probably use EQS? It will generate a bunch of random points, and you can do some math to choose a point that is away from the player
@lyric flint
@fallow hound Thanks for pointing that mate, but i heard some people using dot product and find look at rotation node for that some how
you ever tried something like this?
if you used EQS dot product would be a good way to test the points
you'd get direction of animal to point
and direction of animal to player
and run a dot product on them, which tells you if they are same or different direction
a dot product would work tho aswell, but we do ours with EQS (for things like Evade) etc
as it has a Dot test
oh ahha I didn't know eqs had a built in dot test
my AI is too accurate right now. I tried randomizing his spread but it didnt help
heh
how can i make them a little less accurate but still be good
this is what i have for the end location of their line trace
and degrees should be something like 5-10?
you just adjust the end point
depends, i normally run like 5-20
depending on how long its been firing for
and cone direction is the actor location? or should i get a specific socket on the mesh for a better result
you adjust the end point of the trace
where it hits the player
by the random vector
thank you... will try it out
checked actor location and and the gun location and there are good
you cant do that
you need to have some range
say 10000 units, then apply a random cone to the end result of the line trace
you need to do the trace first
so i can my original logic to get the line trace
then apply random cone to the end of that?
yes
why dont i have return node in my decorator as an option
ive checked old decorators ive made and its clearly there
Prob need to override the right function
It was working fine this morning i dont know where i missed it up
All Ai's reacting at once with animation
Any thoughts why thats happening?
all of them same BP
Anyone had this problem b4?
https://gyazo.com/d32119765d52f7bc2b0521e86af71f00
Really need help its killing me
It was working fine this morning i dk what i missed up
Am checking with the error coming from
but still no clue
i think you need an "isvalid" node
the error suggests that the code is trying to do something with the actor after it is destroyed @lyric flint
but NuN why all zombies
playing animation with same time
It was working fine i dk what happened
they use same code? im not good at it. I would think once one of them dies or so, it cant send all information to all actor. I think "isvalid" could be the solution. I have no real knoweledge buddy, so i wish you good luck ๐
Hi! Where can i find more information about crowd system?
can a service do something like force a success on the node its attached to?
how might it be done in c++?
tricky, you would have to get children underneath the service
and call abort
or grab the running task (i think there is a way) and call abort.
if you don't get it sorted, when i have some free time ill take a look
you could cheat
have a bool blackboard key
and an abort node
i mean a blackboard decorator
and abort when the key is set
service can just set that key
on same node as service
yeah I was thinking the same thing
one way or another I'll get it
for a bigger picture, I'm running a move to, and want to go to the next task in the sequence once the move to destination is in sight
I have a pawn moving in my level but it twitches/jerks very badly when moving. These are my settings.
1: NavMesh is set to generate dynamic.
2: Extended from APawn class.
3: Uses custom made movement component inherited from UFloatingPawnMovement.
4: Capsule component has Can Affect Navigation enabled.
If I disable Can Affect Navigation there is no twitching/jerking but then pawns are not avoiding each other. Floating pawn component doesn't have RVO avoidance.
I don't think pawns should affect navigation, it causes a navmesh update in the tile it is in
But then how will I make the pawns avoid each other.
crowd avoidance.
Floating pawn movement doesnt have RVO avoidance
why you using FPM with navmesh?
@pine steeple I inherited from FPM to make my own custom movement component which is far more simpler than character movement component.
Plus I'm using pawn
will have to write your own avoidance system then
could kinda borrow what RVO does in the CMC
there are also quite a bit of whitepapers for reciprocal velocity obstacles (rvo) on the internets if you want to read more about it
Optimal Reciprocal Collision Avoidance (C++). Contribute to snape/RVO2 development by creating an account on GitHub.
Thank you @wary ivy. I'll look into it.
Guys, I'm rarely getting characters stuck in nav mesh borders like this:
The guy can't move. If I lift him up and place on nav area nearby, he starts to move just fine
Any tips on how to fix this via config, or even better - can I somehow track this particular scenario in my cpp tick and if that happens - try placing him on some random spot nearby? How do I catch this particular scenario in code?
I haven't looked in depth into it, but in the robo recall mod creator you get the full robo recall source code. They had logic in there to help AI find navmesh again when off it.
I think it was in the npc base controller class?
Thing is, he is on nav mesh
You can see that on the left, he's NavMeshWalking
oh found it, its in void AOdinCharacter::Tick(float DeltaTime)
When you put an AI off the navmesh, it goes into Walking
and I check that in tick and put him back on it
but it thinks that it's on navmesh, and yet fails to walk :)
thx I'll check it out
you could also mess w/ navmesh settings, like cellsize if you want
also why are you using navmesh walking, performance?
just curious
I'll mess with cellsize, thx. Gotta find the docs on it
I've had them get stuck off the navmesh if they were Walking, due to RVO
I changed it so that I force NavMeshWalking, and this allows me to instantly catch when they got thrown off the navmesh - they switch back to Walking. I catch that and find nearest point on nav mesh (taking into account the navAgent size). Has worked very well so far
At least considering that this thing above is a separate bug altogether
yeah I'd def look into the robo recall solution
sounds like epic ran into same issue, I imagine their solution is good haha
how can i check if a certain vevtor is reachable by a ai pawn
hello everyone! How do you do vehicle AI movement? I need moveTo logic. I'm writting car deathmatch game, where I need AI controlled car to drive to position. Seems like the only way is to override "RequestDirectMove" in NavMovementComponent
i hate AI so much
im calling MoveToLocationorActor on an AIController but it doesnt seem to do anything
i dont get a request failed or a move finished
do u have a nav mesh?
yeah
so like my guard does a patrol and a chase
and after its done chasing and it goes back to patrol, sometimes it just gets stuck in a loop and does nothing
and pathfinding doesn't seem to work
make sure the event is being called in the first place and the loop would only happen because of faulty logic
yeah so its being called
i would double check the logic then
move to location or move to actor
is the actor valid
yeah
is it in bluprint
wym?
is it in c++ or bp
C++
the guard has a reference to the actor in blueprint
and my AI accesses that reference and tells the guard to move to it
hmmm
yeah its really fucking weird
so task 777 is the patrol task
and its supposed to move
oh also my nav mesh is valid
the weird thing is that path finding always works with chasing the player but not going to the waypoint?
TURNING OFF continuous goal tracking fixed it
fucking hell
why does continuous goal tracking break it???
I know it's a pretty broad question but
does anyone know how to make an ai good for multiplayer using eqs?
or did anyone find any good tutorials on it?
ai is server only
you don't need to care if its multiplayer or not
everything is done server side.
Somebody give me some advice! How can you interact with the enemy by grabbing a certain part of his body, like his throat? Any thoughts on that?
@pine steeple Can you explane? Or give some video?
hi
am working on PawnSensingComponent component
but OnHearNoise is not working anybody can help me with this
@quartz lark don't use Pawn Sending
use Perception System. Pawn Sensing is pretty garbage.
Zombie infection!
#indiedev #indiegame #gamedev #game #gamedevelopment #UE4 #unity3d #zombie https://t.co/7ElxlvaG2c
For some reason
The awarness of the ai
is too slow
if its only 1 ai he will react fast
but if there is multiple it will take time
any reason for that?
Is there a good way to create an AI that follows a distinct pattern, unless a special rule is met?
For example, the AI must follow the grid and cover every coordinate unless the following happens: The coordinate directly to the left or to the right has a higher value than the current one has.
I am generating a grid that covers the area of the patrol and depending on the size the dynamic path changes. If the pawn detects objects of interest, then the pawn should head straight for the object, but that is easy to fix.
The only thing I can think of is to not use the AI tree and code it myself in blueprint or something with goto commands.
When the ai hears a sound he goes to the location but if i want to make a new sound while he is in the middle of the behavior, how do i abort/restart a behavior
How can I get information about the path a controller is following? Through the path following component? I'm looking to check if smartlinks are involved in the path for instance.
yeah but its not that easy to get if its a navlink
Am trying to make the player chase the an imal in a stright line
i did everything chasing etc but the animal is getting a random point to go to as i enter the radius
I want him to run away from me cuz in random point he might come to me ;dd
Any thoughts? and thanks
@lyric flint i hade the same problem. Do you mean, if the player gets near the animal the animal can sometimes get a random point near you so it looks like the animal is running towards you.
@olive delta
Yea mate i want the animal to run away from me ;dd
You managed to solve this problem?
its killing me meh
Okay so I solved it : D @lyric flint sorry for not replying so fast I was trying to confirm your problem
The blue dot is the animal, and green dot is a random location he can go to and a red dot is a location you donโt want the animal to go to. Yellow is you character
So to solve the problem you need a node called something like random cone in degrees
ohh really thanks mate ๐
ok take your time am here ๐
Itโs ok : D I will help you
@lyric flint okay, still here?
Yup am here mate
Hahah ok same
cuz I searched like forever and asked here and got an answer
Hahah so I will transfer the knowledge from me to you lol
That sounds weird but okay
So
Something like that
Yup hahah
Okay so what you need to change here
And 180 = 360 so set the cone value to something like 60
Depends on how you want it
Wolf ref in my picture is just a wolf, but in your case set it as your character
I think I did it like, get player character-> get forward vector-> random cone (60) -> multiply (5000)
When the animal saw me and not wolf
Did it work
am going to try it and let you know how to gose
Ok
am testing it atm ;d
Hello, I am trying to have a path that a player can place down that pawns then can access to move from one place to another. I've never really tackled this topic before so was wondering if anyone could give me a nudge in the right direction?
@rotund lintel do you mean patrolpath?
In this episode I show you how to make a NPC patrol a route; travelling from point to point.
Support me on Patreon and get access to videos early, join our developer community on Discord, get exclusive behind the scenes videos on my projects and much more over at https://www....
Hey that looks really helpful, thank you!
Ah cool! Hope it will help
kaos, what makes it hard to find a navlink in a navigation path?
Also for future reference do you mind being pinged?
if ya dont ping me, i won't always see your message
as long as its not a random ping ๐
been a while since i tried to detect if a navlink is on a path
const FNavPathSharedPtr& NewPath = PFC->GetPath();
if (NewPath.IsValid())
{
FNavMeshPath* NavMeshPath = NewPath->CastPath<FNavMeshPath>();
if (NavMeshPath && NavSys)
{
for (int32 LinkIndx = 0; LinkIndx < NavMeshPath->CustomLinkIds.Num(); LinkIndx++)
{
INavLinkCustomInterface* const CustomNavLink = NavSys->GetCustomLink(NavMeshPath->CustomLinkIds[LinkIndx]);
URTSNavLinkCustomComponent* NavLinkComp = Cast<URTSNavLinkCustomComponent>(CustomNavLink ? CustomNavLink : nullptr);
if (NavLinkComp)
{
const float DistToLink = (MyPawn->GetActorLocation() - NavLinkComp->GetOwner()->GetActorLocation()).SizeSquared();
if (DistToLink < FMath::Square(InnerNavLinkClaimRadius) && !MyPawn->bCooldownNavlinks)``` could give you some ideas ๐คท
something i did about year and a half ago
@fallow hound
Thanks for the code ๐
does anyone know if i can somehow have a navmesh on a BP? i have 50+ maps, dont wanna have to go through each of them everytime i change some config
everything i need to share betweem maps is in a bp, but then suddenly a navmesh is not possible \๐คทโโ๏ธ
How do you make an AI detect multiple enemies/players?
@pine steeple am trying to get my zombie Object field
So i can get its forward vector
but what should i put in the object field as there is no other actor here ;d
Please don't randomly ping me :/
And you need a reference to your zombie. How you get that is down to your game. You want magically just get a zombie. If there is only 1 you can use get all actors of class and get the zombie. If there is more than 1 you have to store reference to it. Villager should know what zombie is chasing it.
if an AI character is stopped, blocking a hall/doorway, is there any way to have other AI pathfind an alternative route around them?
e.g. A wants to get to Goal, but B is blocking the doorway to the most direct path. A could go around but instead A just bumps into B and waits there forever.
------
A B Goal
------
Hello, I was having a problem with AI Spawning animation not working except the Idle. Would anyone know how to solve that?
@brisk zinc use crowd following or RVO
@pine steeple crowd following and RVO are both ineffective if one of the actors is stationary
i never had issues
i also have bump detection
if two ai bump each other X amount of times, they move out the way
if one of the AI doesn't (currently) move, then they can't move out of the way
why can't they?
stationary character
if they get bumped, they can switch behaviour tree, or the one whos moving, if he bumps, he can run a eqs query to find a way around the obstacle
but stationary AI
i mark as Obstacles
in the Crowd Following Component
then they walk around them
hrm
{
UAIC->SetCrowdSimulationState(ECrowdSimulationState::ObstacleOnly);
}```
no way to do that in BP though
@pine steeple thanks, I'll look into this
yeah this is almost identical to the problem I'm seeing: https://forums.unrealengine.com/development-discussion/blueprint-visual-scripting/1721770-can-ever-affect-navigation-not-staying-enabled
Sorting out my AI movement. As I have multiple AI, their capsule needs to affect navigation so that they know to go around other units. In the BP I select the collision component, enabled the "can ever affect navigation" and spawn one in the level. It always spawns with that ...
Hi guys!
I'm having a weird issue, I have a behaviour tree on an ai character, I find the location of the player char, and feed it into a MoveTo in the BT, yet the AI is not walking to the point I give it. It actually seems like it's walking as far away from the point as possible.
When i track the AI as i walk around some obstacles it seems to be hugging the outer walls of the arena.
Running 4.24, Anyone have any ideas as to why this is happening?
@brisk zinc that post does not say anything about him using CFC or RVO.
RVO is a no go here
CFC always works for me
i never get this issue
@pine steeple is CFC different from inheriting from or using Detour Crowd AIController?
CFC is Detour crowd
is there a way to disable an AI from giving move inputs
i tried Set Ignore Move Input and it doesn't seem to work
Is there any guide on how to setup an array on a Blackboard? I understand that you have create a custom C++ Class that inherits from UObject and stores the TArray there. But how do assign the custom UObject to the Blackboard? I want to have a service that gathers information about the player and store the information on the Blackboard. One of the key things that I want to gather has to be stored in an TArray. Thanks!
@pine steeple here's a screencap of what I'm seeing, does that look like what you would expect if I wasn't setting that obstacle flag?
the character seems to go off in the right direction at first, but then can't seem to decide what to do
makes me think I have borked a setting. That's using standard character with both AI Controllers set to DetourCrowdAIController. Made capsule a bit wider for both characters. The left hand character is set to MoveTo the position at the end of the hallway. New project so all default settings otherwise.
@brisk zinc It looks like that ai is learning to dance
Does somebody know why are most of my random navigable points on the grid ?
how are you generating them?
@faint lava just a hint, think of it this way: the blackboard can only store basic data types or references to existing objects created and stored elsewhere. So somewhere else, like in your aicontroller class, you will need to create an instance of your storage class and assign it to the blackboard. If you're working in cpp note that the blackboard does not save objects from garbage collection so you need to actually create and store it in a UPROPERTY
@wary ivy fixed it by using reachablee instead of navigable weird....
never mind i got this
Hi so im new to ue4 and ive only been working on a horror gam for about a month now and ive ran into a problem. I found a fully working AI online and i have already created a map and everthing i just need to make the AI damage and kill the player but i have no clue how to do it. If anyone can help and is willing to help me solve this problem please dm me.
I am using the "Horror Engine" project on the marketplace btw and a AI i found online that works really well and matches the map aswell
Hey, is there a way to make the ai to follow a custom pattern while following the player (like zigzag)?
not out of the box no
you could make an EQS query
which adjust points
but no way to do that out of the bxo
Hi all. I've been having some trouble with follow AI for a WoW style pet, which aims to keep it at their master's side. In the master character class I'm spawning/attaching a TargetPoint actor for the MoveTo position to the master's left side which is then exposed to the pet's blackboard (I tried using a vector instead, offset from the master's location, but MoveTo seems to be very jittery when the location is a moving target and not an actor). The issue I'm having is that the pet will move to the nearest ground location to the TargetPoint. So if the master stands near a ledge, the pet will run down to the ground level instead of just moving closer to the master up on the ledge. I was considering making a custom actor class which detects ground collision etc. but does anyone know a simpler solution?
could you just have the pet check if the new point is past a certain difference in z-height, if not, dont move to it? Or something along those lines
*zheigt from the character
@prime vessel Thanks, but If the master then jumps off wouldn't the pet then be stuck up on the ledge?
Actually, come to think of it the point would never be different in z-height since it's attached to the master character and maintains a constant relative location. It's unreal's AI code which is generating a point that's lower unfortunately. Not sure if that would be accessible.
just make the "actor" the pet uses as tracking
do a check to the floor, if its too high, position itself closer or behind the player
If anyone is willing to help me out on a call i really need to figure out how to make my AI damage my player cause im very new and have no clue
DM me plz
#looking-for-talent @stone cobalt
or ask your question in here. no one is going to jump and call you to help.
ok thanks
@pine steeple That was my plan B but wanted to make sure there wasn't a simpler approach already in the engine. Will just go with that I think - Thanks!
Is there a variable to check if the AI is running a Behaviour tree?
not a variable no
Does anyone have any resources regarding AI Design patterns? Perhaps some recommendations to games( particularly shooters) that have good AI which I could study to improve my own project? Many thanks
Hi all
Is there a default implementation for IAISightTargetInterface::CanBeSeenFrom(const FVector& ObserverLocation, FVector& OutSeenLocation, int32& NumberOfLoSChecksPerformed, float& OutSightStrength, const AActor* IgnoreActor = NULL) const Other than in the .h for the interface? I notice it's called from UAI_Sight and I'd be interested in overriding it to add some Stealth strength multipliers to give an output result with an actual value other than 1.0
the default is not to use that
and does its own trace inside the sight sense
AISense_Sight.cpp lines around 308 onwards
@lyric flint Do you use the 2 vectors to make a direction?
Then use the direction to point a spawner
then cast the ray
then it will definitely hit
@pine steeple AISense_Sight calls it during the update function does it not? I haven't got it in front of me right now, but that was the reason I was looking to override
It looked like it was calling that to check, and then doing line traces within the if statement. The default for the function returned false...
Come to think of it, was the if statement checking for !true?
If so, I'll just make my own class inheriting from Sight sense and override the Update function. Keeping it almost identical but adding additional checks in for other custom class' stealth vars
Also. think you mistyped and meant line 208
Ah I see what you mean now, I missed the if (Target.SightTargetInterface !=Null) wrapped around it. So by default there is no SightTargetInterface, so we do the tests ourselves. Therefore my best option is to create a child class of AISense_Sight and do custom tests in that else bracket
Cheers
well
you could kinda copy it out
and do it on the specific class
so you don't break stuff
Why wouldn't this work?
Does anyone know why this isn't working? There is a navigation volume and pawn sensing component.
I just want basic following
Ping me
@buoyant bison PawnSensing isn't working, Cast Isn't working, or your Pawn isn't in a NavArea.
@desert bison You may have already seen them, but I found these useful:
Halo
https://www.gamasutra.com/view/feature/130663/gdc_2005_proceeding_handling_.php
F.E.A.R.
https://alumni.media.mit.edu/~jorkin/gdc2006_orkin_jeff_fear.pdf
This video has some useful tips for style
https://www.youtube.com/watch?v=Qq_xX1JCreI
How can you add complexity to a brain while maintaining the transparency of a small system? In this proceeding, Damian Isla describes some of the techniques Bungie used in the design of the Halo 2 AI in pursuit of a beautiful, clean and ultimately scalable brain architecture.
In this 2017 GDC talk, Bobby Anguelov, Mika Vehkala, and Ben Weber outline core principles to get the most out of your behavior trees while avoiding common issues.
Register for GDC: https://ubm.io/2yWXW38
Join the GDC mailing list: http://www.gdconf.com/subscribe
Follow GDC...
Thanks for that GDC talk and those articles ๐ @little pebble
I've got 300 pawns and my game runs pretty well, only problems is when I close the game it takes very long to shut down. It come from the AI perception component event with an empty bt and no code on the perception update. Anybody know some tricks ?
@midnight scroll is there any way i could know which one or pair of problems it is?
@buoyant bison Put print strings in places. Before the cast and after the cast.
@pine steeple still trying to get my AI random spread to work... i have tried doing this:
its still shooting a bit off to the left
you need to adjust the end point
after the trace
ie, trace, get impact point
adjust inpact point with cone
so i need to call the fire spread function after line trace by channel?
yes
with the impact point
that is how i have always done it
or you adjust the very start point with a small number
and have it fire
but i normally ensure the first bullet is straight
then subsequent bullets start missing
two seconds let me look at my code
ah sorry i got it wrong
i do stuff in c++
yeah you need to do it before the trace, let my just do this in bp quickly
gimme sec
thanks let me try it out
could use the weapons forward if you have it set up right, but using control rotation forward is always forward of the way the AI is facing
which is why i use it
the trace is behind for some reason
so its firing backwards
yea
what did you use for the forward
why 5000
on the actor forward?
just plug forward straight in
dont multiply
Direction is a unit vector
yea it does
use the gun forward vector
and see if its any better
without seeing all your code
it could be anything
maybe teamviewer or screenshare would be easier ๐คท
not bad
ya need to ik that hand to gun ๐
first things you want to do is make sure all your params are valid
i would draw some debug lines on tick to see where things go
Hey all, stupid problem I can't find an answer for. I can get an AI character to sense and chase the player, but getting two NPC's to see and chase each other results in fail. Anyone around that might have a second to point me in the right direction?
@stark zealot Hey, any chance that you solved this problem here ? ^^"
https://discordapp.com/channels/187217643009212416/221798778208780288/676549149298262057
@midnight scroll what do i change in this situation
Sorry i have no idea how this thing works
Op nevermind
I had an idea and it worked
Hey folks, having a little issue with Character Movement. When I switch movement modes from None to Walking (via a task), my character is snapped to the floor if he's a certain distance from it.
I want to remove the snapping, and always have gravity naturally pull him down
Right now, it applies gravity as you'd expect if they're above this distance
I'd like to know if / how I can modify the snapping distance in BP
Okay, obvious answer of course. I had to set the movement mode to falling, and it automatically becomes walking when he touches down. ๐
@crystal grotto No ๐ฆ you make them move to a location with a simple move to. Then adjust a setting in the player movement to prevent players from hanging off ledges and that seems to solve the issue. That's the best I've come up with
@stark zealot you can enable partial path in that situation
my ai keep following regardless if im off the navmesh or not
Hey folks, I've been stuck on a problem with my AI perception setup. I have both Sight and Hearing setup as senses. The issue is that the Hearing stimulus always appears to be "current" whereas the Sight seems to stop being current immediately. This means, if my player disappears round the corner, the AI instantly stop and turn to the location they think is current: the last place they heard the player. This seems really broken. Am I missing something or is the AI perception system not really fit for purpose?
Here's my current Tick
void AFPSAIController::Tick(float DeltaSeconds)
{
Super::Tick(DeltaSeconds);
AActor *Player = UGameplayStatics::GetPlayerPawn(this, 0);
TArray<AActor*> Actors;
PerceptionComponent->GetKnownPerceivedActors(nullptr, Actors);
for (AActor* Actor : Actors)
{
APawn* TargetPawn = Cast<APawn>(Actor);
if (TargetPawn == nullptr) continue;
if (!TargetPawn->IsPlayerControlled()) continue;
const FActorPerceptionInfo* Info = PerceptionComponent->GetActorInfo(*Actor);
FVector Location = Info->GetLastStimulusLocation();
if (Info->HasAnyCurrentStimulus())
{
UE_LOG(LogTemp, Warning, TEXT("%s Has Current Stim"), *GetName());
MoveToLocation(Location, AcceptanceRadius);
SetFocalPoint(Location, EAIFocusPriority::Gameplay);
}
else
{
UE_LOG(LogTemp, Warning, TEXT("%s Has Stale Stim"), *GetName());
ClearFocus(EAIFocusPriority::Gameplay);
MoveToLocation(Location);
}
return;
}
UE_LOG(LogTemp, Warning, TEXT("%s Has No Stim"), *GetName());
StopMovement();
ClearFocus(EAIFocusPriority::Gameplay);
}
If I disappear round the corner without ever having made a noise then "Has Stale Stim" is printed. If I have shot a gun then disappear I will always for ever after get "Has Current Stim".
o_0
let me re-read that
@dull hatch i would bind to the perception delegate for performance for a start
it fires whenever a perception updates
True but that shouldn't change this behaviour I reckon
Gun shot in this case. Basically the shot takes priority over sight once you go out of sight. I would expect that the last seen location would take priority.
but the last location is where the shot was?
And the sight is the dominant sense
Dominant Sense == broken
Ah, that makes sense.
i ended up just using the perception system, to generate aggro
I'm looking at whether to teach this to students but it looks a bit too broken to teach.
it works, and its better than PawnSensing
but there is quirks with it
let me dig out my perception stuff i did
So you say dominant sense doesn't work. How would you go about getting the location of the youngest stimulus?
gimme sec,
ah
so what i did was, detect the sense
if it was sight, i cached the last known sight location, as last seen location
in the controller
this was my fallback location
when other senses didn't detect anything
i wrote a small function, to convert sense id to enum
{
if (SenseID.IsValid()) {
FString SenseName = SenseID.Name.ToString();
SenseName.RemoveFromEnd(TEXT("_C"));
int32 SeparatorIdx = INDEX_NONE;
const bool bHasSeparator = SenseName.FindLastChar(TEXT('_'), SeparatorIdx);
if (bHasSeparator)
{
SenseName = SenseName.Mid(SeparatorIdx + 1);
}
if (SenseName == TEXT("Sight"))
return EPerceptionSense::EPS_SIGHT;
else if (SenseName == TEXT("Hearing"))
return EPerceptionSense::EPS_HEARING;
else if (SenseName == TEXT("Damage"))
return EPerceptionSense::EPS_DAMAGE;
else if (SenseName == TEXT("Proximity"))
return EPerceptionSense::EPS_PROXIMITY;
else
return EPerceptionSense::EPS_NONE;
}
return EPerceptionSense::EPS_NONE;
}```
so i could detect exactly what sense it was
Makes sense. Basically move the broken functionality to controller. Thanks that's helpful.
Gotta go have dinner will pop back in later.
if the sense was sight, i cache the stimuli location
but if ya need more @ me
cause i thought with this system for about a year
i know it inside out
Thanks"
you can enable partial path in that situation
@pine steeple
How would i do that ?
I just get to this point inside of my AI-Controller ```cpp
GetPathFollowingComponent()->HasPartialPath();
its passed in as part of the move?
Ow xD
But sadly i had it activated the whole time >_<
I also tried already to update PlayerLocation with each tick where i set the .Z value to the ground height.
But that was also a thing which didn't worked to solve this problem
Is there an event that is sent out when AI uses a Nav Proxy Link? I am trying not to execute commands to an AI that accidentally walk over one, would rather have an AI that actually needs to use it execute a command. Any help?
Oh ok and what event will be called when AI uses smart link? @pine steeple
Thank you so much! This helped me out tons! @pine steeple
Does anyone have a good link that has a comparison of c++ vs behaviour trees performance?
I'm wondering which ones I should use (knowing myself I'll probably prefer using c++)
I'm following an Ai course but it has been full blueprints to some extents that are making my inner optimization freak die
Well I use behavioral trees with 100 ai on screen and uses around .6ms game time which is .006ms per ai
Behaviour
And that is a complex but. But behaviour trees are smart and only run what they need too.
I couldn't imagine spending hours and hours writing code for something I can do in 5 mins in a behaviour tree.
Especially when you have around 20 unique enemies
can anyone explain why my AI thinks it sees the player when I'm running in simulation and no player exists? They act normal for a few seconds then run to 0,0,0 and start swinging... Assuming that's because the Vector key is empty, but why do they think they see me?
looks like initial commit for machine learning support
there are python scripts "meant to extend Open AI Gym
machine learning.. That's doesn't tell me much
right, it's a very broad term.. I mean, what does ML have to do with AI in UE4 and how it all looks like in regards to game AI and Blueprints, in UE4 particularly
Exposes means of having external agents query world and game state and control in-game agents
@sullen escarp thanks
@flint trail its for stuff similar to unity ML agents
all this kinds of ML agents are basically soemthing like
input = calc_input(game_state)
the plugin lets you easily define whats that game state, and connect that input to actual game actions
for example if you are writing a racing car, your state could be where you are in the track, + some raycasts aginst walls
and input is acceleration/turning
@near jetty so basically all the "thinking" is done externally and fed into UE4 ?
yes
the idea is that you connect it to Tensorflow and other AI machine learning toolsets in python
on unreal side you just setup an input that basically gives you an array of floats
and you ship that into the ML stuff
and it gives you back a list of floats for inputs,which you send to unreal
the important part is that this is lockstep
i think
so it basically goes
unreal does a frame -> exports data -> python ML stuffs -> thinking.... -> input back to unreal -> next unreal engine frame
I wonder if that would help building Westworld-like world for Quest, having all the heavy AI stuff done on dedicated hardware instead of HMD
Hi, so... I have a parent AI controller which has some "Set value has" for the blackboard, but no "Run Behaviour Tree", the "Run Behaviour Tree" is in the child. I then created a Behaviour tree for Patrol(which runs good no problems), and created a Behaviour Tree for the child which has a "Run Behaviour" of the BT_Patrol. The problem is that the child goes to the first patrol point and then doesnt go anywhere. Am i doing something wrong?
What i have on the AI controller
And what i have on the AI controller of the child
I tried adding a "run behaviour tree" on the parent AI controller, and it has no problems
@worldly flame add a branch with print string
Hey guys, I'm trying to make some simple moveTo's with BehaviorTrees and such for my AI's to go and attack one tower, but they always go to the same side, even if I rotate the target, and also it isn't the shortest path. Could this be an issue with the crowd manager?
https://i.imgur.com/5J9KqQj.mp4
Anybody know why when changing the Agent Radius to lower value than 30, my AI character just stops work (doesnt move to desired location like it usually does).
I have to set it to a lower value because once the player hugs a wall to hide, the player becomes invisible to AI perception, I assuming because there is not nav mesh up tight to obstacles.
Is CrowdManager usable for making units in a strategy game?
Can it make multiple pawns move in formation towards an objective?
Or is it more for hordes of enemies that just don't want to collide with each other, like Zombies?
Does the default AI controller not take pawns into consideration when path-finding at all? And is that what the Crowd Manager adds to it? Ability to see other pawns and some smart ways of navigating around them?
Hey guys, I've googled a lot about this question from which I thought it would be actually more present, but the threads I found didn't really gave me answers. I'm starting digging into AI atm and my question is actually very simple. Is there a way to control / manipulate / interpolate a movement value in an AI Pawn or Add Movement Input manually? (at a player controlled pawn it would be the axis value).
Or is this something I would have to create on my own like a custom MoveTo Task where I tell my AI Pawn that he has to move to this direction and manually fire a timed event into a movement input? I just would like to control / manipulate / smoothen the AI start/stop movement (and give it a bit random strafing, but thats another story)
@lyric flint default path finding only does path finding against the navmesh
pawns don't affect the navmesh
and I don't think crowd controller does formations, you have to come up with your own system for that
it's meant for crowds and resolving pawn to pawn collisions
Cool thanks
for formations you essentially want to have a formation leader pawn and then calculate desired move goals (the spots in the formation) relative to the leader
and then move the pawns towards those points
@wary ivy looking at documentation for Detour, it supports formations by writing a custom behavior: "Flocking behavior. Agents behaving that way will behave like a flock, or a herd. This basically means that they will try to stick together as they move, heading in the same direction, and without bumping into each other."
https://masagroup.github.io/recastdetour/classdtFlockingBehavior.html
yea you'd have to program the behaviour
How do I make a simple boids behaviour?
Just upgraded to 4.25 preview7. Has anyone had issues with AISystem.cpp catching issues with the check statement when registering and unregistering components? (check(BlackboardDataToComponentsMap.FindPair(&BlackboardData, &BlackboardComp) == nullptr);)
@tepid cove you can make some target points around tower and in behavior tree logic you can get all target points and move players to random target points
@gleaming kettle here you can download some boids samples for ue4:
https://www.unrealengine.com/marketplace/en-US/product/flocking-behaviour-system-ideal-for-simulation-of-birds-fish-bees-and-more
https://impromptu-games.itch.io/ue4boids
@high summit I've downloaded the itchio one, how do I work with it?
@gleaming kettle these are only project files, you need to extract and copy this into your project folder
you are importing into wrong version of unreal, these files are created with older version of unreal.
no, you need to copy these files into your project/content folder and restart the editor, (not to import direct)
@high summit thank you! For now what I've done is a donut EQS, checking for overlaps with other bots, and navigation. As every AI is doing that EQS I think that your aproach would be way better, specially with big amounts of bots running around.
Do you guys know if there's someway to set an EQS' config while using blueprints? I just see the run eqs node and that's it ๐ฆ
yeah, it's worked. thanks a ton @high summit !
hi!
Anyone here knows how to make the AI properly decelerate when using MoveTo/AIMoveTo ?
We have our own extension of the CharacterMovementComponent and we override GetMaxBrakingDeceleration to return a different MaxBrakingDeceleration value depending on the Movement Mode (we have some custom movement modes).
Within the BT, we call Stop Movement Immediately, which zeroes the velocity, so no deceleration applied.
What is the right way to decelerate? Is there a Stop Movement function for AI that actually applies the MaxBreakingDeceleration?
Thanks
Also, all I can see in the NavMovementComponent in regard to Stop Movement, is calling StopMovementInmediately()
Update:
I just discovered that there're more parameters for path following breaking that I knew. Like the breaking distance
Update #2: I was missing this settings. Seems to work now. Just needs hell lot of tweaking
is there any way to pass parameters to EQS while using blueprints? have been searching around but I just find stuff regarding C++ and BTs
is there any way to pass parameters to EQS while using blueprints? have been searching around but I just find stuff regarding C++ and BTs
You have to extend the c++ functionality. it's very easy. All you need is already there.
header
#pragma once
#include "EnvironmentQuery/EnvQueryManager.h"
#include "MyGameEnvQueryManager.generated.h"
//-----------------------------------------------------------------------------------------------------//
DECLARE_LOG_CATEGORY_EXTERN(MyGameEQSManager, Log, All);
//-----------------------------------------------------------------------------------------------------//
USTRUCT(BlueprintType)
struct FEQSParam
{
GENERATED_BODY()
UPROPERTY(EditAnywhere)
float PropertyValue;
};
//extension of the Env Query Request so we can access info hiden by the engine
USTRUCT()
struct FMyGameEnvQueryRequest : public FEnvQueryRequest
{
GENERATED_BODY()
FMyGameEnvQueryRequest() : Super() {}
FMyGameEnvQueryRequest(const UEnvQuery* Query) : Super(Query){}
FMyGameEnvQueryRequest(const UEnvQuery* Query, UObject* RequestOwner) : Super(Query, RequestOwner) {}
const TMap<FName, float>& GetNamedParams() const { return NamedParams; }
};
UCLASS(config = Game, defaultconfig, Transient)
class UMyGameEnvQueryManager : public UEnvQueryManager
{
GENERATED_BODY()
public:
UFUNCTION(BlueprintCallable, Category = "AI|EQS", meta = (AdvancedDisplay = "WrapperClass"))
static UEnvQueryInstanceBlueprintWrapper* RunEQSQueryWithParams(UObject* WorldContextObject, UEnvQuery* QueryTemplate,
UObject* Querier, TEnumAsByte<EEnvQueryRunMode::Type> RunMode, TSubclassOf<UEnvQueryInstanceBlueprintWrapper> WrapperClass,
TArray<FEnvNamedValue> EQSParams);
};
CPP
#include "MyGameEnvQueryManager.h"
#include "GameFramework/Controller.h"
#include "VisualLogger/VisualLogger.h"
DEFINE_LOG_CATEGORY(MyGameEQSManager);
UEnvQueryInstanceBlueprintWrapper* UMyGameEnvQueryManager::RunEQSQueryWithParams(UObject* WorldContextObject,
UEnvQuery* QueryTemplate, UObject* Querier, TEnumAsByte<EEnvQueryRunMode::Type> RunMode,
TSubclassOf<UEnvQueryInstanceBlueprintWrapper> WrapperClass, MyGamerray< FEnvNamedValue> EQSParams)
{
if (QueryTemplate == nullptr || Querier == nullptr)
{
return nullptr;
}
UEnvQueryManager* eqsManager = GetCurrent(WorldContextObject);
UEnvQueryInstanceBlueprintWrapper* queryInstanceWrapper = nullptr;
if (eqsManager)
{
bool validQuerier = true;
// convert controller-owners to pawns, unless specifically configured not to do so
if (GET_AI_CONFIG_VAR(bAllowControllersAsEQSQuerier) == false && Cast<AController>(Querier))
{
AController* controller = Cast<AController>(Querier);
if (controller->GetPawn())
{
Querier = controller->GetPawn();
}
else
{
UE_VLOG(controller, MyGameEQSManager, Error, TEXT("Trying to run EQS query while not having a pawn! Aborting."));
validQuerier = false;
}
}
if (validQuerier)
{
queryInstanceWrapper = NewObject<UEnvQueryInstanceBlueprintWrapper>(eqsManager, (UClass*)(WrapperClass) ? (UClass*)WrapperClass : UEnvQueryInstanceBlueprintWrapper::StaticClass());
check(queryInstanceWrapper);
FEnvQueryRequest queryRequest(QueryTemplate, Querier);
queryRequest.SetNamedParams(EQSParams);
queryInstanceWrapper->SetInstigator(WorldContextObject);
queryInstanceWrapper->RunQuery(RunMode, queryRequest);
}
}
return queryInstanceWrapper;
}
once you have that, you will be able to run eqs passing params from any BP
@tepid cove we I did that months ago (we rely heavily on EQS) and 0 problems
keep in mind that you will need to make sure your EQS params have unique names. It's very common that you add 2 Distance Tests and their params are named the same
Even if they use the same value?
well anyway, thank you very much sir ๐ I will check it out later โค๏ธ
Had to delete my previous message sorry.
THIS IS CRUCIAL. If you don't fix this, you will have a lot of errors due trash values.
AIDataProvider_QueryParams.cpp
void UAIDataProvider_QueryParams::BindData(const UObject& Owner, int32 RequestId)
{
UEnvQueryManager* QueryManager = UEnvQueryManager::GetCurrent(&Owner);
if (QueryManager)
{
FloatValue = QueryManager->FindNamedParam(RequestId, ParamName);
// neither does float to int....
//original code -> IntValue = *((int32*)&FloatValue)
IntValue = static_cast<int32>(FloatValue);
//OriginalCode -> BoolValue = *((bool*)&FloatValue);
BoolValue = FloatValue >= 1.f;
}
else
{
IntValue = 0;
FloatValue = 0.0f;
BoolValue = false;
}
}
EnvQueryManager.h
// This is wrong, you can't convert an int to a float doing that
//ORIGINAL -> FORCEINLINE FEnvQueryRequest& SetIntParam(FName ParamName, int32 Value) { NamedParams.Add(ParamName, *((float*)&Value)); return *this; }
FORCEINLINE FEnvQueryRequest& SetIntParam(FName ParamName, int32 Value) { NamedParams.Add(ParamName, static_cast<float>(Value)); return *this; }
if you have access to UDN, here's my post with the solution above validated by Epic (until they fix it)
https://udn.unrealengine.com/questions/510063/view.html
they are doing a bad conversion of values. EQS params are always floats that get converted to int/bool if necessary. The original code will give you 1.f = 16660686 (int) and shit like that.
It's a must to change that code
@tepid cove Even if they use the same value?
If the use the same value it's fine, but it will be confusing if not and nothing guarantees that, with 2 params with the same name, the right one will get the value you want
got it ๐ thank you!
Hey. I'm working on a zombie AI, in which should move to the player if detected by AI Perception. I have set it's field of view to 90, but when it gets close and at odd angles it sometimes loses track of the player. Any typical errors that could be causing this?
https://gyazo.com/124e3300bafc25eda4809038c3fac377 idle state, just finding random spots to move to
https://gyazo.com/c1975f972f047f11e97f7a59ceebfbff the combat section, where the AI chases the player.
Is there a way to get a navmesh character to prefer to turn in place instead of moving in a wide circle? ๐ค
Hey gusy , i have an Ai that would attack regardless of whether its attacks would go through or be obstructed by an object say a wall or a pillar , how would i go about solving this issue? I thought of using a trace to check before attacking but the tricky party is making the Ai move to a place where its attacks would go through you know?
I'm not sure on how to implement that, i thought of just making it move to different sides but its not consistent solution so i'm kinda stumped , any help would be very much appreciated
@opaque lance You could run a check to see if the player is within range and then do the attack, which would trigger a linetrace to check if you hit or not? If your AI is supposed to attack, have it move towards the player until its within range. Are you using AI Perception and behavior tree?
No no , its a ranged attack , it doesn't need to have the player move , if the player is in its sights it will attack by using projectiles. Range isn't the problem , the problem is if the player is for example standing behind a pillar and the AI sees him , it would attack the player but the attacks will be blocked by the pillar , i thought of using env queries but i lack the experience to express it in such a way.\
Env queries could do a check if the line of sight is blocked, if I'm not mistaken
Hi everyone!
I have a problem with navigation system. Tell me please, if this thread is not a proper one.
My problem: In my game you have to control few characters by switching between them and point and click where to go or which item to use and so on. And big part of this game is controlling this characters inside a flighing ship. So navigation is completely broken whenever your ship is flighing not really slow (with 15+ms speed navigation is already shitty).
What I have now, why and what i tried: I have a huge world with level streaming, so making a gigantic NavMesh with updating only around invokers not a solution, because it still completely ruines performance. Also there is a bug, when you have a tall navmesh it don't generate navigation data after some height which is really weird. I also tried to have some NavMeshes for eash character and attach this navmeshes to them, but it still works really weird with invokers, so some of them don't work and it's too difficult to make them always generate data, so it ruins performance too. And the only solution i found is to have a medium navmesh which kinda holds all the characters (they don't need to go really far away from ech other) and move it, when my characters walks from it center for some distance. It works on the ground quite well, but as I mentioned it's really bad on moving objects.
Any suggestions for how to make it work on moving objects too or how to make navigation that can solve my needs is welcome!
Only thing that comes to my mind is: are you using dynamic nav-mesh?
Ofcourse.
if you run the command to show the navmesh during gameplay, do you see it re-generating while your chip moves?
yes, but it glitches a lot when it is moving, so navigation data is kinda behind the ship.
keep in mind that the debug you see is not 100% accurate, so take it with a grain of salt.
Does you AI fail to move or misbehaves then?
Their behavior seems like this debug is accurate enough. They triyng to move but really glitchy. For example if you'll go on the end of ship they'll try to move, and with really glitchy movement they'll jump out of it. (they'll try to move to a dot, which for navmesh will be behind ship already).
Also if speed ~25+ m/s movement is a disaster. They act pretty weird an noone can reach needed location/
I worked on a game couple years ago where we had a similar setup: the level was a train that moved (we had a boat too) and we had many problems with movement. We had problems where AI would just fall out since the destination point was not there anymore (the boat moved), we had problems with physics and what not.
The solution was to leave the boat (and the train) static and move everything else around it to make it looks like it was moving.
I know this is not the solution, but sometimes the headache is just not worth it.
(they'll try to move to a dot, which for navmesh will be behind ship already).
I would try to move towards an actor (AIMoveTo accepts you to pass either a point or an actor. If it's an actor, the code updates the location automatically).
You can attach the actor to the ship mesh, so it moves along with it. Them just update the location relative to the ship (to make sure is on top of it). That way, even if you set it up to the limit of the ship, it will never go out, because it moves with it.
The other thing is: if your ai doesn't move, does it move along and stays in the same location while the ship moves?
If they move along the ship movement axis: do they move slower towards the front and faster towards the end? If that's the problem, you also need to compensate for that, because the CMC will not know. This was the main
problem we had in the game I worked and took long to fix (tons of physics). Add jump and you have the whole pack.
Illustrating example of what I mean:
https://www.youtube.com/watch?v=WSSMtNDm65Q
Thank you for your reply! I thought about it too, but ship is actually is flighing physics based ship, so moving anything else would be not less problem.
Also I've already solved a problem how to move to a point on moving objects. I create an actor in point of click, attach it to clicked actor and move to this newly created item. So the only problem is a bad navigation. While flying my actors trying to move, but do it really bad. Also they act normally if they just stand on a moving ship.
umm if are already moving the actor with the ship I would suggest to print all the debug info you can for nav mesh, velocities etc
I'm not sure what could happen except your AI is covering more space than the expected by the path following component. Check also if you are using NavWalk in your AI
i just don't think the AI system was designed to handle a moving base
in my experience, it's not. But that was with 4.14-to-4.16. Took a lot of effort to get that right. Maybe there are different tools/functions to make it work easily.
You can always create your own Movement Mode and override the Physics movement function to write the compensation there. So "on moving platform->SetCursomMovementMode(MovingNavMode)"
i have a move to node in my AI BT... which keeps running even though the AI is already at the location
any idea why?
There's an IsAtLocation decorator you can use
Has anyone given this a go perhaps? https://github.com/bullyleo/UnrealHTNGraphEditor
Looks super interesting
hi guys, do you know if there is some way to avoid a character to slow down when performing a MoveToLocation?