#gameplay-ai
1 messages ยท Page 149 of 1
But maybe you can check your own conditions when notify hit? Like doing this manually, instead of bindings things dynamically
I mean the binding needs to be dynamic
basically check for the animation to either use the logic on a) anim notify, or b) at the end of animation, if no anim notify exists
I would have to know the exact time per animation, for each animation
perhaps it would be something like splitting the animation up into a startup, active, and backswing setup
and start the logic at the same time as the active part of the animation
but I'm not sure that would gel with the current animation pipeline
Hello everyone! I'm trying to pass a variable from my AI to a task. what i put in the object?
presumably the controlled pawn?
no
the AI
how do I take a variable from my AI and set it to my blackboard?
do I use cast or is there another way to do this?
You will want to cast to the class that has your variable which would be your AI controller or the AI itself then create a blackboard key and set it as an int or whatever type of variable it is
make sure your blackboard key is public. When you add your task to the behavior tree you will now be able to set your blackboard variable to that key in the detail panels of the task in the behaviour tree
How can I prevent creating this navigation part on the actor I spawn in runtime. I want the actor to affect the navigation, but I don't want to have the navigation on it.
How do i get vector into a float value for move up/down and turn right/left. I want to use the same movement function for the AI with the player function that bindsaxis for the playerinputcomponent
so for composition's sake (and due to UE4's inherent architectural limits) I'm trying to make a component that I can just slap on anything that needs to be associated with my AI director subsytem. does anyone have experience with this kind of setup? I assume I still have to write a bunch of class specific logic that may be repetitive?
I guess it depends on what the component does
... right, so how much logic can I cram into the component to automate the approach as much as possible?
All of it? :D
I mean I can't readily put in e.g. an Attack() function because that would be different per AI
so already there it gets class specific
Right, so if you wanted it to automatically handle it, you could do an interface on the AI pawns and have the component talk to its owner actor through it
This would probably require the least amount of glue logic to be duplicated across the actors
yeah but that's just a weaker way of doing composition
with the component, I can do the same AND add generic logic that is true for all classes
I don't think glue logic is necessary in either case, it's rather a case of not repeating logic and avoiding too much class specific logic
You could have a base class for the component and then have different components for different types of actors as well
the ideal would be having class specific data but have the logic be dictated entirely by component
this feels like just moving the functionality rather than genericizing it
Well it sounds like some of it is very actor specific
so the only way to really make that generic is to put it behind an interface or such as mentioned
I don't think I agree with that. putting down an interface means all the logic will be class specific
it's not generic logic that works for all classes then, it's just that each class implements its own version of the logic
But so far what you've said is that you have logic which is specific to each actor type
how do you plan to make that generic?
like I said, the ideal situation is having each actor have specific data that is used in a generic way
Yeah I guess you'd just need to have the component query for it
now that I think about it perhaps it would be possible to do it like that. have a bunch of items and let the item attribute dictate which function should be used on the component... perhaps that is the way
that could be solved by having a universal struct containing the necessary data I suppose?
Yeah
makes sense. thanks for the bounces
๐
AI Behavior Tree flickers when it wants to chase the player
The task is probably failing which then restarts the tree
Evening fellow AI
how could it fail ?
If it's a move node it can fail for various reasons, such as missing navmesh, or invalid move location
alright thanks i will look into it
Visual Logger usually has some more info on why moves fail so you might wanna check with that :)
never heard of a visual logger how do i access it?
wait u meant the log?
if yes then i must be a dumbass
Window->Developer Tools->Visual Logger
how do I stimulate one sense because of another? I added a handler for UPerceptionComponent::OnTargetPerceptionUpdated and want to stimulate Sight Sense from Damage Sense when damaging actor is outside of Sight Sense green are but still within its red area
just move your handling logic for senses into their own functions and call the appropriate functions from your handlers
this way you can just call that function from your damage handling code instead of having to do some really roundabout way of sending sight stimulus
what would be the absolute cheapest way of getting a route between two points on navmesh?
the route is only a needed for a check
not traversal
i am doing an ai without BTs or BBs all in c++ should i put the ai logic in the ai controller class or the character class?
I'd imagine you just have to do NavSystem->FindPathSync or such.. this is what I'm doing for reachability checks between buildable things and NPC's so they don't attempt to move to things they can't reach
How you split the logic is up to you. Personally I find it makes sense to create "actions" the character can perform and put those into the character - eg. things like throw, pick up, look at something, etc. - and those can be then called from your actual AI logic or other logic
Basically the character is like a "dummy" which something else orders around
This makes it easy to swap out the AI logic if needed, or just call the functions directly with no controller for testing purposes
that's my setup, plus a director that dictates everything to keep it more in line with ECS
how do I bind a function to success or fail of Move To Location in bttasknode?
You need the node to be instanced first off, then you just bind a function to it the same way as anywhere else
instanced?
I did override the execute task function and wrote my logic
what dispactcher would I be binding to?
Oh - if you're just doing it in BP's, just call the regular move to node which has the on finished pin
its cpp I am just converting my bp to cpp for performance
I think the right word was delegate
ah
yeah you need to mark your C++ task as instanced, it has a function or a flag on it somewhere that you just make true
I don't recall off the top of my head where the delegate for the move is but it should be in the move request or the pathfinding comp I think.... just look at the code for the BTTask_MoveTo or whatever it was called, since it does all this already
wait how do I mark it as instanced?
gonna try that again as I could not really get how it's doing it.
Interestingly it looks like it's actually not instanced
so they did it in a different way for that one
instead they seem to just use the tick feature to check when the movement is done
I found a delegate called on delegate finished in the path following component that could be what I am looking for I guess
For some reason if my player is at the x the enemies get stuck at the circle, I have a nav link proxy that is left to right only set to have them jump down, and if I am elsewhere not on that platform they are able to traverse the stairs just fine, I can't figure out why they clump if I stand there though
I set it under smart link, not simple link was my issue, I changed it there and now everything works
I'm using the MoveToActor node to have two AI's walk towards each other and for the most part it's working but sometimes they overshoot and pass through each other. Is there a way to make it update more frequently?
Try this?
You might also want to tune the Acceptance Radius based on how close you want them to get so they recognise they've "met"
Anyone can help me on this case ? https://youtu.be/skyXVj73gQs
I'm learning AI feature of Unreal Engine 5 and I can't figure out why when multiple NPC AI characters ars spawn they do not behave like when only one is there?
are there any tutorials on replicating AI? Im having a tough time getting my ai to chase and attack me correctly
same issue here for me...
Anyone tried to use BTs as individual logic trees?
It seems impossible due to design
Like instead of binding to AIController just running it
im like in a huge mess of bps tryign to do this lol
AI framework is not replicated
Movement is replicated by default if you run move to task in server
Attacking logic is depending on you, you need to replicate it in your character/pawn class, ofc that depends on your way of doing things
@celest python I see, the biggest issue im having is geting AIPerception to replicate where it will chose the cloest player to go to
so i kind of made a work around but as soon as i switch it to run on server it shits the bed
Do you think you may have issue with the Blackboard variables ?
Yes, it was wasnโt being set right after this code,. Thank you sm
any idea how to handle navmesh building in an infinite world? i make a voxel game and currently i just move the navmeshbounds volume around and then trigger a navigation rebuild, but that is causing a lag spike although i enabled "lazy" navmesh building and threaded navmesh data collection
i still need a navmeshboundsvolume with invokers
seems like OnNavigationBoundsUpdated updates the bounds
Has anyone run into a situation where their AIs won't choose the correct navmesh?
I have multiple navmeshes, each with a different agent radius defined
but my agents keep choosing the default mesh regardless of their capsule radius
I've narrowed it down to this method UNavigationSystemV1::GetNavDataForProps -- here NavDataInstance is always NULL so the MainNavData is returned
any ideas?
why we use tree meshes in foilage if it already have lod
does anyone know what this decorator actually does?
it seems entirely useless, or very arbitrary
does it discriminate beween blackboardkeyselectors?
Huh?
What that does depends on the type of the blackboard value
For objects and such, it does nullptr checks, for numbers it can do greater than, etc.
what does it do for vectors
Dunno, try selecting a vector value in its properties and see what options it gives you I guess :)
the options change based on what it can do with the value
it doesn't give options
It might not do anything with vectors then I guess ๐ค
I don't get notifies either. result change or value change... what's the difference?
what does it mean that a vector value is set or not is not set
it's written so obtusely
my understanding is that value change will trigger even if the same value is reassigned, result change triggers only if the actual result changes (eg. false becomes true)
set or not set for vectors doesn't make any sense yeah, for objects that's a nullptr check
so what's going on? looking at the code I can't find anything
there's BlackboardKeyType.h that houses the enums used and some generic functionality, including comparisons
but there's nothing that seems used in that node
Not sure what it'd do with vectors, I've only really used that with integers and objects
surely it's means to be used for vector comparison too
99% sure if you look at the code it's written like, if a vector is 0,0,0 it returns true as "unset" (yeah, it's very lol)
isnt InvalidVector MAX_FLT?
ah yeah. I'm probably thinking of how it treats bool by accident
I've started learning custom NavLinkProxies and I have a couple of questions
- Say I have a nav link for mantling on ledges and I have 4 crates in a row and I want my AI to mantle from 1st to 4th. Do I just place my custom nav link proxies one after another on top of each other or is there a better way?
- Is there any event to subscribe to or a virtual function to override to handle reaching end point of nav link proxy? I have a slide mechanic and I want my AI to start sliding on reaching left point and resume walking when it reaches right point but I just can't find anything to override
look into smart nav links, this allows #2 at least
Could you be more specific what exactly must I do with smart nav links? I'm inheriting my link proxy from ANavLinkProxy and already subscribing to OnSmartLinkReached event to start an action, now I need something like OnSmartLinkLeft event but I can't find one
you need to determine it manually based on when the actor reaches the end of the link
I still don't get you.
when the actor reaches the end of the link
this is the thing that I want to know how to do it
You need to handle it in your actor that's moving. You can create a custom smart link component, which has an event which fires when a pawn reaches it, with the destination point for it as well
Then you tell the pawn to move to the destination point, and the pawn can have an event for when this completes, which you listen to
iirc you can also extend the nav link proxy actor to create your custom navlinkproxy which can handle this logic too without needing a component... but if you want to have a smart link as part of an existing actor then you'd need to make a component for it
Im so happy I think I finnaly got it down how I should think when using sequence and selectors
It checks if the vector has been set. Clearing it will make it "unset". Although I have a had problems using blackboard based condition when it comes to vectors a few times. Therefore I wrote my own decorator for checking Vectors.
Set and Unset make no sense as conditions for vector. it could mean that it checks for a FVector::Zero() or it could mean that the value has changed or anything really.
but
I found out yesterday that the Set has to do with whether it's within bounds of the AISystem
so it's completely useless unless you use that
but you won't understand that information from just reading Set. it doesn't implement arithmetic operators for FVector as it does for float
Well that's kinda weird :P
FORCEINLINE bool IsValidLocation(const FVector& TestLocation)
{
return -InvalidLocation.X < TestLocation.X && TestLocation.X < InvalidLocation.X
&& -InvalidLocation.Y < TestLocation.Y && TestLocation.Y < InvalidLocation.Y
&& -InvalidLocation.Z < TestLocation.Z && TestLocation.Z < InvalidLocation.Z;
}
Yep, this is all it does
InvalidLocation is FVector(FLT_MAX)
so it literally just checks if the vector value is within the bounds of the float datatype
which seems like it would pretty much always be unless something was horribly wrong
Probably fails with NAN ๐
Hi there. How can I build a path with a vector array for an AI? So, I have a vector location for each frame (25FPS), the goal is to move the AI along the Path for a 6-7 seconds, but the movement should be smooth and realistic
for each path point, find path between path point and previous path point (unless it's the first point in the array)
What have you tried so far?
I have tried to make it with Behaviour Tree, with ServiceNode, that update the target location by using the for each loop and with the Task Node MoveTo. But this for loop ends immediately, that target location is defined only throught the last element of the array.
Thank you, it looks helpful for the future, when I will find out how to implement this AI-Behavior in general :)
Does AIPerception support interval updates? I'm looking at wanting to revaluate what's already perceived to be able to react to changes like distance. So if my AI sees a group of actors it can switch target if who is the closest actor changes. Right now I'm getting OnPerceptionUpdated events when an actor leaves perception, a new one joins, and if there are any fired stimulus events such as damage. I don't see a straightforward solution for rechecking stored actors to update the behavior tree.
I'm not sure if AIPerception is meant to function with PawnSensing (They seem to do a lot of similar things so kinda like it's own implementation. I notice that PawnSensing has EnableSensingUpdates and SensingInterval which would allow for the kind of behavior I'm looking at, but I don't really want to mix & match two systems if they're not meant to be used together.
@simple sigil you can use a BT service which goes through the list of currently perceived actors and assigns the appropriate actor to a BB value
Or you can do it on tick in your AI controller and assign to BB, or do it in a BT task whenever it gets executed, etc. - various ways to do it :)
AIPerception afaik supercedes PawnSensing
Hi may I know what is the difference between behavior and tasks? I thought they were the same? Some tutorials mix the name. Thank you
hello!
does anyone know how I can get this dynamic age value in blueprints?
This condition is Failing, despite the Key Query being Is Set, and the bool is True. "value: true (fail)"
Do 2nd decorator evaluated if first one fails in BT?
Is this the right way to check if pathfinding is complete in cpp?
Controller->GetPathFollowingComponent()->OnRequestFinished.AddUFunction(this,"ReachedLocation"); // inside another function
void UBTTask_FindLocationRelativeToPlayer::ReachedLocation(FAIRequestID RequestID,const FPathFollowingResult& PathFollowingResult){
if (PathFollowingResult.HasFlag(FPathFollowingResultFlags::Success))
{
FinishLatentTask(*BTComponent, EBTNodeResult::Succeeded);
}
else if (PathFollowingResult.HasFlag(FPathFollowingResultFlags::InvalidPath)||PathFollowingResult.HasFlag(FPathFollowingResultFlags::Blocked))
{
FinishLatentTask(*BTComponent, EBTNodeResult::Failed);
}
}
I mean syntax ๐ค
What do you mean? If it compiles it is the right syntax
I guess I should test it. Sadly the rebuild also rebuilt the engine again :/
ue5-main so yeah
I would imagine there must be some way to exclude it from being built, similar to how the EGL distributed engines work
not that experienced so no idea. The problem is when I right clicked my project and clicked rebuild, it should rebuilld my project not the engine -_-
second time this is happening
I think the perception settings for the sense in bp determines age duration
How do I make AI do something when he enters and leaves a zone? For example I'd like to place an area on a map in which AI character starts sprinting when it enters the zone and stops when he leaves it
you could just use a trigger and on begin overlap set the variable on your AI to make it sprint and disable it on exit. Pretty sure there are other ways though @keen crow
Hmm I guess I could but for some reason that doesn't sound right although I'm very new to AI in games. I was hoping there's something to do with smart links in NavLinkProxies or just some existing funcationality in AI components or smth. Like I know you can handle an event when a character enters first point of NavLinkProxy but I couldn't find an event or a function to override when the character leaves navlink. But thanks anyway, I guess I'll try it your way
I want to:
- create a scene in unreal that plays a boxing match between 2 computer controlled players
- make camera move the way it moves in real life boxing translations
- record screen of this game, together with CSV file containing 3d transforms of the actors/control rig movement data with time stamps)
- develop a Classifier using this training set, so it could
- if 1080p video of real life boxing game translation recording is given, spit out this stream of floats that is convertable into UnrealEngine animation
How it approach the development of classifier? Say I have a training set - many video files and huge CSV files for each of them
Wow, you go for the real easy questions first don't you
Try classifying content from an existing dataset first, there's plenty of pose estimation datasets out there with hand annotated keypoints for still images at least
There's a few from Michael Black's lab for 3D too
But you're talking about a pretty big project. This goes to the heart of a thing called "Motion Matching" if you want to search for that term in semanticscholar or google scholar
CMU also has a 3D pose dataset with video too if I recall (from their multi-camera surround volume)
3D pose estimation from video isn't really a solved thing yet though
Ah yeah, CMU Panoptic dataset.. useful for you I think.
there is no real right way of doing things and from what I know the navlink proxy just affects pathfinding choices for encouraging or discouraging certain areas for pathfinding
NavArea is what you want, its basically a volume, but honestly you could just use that thing that was on the marketplace for this kind of thing?
Navlink's are meant to be just connectors between navmesh chunks, so not really what you're after
You could basically do it with any volume where you can get enter/exit events.. then just change your values on the AIController and feed them to your blackboard as per usual
Navarea is a volume, but it also changes the cost of navigation. But that doesn't really sound like your goal, so just use a trigger volume instead and change a property on the controller to say "I'm inside a trigger" on enter and unset it on leave
exactly BP interfaces can make it even easier and save you casts
Trying to optimize BP's with interfaces seems a bit redundant.. if you're doing things in BP its going to be slow anyway ๐
But yeah, why not
I mean you would save on trying to cast to the right thing and not be stuck with one parent class
So our recommendation is.. use a trigger volume, set a flag (that gets put in the blackboard) and unset when exiting
any actor with definition for the logic would do its thing or else the nothing happens
what I sad as well you could derive a bp from the trigger class ๐. \
Yeah, that's the usual way
I doubt what he wants to do needs to got to the BB
you could just set the walk speed on character movment. he just wants to change speed
Well, might as well do things right, throw it in the BB and use your BT properly
unless his BTs affect movement speed in some other way as well
Yeah, fair point.. I was thinking he wanted a bit more complexity than just setting the speed
You could do the same thing and have an AI queue for a ladder for instance, or wait for a traffic signal. I was kind of thinking of those types of use-cases
hmm those are different cases as I said. changing movement speed by going into BB and all sounds kinda more complicated than needed
It can be useful to also allow filtering via tags or some such to enable/disable volumes for different classes of actor
Yeah, for just speed you'd just set the movement speed as you said
But when is AI ever just about speed ๐
If you did it every frame, then yes it would be bad.. but once? nah
remember this is simply onenter/onexit stuff
Aren't tags just names so they should be fairly cheap to compare
If you're worried about speed, you could always use a hash
Of course it depends on whether you also need to find the object which contains the tag first and not just look at tags on some ref you carry
Well, in this case, you'd get the overlapping actor on the entry, so you could just get the tag value directly once and switch behaviour, as you say, a string comparison although if I recall, the tag values have some optimisation? can't remember if it was the UE default tags or our own
I've used hashes as tags before to avoid string comparisons, so you could easily add your own "tags" container component that simply uses hashes rather than tags (hash the tag string into a hash number and do a number comparison instead)
for example, I have a spherecast firing before the enemy shoots to prevent friendly fire so that can be easily 20 plus calls depending on baddie count
But in this particular use case, I doubt you'd notice any perf problems
iirc a tag in UE (and gameplay tags too) are FNames, which are basically converted into some kind of numeric lookup or something so it's faster than a string comparison
yeah saw an article by Tom Looman on those. Might check them out soon
zomg: sounds right..
We rolled our own version years back too
Not hard to do, generally useful
Boils down to a unsigned integer comparison, so its damn quick
Well, I guess bitwise comparison in UE's version
Would recommend ๐
Vegito: I hope you're cache-ing those spherecasts ๐
why would I cache? it is a bttask which checks if there is a friendly blocking the way to the player. If not, shoot or else task fails
tag comparison is something I could optimize though
I guess it depends how often you're shooting, but if you have a lot of enemies that'd mount up
as of now I am just converting my bttask for ai to get a good location to the player to cpp for performance.
It has an eqs, patfinding and a timer with distance checks which gave 60 fps with 20+ enemies. Gonna optimize that one first
Tbh you might not see much of a difference if it doesn't have a lot of BP nodes
I do have a lot of distance checks every 0.5 seconds
one enemy to player, one player to eqs origin point (whre the player was when the eqs was called),etc
@hearty niche @ocean wren my original question with a sprint was just an example. The real problem is I have various mechanics for player in my project like mantling, sprinting, sprinting to sliding, sprinting to wallrunning, proning and say I have a logic in my AI controller that under some occasions AI character just goes from one point to another by AI Move To Location functions. Now I need to know how to teach AI characters to slide under low obstacles, how to wallrun over pitfalls, how to use ladders, etc. I managed to implement mantling for AI but that was easy because I just had to create a custom NavLinkProxy and invoke base character's Mantle function, but things get harder on situations like sliding, wallrunning, sprinting, etc where I want AI character to start some action before obstacle and finish after it so that it can reach destination point set by AI Move To Location. Your idea with trigger volumes is nice but I haven't worked out yet how do I determine if by entering the trigger volume should character really start say wallrunning or if he is doing some other login like chasing character or hiding in cover or whatever
Hmm, I see. In that case, I probably wouldn't mark up the world and instead would build a navigation controller on top of the movement component to alter the methods that the movement component uses to traverse. Maybe even call it a traversal component. The idea of this component would be to classify the neighbourhood around the agent to determine how best to move through the world locally. So might do a bunch of sphere/raycasts to determine if it needs to duck etc. Wall running would be a proximity check for a bunch of raycasts or a spherecast and contact distance check to activate wallrunning. They did mention a bunch of this on the Wolfire blog back in the dev phase for that game, so might want to look at that. So the main advice I'd give, is to build it into the characters movement otherwise I could see your world being full of hint volumes and getting a bit difficult to edit.
Usually, what you'd do, is try and identify nearby opportunities for smart movement. So is a wall near me? then wallrun, if there a gap coming closer in front of me? start sliding. The way you discern those opportunities is up to you. You could always mark up the world (they do this for assassins creed games for instance), but it feels like you'd be wise to do some mix of ray/sphere checks and world markup.
This kind of thing is related to the "smart object" concept in game AI, where we annotate world items with potential uses and animation data and lets AI's decide which nearby smart objects satisfy their needs
The idea of this component would be to classify the neighbourhood around the agent to determine how best to move through the world locally. So might do a bunch of sphere/raycasts to determine if it needs to duck etc. Wall running would be a proximity check for a bunch of raycasts or a spherecast and contact distance check to activate wallrunning.
is it something EQS is designed to solve? I've watched some videos about it but it seems kinda complex and I'm not sure if it really fits for problems like mine
EQS could certainly be part of it for sure
then I guess I just don't know AI in UE4 good enough yet to solve my problem. I'll try to learn EQS more because as you said
I could see your world being full of hint volumes and getting a bit difficult to edit.
that scares me too
So here's an example of one thing I've done.. I want to stack a group of AI soldiers up on a door, breach the door and make them enter the room in a "spec ops" manner. So I have components on the door for "stack up locations" where I can edit those per door to make the stacking work. The AI soldier uses EQS to find the stack point that is 1) closest to the door 2) not already occupied 3) on the correct side of the door etc..
Now I don't want to annotate EVERYTHING in the world. But doors and door handles are obvious special cases, so makes sense to mark those up.
But walls? no, I'll sphere/raycast for those
Now I've seen some games (notably some CryEngine ones) where they basically have designers annotate the blueprints for every item that can be placed in the level. So cover locations, mantle locations etc.
Personally, I'd balance it a bit.
Annotated world content looks better generally. Less prone to making errors. But adds clutter to the editor unless you can switch off visualizations etc (you should enable that)
So for instance, you could annotate windows to allow soldiers to shoot out of them by standing in a certain position OR you could just get the soldier to find actors with the tag of "window.open" and go and stand at the nearest middle point of the window and fire and hope it works ๐
The latter actually does work most of the time, but means you need fairly open windows and kind of fails if you start to have fancy windows where they don't fully open etc.
Always a bit of a tradeoff
You can also have smarts in the objects themselves. My door example, the door controlled the execution order of the breaching because it had different sequences for breacher entry1 entry2 etc.
Ladders were another one where I had more of a smart object approach. Because you want them to queue at the top or bottom if someone is on the ladder etc.
ideally you need your squad to cover the other end of the ladder ๐
Same for elevators, trucks, carts and the like.
So you hand off some AI from the character to the object to be interacted with. Instead of "use this <door" you go "door, I want to use you, tell me how"
If you were being a proper AI programmer. You'd build an ML model from examples of your own world traversal and apply that as your traversal component ๐
honestly this approach with "smart objects" is not really to my taste right now because my previous enterprise background tells me that objects like doors shouldnt really controls actors, or characters how should they interact with it but still thanks for advises. For now I guess I'll fill my EQS knowledge gaps and return to my problem again
Well, just know that the smart object approach is what Bioshock uses, and the sims
and plenty of other games
guess i'm too narrow minded then ๐
there is no right way of doing stuff in gamedev as I said earlier. As long as it works does not stall fps any smoke and mirrors trick can be appropriate
The reason they use it, especially in the sims case, is that you can do extra content packs with new objects if you make the behaviour of object usage reside in the object itself.
good point
So they can do loads of new content packs by editing a base "use me this way" script and edit it for new objects. A toaster and an oven for example.
There was a nice presentation from GDC by a guy called John Abercrombie about Bioshock's smart objects in the beach scene.. its on YouTube
I think dishonored does it too right?
John now works at Epic ๐
Yeah, pretty sure. Probably in that video by Laurent about Dishonored 2?
dunno it just feels like it when you interact with stuff in the world I just took an intuitive guess
Its a pretty popular pattern, not without its downsides of course.
I wouldn't be at all surprised. We were all kind of discussing similar situations back when they were doing dishonored. Most of us were using smart objects in one way or another. If I recall there's some videos about ambient AI's that Ubisoft presented a similar idea too.
what are the downsides tho?
Well, your world becomes cluttered with annotations. Some poor schmuck has to annotate everything. Some poor schmuck has to check the annotations are correct. Often annotations work ok in test cases but when placed in real levels they fail. Stuff like that.
For example.. I annotate a door to say "you can use me, just stand here and play the door opening animation", then some other schmuck decides to place a barrel in front of the door. The AI finds the door smart object, tries to navigate to the "you can use my stand here" location.. and fails ๐
One response to that of course is to have an AI whose purpose is to try out all the smart objects ๐ so do coverage testing.
Just have them move around the level trying to use smart objects for stuff.
And log any failures
Automated testing of AI is definitely getting to be more common for the industry. I know plenty of devs who do it, including most of the bigger publishers.
For instance, if you aren't automatically testing your navigation, you're missing a trick
Hell, we did it on worms 2 back in late 90's early 2000's
Not so much for indies though
sigh ๐
Had a good discussion with a guy from Naughty Dog about it one night in a bar. Apparently they'd not done it fully yet. It was after a presentation by Microsoft where they had like 500 Xboxes testing overnight. I suspect they do it these days ๐
Worms 2 
...I was 10 when that came out
probably got it a year or two later but it was pretty great lol
I didn't really play the rest of them after that tbh, but they more or less felt like "worms 2 but with more"
I'm sitting with a problem of defining high alert actions for AI. I've found 3 cases that I'd like to implement (each of which I know the logic for):
Raise Alarm
Attack
Escape```
I'm thinking whether or not I should implement these as behavior tree actions (that are unknown to the AI, but the AI has a type preference between them) or if I should put them directly into the AI as behaviors so that the BT can have a generic `UseHighAlertAction`
Worms armageddon was Worms 2 with better singleplayer content in form of missions IMO. for a long time it seemed like the premium version of worms 2 that us worms 2 peasants never had access to. I was already an adult when I first tried armageddon
WA was basically a rewrite of a lot of the frontend part of W2, had some neat weapons and generally was a bit more polished and less cobbled together ๐
Oh and I rewrote the servers and whatnot for WA
although it was still a nightmare when we got chinese players and half a million of them tried to logon at once
I have a follow up to this. While I have a way to get attacks working, I am wondering if there is a good pattern or something to genericize attacks. I'm thinking right now of having a data table with attacks that essentially store path to a UObject where the logic is contained for each attack... but perhaps there is a better way?
Where to read / watch about new Unreal Machine Learning plugin?
Instead of datatable I have a TSubclassOf<UAIAttackActionGameplayTask> (its not a gameplaytask per se but it works too) in my Pawn class and BT creates and runs that
Works for my system, might not be suitable for your system
ok, why have you chosen to do it like that?
I wanted to encapsulate attack actions because while some AI's can only do melee attack some of them has multiple weapons and behaviors, so I needed to decouple this system from BT, otherwise I would need to create BTTask for each behavior
Instead of I just create gameplaytask-like objects now which can be callable from single bt task for each AI
Also since gameplaytask class is just a variable, I can change it dynamically
so I'm thinking for my system to use a generic HighAlertAction that just calls whatever the current high alert action is (this can be an attack, but it can be other behaviors), and let the AI themselves handle it depending on circumstances
like an AI might have their preferred action changed dynamically to ESCAPE if they realize they can't win
however, that would mean I would need a new behavior tree for every type of action
which isn't great
You might not need to. You can do a similar system to mine, but there is one pitfall. For example AI realized it can win, and executed ATTACK behavior. But player did something and they changed their mind and now they want to use the behavior ESCAPE. You somehow need to solve how you can signal this to BT and reset the current running ATTACK task
That's also a problem I'm currently working on now. When AI got damaged and health is lower than X, I want it to use different weapon with different attack task, what happens if this situation happens while I'm running one attack task already?
It's easy to fix but I'm struggling to find the most clever way
I think if it has committed to an action already, then that's that
the next action becomes the important action IMO
I wouldn't attempt to switch actions mid action
but if it's in the process of reaching a place where it can execute that action, then it can switch
equally in my system I don't query the next task until right before it is being used
Alien Isolation solves this by using some kind of states in BT (zoombapup will love this lol), before any kind of action they evaluate decorators similar to "Should Search Rooms" or "Should Attack Player". If "Should Attack Player" returns true, they just run a single task and if something that can prevent this situation happens, its already considered before "Should Attack Player" state so they can cancel it without any problems. For example if some NPC damaged the Alien very badly, they already runned "Should Run Away" before "Should Attack Player" so next tick, before running attack behavior they will execute running away behavior.
If you are not switching them as frequent as me, then its a good pattern imo.
like I said the only crucial moment for me where a switch cannot happen is from when it queries the next action, to after the next action is executed
at that point it will have committed to whatever action. anything up until that point is fair game
but my case is made worse a little (or better, depending on how you look at it), because I've chosen to use a data actor as a generic type to hold all data for actions
and the same data actor is being used for high alert actions as with passive actions
perhaps I just need to subclass it for some extra specific high alert based logic
but I'd rather keep that in the AI component, and not in the action itself
AIController?
(though in some cases it's not possible - for instance, for animations, the animation notifies decide when the event happen with every animation)
I'm inadvertently not using AIController a lot
I've basically created an AI Component that hooks up to the AI director
the component handles perception logic, as well as instinctual behaviors (e.g., high alert actions). anything else is handled by the BT
I just store behavior-related things in the class directly, and try to instance/subclass things as possible
I would, but it would remove the genericness of being able to just slap a component on an actor and make it work
I do hookups between components on the actor though... like when health matters
Behavior itself shouldn't be generic in my opinion. BT can be generic but pawns actions and behaviors not
I do my best to instance everything as possible
well like I said, actions depend on what the action data actor has stored
I think I'd need to see an example of what you mean here
As said in there, single BTTask calls pawns stored action. Each enemy type has its own BT, but every BT calls that UBTTask_RunGameplayTask when they need to do something specific
so far I'm thinking:
- Pool of potential attacks (Data Table or UObjectList) on the AI component.
- On high level action -> if Attack -> Query an attack from pool based on conditions.
- Spawn ActionData Actor with Attack at target's location.
- Adjust AI component's sense towards action
- BT handles movement and action once everything has been setup
Though just keep in my mind, I'm explaining how I did my setup for my own specific needs. I don't really know what you need for your system
Is your game something like turn based or similar?
nope, real time
So then you will do something like my system, BT will only signal to X (actor/component/action .. anything) and after that it will handle tracking the target goal etc.? - asking to understand your case
But yeah generally looks good to me
One thing I can recommend is decouple your AIComponent
Don't use it as base of everything
Do AIPerceptionComponent, AIAttackListComponent, AIBlahComponent but not AIComponent
that's why I wanted the action data elsewhere
It still communicates with single component that handles many things
I would decouple, but that means I have to use the actor
and I don't want to use the actor
there would have to be a lot of repeat logic in actors if I have more than one actor with the component
I handle perception in the component, but not behavior generally. Perhaps the AI director should have responsibility for creating the correct action for the AI
Can you make me understand, why it will repeat logic? It will split the tasks, one of them will do X, other one will do Y and owner actor/pawn will act like a base of them
Yeah, but if AI is only targeting player, it can be one of player's components too
yes but consider: any communication between components must be handled in the actor
I make one single exception, because I use one type of component as "eyes" for the perception, and the AI component gathers these themselves
it's not a given. it wouldn't be systemic just to target the player
How do you calculate how AI should react/attack?
Based on which stats
Position, health, direction etc.
I do this instead of carrying a list of transforms for each eye basically
right now I use a "Stress" fluid state that works similar to alertness
any time perception triggers, stress increases
at certain thresholds behaviors become unlocked
So you kind of mapping behaviors based on stress level then? That data actor provides "stress level" and if its higher than X, you're doing Y etc.
yep
the BT takes into account stress levels and tells the AI to do things based on that
I don't think so?
I've used BTs to model all other behavior
the high alert stuff is my last issue
Nah I was meaning generally not for this specific case
You can ignore it
So why don't you literally map your tasks then, I mean literally using TMap<>
I still think I will have to make three different subtrees for the three high alert behaviors I have
go on...
I should say, the perception system outputs the stress level, and nothing else
struct FAIAlertBehaviorWrapper
{
// Possible alert behaviors for specific stress levels
TArray<UAlertBehavior> AlertBehaviorArray;
}
TMap<float, FAIAlertBehaviorWrapper> AlertBehaviorMap;
You can add our own level of stats to calculate which one will be considered in that array
Instead of UAlertBehavior it can be FAlertBehaviorData which also holds conditions for that alert etc
And it can be UDataAsset to differentiate it between situations, AI types etc.
So AI director or data actor can only select a data asset
I think the map is a bit overkill as it would make behaviors very unpredictable
I stick to thresholds because they keep things at a baseline
and players need fairly predictable behavior to model their playstyles
How about TMap<FVector2D, FAIAlertBehaviorWrapper> AlertBehaviorMap; then
Adds a range/threshold ๐
I think the BT kinda solves the issue without having to deal with complex mapping
it outputs behavior based on stress thresholds
and it's very easy to see the visual of what's going on
plus I can access passive behaviors as well, when there is no stress
That way you need to handle differentiating that 'actions' -- which leads us back to your first question
well... I would have to anyway
the map solves a problem I've already solved
but I think at least I've understood that the director needs to have the responsibility of the action data, based on the preferences of each AI
and yeah, maybe you're right with the map I wouldn't have to make subtrees, but that would come at the cost of not using a behavior tree
Well each decisions has its trade offs
But I can say, I would never duplicate BTs or use subtrees
I'd prefer using the behavior tree since it works perfectly for all other behaviors
You will still use BT
well you can execute subtrees by creating generic BT subtrees
which I will probably make use of
I know, thats my way of handling things, your one is not trivial
I always prefer to do things like that
BT just signals in my projects
Not handle things
I'm kinda abusing it in some way
I'd need to create toooo many BTTask if I would try to handle behaviors there
same
which is why I think the action data in a separate spawned actor is the best
data separate from logic
I just need to understand how in the end, the action data is generic enough to be used by all AI components and their actors
Is ActionData "Action Handler actor that stores data based on AI's stats" or just "ActionData just stores data" ๐
it stores:
transform
animation
animation notifies
(potentially it stores projectiles)
I would love to make it so I could use it for the AI to e.g. open doors or do other interactions
but I don't know that I can do that without adding logic to it
but basically I spawn it in world, tell the AI "here's your next point, figure out what you need to do with it"
in the case of a projectile, they might need to fire a projectile at the location
in case of an animation, they might have to reach the point and do the animation on the point
etc.
hard cap around 100, max at any one time will most likely be 20 or so
AIs are generally a massive threat to players that require thorough assessment
you're not going to just walk up and kill one
(but then, they're not actively looking to kill you either necessarily)
Is that ActionData created for each AI or its simply an AI director?
it's an actor in the world
each actor in the world has different data
for instance they are also used as patrol points and points of interest
they're placeable in editor as well
Then having a seperate AActor is a bad design plan. It is similar to your example of yesterday, like you're giving players a defensive objective but you're not preparing them enough for that. It's not a disaster, but its not good either. I know it's an intentional choice but either way its not a good thing. Anyway I know thats not a subject but just wanted to point it out
I'm not sure what you mean?
I mean using actors for this is not a good choice
what would you use?
Depends, probably it will be something against your design but not actor. Probably I would just code it inside pawn or into a component
but... that doesn't work
If it requires you to use actor for any case its bad
it needs a separate transform
because otherwise you can't use it as a position in the world
likewise the points control animations because animations are pertaining to the world locations
if it was a struct in a data table, there'd be a disconnect since you'd have to find out where to place them, then go in and create a struct in a data table to represent them
but you'd have no visual control over how the data would work in the world
now you could argue that it just needs to be an actor at design time, and that once the game begins, the actor self destructs and sends its data to e.g. the AI director to create structs, but I'm not sure that would be preferable
mostly because there is more complexity once you start including stuff like conversations between two actors who are scripted to speak to each other. maybe once I know the full scope of complexity that would be a viable solution
and that solution will only work insofar they stay as pure data actors. if I start introducing logic, I won't be able to convert them.
From what I can see you sorted out things based on your way and thats working but I'm not able to see your whole system, I'm just sharing what I've seen around the industry: Usually not having seperate AActors how handling things is a general rule. For example, once upon a time we refactored a whole sense and suspicion system because I used UObjects instead of structs. It's not something "never do it", but if there is a way that you can do it without actors, even if its ugly, do it that way, in my opinion. Even with working indie studios using actors idea was not welcomed.
I'm just sharing what I've seen around the industry:
I just pointed it out to make you consider again, totally not to imply you should change it etc.
Also having seperate spawning (also frequently destructed and recreated again?) AActor can be taxing for memory
It depends on hardware and your project
well it's not a mobile project, haha
We were developing for PC and we refactored whole UObject based suspicion and perception system to USTRUCTs ๐
I've taken this system out of companies that I've worked with that worked on stealth type games. the only difference is that none of those companies used UE. the concepts, however, remain the same.
Yeah, I was going to ask that too
I sensed that non-UE concept ๐
Maybe thats why I'm disliking it
well consider this: there needs to be an atomic class that you can place in world, that can carry data
unless there is a more lightweight version of actor, then actor is just that class
if there was a FStructWithLegs that carried a transform around, I would of course use that instead
but given that limitation, there aren't really great options inside the engine
I also can't imagine the nonsense it would be for any designer wanting to use a non visual system to place down patrol points or model behavior points for AI in world
but perhaps the self destruct option has merit. the actor gets killed off come game time, but passes on its data
in essence being a proxy for the data
We solved that with doing some very low level things because we had too many waypoints both design and runtime but I did not involve with that process, so I don't know how it should be handled
every level may have some ~50-150 points in total
But I don't know, even with that project, we were not explicitly placing waypoints, we were defining 'areas', and we were handling the behavior based on that
Waypoints were just single FVectors
right, but those can't be placed in world... at least not by default
and FVector also doesn't signal direction
like I said, if this was possible, I'd be the first to throw away the actor
I understand
now you might be right that I don't need to spawn them through cpp for action data though. perhaps I need to make a FActionData struct and then just use the actor as a wrapper for that data
Why does the Agent Radius setting in the recast manager always get reset to 35 whenever I restart the editor? Is that supposed to happen?
If its marked as Transient in C++, yeah
thanks for the conversation btw, I've made some notes. I'll see how can wrap my thoughts around what you've mentioned
Doesn't seem to be marked at Transient. I also changed the AgentRadius parameter in the DefaultEngine.ini to 75 but still does not work. It's weird because the Cell Size parameter saves, but not the agent radius.
That's very weird
Is it happening with every recastnavmesh in every level?
or just this one?
Its happening for all the levels ๐
Then we're missing something
But I dont have any idea currently, maybe its intended
There was a agent radius config on project settings
Maybe its using that somehow
hhmm, I have that set to 75 as well
Sadly I don't know then. Maybe someone else had similar issue can help
How taxing is it do you figure to have a few dozen AI perception systems running at once?
depends on how taxing each of the components inside AI perception are individually
if they're well optimized a few dozen shouldn't be a massive issue
I don't know your systems
so I don't know how you'd optimize them
but generally: fewer checks, cheaper checks. avoid square root, avoid traces
avoid normalize
I was using the built in AI Perception system.
woah
What? It's not that crazy.
Not sure what needs the default one didn't fulfill for them though
I liked the reaction ๐
I basically still needed to extend it and the EQS queries. so I just didn't want to bother
Alright. I don't know if it is too limited for me either, but for now I think it will work.
anyone know if NavLinkProxies work for CrowdFollowingComponent somehow?
I've got a custom NavLinkComponent that notifies NPCs when a smart link is disabled (when being used) and Invalidates() their navigation path, but they dont actually stop and repath.
Definitely had it working ok when npcs just had PathFollowingComp
Their pathfinding systems are very interesting: https://youtu.be/yqZE5O8VPAU
In this 2021 GDC AI Summit session, programmer Eric Johnson explores the unique AI challenges faced during the development of Kojima Productions' debut title, Death Stranding.
Join the GDC mailing list: http://www.gdconf.com/subscribe
Follow GDC on Twitter: https://twitter.com/Official_GDC
GDC talks cover a range of developmental topics incl...
I am getting a crash on my BTTask node for some reason any ideas why @misty wharf?
Error: Failed to find function ReachedLocation in BTTask_FindLocationRelativeToPlayer
this is the dispatcher I want to bind my function to
Controller->GetPathFollowingComponent()->OnRequestFinished.AddUFunction(this,"ReachedLocation");
the function :
void UBTTask_FindLocationRelativeToPlayer::ReachedLocation(FAIRequestID RequestID,const FPathFollowingResult& PathFollowingResult){
if (PathFollowingResult.HasFlag(FPathFollowingResultFlags::Success))
{
FinishLatentTask(BTComponent, EBTNodeResult::Succeeded);
}
else if (PathFollowingResult.HasFlag(FPathFollowingResultFlags::InvalidPath)||PathFollowingResult.HasFlag(FPathFollowingResultFlags::Blocked))
{
FinishLatentTask(BTComponent, EBTNodeResult::Failed);
}
}
@hearty niche my guess would be the delegate add is wrong. Have you tried AddDynamic(this, &ThisClass::ReachedLocation)? Tbh haven't used non-dynamic delegates much so if it's not a dynamic one you might have to ask on #cpp how to do it correctly
hmm
Unrecognized type 'FPathFollowingResult' - type must be a UCLASS, USTRUCT, UENUM, or global delegate.
Controller->GetPathFollowingComponent()->OnRequestFinished.AddDynamic(this, &UBTTask_FindLocationRelativeToPlayer::ReachedLocation);
Is it actually a dynamic delegate?
Hi
How can I disable all AIs in level ?
I want to do this while a sequencer is playing and then I want to re-enable it
Way 1: Have a boolean on your game state something like "bPlayingSeqeuncer" and check that boolean first before evaluating other nodes in BT
Way 2: Loop all AI Controllers and disable logic, then do reverse when sequencer ends
Way 3: If you're with C++ maybe there is more advanced way with UBrainComponent but not sure
I coulda sworn I posted a question here but
AI touch sense without collision, what's the go to?
best answer: AI director subsystem
other answers: gameplay tags
anyone has a good tutorial for behavior tree? followed few tutorial but i think they are outdated
Outdated how?
I've not noticed there being that many changes to how BT's work, maybe the UI has changed just a bit but the method of operation is still the same
Try Inside Unreal videos!
hey guys, I'm trying to set a location for an AI to move to through an EQS. My level is huge so I have to use a navigation invoker. However, if the point my query selects is outside of the navigation invoker's range, my AI won't move there. First screenshot is my nav mesh range and my EQS range. The second is another game that I'm attempting to emulate while I learn. When the second game does a "Move to" in the behaviour tree, it seems to generate a path for it to move through while mine doesn't and subsequently can't move to the point. How can I do this?
Hi there. How can I move an NPC from one point to second point and then to third point without stopping? That NPC is continuously moving toward third point location, without stopping at first and second location.
alright well I'll figure out how to do this at some point. For now I just conceded to losing 20fps by massively increasing the nav invoker range.
maybe you could check on the Nav range and if the position the EQS sends it's out of the Nav range then clamp it to the nearest point inside the Nav
i've actually been looking for something like this, do you have any doc on Nav Invokers? ๐
yeah I basically did that by adding a test to ensure its only inside the nav range, but of course that meant it would not move far at all. I've seen little to no documentation about anything to do with this haha, so what I've learnt to do I've learnt by trial and error and figuring it out myself from the names of everything
exactly, what you could do is take the point that the original EQS gives, save it like your main "Target Location" but move your agent by another location that is clamped to you nav and when he reaches that mid-point check again if you have to re-clamp the Target
Ah yeah that could totally work
What I was trying so hard to achieve, was what you can see here. Where the ai has a nav invoker, but also a new nav mesh that is set up along a path to the target location. I could not for the life of me figure it out. very frustrating
This game is going to have mod support soon though, so when it does I should be able to take see how it was done
the GDC yt channel just released how the AI on Death Stranding tackled this kind of issues dude, hope it helps ๐ --- https://www.youtube.com/watch?v=yqZE5O8VPAU
In this 2021 GDC AI Summit session, programmer Eric Johnson explores the unique AI challenges faced during the development of Kojima Productions' debut title, Death Stranding.
Join the GDC mailing list: http://www.gdconf.com/subscribe
Follow GDC on Twitter: https://twitter.com/Official_GDC
GDC talks cover a range of developmental topics incl...
๐
FWIW, I think they added the grid based pathfinder to get around the navigation issue for large terrains? I think Miesko was using it for Fortnite at one point. Although I don't remember where they showed that. It was prior to them ripping off the PubG gameplay, so pre battle royale back when Fortnite was a sort of tower defency thing.
is it worth it to make a service for (slow) projectile avoidance?
I'm a bit uncertain that a service can abort tasks in favor of other decisions
so I was thinking decorators instead
Services can't affect control flow afaik
I guess you could use one to set a BB value which is then watched by some decorator which then affects control flow
I mean a a decorator is going to be cheaper I guess
so if services can't affect flow control, I have no issue using decorators
you can use a service to detect for projectiles
which then changes your BT to avoidance via decorators
I already asked this in the blueprint server, but this question might be best suited here. Does anyone know of a tutorial on how to make AI "Road Network" spline? I want to be able to make paths that AI can Transverse and have a choice from different paths not just one "straight path". If what I am asking is confusing, which it might be as I am a half wit. lol Assassins Creed GDC talk on "Meta AI" is what I am looking at replicating
Is there any event or function that gets called per each end of a offMesh Nav link whatever it's called? That would be super useful
Hello have a question, so we have BTTask and PawnAction who can explain for what we need Pawn Action?
Is there any method to use PawnAction inside BTTask? because i found that some implementation is copied in both of them
And looks like Pawn Action may listen brain component messages
Pawn Action was used before gameplay tasks
Zoombapup knows more about them
AITasks or BTTasks should be able to listen brain components too
@sullen pier
Check BTTask_MoveTo
UE5 probably (personal opinion: %99) will use AITasks (though UE4 also using AITasks right now, you just need to enable a flag on project settings) and not gonna use pawn action anywhere
I dont recommend using them if you dont have any specific use case
@celest python thx, the actual use was just reimplement to use interfaces for both PlayerController and AIController
with brain component
rts/fps like mode
and found that PawnAction may be instanced inside cpp
Is there any way to abort All BTTasks? for example move to location if i switched to manual controll?
Ok, thank you!
Hey there,
I'm in a BTT and want to update a variable on my ABP.
That alone is easy enough, but the changed boolean begins a transition into a new state, which involves a montage playing during that transition in the state machine.
Is there a neat way to do this in a BTT and either wait for that completion?
You would need to listen to some event that triggers when the animation completes
and trigger the Finish Execute from that event
Thanks, thats what I ended up on. Now I just gotta debug why my LeftStateEvent isnt firing
Ensure condition failed: !SearchData.DeactivatedBranchStart.IsSet() [File:D:/Build/++UE4/Sync/Engine/Source/Runtime/AIModule/Private/BehaviorTree/BehaviorTreeComponent.cpp] [Line: 1592]
There should not have more than one deactivated branch. (Previous start:[0:4], New start:[0:4]
[2021.10.27-21.48.17:230][493]LogOutputDevice: Error: Ensure condition failed: !SearchData.DeactivatedBranchStart.IsSet() [File:D:/Build/++UE4/Sync/Engine/Source/Runtime/AIModule/Private/BehaviorTree/BehaviorTreeComponent.cpp] [Line: 1592]
There should not have more than one deactivated branch. (Previous start:[0:4], New start:[0:4]
[2021.10.27-21.48.17:230][493]LogStats: FDebug::EnsureFailed - 0.000 s
UE4Editor-Win64-DebugGame.exe has triggered a breakpoint.```
I'm getting something like this, and I'm not sure why
Hello, how do I make the playerAI avoid enemyAI?
I have a player AI and an enemy AI. I would like the playerAI to avoid the enemyAI so I setup the enemyAI with an obstacle volume affecting navmesh. The problem is that if I do this the enemyAI pathfiding becomes finnicky/jittery, because it is having trouble navigating with a volume around itself as obstacle. I want playerAI to avoid enemyAI but I don't want enemyAI to avoid playerAI (hence I am not using rvo avoidance).
I would imagine there must be some way to configure either RVO or crowd avoidance such that only the player character uses it
there is
RVO has flags on who should be avoided or not
1 could be player, 2 could be enemy
1 can avoid 2, but 2 should not avoid 1
Hi! How can I get "OverlappingActors" from custom "EnvQueryTest" ? Now I have empty array (but it's 100% must find overlapping actor). Why logic to find overlap is not working from this class?
It.IgnoreTimeLimit() is just experement. Same result without it
Hey anyone know how to fix this issue with the hand
you need to use IK
to keep the hand attached to the gun
also looks like you imported the animation for a different skeleton and never had the pose setup properly.
inverse kinematics
How do I make some logic to execute even when a branch is aborted by some decorator on a branch with a higher priority? Is a service with OnBecomeRelevant and OnCeiseRelevant overriden a good place to have this logic? I'm kinda confused that services are kinda for updating constantly while a branch is executing and not for obligatory in and out logic but I can't think of any better place
can you sketch a diagram of what you're trying to do?
Something like this for example. Decorator from left branch will abort right branch. And in the right branch I have an entry node SetPatrolMode(true) and an exit node SetPatrolMode(false). As I understand if the patrol branch is aborted by left branch, SetPatrolMode(false) wouldn't get fired so I tried to place this logic in a service StartPatrol which has OnBecomeRelevant and OnSeizeRelevant overriden. Is it ok to do so?
Does it work? If yes, then yes, if no, then no
:D
It seems like a reasonable way to achieve this type of modality to me
I'm still new to BT so just wondering if there are better ways. What bothers me in such solution is that services are designed for regularly ticking and updating state of AI. This OnBecomeRelevant and OnSeizeRelevant actually come from BTService ancestor (UBTAuxiliaryNode)
It might be possible to also use a decorator for it... I don't remember for sure if they had that function though
* Other typical use case is creating a marker when specific branch is being executed
* (see OnBecomeRelevant, OnCeaseRelevant), by setting a flag in blackboard.
btw it says that about it in the code so I think your usage is perfectly fine
they do as they also inherit from UBTAuxiliaryNode but for some reason I refused to test decorators. I think I thought that if decorator check fails OnCeaseRelevant won't execute
but I think I should check it
Pawnaction was the first attempt at making sequential actions, that eventually got outdated by gameplay abilities system (gas). Basically pawn actions are just sequences of enter->update->exit classes that you can add to a queue of actions. Which is fine for some things so I guess they left the code in. But the message at the time was that pawn actions were being replaced by GAS.
@ocean wren yes thx, already investigated that
I used them, they do work and all ๐ so hey, why not?
Personally, I modified the classes to allow channels of actions and used them for things like tank control where actions were at different levels (gunner, commander, loader etc)
its quite simple, but im tried to use it in PlayerController as a top down brains
after possess
I think the use case was more just a simple queue that was "fire and forget"
It feels like there's a bit of overlap with pawn actions and bt tasks too, since at least in my case I have a lot of bt tasks for those types of "actions" my npc's do and I sequence them in BT's :P
Yeah, that makes sense.
I used a channel-ized version because I like the simplicity. Just shove an "action" into a queue and it gets run in order. Add some queue shuffling/clearing/locking etc and I guess it is a bit like the GAS.
Made sense for a layered AI I was building at the time
for controlling a tank
Yeah
i refactored pawn actions to brain component with behaviour tree, but again found bttask and aitask using controller->move fly etc
bt's are great for sequential stuff but they're not the best if you need something to happen simultaneously I think
Its the kind of thing that's actually fun to program ๐ doesn't feel kind of braindead like the blackboard implementation ๐
Yeah, BT's really aren't designed for that layered stuff. No "walk and chew gum" ๐
you mean kick ass and chew gum lol
well, yeah ๐
Man I'm wiped today.. did 4 hour workshops and then 2 hours of project meetings. I need a weekend off ๐
Until a few months ago my everday was like that ๐
PSD and ICC file format investigation 
ICC the colour thing?
yeah
I'm covering someone else's classes as well as my own, so timetable is pretty brutal, means I have to spend all weekend in prep
At least I get to play a bit with the class. doing sentiment analysis on multiple chat streams next week ๐
nice, was just watching some CS on twitch and thinking they really need something like that to get rid of all the shitposters 
I had a final year CS undegrad project to make a teams joke bot, but nobody took it ๐
I was dissapointed
Although, I've got a couple doing lip sync and text-to-speech-to-text for metahumans ๐
with dialogue generated by GPT2/3
which if you ask me, is fun, but then I'm a bit warped ๐
I'd love to be able to use something like that for my game as I generated stuff like movies and movie synopses procedurally
but I have no idea how any of that ML stuff works and I bet it would be way too heavy for it anyway lol
naaah man. Thats what I work on in my own research. PCG cinematics and behaviour
ML based.. by learning from movies
Stealing all the ideas from Google and Facebook and NVIDIA ๐
brain component has background tasks or something, just started surfing sources, probably will add new parallel tasks
Yeah never really looked at that in much detail other than seeing that Behavior Tree is a subclass of that
i mean implement new logic
Its about bloody time someone just rewrote the whole goddam AI system for UE. I mean I'd do it, but I don't think Epic care ๐
Its so far from "good" ๐
I have bigger fish to fry right now too.. what with consultancy and research projects and the like
it seems to do the job pretty well at least in both projects I've used it in
but neither of them really required super complex logic
Its ok. It's just not "good" ๐
lol
I mean more about the usability and documentation than the code. Although the code has some bad smells too
documentation is a problem with almost everything in UE :P
i started to use unreal a while ago and i know about it only little) But never the less already extended lots of things
I just feel so bad for all of the people coming into the channel and not having a clue where to start on things ๐
code is quite good, with lots of comments ๐
I'm sure Epic could afford to hire a couple of folks to fix the docs
I worked on an AI system for MMO's called StoryBricks where we actually thought about how inexperienced users might think about AI
zomg: and yet, many years later, here we are ๐
Thanks Tim. 
He's too busy rolling in his mountains of money to care about AI and documentation ๐
Mmhm
?
You'd never know half of the stuff in C++ exists unless someone tells you about it on #cpp :p
My favourite part of the codebase is the node editor code ๐ I'm twisted that way.
They namespaced something I cant remember and for that reason I was not able to automatically rename assets when they created, after that I never opened editor code again
@celest python UDN is for dedicated Epic support, not documentation
This is not giving the expected result. I cranked my enemy ai rvo avoidance radius to 5k and the ai player still doesnt go around it. AI player has rvo avoidance activated.
I'm using SimpleMoveToLocation to move my AI character along a navmesh. However, when the goal location is outside the nav mesh, the AI character stops moving. I want him to get to the closest point in the navmesh instead. Is there a way to do this?
AIMoveTo and acceptance radius I suppose
or you could map a path maybe
I'm having an issue where a decorator is being skipped despite being true. I'm not sure how I'm supposed to handle higher priority tasks that are transient in nature that then also allow it to return
Checkout FindDistanceToWall in RecastNavMesh.h
hey, so I'm not sure how I will get the closest point on the navmesh with the FindDistanceToWall tho. I tried using the ProjectPointOnNavMesh, but I'm always getting a zero vector back so that's not working either (Picture of implementation below).
I am no expert in Navigation and EQS, but I believe there are two solution and it might work(For chasing player): 1. Use MoveTo LastKnown vector Location https://answers.unrealengine.com/questions/413063/ai-walks-outside-navmesh.html 2. Use a EQS query to find position that 1. Get closest position near player 2. Get furtherest position away from itself 3. Point is on nav mesh
I think you have to trace through code to see why it is not valid. There are lots of settings that could go wrong for nav mesh. Try delete all RecastNavMesh in your level and move NavMeshBounds a little bit to generate new nav mesh (For changes to take effect).
Check Visual Logger to see why it is being skipped
Where can I read about running behavior trees from behavior trees? Currently I don't understand how do I pass some data from parent BT blackboard to child BT blackboard and how do I stop child BT from parent BT (I assume just by decorator) and from inside child BT itself?
you can not run bt's from bt's
but you can run child bts via Run subtree
slightly different as your main tree is still running.
and you can't have different blackboards
Child BT must use same blackboard as parent bt.
then what does this node do?
runs a sub tree, but parent tree is still running, and they can not have different blackboard than the parent
i use them regulary
i use the Run Dynamic
and i inject different trees based on ai behaviour
makes the BT's cleaner for complex AI
used alot inside our "Hunter" monster
what do these tags mean in run behavior dynamic task? i didn't understand a thing -_-
but what does it mean to run a behavior dynamically with an injected tag?
its like in the context of a running subtree I can somehow read those tags?
you choose what BT to inject into it
like this
then the BT will ibject BT_DogEvade into it
and run that
still don't get it. I choose what BT to inject in regular Run Behavior task also. What are those DefaultGameplayTags.ini about?
it seems like I don't know a lot about BTs because none of that makes any sense for me yet -_-
so for example the above, by default this node will run Basic monster evade
but with my injection above
it will change it to use DogEvade
oh wow. I guess I understand it now but can't imagine a usage for this yet. I'm currently only learning with just 1 type of enemy
yeah its more for complex stuff
seems like some BT-level polymorphism
i keep my bt's generalized as much as possible
and inject things in when needed
but there is a limit
(works fine for basic monsters, but gets less manageable on complex ones)
so for them, i make unique behaviour trees
cool. its rather clear for me now, thanks again
yeah BT's are hard to get used too
but i have around 100ish bt's
for 30 monsters and human AI
lot of them are small subtrees which gets injected into the main tree
@pine steeple can you help me with another question? Before I started learning BTs I was playing with custom NavLinkProxies. I managed to make a simple one for jumping on a ledge just by subscribing to OnSmartPointReached event. But I couldn't find out how to set up a custom NavLinkProxy where a character needs to start one action and the beginning of the link and stop doing it when it leaves the link. Like for example I have a mechanic for a player to crawl or crouch to go under low obstacles and I can make character crouch or prone when it enters first point of NLP but I don't know how to make character uncrouch once it gets through the obstacle. I asked this question before and someone suggested just using custom triggers which makes the bot uncrouch once it leaves the box collision but after discussion we agreed that it would become cumbersome to maintain as there are more and more NLPs and harder actions like sliding under obstacles, running walls, etc. So is there any better way?
you just need to check if AI location is nearly equal to target location (end location)
that is the only way
that is how we handle vaulting
though the vault calls in to the AI controller
and tells the AI controller its finished
and this then ends the link
but same principle
I have a similar setup for going through doors although in my case the AI controller figures out when it's reached the end by itself and informs the link
it's a bit annoying because you can't really pause its navigation pathing, give it a new nav target, and then resume the previous pathing later
or rather, you probably could, but if you use f.ex. AI MoveTo, changing to a new nav target for traversing the link would cause it to consider the pathing finished
thanks I'll check it out
Is it possible to somehow group or categorize blackboard keys?
nope
so everyone is fine with having dozens of blackboard keys in one blackboard?
or if I have dozens of keys in one BB then i'm doing something wrong?
No idea tbh. I have some BB keys and a bunch of decorators which access other data that's not in the BB
how do you get a blueprint bttask to tick?
I gave up using the ProjectPointOnNavMesh function. I honestly think that function is broken. I noticed that they used it in the MoveTo function in the AIController class and doesn't seem to work there either after doing a couple of tests. I just ended up using EQS and made a custom context for the player. That seems to be the only viable solution for this problem without changing the source code.
Hey everyone, I'm doing a gamejam and time is running out on me, I'm trying to do a barebones quest system, I already finished the dialogue system and need some help
How do I make an AI decorator that checks wether or not you have a quest item (bool on char)
oh, then its probably not broken then ๐ . For some reason, it always returns 0,0,0 no matter how large or small I make the extents. I even mimiced the same implementation from the MoveTo function in the AIController and got the same buggy results. So idk ๐คทโโ๏ธ . Im not too worried about it now tho.
Can someone explain the difference between a task with "AI move to actor or location" and a simple "move to"? With "AI move to actor or location" whenever there's a "wait" in the BehaviorTree the AI executes another "AI move to" task during the supposed wait.
But if I use "Move to", it respects the "Wait" lol
hello, how can you add collision to ai for the whole body?
mine is kind of giant
and i want player to be able to cross between it's legs
increase capsule radius and capsule height size. When you click on the capsule component in the viewport, it shows on the right.
yes but player cannot go between it's legs which is the one i've wanted to do. enemy ai is giant
add 2 capsules for legs, leave a space between them
haven't seen that option yet. how can you add another capsule?
are you on bp viewport or mesh/skeleton editing?
On the viewport, to your left there will be a list with the components. Above the list there will be a dropdown menu. Clik on the menu and select capsule collision.
what's the usage of Push pawn action node in BTs? I tried googling about it but it seems just like the tasks so why ever use it?
Anyone here have any idea on creating ai that can do flanking?
Yes, use EQS and make the dot product calculation bias to the sides of the player
But... I'd recommend against it, players will be getting shot in the head and dislike that they don't know why ๐
Other than that, its just the usual setup
You could bias the EQS to choose routes to the flanking position that are visible from the player, but that just looks a bit haphazard
Don't worry, the Player is not gonna get shot in the head by the enemy
I tried using EQS, it didn't worked out as I expected since its responsible for generating position and doesn't really care about the pathfinding. So, most of the time, the enemy will go in front of the Player and then proceed to the generated position, which makes the enemy look stupid ๐คฃ
But you mentioned using EQS to choose routes, can you share a bit more on that?
Generally, you can use the EQS to bias the chosen location in a direction. So use perpendicularity to choose "off to the side". But yeah, if you wanted the pathfinder to not pass in view of the player, you'd need to modify the cost of the navmesh to score against any visible navmesh polygons
But my experience is that flanking comes across to the player as enemies just running away.. then later shooting you from behind/side
We had this exact same problem a looong time ago on one of the first first person shooters on the amiga
What we ended up doing is making the enemy take cover.. then wait a bit, then try and move up.
But always in view of the player (aside from when its fully in cover of course)
anything the line runs through ticks. but decorators are conventionally branching points
Ah yeah, thought so too.
I am using a box collision marked as dynamic obstacle to affect the area costs at the moment ๐คฃ
It does, which is why for mine I have the enemies signal to the players that they are gonna flank the players. Depending on what situation it is of course, in some situations where the intention is to make the players jump, I won't have them signal to the players.
Thanks for your input!
hey, does anyone know why 'ai move to' can suddenly stop working or work incorrectly? I had this setup and it was perfectly okay and some day AI just stopped moving (thought it still tries to but stands still)
my built nav is ok
no obstacles
no additional components except volume trigger, pawn sensing and some fancy smoke (all component have 'affect nav' turned off)
did not alter any movement component settings
you can check the Enums you get as a result from the AIMoveTo and set them to print strings on fail
most likely it can't path to one or more of your locations
debugged all locations, it behaves the same everytime, feels like the pawn is stuck, it doesn't even rotate towards next destination
did you read what I wrote?
y
so what did I say?
says success
though in debugging it does not do the thing after 'on success' and keeps playing like it didn't
even when I make a loop after 'on failed' it keeps looping, but says success
then do as I said and put the enum on OnFail
aborted most likely means that it's outside of navmesh
or it received a different order
what it could also be is
because you have a delay
it triggers the delay and starts moving to another point within a second
your setup needs wokr
unfortunately the issue remained still even after I turned off delay
recreated navmesh, rebuilt it and yet AI still does not move
what can that red spot be?
try and see if there's a path to your location on the navmesh
there's a node for that
I checked all locations with 'navigation raycast' it said true and named the final point for all of them correctly , so I guess it does work
navigation raycast just tells you the location is valid on the navmesh, not that there is a path to it
there is a node called find path on navmesh or something, use that to check
okay thanks I'll check it
I'm having a problem with understanding trace test in EQS. Why are the spots behind walls aren't filtered out by trace test that requires to hit the context?
And here's the EQS query
what am I doing wrong?
@keen crow it's kind of a confusing system - only blocking hits with bool match enabled means that it will count hits that hit anything as success
What do I do then -_-? I tried disabling only blocking hits but it didn't work
iirc you need to have it count things that don't hit anything as success
How do I do that?
Raise up the trace so it doesn't always hit the ground with those settings. And probably disable "only blocking hits"
Thank you thank you
Yeah it's kind of confusing how it works at first lol
not perfect but at least seems correct
still curious though what can be wrong with these ?
Current trace test settings
A quick silly couple of questions. I have navmesh set up and ai bp controller and blackboard with a look for new location move to wait system in place working well. My model has a walk/run with a walk left/right. how do you go about making it not so wooden I.e gets to xyz rotates 13* then walks straight to xyz2 in a direct bline of sight and how would you go about adding the walk left right as it turns a curve of sorts not just spinning on the spot. Second one is I only have 100 in scene and the FPS drops dramatically iv seen 1000s used in a niagra crowd. Not sure if I can have them as physically gotta Le things with ballistics or not and if not Iโm guessing as the bullet gets close it should be turning it from a niagra to a physical meshโฆ..
Hey guys, do you know if there's any way to avoid the hard deceleration when aborting a move? I'm using dynamic navigation and when the path is recalculated the previous move is aborted and the acceleration drops to 0. This sudden change is breaking something in my Animation Blueprint.
Not sure if this belongs here or in #cpp. But is there an easy way to completely reset all blackboard key values?
neither quick nor silly questions. this is something that's hard to pull off. basically you'd want to create a custom move to node that takes a bezier style input curve per point
not as far as I know. what would they be reset to?
this can then dictate speed along the resulting spline, making speedups and slowdowns as necessary
I'm actually wondering if this would be possible in BP now...
but my initial reaction is no, since you require latent functionality
Just empty values. I just want to start up the blackboard completely fresh is the goal essentially
given that they are wrappers, there is no good way to flush them
crap :/
it might be worth considering how many values are dependent on being flushed
in my general AI BT I have 1 variable that I flush
Hi, does anynody know if Hearing in AI Perception registers events from Report Noise Event adjusted to walls and other geometry. For example if there is a wall between Pawn and Actor who reports Noise Event does he hear it in a same radius if there was no wall? Thank you
thankyou. least i have some keywords to go do some research.
thanks a lot, yeah pathfinding is probably the way to go.
so with debug icons or what have you installed, this actually bugs out and I get an error: cpp Ensure condition failed: !SearchData.DeactivatedBranchStart.IsSet() [File:D:/Build/++UE4/Sync/Engine/Source/Runtime/AIModule/Private/BehaviorTree/BehaviorTreeComponent.cpp] [Line: 1592] There should not have more than one deactivated branch. (Previous start:[0:4], New start:[0:4] [2021.11.01-22.31.28:633][586]LogOutputDevice: Error: Ensure condition failed: !SearchData.DeactivatedBranchStart.IsSet() [File:D:/Build/++UE4/Sync/Engine/Source/Runtime/AIModule/Private/BehaviorTree/BehaviorTreeComponent.cpp] [Line: 1592] There should not have more than one deactivated branch. (Previous start:[0:4], New start:[0:4]
I'm tagging you just in case you would know how to resolve this?
I've never seen this error before but I'll give it a look on my free time and let you know. iirc you had some similar error posts here related with BT, something probably went wrong with nodes
this has to do the skipping
Well, wait a second, "Target Acquired" decorator runs first and "Cast Intent" runs for 2nd one?
Set a breakpoint to this line and check values of .Describe() functions' returns
If new end is lower than previous end, it complains about you're returning back to a previous node on a selector
Which is not a valid thing, afaik
Also, can you share the visual logger screenshot?
I dont have the same error logs used on my source code for the same line (4.26 version)
oh I see. wait so if I change the big selector to a sequence, it's ok?
I didn't actually use the visual logger
and yes, that is correct
I figured that if it aborted lower first, then came back it would retry lower due to being a selector
Honestly since I never tried to do this, I never got a similar error too, but just having a guess what you're tried to do is probably against the design of BTs. Maybe someone with wider experience can say something with more confidence
Let's try, but I'd suggest trying Visual logger first, it gives more detailed info
what you're tried to do is probably against the design of BTs
Btw, do BT continue to execute other nodes when those two skipped?
if it returns back to previous node, it might end up in a infinite loop, and thats might be the case why BT put an assertion to that line
yeah it returns to the default nodes. all the other connections work flawless. I seem to recall this used to work flawlessly as well, I think the bug may have come with an update
like it stops play because of the error but I can resume and it'll not pop up again and never cause an issue again
Thats how ensure() works
Lets you know something is wrong and never bother you again
fair enough
but yeah it's only between those two nodes
I have 5 nodes springing from the same selector
the others have no such issues
trying to understand why the relationship between these two nodes is like that
yep
Hmm
Maybe the reason is when the 2nd one (the one on the left) failed, it should execute the 1st one again, and its also failed
If not, I think you should see visual logger if it will provide more info. I don't think I can brainstorm more about this without knowing further informations since I never saw the same error before
just for reference
the lowest three have no issues and work perfectly between each other
one of them isn't implemented so it always returns false
so it remains untested
the two other high prio nodes have issues between each other
the visual logger has no info
and sequence breaks the order so I'd have to rearrange logic to trickle down
but perhaps that is the answer?
Do you still get the error with sequence?
no but I can't get it to the point where I would get the error
like I would have to change the logic of the BT tasks
I don't think it would work
hmm now strange the third one doesn't trigger like it used it
very weird
That might not be pointing anything since the error was relevant with selector node
well consider that with a sequence every task has to succeed
SearchData is a selector thing
so in order to pass it down the chain I would have to succeed each of them
No I'm not saying you shouldn't use selector, its just error was related with selector node itself
So when you removed, error can be gone
It might not be giving correct clues to find the error
Maybe @ KaosSpooktrum knows more about this situation, but I'm afraid to @ him, he might be busy ๐
But he usually checks #gameplay-ai
I might give him a prod the next time he's around
thanks for the rubberducking at least
aha, the problem happens with the cast intent node regardless
perhaps it doesn't like that it is aborting itself
it has no problem aborting lower prio, but it has a problem aborting itself... which doesn't make any sense. it should search for other nodes then, and there are other nodes. maybe it's because there need to be two separate decorators
hmm
. (hi Kaos :D)
I'm an idiot, did not see your "abort both" flag at the first stage
yep
that's intentional though
or at least, how I have understood the "aborts both" observer
for as long it stays true, it aborts lower prio
as soon as it turns false, it aborts self
So if Cast Intent returns false, it will skip the right one even the right one is true
well it shouldn't
it should restart the tree no?
if it aborts both at the same time when it's false, let's say (worst case scenario)
then the tree restarts, and it reevaluates every node in order
No? It will just continue to execute other nodes
then why would it not check and execute the next node in order?
You're aborting 'both'
yes
self and lower prio
yes
which prevents the execution of next node
so worst case, that means it restarts the tree because the selector fails
it does, all children aborted
You said it continues to execute other nodes flawlessly? 
it skips that one node
but in the case of it aborting the tree
that's fine too
because it restarts
and finds the right node
the BT doesn't just die
it reevaluates in case of failure
my point is just
in either case, it skips a node with a decorator that is true
if it restarts the tree, then cast intent is now false, the next node has a decorator which is true (and aborts lower prio), of which path it should then take
but it's definitely something to do with the aborts both. even with just two nodes (the other have no decorators), it still causes the same issue
and I know it didn't use to be an issue
this is logic I hadn't changed for a year or more
interestingly, other aborts both work as intended
Is there any possibility previous decorators affecting the condition of your skipped decorator?
Quick example, first decorator sets the "targetplayer" and since all of them checks targetplayer is valid or not, whole execution stops
Or maybe something is wrong with notify observer settings?
hmm I only have one, on a separate selector one level up. it basically initiates the BT values
Have you ever breakpointed the BT? Maybe some insteresting stuff come out
While doing that you can examine the values
on editor
I have.
there isn't anything
other abort both nodes are working as intended
this is starting to seem more like a bug
I don't do things based on BBvalues
(at least not here)
Can you both debug in BPs and inside of the IDE to pinpoint exact location that assertion happening?
put breakpoint to that ensure on line 1500~ and put another breakpoint to start of the BT in editor
also there should be a function or a condition to call that decorator on that function body
it should show you why it is not being called after that assertion
Is it just me or our messages are being deleted lol?
I was trying to find the logs you posted
ok so now... I changed some of the low prio decorators on the nodes that otherwise worked fine
and the entire tree works as intended now
except I still get that ensure issue
Literally everything got deleted on me
wait what?!
what the hell ๐
ok so now... I changed some of the low prio decorators on the nodes that otherwise worked fine
and the entire tree works as intended now
except I still get that ensure issue
@mossy nexus are messages deleted on your side too or am I seeing things? I really need a sanity check on this
nope I see all our correspondence @celest python
have you tried restarting discord perhaps?
Yeah restarting solved, that was a very weird issue though ๐
Another thing biting me is I don't have same ensure() function like you