I'm trying to make ai perception for a monster that sees me.
My character has an AIPerceptionStimuliSource.
This way the monster sees me. Everything is working properly. However, there is another blueprint that is a child actor in my character.
And although there is no stimulus attached to it, the beast sees that too.
How can I make it not see this child actor?
And I don't want to change the collision of this
#gameplay-ai
1 messages · Page 23 of 1
maybe a dumb question but i'm just getting started with behavior trees. I have a bunch of components right now on actors that handle things like damage/healing, threat (taunt, fixate, vanish, threat drops, etc.) and target selection, and such for basically all of my combat functionality. In designing a behavior tree, is the expectation that all of the things I need to access in the behavior tree (like current target, current health %, current abilities) are copied to a blackboard when they change (essentially duplicating everything) so that the behavior tree can track changes, or is there some way to just reference variables that already exist in components of the actor and be notified when they change? I have multicast delegates attached to most everything but wasn't sure if I should be trying to subscribe to those somewhere in the tree
Hi, a quick question. What's the difference between AIPerception and PawnSensing? I believe they both have an ability to sense sound, hearing, etc. Is PawnSensing specifically designed for pawns?
any thoughts?
The blackboard is the memory that the behavior tree uses. You don't want to save everything to it, just the things that make sense to. What that means is going to be project dependent.
Is the child actor a pawn or a character?
is there some way to bind a blackboard key to a variable elsewhere? so that i don't have to have my target in my threat component AND in the blackboard as well
Not built in. You'd have to do it yourself if that's how you want it to work. To be fair, there isn't a lot that needs to be in the BB and you might be overthinking it.
i made a basic enemy AI for my game, there is supposed to be groups of enemies chasing after the player, but they all walk right into each other 
I'm having no luck with google, and no luck messing around with their collision settings. They walk around static objects perfectly fine, but wont avoid walking into each other like in all the AI tutorials ive seen.
anyone know how to make them avoid walking into each other?
change their AIController class to DetourCrowd
awesome, thanks good sire
It's a pawn, but I turned off all pawns to have views in the project default settings. So if I throw it on the stage, it can't see it, but if I make it a child to my character, it also sees it with the ai stimuli source that exists in my character. this is my problem
I have an AI that moves along the ground using a navmesh, but I also need a flying enemy that hovers above the player. How can I use the navmesh to do this?
How would I go around synchronizing enemy AIs with each other to implement simple tactics in their behavior? I was thinking of having some kind of swarm controller, or a hive-mind if you will, but I'm not sure what'd be a good place to put that logic and wanted to make sure there's not a dedicated solution that I'm missing.
is the flying enemy restricted to the navmesh as well?
I want to make an AI actor that essentially is a fireball that patrols around, and follows the player if spotted. Regular AI is fine, but how do I make the orb fly, and avoid obstacles? I dont want it to go flying too high either, just enough to avoid elevation-changes 🤔
I could obviously just cheat it and make it travel elevated from the ground although that removes the orbs ability to fly straight to the player. Is this where BOIDs come into the picture, even if its just one actor? Never used that before.
Hello everyone, I see that Epic has developed AISubsystems that does inherit from classical subsystem is there any advantage to use them ? It looks like it is harder to set up than classical one and less versatile (We can not easily say I want this subsystem on client for example)
well, it just needs to be flying above the ground and ideally not crash into trees
but yeah it should be within the same area ideally
what do these values do?
guys, I have this idea, dunno how feasible it is. Have you ever come across the AI feature in versus fighting games, such as Street Fighter, where you can create a CPU-controlled match? I was hoping to develop a similar concept for movies, cartoons, and cinematography. Essentially, users would select a character and their moveset, be it karate, muay thai, or the like, and these characters would engage in a realistic battle, akin to the video example I have linked
https://youtu.be/hueZgTiE-qQ
Fist of legend fight scene 3
then we just record the two AI fighting in the level sequencer. That way we only have to animate once rather than every fight scene in a franchise.
sort of like virtual AI stuntmen and martial artist
https://youtu.be/9JqytQtdVhI
#streetfighter #capcom #fgc #fightinggames
Its very common to have AI fight AI in games yes. We used to run 1 million CPU vs CPU games per night to soak test our code (we can have AI automate the testing of weapons for instance). There's lots of examples of that. Happens a lot in racing games too.
so how realistic the fights will look is based upon the mechanics of the game?
and can the AI fight like jet li, jackie chan or bruce lee level of interaction? something that if it's recorded by a camera, it won't look too much like a video game...
this is fascinating though, to let something run without any human intervention...
Well, I mean in games we can use motion capture, so we could capture Jet Li or anyone else
And using machine learning you can generate motions that are similar
There's new models of animation like SinMDM that use diffusion models for animation (bit like an animation version of the image generation models)
running automated tests for anything involving players is going to require some sort of AI
thta's fascinating
Modl.ai are doing a lot of automated testing work
Diffusion based animation models are pretty interesting though yeah
There's new models of animation driven by language too.. so you can say "walk forward two steps" and it animates that
Which, if you think about the new papers involving large language models as generators for behaviour and dialogue, could quite easily be similarly used to generate movements from language as part of it. Or generate dialogue, which can then generate voice synthesis and then that could generate facial and body language content..
Quite an interesting time
Attaching actors normally doesn't do that, so you need to debug why that is happening for you. Are you using a child actor component? Those are barely supported and not recommended, so that might be why.
You would have to build it yourself. It's common to have a squad or group manager to make coordinated behavior.
Last time I looked, they aren't the newish subsystems. They were built long before the subsystems. I would recommend using the non AI subsystems, because they have more functionality. Even the new AI systems (mass and smart objects) don't use the old AI subsystems.
I want to turn my AI character after used AI Move To node on task. SetControlRotation seems not properly working after used AI MoveTo node. Is there some pawn or AI Controller settings that i should to change? I am using Advanced Locomotion System v4's AI Pawn & Controller.
And here are the current pawn settings for desired rotation
There's a load of AI work we could do for games. Just not enough people taking it seriously or skilling up to do it.
yeah definitely is maybe a topic that need more atention
Its kind of weird, because there's a ton of students, you know, masters or PhD students.. writing frankly terrible code in python, which could be so much better engineered by games programmers and making really amazing stuff
Guess its not a thing the games industry is interested in yet though
ye I think maybe they haven't seen a commercial need or product idea that needs it, idk
I bet it's coming soon given the amount of AI stuff we're seeing lately
You'd hope so.. but I don't get the feeling they're serious
I mean Epic have bought a few companies that are doing ML, like Cubic motion.. so maybe that will change eventually.. but I get the feeling that senior leaders at Epic don't get it.. certainly they haven't invested in AI to my knowledge
They will do eventually I suspect
ML based PCG being so generally powerful to scale up content
Maybe they'll wake up a bit as NVIDIA does some new content stuff
Idk at Epic in particular, I meant more the industry as a whole
maybe
Yeah, I've long since realized the games industry is far too conservative in its approaches.. I guess because its so precarious
ye makes sense
I suspect that we'll be using language a lot more as guidance for content generation, at least that's what I've worked on this year
voice control for unreal engine is kinda fun
but we're way beyond that now
Looks a bit like nvidia omniverse?
To be fair, could be any toolset, just has an omniverse vibe
its an in house tool but design looks awful yet from what I can see its made by a skilled programmer so i wonder why i see state machine in a bt 😄
You'd be surprised how many BT's have FSM and how many utility systems are in BT's
transit condition tree 
so I guess that BT is one of the trees run when in a given state
Yeah, that BT seems to have conditions for the state transition
Yeah, that's what that looks like. I don't know what advantage there is to structuring that like a BT (instead of a classic function)
Well, top level state machine isn't that unusual, its basically like a heirarchical state machine, its just that the substates are implemented as a BT
Yeah, the top level state machine isn't surprising to me. I just wouldn't expect transition logic to be formulated like a BT.
Yeah, its a bit weird, but hey.. I'm all for a bit of experimentation
where is the best place to put AiPerception? Character or AIController.
has anyone had this issue when using a state tree?
My editor will crash if I recompile the actor blueprint and forget to recompile the state tree its using. Even though the state tree isnt showing up that it needs a compile. Since its not registering the compile, if i dont manually recompile the state tree its causing the crash.
Seems to be coming from a binding to a bool variable on the actor the tree is on during a event tick transition condition
Ive been able to narrow it down with the information from this forum post, but the always having to remember to manually recompile the state tree after ANY actor blueprint change is driving me crazy
i want to assume its a bug but im also not 100% sure its not me doing something I shouldnt be with the binding
it almost seems like the state tree is trying to access an old address from the blueprint that gets moved after the compile or something?
The error:
appError called: Assertion failed: FieldSize != 0 [File:D:\build++UE5\Sync\Engine\Source\Runtime\CoreUObject\Public\UObject\UnrealType.h] [Line: 2518]
Epic Developer Community Forums
Hello, To manage my Ui i added a state tree component in my HUD subclass. i have some bool in my HUD class, and i compare bool in my "enter Conditions’ for each states in the state tree. A crash occurs when i recompile my HUD and hit play. I’ve eliminated all the possibilities, and i isolate the issue : The Bool compare in enter conditions ...
i think you usually put it in the character, here is an unreal post that is doing the same
https://dev.epicgames.com/community/learning/courses/67R/introduction-to-ai-with-blueprints/586p/ai-perception-theory
yeah I feel like we've barely used AI tech that has been there for some time
I prefer to put it on the controller since, in my case, it interacts with a lot more of the "brain" side of things, rather than the actor itself.
This is tangentially an AI question, but: I have a data asset which contains an array of EQS queries that an AI can use. Each of these EQS queries can have zero or more data bindings that represent tunable values on that specific query (e.g., search radius, health amount, maximum path length). I would like to be able to tune these data bindings from the data asset itself.
For example, I have DA_One and DA_Two which both contain the query EQS_NearbyActors. However, DA_One needs to set its radius to 800 where DA_Two needs to set the radius to 1200.
I thought I could just use EditInline and it might expose the data bindings, similar to how it exposes public variables on a blueprint, but that's not the case. Does anyone have any suggestions on how to expose the data bindings of an EQS query when it is selected inside a data asset?
One of the larger problems I see with that is there is such a huge knowledge gap between academic AI and game dev. I see a lot of research come out and it's interesting, but doesn't typically work with how we actually make games. I've seen a few studios that are doing more research focus on those topics, but they are often kept separate from the dev teams.
Controller. It's better to separate the character from the AI.
I would dig through source to figure out how the BT does it. The BT is just a fancy data asset. It might also be in the struct the BT task and service uses.
@uneven cloud Are you by any chance AI luthage from the unreal subreddit?
Yes I am.
I found your answer to a post about focus when moving AI using AI MoveTo
Is there a way to disable the rotation to the next path point when using it?
I know I can use SetFocus but I dont like the idea of enemies tracking the player with pixel perfect accuracy
I'm also trying to use SetFocalPoint but I can't find a way to interpolate it correctly to slowly look at the player
Unfortunately without changing source you can either use the control rotation or not. If it's on, it'll set focus for the path point. If it's off, then set focus/set focal point will no longer work.
You can use set focus with a higher priority than movement to override the one during pathfinding, but I think that's only available in C++. It's how we usually do strafing.
You can slow down the rotation rate by using the character movement component. You have to uncheck use control rotation in the character and turn it on in the CMC.
I see, what does Allow Strafe exactly do? It seems to set the focus to the next path point at the start of moving but then it lets me change it
But that makes the AI Controller always rotate to the path point for 1 frame when it starts moving
I don't remember what it does exactly. I've just used the other way, because it gives better results. Probably because it doesn't rotate to the path point at all.
It's all my fault, yes ai doesn't see child actors. I just pretended to see it because I filled a variable with this actor for something else elsewhere, thanks ^^
Great suggestion, thank you!
Part of the problem I think, is that there's a lack of awareness in management and that translates to a lack of investment in training of staff. I mean games is a precarious industry, so I get why that might be the case, but if they were better at management in general, they'd be planning for adoption of new technology a lot better.
None of them are thinking of investing in something before its proven, but by then its already been adopted by everyone so has no competative advantage
Part of that is the promotion to leadership based on IC skills and not leadership skills. Then they get no leadership training.
Another part is there is no time to train staff. I'm mentoring 2 AI engineers right now and I have to hire another 2, because the volume of requests keeps exploding.
There are studios with R&D teams, but they are completely separate from dev teams, so what comes out isn't exactly useful.
I have to hire another 2
😍
Just to confirm, EQS testing pawn only renders debug info in the editor window, not the play window? And doing things like moving the pawn through gameplay doesn't affect this.
After looking further, it appears the pawn is for editor use only. Somehow missed that.
Yeah it's for editor use. You can use it in PIE, you just need to detach from the player pawn to see its output iirc
Hi All.
I would like to make a platoon of units moving in a formation (such as in Total War, or Cossack, for instance). How would you dot it?
I tried the following:
- The Leader has a BT: move and set its position in BB, and a Walk speed divided by 2
- Followers have a "follow" BT with a high refresh rate (
SetNextTickTime(NodeMemory, 0.05)) and a call toAAIController::MoveToLocation
AActor* QueryOwner = OwnerComp.GetOwner();
AAIController* ControllerOwner = Cast<AAIController>(QueryOwner);
if (ControllerOwner)
{
ControllerOwner->MoveToLocation(Memory->NavLocation.Location);
}
SetNextTickTime(NodeMemory, 0.05);
But this is not very nice to see. Do you have other ideas?
Purple is the computed positions for the fromation (followers )
I'd recommend turning on use acceleration for paths and reducing the acceleration value in the character movement component. This will smooth out the movement.
You can Google flocking/formations/coordinated movement to get examples of how it's usually done.
Ping me if you are interested.
Thanks I will look at it
Yes, I am interested. We can take it to DMs if you'd prefer.
I've been strugling the whole day to set up the navigation mesh inside a streamed level, FNavigationSystem::GetCurrent<UNavigationSystemV1>(GetWorld()) returns NULL
Could it be because the recast navigation is inside the streamed level and not persistent? how exactly should I set this up?
further into in it seems MainNavData is nullptr
problem solved 🙂 Setting Runtime generation to Dynamic in Recast is not enough, I had to set it in project settings as well
I don't remember any time I got any mentorship or any of that at all when I was in games. I tried to do my best to discuss architecture decisions with my junior guys, but there was never any official time or support for that, it was more just informal discussion. Quite a problematic issue.
Yeah I've never had mentoring per se
I mean you can always learn from anything and anyone but focused mentoring is nicer
I was not mentored either. It's throwing new people off the edge and seeing if they sink or swim. Some teams still have that toxic view point of "I swam, so it's not bad." Others are starting to figure out that our inability to hire seniors is because this industry refuses to train anyone.
I guess when it comes to AI, mentorship is even 2x more important because most of the cool tricks are taught in tacit ways compared to other areas
is there some kind of callback i can hook into on a pawn when it gets possessed?
yes, its OnPossessed()
from a component on that pawn i mean, not overriding a pawn function
like an event dispatcher or something
i dont remember any
okay, i didn't see anything but figured i'd ask
there are other ways though
gamemode should have some functions
but same thing, no event dispatcher
you'd have to hook yourself
There is the ReceiveControllerChangedDelegate
You can also hook into the GI for this delegate
OnPawnControllerChangedDelegates is the GI version
thanks i will look into these!
Posssession changes the cached controller.
I am thinking of a way of creating a monster for space invaders type game that could use a laser that will chase player. But i donot want him/her to die an inevitable death
They just released a properly open source large language model: https://open-assistant.io/
Conversational AI for everyone. An open source project to create a chat enabled GPT LLM run by LAION and contributors around the world.
Which is kind of fun.. there's also one by Databricks, but its not as good.. looking forward to a merge of the two
And using them both in a langchain agent connected to UE
Dumb question: do decorators just tick and check their condition every frame? Trying to understand how to make an event-based decorator that will abort when a certain event fires off without checking that condition every frame. I have dispatchers set up elsewhere for the event I want to keep track of, is there some kind of “BeginPlay” equivalent in a decorator where I can bind to that dispatcher and some way to manually call abort when that binding goes off?
My use case is that I want to cancel moving and other low prio tasks when an ability comes off cooldown (which I can get an event dispatcher for)
are you using move to tasks to move your AI?
and iirc you just setup an abort decorator on a blackboard key
also need to handle the aborted events in your tasks
Was trying to avoid the blackboard key decorator because then I have to add a blackboard key for every ability class I want to track the cooldown for. Was hoping to just be able to select the ability class as an instance editable variable on the decorator itself
Also not sure what the best place is to put the logic for a blackboard key changing when an ability comes off cooldown.
i have an actor that generates 1 eqs item and i want to before AI move to its next location, to check if that location is avalible. is there a built in way of doing this?
okay so i just saw that subtrees must use the same blackboard as their parent trees, so I'm not really sure how to go about creating a generic tree that all NPCs use to alternate between patrolling, combat, and resetting, while still having unique combat trees with different ability priorities and requirements and cooldown tracking inside of the "combat" branch of that generic tree. I feel like that's something that should be possible, it would be pretty crazy for there not to be a way to have compartmentalized logic like that without having a massive blackboard with hundreds of keys right?
specifically looking for something like a boss fight in WoW, where all bosses have the same "if not in combat, walk around the room, after combat ends, become immune and teleport back to spawn point and start patrolling again" logic while also having 20-30 abilities and multiple phases they go through during combat. Is this not something behavior trees are suited for?
Decorators don't check the condition every frame. Only when the tree evaluates. You can make a decorator that listens for things, but I believe that's only available for C++.
Yes. You make a generator that gets that location. If you have more than one generator, the one to the right will run if the left one fails.
You do it by not trying to script it in the BT. The BT should not be setting ability priority, requirements or tracking cooldowns. You need ability selection and ability execution. That's 2 nodes instead of a massive tree that handles 20-30 abilities.
how to go about creating a generic tree that all NPCs use to alternate between patrolling, combat, and resetting, while still having unique combat trees with different ability priorities and requirements and cooldown tracking inside of the "combat" branch of that generic tree
you might want to look at Run behavior dynamic nodes. Those allow you to map gameplay tags to behavior tree assets at any moment (for example at AAIController::BeginPlay). Then you could have your main tree to have a selector between 3 Run behavior dynamic nodes with tags "AI.State.Rest", "AI.State.Combat", "AI.State.Patrol" and on some data layer set different combat BTs for different NPCs but the same patrol/resting BTs
That was my plan originally but you can’t run behavior trees with different blackboards that way, so you’d end up with one super-blackboard with keys related to everything
I’m looking at either just not using BT at all for the combat part of things (just having a node that says “do combat” or something and then put all the combat logic in a component somewhere) or just manually swapping out behavior trees at runtime entirely
one super-blackboard with keys related to everything
idk man, in my experience one is doing something wrong if he has a lot of specific BB keys. I feel like vectors/actors BB keys for EQS output, actors for target and some float BB keys as parameters should be sufficient for a lot of cases. BTs (IMO) should only organize sequences of actions and not contain action implementation details like attack power, iterating over targets, setting color of fireball, etc.
That is, of course, if you are not doing ultra-complex AI.
I was looking at something like having health thresholds for healing abilities, having enemy phase changes at certain times (boss battles), and just generally prioritizing using different abilities based on any number of conditions like target/own health, buffs/debuffs active, time in combat, etc. Another poster basically just said to do all of this elsewhere and simplify the BT to just be “move to place or use ability”
well, if such logic applies to all or most of bosses, then this part
I was looking at something like having health thresholds for healing abilities, ... using different abilities based on any number of conditions like target/own health, buffs/debuffs active, time in combat,
looks like doable in BTs. I think you could pass these health, time, etc thresholds to BB floats and have a BT service to evaluate current values and then a selector could switch between various combat subtrees (with some minor magic you can run subtrees inside of subtrees)
I'm trying to figure out how to use RVO avoidance while also maintaining velocity/movement speed? Right now when a unit if within a certain range of another it will start to change direction to avoid it, but it will also slow down
Yeah, definitely agree, do this outside of the BT. BT is for top level logic, this feels like more usefully implemented as a utility system
Have the utility system decide on the spell etc.. then store the result in the BB for the BT to transition if needed
Its always a bit of a balancing act, but I like to keep my BT to the overall decision making at the top level and have subsystems handle the action execution and scoring elsewhere
Hi, Little question. Decision from the Behavior Tree of the IA is influenced by the game FPS? that's the feeling that i have. is it normal? if the FPS drop, decisions done are slower, and calculation of those decision will be bad
When the FPS is low, the tick rate is slower. So everything in your game is slower. You want to optimize your game to ideally hit 60 FPS or 30 FPS on your min spec. You also want to optimize any hitches, where the FPS suddenly drops for a period of time.
I'm trying to give my AI the ability to find a preferred distance with EQS, but it can only create weights depending on distance in a pretty linear way. I would love to give the EQS a curve that it can use to create weights, is that possible? Now I have to stack multiple distance tests and that's a very impractical way of using it.
There are curves already. If you know C++, you could probably make more.
hey, I'm learning all those Behavior Tree things. A concept that i don't clearly understand. If you make a Task. It will trigger a function on the Task. If you don't end the task with "Finish Execture" or "Finish Aboard", it's not supposed to execute the task until it reach on of those 2 nodes?
I was expecting to have something like that
if the task is not finished, it will perform it again
If you never call Finish Execute, the task will never finish
However aborts are a bit different, I recall it may still abort and exit the task even if you don't
so by finishing you mean i will be stuck on the non existing node after AI - Move to Location?
In a way yes although there's no such thing as "non existing node" in that sense
it simply has finished executing the graph at that point and there's nothing left to execute
so to make a simple movement we need to exectute the task multiple time and finish it each time
because when i see something like that
Il wondering if I use them properly
Or maybe it’s normal?
If that's happening then the task is exiting (or failing)
If you don't call Finish Execute, it will just sit there
(assuming it doesn't fail and abort)
Should we use some loop inside those task?
ok, it's a kind of loop 🙂
i put an infinity loop there... and it's crashing the game 😄
Yeah if you want it to repeat some task or such, you would need to make it latent
Eg. if you use AI Move To which has the exec pins for when it completes, you could loop that by connecting the pins back to it
it was a custom Task to avoid to use the AI Move To
How do I compare two values in a BT decorator?
I have a BT that when a unit is in range of an enemy, it shoots, else it moves towards.
I have a service that gets the distance to the target as well as the range of the unit. I have a decorator that sees if a BB key is less than a fixed value, but I don't see one that lets me compare two BB keys.
Or is this entirely the wrong approach?
there's a UBTDecorator_CompareBBEntries but if I was you I'd have the service to compare distance to attack range and then set a BB boolean bAttack to true/false unless you need distance to enemy for any other decorators in the BT
with vislog or ai debugger with enabled navmesh option
the path is there for the ai to walk. it should be able to. it is just stuck suspended in mid air
it still shoots and spins to focus on the player. when its on the moveto node in the behavior tree it doesnt move
then you should open vislog and see what error message is displayed for failing AI_MoveTo
maybe MoveTo location is out of navmesh
Say I want the user to click on a tree or rock, and then send the closest worker to go mine it
A navmesh would be the best way to do that right?
Like I want the workers to have queues of tasks
Hey, The 'AI Move to" change the "Arrow Component" direction to the destination target. Is it possible to keep the arrow component into the same direction ? Like we have with 2D game and with (Add Movement Input) ?
General spawning problem: what's wiser, not requesting spawns until we have a navmesh, or requesting them and having the spawning system retry until we have a navmesh?
It seems mostly a question of abstractions in a sense
Does the code that requests spawns know about the navmesh, or should it know about the navmesh? Or is it purely a concern for the spawning system?
There are a bunch of delegates on the navigation system v1 which can be used to listen for when the mesh gets generated etc.
The code that requests spawns is the usual "I want these dudes in these places" and the picking of locations might happen offline or online depending on designer setup. Navmesh generation time isn't obvious because it's dynamic nav. I might get away with it for now by just adding a "wait for nav build" tickbox on the requesting code
I don't think the requesting code should concern itself with the navmesh, rather the NPC type it requests should know if it requires a navmesh
Hello 👋, if anyone has a brief moment I would like to get some ideas on how to resolve the following issue I am facing:
• My enemy AI (one blueprint only) is programmed to have their health bars reduced on damage received.
• The function "get all actors of class" together with "For each loop with break" is being used to ensure each instance of the enemy placed in a level has their own health bar reduced on damage received.
• This is partially working as the engine somehow automatically selects a -random order- in which my AI enemies within each level have their health reduced on damage received.
• If an enemy is attacked that is not in the random order the engine selects to show health bar damage reduction, the health bar widget is not shown to reduce on damage received 🧐
What would happen to be the issue I am facing at the moment?
Any and all advice, suggestions, tutorials, and support would be TREMENDOUSLY appreciated 🙏
I have been struggling with this issue for over 3 months now 😓
I think you want to have some component that updates the UI on each actor, rather than finding all instances globally. Also I don't think there is a random order there, no point in it
There's an issue there you're not seeing but you've approached it in a problematic way so there's no point fixing it as-is
The thing causing the damage should know what it is damaging, so calling an interface/function on the damaged object telling it how it came to be damaged, means you won't have to loop over every object.. basically looping over every object of a type is a bad practice
At the very least, get them to add themselves to a collection and only iterate the collection
I'm an indie dev just getting started with AI. Wanted to ask if there are any decent off-the-shelf assets on the marketplace or other places online that I could play with to start to understand how to program AI. Looking to make a shooter, if that helps.
Or would something like the Lyr starter project have good examples?
You shouldn’t have to do a for loop. Each instance of the bp will have its own copy of the variable
You just need to tell it what to do when it takes damage
Do AI pawns have a control rotation for x, y and z?
I use the mouse Delta for human players but I don't think that will work for AI
Yes. For AI the control rotation is used by the AI Focus functionality in the AI controller.
Thank you very much for the suggestion. What type of component would you recommend that can update the damage taken and health bar reduction animation on each instance of the actor?
Thank you for the advice 👍 Would an example of this be:
•To add a health bar reduction function to the enemy AI blueprint itself as opposed to the health bar widget blueprint?
Here is screenshot of the blueprint programming that I am struggling with. Any and all suggestions and support would be deeply appreciated 🙏
Here’s how I do it. There’s an apply damage node and an ontakeanydamage event. Use the first one to tell the engine who is taking the damage and what the amount of damage should be, and the second one to make the target actor receive the hit, deducting the incoming damage from your health variable
If both actors are in the same parent class you can have both of those in the same parent bp
Then link your health bar widget to your actor bp to tie the health value to the progress bar.
Assuming you’re using a progress bar for health bar
It can be a bit confusing but to put it simply, whenever you place or spawn an actor from a bp, you are generating a copy of it with its own separate variables. So you can do things by just having different targets (i.e. self or other actor)
Thank you for your kindness and support. 🙏 Yes, I am using a basic progress bar for health bar display.
Yes, all placed enemy AI antagonist actors are all from the same bp.
No, the damage causing actor and the damage receiving antagonist actor aren't in/from the same parent class.
The ontakeanydamage event is being used within the antagonist enemy AI bp. The apply damage node is being used on the damage causing actor bp.
Currently, the health bar (progress bar) widget is not visually showing a reduction in health on damage dealt to an enemy AI unless it is the first one, followed by the next randomly selected one pulled from an array that the engine randomly decides once level begins play.
If there are any visual tutorials or event graph examples of possible solutions, those would also be very helpful at this time.
Thank you truly, everyone, for considering my request. 🙏
🙏 This event graph displays a function within the progress bar widget. The progress bar itself is binded to this function for the health reduction to show in the widget.
There's a bunch of tutorials on health bars on youtube, maybe that'd be of help? https://www.youtube.com/results?search_query=unreal+health+bars
Again, you shouldn’t need to to use get all actors and for loop, just do it as if you’re only doing it for one actor. You can put this in a component and then add that health bar component to your desired actor bp, so every copy of the bp gets the bar.
can you help me why my bot is not playing animation montage. I'm calling a function from the tree on the actual character that should play animations, he doesn't. I have already checked the animations set in the character itself. I do it in c ++, it enters the function, but it is this line that can be said to do nothing.
can i get player input into a bt task?
I mean you can - but why would you want it? You pretty much have to send it through multiple systems.
It's a roundabout way of doing it at least
want an ai to follow mouse clicks
Click -> Set target destination on Blackboard -> AI reads value from Blackboard
Upon arrival - clear the target destination
in the player controller?
I'd do it in the behavior tree task
Move To and then after that Clear Value
Two different tasks
You will need to get a reference to the blackboard
yeah the click is where I'm stuck though, how do I get the bt task to read the click if i can't have input in it
Get a reference to the blackboard. Then set the value like I said.
and the reference to the bb is in player controller?
If you save it, then yeah.
alr ty
what's the difference between OnBecomeRelevant and OnSearchStart in a service node?
OnBecomeRelevant happens when a branch has started. Such as the first task has been decided. OnSearchStart happens when the tree is looking for a task to execute, I believe.
so OnBecomeRelevant is called after the first task has finished or started?
and OnSearchStart is called when the tree is looking for a task to execute on that specific branch where the service is on?
it means that in most cases OnSearchStart will be called first, right?
I believe it's right before a task has started. Let's say you have a move to task. You want to add a service to set the move mode to sprint. You use OnBecomeRelevant to set sprint and then OnCeaseRelevant to end sprint.
I believe so. I've never needed it, so I've never actually tried it.
yeah same, I was just wondering if I'm missing something
Services and decorators are both auxiliary nodes. I think the search start is more relevant to decorators as they change the search flow.
I believe search start is relevant to services only, in decorators it's a bit different
I dug through source code and it appears that OnSearchStart is to allow the service to do work that might effect the execution flow for things such as blackboard decorators. There is a bool in a service to tick the service during on search start, so you don't need to override the function if the functionality is the same.
Example:. You have a blackboard for HasLineOfSight. You have a service to checks for line of sight to a given target and sets a blackboard. With tick on search start, it will run the service BEFORE checking the blackboard decorator.
oh okay got it, but why would I need to run the service before checking the decorator?
Thank you 👍 One of the YT tutorials I followed is how I learned and became pre-occupied with my current blueprint focus.
why does the main task only run once? I want it to go to the ball while the ball is being constantly updated. Instead the main task does once and the background one just keeps doing what it does. I need the "Found Ball" to be constantly running to be updated and the "GoToBall" to be executing also. They need to be simultaneously running. Is this the right thing for that?
You should probably use a service instead. That way you can make sure it finds the ball constantly
But if all you want is for the location you are moving towards to be updated, then I believe you don't even need to update the ball's location? You can find the ball once and pass an actor reference of the ball to the "GoToBall" task. Then you can tell it to automatically update the goal. That's assuming the ball reference remains valid and you don't want it to be able to lose the ball
hello,
i've trying to add an implementation of AISens_Sight, same, it's for the moment just an children of AISens_Sight, but when i choose it, then the sens is not working at all, what i'm missing ?
I've added ALS to my AI but it's not walking. I mean it's moving but not walking.
Animation Blueprint of manny Is working fine on skm manny but ALS Anim is not working on ALS Mesh
Hey anyone found a way to have a Navmesh Volume Bounds generate navmesh like it normally, but also create some in the hole at the bottom (collision-less, default, filling?)
Can you show some code or BP?
Thanks a lot, but someone answered on the board ( https://forums.unrealengine.com/t/ai-sens-implementation-how-to-override-one/1107325/2 )
Epic Developer Community Forums
Hi, I think you will also need to create your own NoiseEvent, where you tell the engine to send that event to your UAISens_AdvancedHearing. So you could also create a new NoiseEvent inheriting from the regular one like this: USTRUCT(BlueprintType) struct AISENSETEST_API FMyAINoiseEvent : public FAINoiseEvent { GENERATED_USTRUCT_BODY() typ...
@ocean wren and anyone else... I don't know much about training image data on stable diffusion to generate your own style of images. I know you need a bunch of the type of image you want to train the model on. Now, the question is can you train a model on timelapse video of yourself drawing? I suppose the video with have a more detailed approach as to how the final result will come out...
I'm thinking about how to implement our StateTree tasks and conditions, I wanted to ask how is the C++ API compared to blueprints - I could create some test tasks easily in blueprints, but the C++ base classes seem a bit more complicated. Will I run into issues and should I just stick to the blueprints, and provide C++ functions that I can hook into tasks, instead of defining the tasks themselves in C++?
I actually found it to be easier than BT tasks (in C++ that is)
Mmm I see quite a few derived classes from FStateTreeBase so I guess it is not a bad idea
I could expose some c++ functionality to the blueprint tasks
but that implies coding the main logic elsewhere which I don't fancy
I'd rather have the logic contained in the tasks
that is nice to hear
I also saw people say in some videos that the blueprint stuff was a bit buggy, so I was curious to know if that extended to C++
I think the module itself is buggy. I dropped it because the bindings would randomly stop working or I just couldn't bind anymore.
oh damn
So I'd have to recreate the state tree to get it working again
well I'll experiment for now, since we are not in a hurry
maybe 5.2 brings more stability
Noticed I wasn't making progress with my AI, so I dropped the new & shiny in favor of the tried & true, lol
I mean, it's cool when it works. And I do like it.
But, much like other areas of 5.0 - just needs some more time in the oven imo
Thank you for your continued advice. As you advised previously, and as seen in the example above I created an actor component bp and programmed the health reduction function inside the new component.
I added the health bar widget itself as a variable within the component.
I added the component to my antagonist bp, and also called the component's function within the antagonist bp as well. Both additions applied both independently and simultaneously now cause the health bars to show without the red color on all instances of the antagonist bp.
Would you happen to know as to what I could now be facing at the moment?
Thank you truly for your continued support 🙏
Any and all recommendations from anyone would be tremendously appreciated at this time. 😓
Well you’re still getting all actors. You only need to affect the variable inside that blueprint, not try to affect every instance of it manually, because that’s what is likely causing the duplication
Where is this get antag function located, what bp?
Can anyone help me with the ALS?
Yes, the get antag health bar percent is a function created within the new component bp, as recommended.
Adding the component itself to the antagonist bp either as a function call or as standalone component within components list removes the red bar color visual data from the health widget. 🙏
Is there anyway to force the move to location or actor function to succeed? I am having an issue where the speed of the behaviour tree runtime seems to result in the AI pausing in between movement commands and I would like to make it more fluid by having the movement run in parallel to the other processes. But I also need to be able to force it to succeed based on a dynamically shifting distance in order to make the character stop.
Hello, is there a way to make an AI Controller possess my character as soon as it gets unpossessed with the playercontroller?
You are getting actor of class. Which is the first one in the actor array. Where is this functionality? This is not how things should be done in a character or a component.
Yes. You need to add that functionality. Usually when you are unpossessing.
Yes there is a force success node. However you might want to rethink that direction and try a service instead.
cheers, I'll keep that in mind. I found the existence of the stop movement function in the controller that seems to have resolved my issue
do u have an example for me how i could do that?
You unpossess the character, create an AI controller, possess the character with the new controller.
Understood 👍 Your guidance and advice would be much appreciated in this regard. What should I do exactly to resolve the issue I am facing? 🤔
yea but thats the problem, i dont know how to create an AI controller
SpawnActor?
Does anyone know how to go about creating UNavLinkCustomComponent at runtime? I tried with all the usual RegisterComponent and with world, but it doesn't seem to affect the mesh, nor does it draws debug arrows, and the ai doesn't see them
How you get the character depends on where this function is.
Is your nav mesh dynamic generation?
Does the MoveToLocationOrActor (with pathfinding) have a max range? Trying to move an Ai a long distance (>5000) and it triggers the failed execution pin
I'd recommend using Automatic1111 if you're going to train a custom model, there's actually a few ways of doing that. As for filming a timelapse, generally you want to train the model on a diverse dataset of whatever it is you want to have from the model. So if its images of a specific person, you want them in different angles, lighting conditions, poses, clothing etc.
So timelapse of someone drawing isn't a great idea, it'll basically learn the drawing pose and fixate on that
I don’t believe so. Have you tried debugging and checking if it gets the correct transform coords? It could be anything from a nav mesh issue to meshes interfering with pathing and whatnot
Hey! Have a question here. Is there a way to randomize eqs querry, so that same enemy bp will run different diractions?
I have an AI detecting another AI. Why does this return false?
^ whats the c_3 about
Thank you! It was static!
hello. I have a problem with AI movement. sometimes (pretty rare, but it is) during "move to" node, AI is starting to slide almost in place with running animation - max walk speed is set to 650. I checked in BT and it is still in "move to" node. I checked in Visual Logger and nothing happens there. I have no idea what can be wrong
There's a max search nodes limit, which limits the distance based on complexity. You should debug with the visual logger to see what is failing.
Yes. In the run EQS node there is a variable for run mode. It defaults to single best, but there are random options you can use.
thanks!
Sounds like an animation problem.
without root motion can animation change AI movement?
You said it isn't showing up in the visual logger, so it doesn't sound like a movement problem.
but as you can see on the video, AI in the half way is going left with minimal speed instead going straight
it is not always the same direction. sometimes they are in "move to" node and running almost in place
and this is rare behavior
Is there anything they could be colliding with? Are there any AIs around and getting pushed with RVO?
no, I don't think so. I did tests without RVO and there was the same problem
I would try to repro it with show collision turned on. There's nothing in the path following that would cause that. All the path following does is tell the movement component to move towards the next path point.
yep. that is the case ;D when dead they have pickable with wrong collider. thank you for clue 🙂
In AIPerceptionComponent I am calling UAIPerceptionSystem::GetSenseClassForStimulus which returns a TSubclassOf<UAISense>. How do I check if this was a sight or hearing or damage sense? Should I be casting to, for example, UAISenseConfig_Sight? EDIT: The last line is incorrect even as I read it. They are two different types. I'm stuck on needing a sense ID to get a sense config, but not knowing which sense config a stimulus comes from.
Ugh, I was calling StaticClass on the wrong class. Now calling it on UAISense_Damage, etc.
Hmm, what you could do, is record you doing the timelapse, then extract frames via ffmpeg and use those as a canny edge value in controlnet via automatic1111 and generate using the same prompt, I thought you meant a video if someone actually doing the drawing, not the drawing itself.
Is there a way to cancel the MoveToLocationOrActor async task?
Promote async task to a variable and call EndTask from it once you need it
- Spawn character,
SpawnDefaultController() - Controller runs all its
GetTeamAttitudeTowards()with the default ID - Call
SetGenericTeamId()but it's too LATE!
Inside SetGenericTeamId()
// @todo notify perception system that a controller changed team ID
What do you all do about this?
You call the function yourself. I believe it's in the perception system and not the component.
Trying to decipher this further increased my headache... I'm afraid I'm just an outside looking in but I plan to get into the scene and train my own model once I make out time in my calendar. And unfortunately i can only make out time if I gather enough nuts for the winter, otherwise I'll keep working come winter...
Training your own model is.. a bit hard. Try fine-tuning a model first.
Hi all, i have a question regarding Crowd System.
I've made a controller which uses CrowdFollowingComponent instead of default one. But it doesn't seem to help that much for Pawns using this controller to avoid each other. Do i need to implement an ICrowdAgentInterface in the pawn class or anything else to make the characters avoid each other?
@ocean wren
❤️ Check out Lambda here and sign up for their GPU Cloud: https://lambdalabs.com/papers
📝 The paper "Generative Agents: Interactive Simulacra of Human Behavior" is available here:
https://arxiv.org/abs/2304.03442
https://reverie.herokuapp.com/arXiv_Demo/
My latest paper on simulations that look almost like reality is available for free here:
h...
Hey peeps, I wonder if anyone could recommend any good game AI related resources (not specifically tutorials) could be breakdowns, discussions? Thanks in advance 🙏
@iron urchin check pinned messages
Is it possible to migrate the AI behavior from Lyra?
how do you correctly "kill" an ai?
Yeah, that was an interesting paper. The idea of chaining LLM calls is actually all over the place right now. Things like AutoGPT and MiniGPT and all sorts of similar things. There's even half a dozen or so LLM frameworks like Langchain now (Chameleon for instance). Basically, everyone is on board the language model train 🙂
Shoot them in the head? Oh wait! shoot them in the CPU?
YouTube - search for AI GDC
For EQS queries that are scored. Isn't a higher score the better score?
I'm trying to find places to spawn some units and scoring based on distance, trying to get closer to the point as a better score.
I would expect a scoring factor of -1 to work here. But that's picking the farthest point.
It's actually fairly inconsistent with what I would expect to happen. I'm generating a donut with multiple rings and it doesn't seem to matter what I put for the scoring metric, it's always choosing somewhere on the outer ring.
Testing pawn looks happy.
It appears that the data you get back from GetAllAsLocations() is not sorted as I thought it was.
I must have read that Result.Items was sorted and mixed them up. Thank you for your time.
No, i mean how do I kill the ai in the engine? How do I detach the character and the controller safely
Nope, still don't understand what's happening. If I use the scores from Result.Items, that's still not giving me the closest locations.
What am I misunderstanding?
How do you provide value to EQS_ContextCursorLocation when testing with EQS testing pawn?
If I'm using point A, and generating 2 rings of donuts between radius 0 and 100, I get 4 points in a line:
C---AB---D
A and B are at the origin of the query and I would expect both of these to have a score of 1.
Depending on whether I use 1.0 or -1.0 for the scoring factor, it gives me C or D as 1.
It's getting a FVector stored on the player controller that I get from the cursor hit location.
If I only generate 1 point from the EQS, it properly chooses that location, so I haven't dug into that being incorrect. That said, I am actively wrapping it so I can breakpoint that and see.
I switched the Distance2D check to use EQS_ContextCursorLocation as that seed like it was it. But now it fails entirely. :(
hmm, maybe my sphere overlap is being weird
Okay. Once I switched it over to use my location as the testing point... not sure how I missed that. It seems to work as expected.
I just need to figure out my collisions so it's actually finding good points, and then prevent it from generating points that would conflict with each other...
Thank you for the help.
Oh man, so many language model API control frameworks released this last two weeks 🙂 its hard to keep up sometimes
Anyone tried using the Remote Control Web API? I need to control UE externally for some AI stuff, this looks about right, but its mainly setup for virtual production
Hmm, this remote control toolset is pretty nice!
Doesn't expose niagara particle system user parameters though.. so no sheep flocking using this.. sad 😦
You are preferring greater distance to querier. You need to switch it to inverse linear.
Watch the livestream of Epic Games’ tech talk from GDC 2023, ‘The Verse Programming Language’.
An exciting future of interconnected next-gen experiences and virtual worlds could be within reach, but it will require a robust universal programming language to come to fruition—one that is scalable, open, and transparent.
This talk will introduce...
I thought that's what it was, but it didn't matter if I switched it to inverse, it never picked the closest. Turns out I was using the wrong location for my rule.
are there any cheaper alternatives to ue4s character movement? from what I understand the general move to for example is really expensive when you have a decent amount of AI on screen
I have disabled movement of an Ai controller using the DisableMovement() and now need to enable the movement. EnableMovement() dosn't seem to exist. Anyone know how I could Re-enable it the Ai controllers movement component?
Hey everyone! I have a car with chaos vehicle component driven by ai controller. Once I switch controllers and posses the car by another (player's one) the car stops immediately and it take some time to get previous speed. I want to have smooth transition between switching control from ai to player and from player to ai, but without success so far. Anybody knows how to achieve that?
Can we make Blackboard keys in c++?
Yes
how 😅
I forget 🙂
But aren't you glad to know it IS possible?
I bet you feel relieved
Sorry, in a funny mood today.. got interview panels all day
yeah, until today i didn't know about this 😅 ,
i was getting bored so my senior told me to make blackboard in c++ 🤣
what exactly do you mean to make bb keys in c++? like bb types or to manually add a new bb field to an existing blackboard component?
new bb key type
AFAIR it's doable but a bit tricky to register the new type, it might be something not overridable, I can't remember for sure
but if you use a custom engine then it shouldn't be a problem
Would trying to fine tune a GPT to generate a domain specific language based on your backend (like LLVM intermediate syntax) be a good start or should I prefer something easier? assuming I have enough C++ knowledge to dive into depths of API
i think people normally don't create custom bb keys
The SmartObject Plugin introduces the SmartObject BB key. So it should be possible from outside the engine I believe.
To create a new BB key type, you just need to make a new class with a parent of the blackboard key type. I would look at one of the existing ones to see all the functions you need to support.
I'm a bit confused by the EQS Overlap test. I'm generating points on nav mesh around a point and I want to make sure none of those points overlap with pawns. But nothing I seem to do causes points to fail. I haven't been able to find much in the way of EQS documentation, other than a million tutorials on how to make AI hide from the player. :/
ok thanks, i will too look for the existing keys
Hey, does anyone have experience with shipping a multiplayer title that uses GAS with their AI? We're doing this with our current title, but have received some feedback from partners that other teams have run into network and CPU performance problems when using GAS with AI. Would love some insight.
Fine tuning is a great way to go. There's a bunch of reasonable open source models now, like OpenAssistant that would be worth fine-tuning. Apparently DataBricks fine tuned their dolly LLM for $300. I reckon fine tuning for specific use-cases is going to be a large part of the future of these things. Alongside making chains of them.
When I use AiMoveTo with a regular AiController, it works fine, but as soon as I switch to a DetourCrowdAiController, movement breaks completely, and the result keeps returning "Aborted". Does anyone know what is going on?
This is a dumb question most likely for many, but if some one could guide me on resources / courses by which I can learn Unreal Engine AI in depth !
Have gone through almost every YouTube videos including one those of UE too, but seems there is nothing much to gain !
I have. NPCs should only run the ability on the server and CPU issues depend more on how much BP you use.
try looking at project settings → crowd manager parameters. maybe you have more than 50 (default max supported agents) NPCs on map or some other parameters are not fitting your current state of the game
Hey folks, I have a weird issue where my enemy has a PawnSensing node, but OnSeePawn triggers when the player pawn is way outside of the cone. Only Detect Player Pawn is enabled, and when this detection happens at this distance, it only sometimes triggers the event, not consistently. Any ideas why the range here is wrong (I'm not setting the Sight Bounds in code or anything)?
Any idea why my behavior tree would be skipping directory over the Wait node in this example?
When the BT runs, the wait node flashes and then the next node in the sequence immediately executes. I changed wait duration to 30s and it hung on the wait node for about 3 seconds before moving.
But if I do it like this it apparently works fine? BT can't start with a wait node?
Hahaha.. huggingface just released huggingchat, which is a 30b parameter version of OpenAssistant.. give it a go 🙂
Balls, not the open source model though.. stand down
I literally have one
ai only working for my one character and not the other actor that I placed in level
sharing same behaviour tree
Has anyone managed to bind to a data asset value from a State Tree condition? This variable comes directly from a Data Asset value that is indeed populated prior to runtime. It crashes with a InstancedStructArray invalid error
If I retrieve this value manually instead of a binding, it works fine
Hey guys, do you know if there's a place I can check the reason behind a failed navlink?
Mine seem to show up on the Draw Failed Nav Links debug draw but not on the regular one. They seem to be failing for some reason and I need to figure out why
Got these responsible for jump pads, and they seem to be the main culprits
issue was resolved. Unreal does not support navlinks between different tiles. Increasing the tile size to 10000 fixed my navlinks. Hopefully things won't break
Things broke
alrighty, about to embark on creating a great enemy AI
im 2d pixel art but in 3d world
anyone have any suggestions?
I have a MoveTo in behaviour tree but my AI just instantly skips over it all the time
Most common issue is your navmesh isn't present
is there a way I can bake navigation onto an object? Im trying to move my ai character relatively on a moving ship but attaching a navmesh is almost impossible and it doesnt seem to update. But if i could somehow bake it onto the object and then attach it wouldnt that work? Any info would be super helpful! 😄
Does anyone know if there's some model around trained on Niagara system for VFX creation?
nope
I don't know why people talk about deep learning models in here completely unrelated to the unreal AI framework
I guess there's an unreal AI learning model on main
oh, I tough it was more general to AI, ignore it then : P
I mean, no harm done I guess
Why do you think deep learning isn't applicable?
I mean, Epic are using it a teeny tiny bit themselves
For making a racing game with AI and a lot of verticality, is navmesh practical or is it better to use splines?
I want the AI to be able to use shortcuts / branching paths like Mario Kart but not sure how to accomplish that with splines and Navmesh volumes seem to have trouble with Mount Wario esque maps with what I currently understand about implementing navmesh.
Any good resources on this subject?
splines for sure
although maybe you could use navmesh to constrain them
Make yourself a spline graph
First time hearing of a spline graph. I'll dig into that. Already have a spline running through the map for checkpoints so it's going to be getting a lot of use it sounds like.
Yeah, personally, I'd make myself a toolset and a pathfinder for sets of splines connected in a graph
You can basically copy the spline editor and repurpose it for graphs of splines, although thinking about it maybe the mass traffic zone stuff could do it? I haven't looked
There's a zonegraph editor, maybe you could use that?
hey guys, I'm quite not understand how AIMoveTo works, it seems that AIMoveTo is running even if task, that uses this function, finishes. I was expecting that AIMoveTo would finish moving when task is finished, is that wrong?
Basically in the debugger, I can see that the task is not firing, but npc is still moving
i do recommend spawning a MoveTargetActor, then moving to it, once, with GoalTracking enabled from outside BT
then you just teleport move target, and AIControllers have a delegate they fire when the move is completed
then you don't need crazy parallels to do move + shoot for example
okay, thanks, will look into that
Anyone know why logic inside Behavior trees seems to be the complete opposite of what would actually make sense?
I am curious as to why I would need to Abort Normal Logic if the Player is not seen in order to get it to actually abort it when the player is seen....I fail to realize how that could possibly make one lick of sense
The condition on the left will abort when PlayerSpotted = True
in order to get it to abort when PlayerSpotted = True I had to tell it to Abort when PlayerSpotted = False....unless Not Set = True in this Backwards place
This is probably the Most ridiculously confusing part of Unreal...It's bad when you can't tell if True is False or False is True
AI move to is a latent task. You need to explicitly cancel it.
is is Not Set == False is is Set == True
You are confusing the decorator with the abort functionality. Those 2 are separate logic.
The decorator is what affects the flow. When the condition is true, the nodes below will be run.
Abort is separate and has different settings. That can be value or result changed.
BT is like playing a game of chess with the devil, in my experience I advise you that you should change the order, remove the is not set condition, (when the priorities are well positioned you can save a lot in conditions). and adding abort childs to the is set.
has anybody managed to get run behavior node to work
I have tried 3 seperate times and failed everytime to make it work
Hey does the «Focus» node always make the AI’s mesh face the player mesh? I have a third person shooter and the camera is slightly on the side of the character.
This makes the AI miss all its shots because its looking at the player.
The focus node should make the camera look at the player, not the mesh. Does that make sense?
How can I fix this?
The gun is shooting from the camera, not the center of the character
is it possible to cancel like with timers, when we can save timer's handler to a variable and then use it (however I can't see any handler pin from AIMoveTo), or it's only possible via c++ ?
I have an AI based on SO (at a certain time, the agent goes to an SO and uses it). I need to adjust it so that it can support dialogues in 2 ways:
- During the action it is performing, as a parallel action.
- While the Agent is moving towards the designated SO, I need to be able to stop it and initiate a dialogue with it, then it should resume it's task.
Any suggestions how I should go about this so I can easily implement it? (Keep the dialogue logic completely separated and only have some flags to interrupt the BT, or somehow have the dialogue logic in the BT as well or such?)
I don't know if plain BT can easily achieve something like this
I think you'd need to have some kind of system of "tasks", where you can define a task like "go to SO"
Then your BT executes the given task for example, and if it gets interrupted, the active task is stored somewhere, and can be resumed later
I see that's an idea
I do have something similar to that in the sense I have a goal generation system
I still think I should keep the dialogue system completely separated, shouldn't I ?
Yeah that seems like it would make sense to me
Oooh ok I see thanks....man I was struggling with that bad, I was really starting to get frustrated.
But yeah I was getting confused, I was under the impression that the Abort was tied to the Condition
Hi, anyone has an idea why an AI move to fails in a packaged build? it works perfectly in the editor, the nav mesh is correctly build in the packaged build.
Yes. You need to use the AI task version and save a reference to the AI task.
Hey, quick question on best-practices: I'm learning to implement AI with State Trees. In my experience with UMG, variable binds are virtually never used because they call on every frame and can't use getters. Binding in State Trees seem to be pushed pretty hard, though. Is it best practice to actually use the binds? Updating variables on a per-event basis isn't very intuitive with the current presentation.
I would have an AI task that can run in parallel to your other tasks that calls into the dialogue system
Okay, got it, thanks
So I'm playing around with State Tree, and I'm trying to figure out if this is a bug, or intended behavior. If I have a single state that is part of a parent state, neither its Success or Fail transitions will fire. It will remain stuck in this state forever. If I add a child state with literally anything in it, the state works perfectly.
If I remove WHY, this state will never progress
Tought a bit more about it and i agree, will go down that route!
Hey guys any idea how to make the decorator note called "cooldown" in the behaviour tree an Blackboard key instead of a float?
Lmaoo
Fair point. Im just trying to start simple w w basic enemy. Think like blobs in legend of Zelda. Simple movement but thry do the basics. Move toward players within range, and having an attack. The idea is to make this simple enemy be performant enough to be able to have say like a wave based moment where potentially 100 couple be spawned
Hey everyone, I'm working on a little side project where AI should avoid the light. I am dipping my toe into EQS but I see that there isn't any options for light or at least as far as I know. Is there a way to make a trace and make it test the luminosity?
As a side node, i'm a complete noob in c++ and I see that custom EQS test can only be made in C++. Is this something I can get into or am I getting myself into a massive headache?
Anyone who can point me in the right direction or has any suggestions?
You could try putting a box collision around the light that only the AI can collide with?
Hello again people, I'm having a problem where the supported agents nav meshes are not being exported, except one, when packaging the game, I've been looking around in project settings and in the nav mesh and there is nothing about packaging, this causes the different sized npcs I have in my project to not move, this works perfectly inside editor and only happens in packaged game, anybody knows how to fix this? Thanks in advance!
Yeah that was my first thought too. But it doesn't really deliver the results I'm looking for.
In my project you can create lights and connect them to a generator. You as a player are in darkness and the light is kind of a weapon against these creatures in the dark who lurk and watch you from the dark.
I got the lights and the generator going but with just a simple collision sphere they walk around the boundaries. I want them to look for a place to hide from the light. Kinda like a raytrace from the light, looking for a place where they are not visible. That's why I thought a EQS would work great. But that was another dark rabbit hole I'm jumping in now.
You can create a custom environment query context that returns all the light actors as the result
Excuse my noobness, but do you mean like a asset query that targets the lights or is this something else?
Make a context, get all the lights as locations, use a distance test with that context. I believe the base class is envquerycontext_blueprintbase
Great we are getting somewhere. Let me look into that. Thanks 🙏
There are lots of tutorials for AI in Epic's learning library. I'd start with AI with Blueprints as it goes over all the systems.
You are going to have perf problems with a lot of NPCs, not necessarily because of the AI. The movement component is going to be your biggest problem. The new mass system is supposed to elevate that, but it's not easy to use at all.
why NPCs > AI?
i would imagine an NPC (quest giver or something) would be less of an issue rather than an enemy that moves toward you to attack?
im also using 2d pixel art for main characters inside of a 3d world
AI is the decision making. The character is the physical representation. The skeletal mesh and the movement components on the character are a rather a high cost. Which is what is usually the perf issues of NPCs.
That's Okey, I'm not looking for more then 3 enemies at the time. I want a scary horror fibe not a horde vibe. But interesting to hear. I saw some video where they use physics balls to direct hordes in Unreal. Thought that was pretty interesting as well.
even if they are sprite characters? that does make sense tho. i'd imagine, you coul dmake a master BP for the enemy NPC's and make them extremely performant tho, just would probably require some thinking per game
in my case, im just using pixel art that would flash frames when moving ect
Not entirely certain if 2d changes it. That's something you need to profile. A master BP wouldn't make it better and in all likelihood make it worse.
A master BP would make the NPCs below it have less size if done properly. Not even sure why but the children are more performant (i could be wrong but I learned this in a course)
I’m going to attempt to make a simple enemy w 2D logic and see what happens
How do people do wave based shooters/killing ect where 1000s of NPCs spawn in your opinion?
That is completely incorrect. Just look at the size map and you'll see. Object orientated programming (OOP) doesn't work like that. The children are the size of the parent (and all of it's parents) + what it adds.
Some use Niagra, some do a lot of optimization, and others are trying out Mass.
Did you watch this? https://youtu.be/iY1jnFvHgbE
In this presentation, Epic's Paulo Souza uses Unreal Engine's built-in AI features to build smart enemy behaviors for a game with stealth-like mechanics.
By relying on the Gameplay Framework in Unreal, we're able to quickly create convincing AI using Behavior Trees. Behavior Trees are great for creating complex AI that can be presented in a way...
The size of an object only really matters at load time. Sure there are memory constraints at runtime, but you'll unlikely hit that as a solo dev. What I'm talking about is runtime performance, which is what it's doing during the game.
that makes sense for sure
i trust your conviction
where can i peep size map/profile in my game?
like how do i check to see whatis doing what
The size map can be found by right clicking on any asset in the editor.
Profiling is done by doing a recording of a game session. And using unreal insights: https://docs.unrealengine.com/4.26/en-US/TestingAndOptimization/PerformanceAndProfiling/UnrealInsights/
Profile application performance with Unreal Insights
dope, i'll check this out, i actually think i tried to use unreal insights once and i just didn't record the session probably wy i was i was getting no results
are there certain numbers as a solo dev, i should look out for ?
like max / reason size map's per item / scene? a good base meter to watch out for bascially
i mean, i can feel when i do soemthing bad when i press play, but also nice to know the digits
Oe! That looks like a good one. I will check it out. Much appreciated 👍
np, it talks alot about EQS, figured you might be able to use the Sight Sensing for your issue
The only numbers you need to worry about is to have a consistent FPS on your target and min spec hardware. You do that by profiling to find the hotspots when you aren't getting your target FPS or you are getting hitches.
dope, once again, makes snese. im on a semi not optimal computer so frame rate is naturally a bit low, around like 40-70 fps, and that is the easiest sign that something is off
appreciate the help tho
Also note that your frame rate in the editor is going to be a lot worse than a packaged game. It's highly recommended to profile using a packaged test build. It's the closest thing to a shipping build, but still has profiling available.
ahhh well that is refreshing to hear
I'm having a weird issue in 5.1
this task succeeds as I want, but for some reason the next task is never executed
the eqs query just seems to never fire
all this worked in 5.0
can see the first task even set's the correct blackboard key
hmm seems the behavior for abort self has changed
this did the job for me. Learned something new today. Thanks!
Hi all.So I want to make a horror game with the monster being an a.i which can chase, attack, roam and investigate(players last position) and i also want it to have good hearing so i was wondering if i should use utility a.i or behaviour trees?
Either would work
Can i use a dectorator to see if a vector is set / unset? seams to me like 0.0.0 would be a valid vector. so that doesnt work right?
Correct. A vector cannot really be "unset" because it always has some value
yeah so i would need a boolean to go alongside with it then
How can I have my AI actors rotate towards the player even during a rootmotion animation? I tried enabling ‘Allow Physics Rotation During Root Motion’ but that did not do the trick as the AI is not using MovementInput, but rather AIMoveTo from behavior tree.
If you use C++ there is FAISystem:: InvalidLocation
Behavior Tree. Utility isn't great for simple behavior.
NPCs use control rotation in the AI controller or movement component, by setting the focus location or actor. I don't use root motion for locomotion, because it doesn't respect the nav mesh. There are lots of results if you Google: root motion AI focus
hey, is the step at 12:00 in this video still necessary in 5.2? https://youtu.be/iY1jnFvHgbE
In this presentation, Epic's Paulo Souza uses Unreal Engine's built-in AI features to build smart enemy behaviors for a game with stealth-like mechanics.
By relying on the Gameplay Framework in Unreal, we're able to quickly create convincing AI using Behavior Trees. Behavior Trees are great for creating complex AI that can be presented in a way...
Yeah, found a solution - lots of methods that didnt work for rootmotion. Made a custom BT service to set/clear focus while playing an animation, which ensured the actor kept on rotating.
I am trying to use the new AI State Trees instead of Behaviour Trees, but I can't find a way to debug the flow. Is it really not possible at the moment to visually debug the State Trees? If not, I guess I will stick with BTs. So, is it possible to debug State trees?
No idea, since I'm a total beginner in UE, but I realise that this video contains a very good introduction on an area of UE that I am very interested in. Thanks!
Yes. This stuff hasn't been touched by Epic in ages.
Lol np
Yeah I read the docs and even on 5.1 it still has the same note saying you have to use tags if you want to check friend/foe in blueprints
Did you figure out that issue? I had the same and ended up ditching BTs because of it. It’s same in 5.2
the behavior for abort "both" changed and I switched to abort self
Ah I see, I think I tried self and it didn’t do what I needed. But I need to revisit
another thing was that some sequence nodes wouldn't finish without a wait node added to the end
i have some tasks that call into interfaces and I just wasn't getting finishes or something
I had an issue where nodes where being excited twice, didn’t happen in 4.27, 5.0, same project in 5.1 now suddenly everything executed twice, really frustrating
yeah something changed from 5.0 to 5.1
Does someone have experience with vehicle AI plugin from 313 studios and AVS ? Everything work fine when I'm driving my car manually so my problem is not from AVS, but when it is possessed with the AI controller (provided by the vehicle plugin and with same settings for custom vehicles that they are showing in their youtube channel) my car is flying like a bird. Any solution ? (I'm using UE4)
Haya folks, does anyone know how to access the values for AI sights etc?
Im trying to set it up as a variable so that I can customize my AI further (e.g set custom sight radious range/lose sight radius)
Apperently there is a node called clear blackboard value that invalidates the BBkey. So it has to be a wrapper around the value. In other words. it is possible to invalidate a vector.
That's interesting, I knew the BB values are wrappers around the actual values but not sure how it actually represents it as valid / invalid
i just created a task to invalidate a value. and then i can use the isSet decorator on any value
@shell sable I've set up the Nav plugin from the link you gave me - https://github.com/chillpert/DonAINavigation but it's giving me the same behavior I know from the other plugins. I can see the "Fly To" task getting used but I don't see any input on the CharacterMovementComp of the character I created and thus the Bot isn't moving; I'm PrintStringing the last input vector from the comp every frame to see that. I assume I need some kind of component that acts as glue between the plugins task code and the MovementComp, but I don't see where that happens in the basic example from this article: https://erlangen-sheppy.medium.com/3d-pathfinding-in-unreal-engine-9b04f58ca50c
Any pointers? Is that article even correct anymore?
FWIW I also don't get any visible debug output, like nav volumes or anything in the level when I enable the debug output flags in the BT. I'm also wondering if this has nothing I need to place in the level, like a global nav volume or somesuch
morning
Hi! I am once again asking about State Trees 😄
Currently, it seems that the only way to deal with async tasks is using tick events (on the task) that check for x conditions and then set the return value to running, succeeded etc. Is there any other way to do async tasks? It is a common usecase and checking on tick seems like an unnecessary performance overhead
I'm mostly using blueprints but I can dive into C++ if it is less buggy/easier to setup there
I don't know of any async functionality. Tick goes brrr
like an unnecessary performance overhead
I'm mostly using blueprints
Bruhhhhh
it seems that ST tick is not the same as actor tick so maybe it's way faster, idk
or at least it depends on the logic you put on tick
As per usual
But in all honesty - I really don't recall there being any async functionality like you're looking for.
xD
I'm just experimenting - I barely run any logic so what I want to see is if the overhead of the state tree itself is significant
ST was too buggy for me to continue with it.
I had 2k state trees and it seemed to run fine, so that tick shouldn't do much afaik
bcs the alternative is to make a very simple st-like system that runs on async
but that's quite a lot of work maybe
BT to the rescue?
Yup. Went back to the tried & true.
New & shiney was preventing me from actually making progress in the AI department.
yeah makes sense
The big thing that broke for me was when the bindings just decided to stop working
So I was just like, "Eh - maybe another version I'll try" 😅
I love the idea of state trees but it's difficult to tell how it works, I cannot control them to the extent I might need, and if it's running on tick it might be a problem
I wish I would've actually wrote the blog that I said I was going to back when I was messing with ST far more frequently.
But I've since forgot some of the inner workings 😅
but if it's buggy and slows down work, it could actually be a problem
idk if 5.2 might bring something new to the table
For what its worth - it was mainly the editor portion that was buggy in my experience.
yeah I see
I mean
it seems that even returning certain states from leaf states is not working so
BT: "Come back to me my child"
ye but probs BT are even slower for my needs
Wonder how much you can make BT go brr if you don't do any instancing 🤔
Well Max, you've been volunteered
xD
No BP tasks or anything like that. All C++. No instancing allowed.
right now I'm leaning towards rolling our own lean stuff
Let's see how brr it can get
xD
Most people do a lot of tasks in BP (from what I've seen) and then claim BP is slow.
But according to Luthage, instancing the task is what is really killin' the performance.
I see, I have no idea
but judging by Unreal's performance standards, and the age of BT
And according to @celest python - BT is overoptimized 😅
Well...AIModule doesn't do things the same way as the rest of the engine 😅
I can predict that it's gonna be too slow for what I need
in a good sense or bad sense? 
its only for spawning things afaik, it has no continuous perf penalty
Yeah - that's true, but Max deals with a large scale; so spawning will be the bottleneck in this case
indeed
I'm doing some tests on ST tick just to see how impactful it is
I was thinking about rolling our own stuff but it feels like such a big undertaking, even if it is a lean thingy
I think anything below 1ms per frame is quite acceptable
yeah
but it seems tasks tick by default and async behavior is tied to tick
having another tick for 2k entities (taking into account that Mass is already iterating multiple times and also actors have their aggregated tick for now) might be too much, idk
Just don't have AI
arent you calling ST tick function from mass?
no
why
I'm using ST component on actors
why 2x
mainly because we only use Mass for movement, actors still have most logic
AI definitely needs to be on mass scope for an RTS
empty UActorComponent ticks alone is already a bloat for you
yeah indeed
Is Mass's movement actually better?
the problem is that we need actors, there's no easy workaround (for GAS for example)
why you need GAS for an RTS
it's "better" because it's all custom, we just use Mass to implement it
abilities, combat
if you decided on RTS on scale you should also consider writing custom systems/tools for those instead of GAS though
I'd not use actors etc if I started from scratch, but half of the basic game was already made when Mass came out
we'll modify GAS, but for the moment there is nothing inherently bad about GAS besides the networking model
GAS will interop with NPP it seems
I wouldnt ever use GAS though, its not like it can also replicate 2k entities if you were also doing multiplayer
we are
ST tasks should be abilities and combat graph itself
how do you plan to replicate 2k entities?
fast array serializers and ASC proxies, it's already studied xD
how about CPU cost of replication though, not just bandwith
UNetDriver tick go brr
It's both!
I'm sure you can't predict that. We have profilers for a reason.
I'd have to measure, but replicating GAS through a proxy is going to be very similar or equivalent to custom combat/abilities + replication
and the good part is that the GAS stuff is really less frequent and intensive than movement replication (which is already kinda done)
well yeah I tend to hesitate to say something about those things when it comes to RTS + replication combo
one way or another it will involve a huge engineering job to do
since you're fighting the engine
yeah it's always harder but
fortunately there's people that have already done some of it
Fortnite already uses GAS proxies, and I talked with somebody with 400k entities using GAS for them, and a similar trick
I dont know how GAS proxies work but I know its just a fancy lazy loading trick
it also relies on dedicated server and previously that grid based networking thingy
so I guess it could work with RTS too, why not
idk exactly either, but it's mostly about disabling regular replication and using a different one
so basically ASC does not replicate normally and the data is replicated through other means (FastArraySerializers for me probs) and re-wired into GAS on clients
there is only one game released with client-server model and large scale RTS though
all others are lockstep
so can't say that idea is battle proven
Mass can also use actor representation, where most of the functionality is still driven by Mass, but an actor is attached.
there are more client-server RTS games though
I'm intrigued 🤔
Do you even actually get the benefits of Mass at that point?
i might be wrong, I've read an article about it a year ago or so that explains a game where they claim its the only large scale RTS with client-server model
indeed - for now we have Mass for movement (and Niagara/VAT sync) and actors for gameplay logic
depends on what do you call large scale
1k+ units?
depends on what you're doing
Yes. Since most things are still using mass. Look at the mass representation subsystem
actors are not slow
skeletal meshes, CMC, and other stuff that is usually associated with actors is
Actors are still slow. Just not AS slow.
depends on what you do - tick might be slow (specially if not aggregated), and transform updates too. And of course the inherent slowness of working with data that is not memory-adjacent
also the problems of non being able to multithread them
well true
then there are definitely more than 1 - I know at least two, and the scale is way bigger
Slow is relative. Actor components are slow. Many games don't have to worry about it, but some games do.
But I need my 10k zombies 😭
Do you really? I mean really?
Dead Rising is going to look like child's play
I do wish the Dead Rising team made more public how they did what they did.
I just assume it is instanced skeletal meshes and client-auth networking
I doubt it's client auth networking, but maybe they did really bad things to do that.
there is actually a GDC about that, where they explain their low level systems
Well Eren linked me some stuff awhile back, it was client auth
They just didn't talk about how they achieved the zombie counts.
It was P2P as well
They did say their tech could scale to like over 20k zombies or somethin' like that...way back in either 06 or 09. Don't remember if it was about Dead Rising 1 or 2
And simple skeletons
instanced skeletal meshes are probably not rocket science, i think engines designed with such mindset can achieve it easily if you have graphics programmers
early 2000s games was doing it
yeah
it is mostly about calculating the animations on the GPU
instead of CPU (as Unreal does)
It's more common to calculate on CPU as far as I know
what might be tricky (not sure) is handling stuff such as collision with GPU-based animations
like, how does the game logic know if you hit the head or not
yeah
game state in games like dead rising and europa universalis mean something different than UE
its actually the state of the game
I don't mean to imply that they are - but as the 3 of us know, none of us are graphics programmers 😅
hey I'm learning OpenGL
probably even a graphics programmer struggle a little when implementing it to UE4
UE's mesh pipeline heavily focusing on fidelity rather than quantity
all data structures based on that mindset
For now....😈
and for foliages etc. there are hardcoded monolithic codes on private files
ye tbh I just wanted an intro, I wanna learn DX or something actually usable in Unreal later on
Everytime I pick it up, I put right back down and am like, "I need to work on my game"
I don't need 10k....yet
I am lucky I get training time on my job
The dream
it's not reliable time, because it depends on my work schedule, but at least I get encouraged to do it
and I got free Udemy which is something
enough slackers for me, bye people 
the problem is that I barely have stuff to implement regarding graphics programming
and I don't learn without challenges
ughhh state tree overhead for 2k units is not nice
back in CPU-bound land
2.5ms for 2k state trees
that was in blueprints, let's see what happens with a C++ task
pc will explode 💥
not really but it's a significant performance penalty
going from 80-90FPS to 50-60
just due to the empty state tree component overhead
Were you the one asking whether you should go back to using BTs?
yep
well
Is it less expensive ?
Idk, I don't think I'm gonna test it
I'm playing with the tick frequency and see if it is of any help
since I don't need it to tick super frequently
hi there.
I'm having a slight difficulty with path finding in unreal, and as I'm a noob in unreal in general ( more even so in their AI part ) I'll ask you guys.
This is not my code base, so a lot of stuff here isn't EPIC's stuff, it's the company I work for.
I have to move a pawn from A to B.
I have this line at the beginning of the code:
PathFollowingComponent->OnRequestFinished.AddUObject(this, &ThisClass::OnMoveRequestFinished);
but I guess this MoveRequestFinished is not triggered when the move is finished, but when the AI finishes calculating the path?? is that it?
the reason I'm taking this guess, is because inside that function, I'm trying to make some decisions about which path to take. So I make another call to the AIController::MoveTo with a different destination.
If I don't like some aspects of that path, I make yet another call to AIController::MoveTo, and for some reason, I find that I just reentered OnMoveRequestFinished! I can see the two calls on the call stack.
So my question for you is, after reaching my destination, I have a few destination points to choose from, so I should probably request some paths. But the way I'm doing it, doesn't work. How should it be done?
Thanks.
Just as a followup on my state tree research, I'll just lower the tick frequency of the ST component (10 times per second seems reasonable) since I'm only using tick to set the state from async tasks
maybe I can hack something in the future when the tick is disabled and called manually on events or smth
you need to add a "don navigation manager" to your level
check out this tutorial video https://www.youtube.com/watch?v=6Tr_K551zvI
DoN The Nature Game uses a 3D pathfinding system for it's flying creatures to navigate a dynamic and procedural world.
Now this plugin is available for free to all Unreal Engine users!
Download the plugin, sample project and source code here:
http://www.drunkonnectar.com/3d-pathfinding-ue4/
Forum thread:
https://forums.unrealengine.com/showth...
sorry, I can't just add stuff to this. It's work, not my personal project
ooooh ok
basically, I have a set of points for which I set a route. Patrol points. but I want to check, when I reach a patrol point, if the path to the next node is too far or not. If so, skip it.
so, I have added a bit in OnMoveRequestFinished, when it fetches the next point, asks for the path, gets the length, if bigger than X, fetches the next point, and asks for path. and here is where it breaks. I Guess I should probably do this somewhere else? Or develop a kind of state machine?
The delegate is correct, but you are getting the callback when the first once is cancelled.
How you are doing this is incredibly problematic. I would recommend testing the paths without requesting one. Either using EQS (preferably) or testing paths directly from the navigation system.
this is not my code. I am trying to adapt it to do this. I've never touched unreal's path finding
so, basically, a path is asked from A to B, and when the path is finished calculating is calls OnMoveRequestFinished? or is it when the move there is finished?
and what do you mean testing the paths without requesting one?
The problem here is that I may use something to block a path, eventually, so the patrol must adapt. It's not the most frequent thing, but it must be taken into account.
So my idea was, most of the time, it'd just request a path to the next patrol node, and follow it. but sometimes, that path may be blocked by something, but UE's engine does not tell me that. it simply provides me with a longer path around the obstacle. So, I'm trying to find if that longer path is TOO long ( so it doesn't seem silly ), and if so, just skip that waypoint altogether.
It's called when the request has finished. Such as when the move has completed or been cancelled.
ok, so in my code, assuming I don't move, I shouldn't get a second call....
hmmm. unless....
I mean by instead of requesting a path via the AI controller, go directly to the navigation system. I personally would use the EQS to find the next patrol point, because I don't like to hard code logic like that.
navigation system? I'm a noob. what do you mean by that? I need my soldier to find a way to get to that waypoint. is there an alternative to the AI to get A* to calculate a path?
ok, if this is available, why would one use AIController instead of navigation system to move a patrol from A to B?
any reason you see?
Using the AI controller one isn't just finding a path. It's finding a path AND moving towards it.
hmmm, ok
You want to test a path BEFORE moving towards it.
it sets the whole action queue for me, then
yeah. so using navigation system to test the paths, and when one is ok, pass it on to the AI to control the pawns
Sure.
is there a way to make an actor invisible to AISense, or if not, a way to force the AISense to move on to the next actor in its sight radius?
I'm using a decorator currently to check for specific classes, but the AI gets hung up on targeting the camera and mostly ignores the rest of the actors
Hello I will pay anyone $10 if they help me with a simple ai blueprint script. So I have an ai script to move in a straight line for a random time and stop for a few seconds and then move to a random direction again. what i need is:
- when its paused few a few seconds and choses its random location again, it slowly turns to the random location during its delay time.
- every so often (maybe around 30 seconds to a minute or so), the ai will go to a random specific location of any of lets say 10 different locations i initially select. and then after it goes to this specific location, it will go back to doing its basic random direction code.
Use SetFocus/FocalPoint for 1, and use a timer with an array of locations from which you select randomly for 2.
so for 1, do i use both set focus and focal point
this is what i have right now
No one has to be updated repeatedly while the other doesn’t. (I can’t remember which is which.) Just use the one that works best for you, or use SetActorRotation too is an option.
yea but how do i make it so during the delay period it slowly rotates to the new location its about to go forward to
Use one of those functions and the tick event or a timer if you want. You can repeatedly set the rotation based on the time elapsed so far and the angle to the place you want to look.
should i use a get desired rotation?
because i dont have code right now for the ai to get its rotation but i have it to get a new location
SetFocus sounds like what you want. See if this helps: https://youtu.be/ljgtdAxS2p8
What are the Get, Set, and Clear Focus Nodes in the Behavior Tree in Unreal Engine 4
Source Files: https://github.com/MWadstein/wtf-hdi-files
i mean i get what he is trying to do
however when the ai turns in his video, it doesnt do it slowly
it just sets the new rotation and goes
doesnt take its time and then go to the new locaiton
Also I think when it comes to AI they have a rotation speed setting already
where can i find that
It doesn't do it instantaneously. It is called on Tick in the UpdateControlRotation of the AIController. I can't remember the name of the variable, but I imagine there is a rotation rate on the character movement component.
There is a turn rate setting but I just checked a link and it said the unit still moves, it just slowly turns the mesh to face the fwd vector
So maybe just rotate it manually using event by timer, and then give it the move order
As for your patrol, you could use behaviour trees and EQS. Watch this video: https://youtu.be/iY1jnFvHgbE
In this presentation, Epic's Paulo Souza uses Unreal Engine's built-in AI features to build smart enemy behaviors for a game with stealth-like mechanics.
By relying on the Gameplay Framework in Unreal, we're able to quickly create convincing AI using Behavior Trees. Behavior Trees are great for creating complex AI that can be presented in a way...
Yeah you'll want to rotate in place first, then set focus. If it's AI, you can make a BT task that disables movement, rotates player in the BTTask tick function using the RInterpTo node (note: the interp speed argument = 1 / value * 1 second, so 2.0 = .5 of a second), then reenables movement and sets focus.
Any idea why my BT is stuck in this Task ? It was working perfectly in UE4, this started happening in ue5
no matter what I do, "Abort" , "Finish Execute" , Any Observer abort, still the same
As we have no info, it's hard to say. I will say the one big change from UE4 to UE5 was the default abort condition changing from "both" to "self". Try changing your aborts to "self" and see if that fixes it.
Hi, can you show us what is inside you btt ?
it always hit this area
let me know if you need smthing else
Are you sure it not hit at cast failed and keep stuck here?
Make a breakpoint at your cast node
cast never fails, it hit the finish task everytime
but yet still stuck
I even created a new task that has 1 print and 1 finish execute, still same issue
What kind of info do you need ? I tried setting the observer abort to self, low proiorty and both, all was the same sadly 🤔
What if you tried removing the empty selector and having an arrow point directing to the node. An empty selector is essentially the same as a "true" condition if the parent is a selector.
Same issue, The yellow changes the state for the red decorator, I can confirm that through BT debugger , I can see the state switch from Move to Stop, IsOrderType checks for Move and since it is Stop not move, it should just get out of here , that was happening in ue4
If it's reaching the node, it's because the conditions are returning true. All you can do is debug each decorator and figure out why it's returning the value you don't want.
I wouldn't get too hung up on 4->5 changes. If you make the choice to upgrade mid-project, you'll always face these issues.
Did you check manually the distance for "IsAtLocation" ? For the first path you can check it
For the second path, it's clearly your second BBC who is returning false and not meet the condition so it will never entering in that BTT
When using Move To Actor with a goal set, is there anyway to reduce the amount of times it recalculates when said actor is moving?
Or is it best not to use goal oriented move to
I think I found the issue, it is with "PauseLogic" and "RestartTree" in c++, when I give order, in the order execution it pauses the tree, populate blackboard then restarts tree, for some reason in ue5.1 this isnt working, commenting 'out these 2 lines makes the tree work with no issue but not with the results I want 
I am not sure how to make StateTree tasks implemented in C++ show up in editor Blueprints. The Debug Text Task and Delay Task included with the StateTree plugin are implemented in C++ as UStructs inheriting from StateTreeTaskBase
//Draws debug text on the HUD associated to the player controller.
USTRUCT(meta = (DisplayName = "Debug Text Task"))
struct STATETREEMODULE_API FStateTreeDebugTextTask : public FStateTreeTaskCommonBase
{```
When I make my own custom StateTreeTaskBase struct in a project, it does not appear as an option in any State Tree editor blueprints. If I create a custom StateTreeTaskBlueprintBase class, it does show up in the editor, but the comments say that this class is for Blueprint tasks so it seems like not the right way to do it. Could anyone with experience implementing C++ ST Tasks point me in the right direction?
The answer is that it needs to be a StateTreeTaskCommonBase, not a StateTreeTaskBase.
it doesn't seem like any of my print nodes inside BTTasks are actually able to print to screen. Anyone know why?
like the code is flowing through them, they just never actually print to screen
How did people use static navmeshes with World Composition in UE4? From what I read on UDN navmeshes cannot be streamed in separate parts yet.
ohh cool, I was gonna try writing my own C++ tasks too
I get this randomly too. My gut says it’s printing too fast? But I haven’t been able to figure it out. Please shout if you do as it’s super annoying!
I remember there being a float that would dictate when it calculates a new path but maybe I’m misremembering…? So you could set the float higher and it would repath less if that’s what you’re looking for
Hmm maybe, I’ll try to figure it out later
Using BT, my AI finds enemy actors on perception update, and before I initiate an attack montage I set the focus to the actor
The issue is that the AI seems to -some odd times- in that moment not return a percepted target, and turns towards 0,0,0.
Any suggestions that come to mind? 🤔
While table ducking this text I realized maybe a custom set gameplay focus could solve the issue? 🤔 As a service for the montage task.
@shell sable It's moving now! Thanks for the tutorial. Plugin has crashed my editor twice already though, has it been crashy for you too?
Yes they could. It was annoying to set up, but there is a UDN post on the steps you need to take.
Are you using currently sensed targets or known targets? Is it dropping the target, because of line of sight issues?
When I use Stop Logic then Start Logic, the behavior tree refuses to enter this blackboard based condition despite the TargetActor being set.
Like is it a known issue that stop / start logic breaks blackboard based conditions?
It is not a known issue. Use the visual logger to walk through what is happening.
I found a workaround to this problem, instead of using Stop / Start logic I've just created a bool "IsBehaviorTreeActive" at the root of the behavior tree, now it works like a charm
Before the workaround I tried to do some debugging where it was as if the leftmost node (Blackboard Based Condition) didn't exist. The breakpoint only stopped on the rightmost node, and before that it kinda entered the middle selector where it said it failed... Anyways I gave up
Im actually not removing any sensed targets yet, so whenever it senses a target that’s the target until theres a perception update, where sight is primary and hearing secondary. Im not doing any crazy maneuvering when the issue occures, such as moving out of its 70• peripheral
There is a perception update when the target is lost.
Okay, I’ll have to explore that then 🤔 Have it move to the last known location or something like that
Thanks 🤘
Any pointers as to where. The world partition one is unstable and we are looking for an alternative.
hello guys.. I want an object to move with a behavior tree to a specific location, stop using the behavior tree so it can use a spline path there, and then continue with the behavior tree .. do you know any sort of way to implement this?
Seems like you could use StopLogic
And then RestartLogic
Is it possible to search all the behavior trees in a project for a particular task, decorator, service (or reference to a bb key within one of those)?
It would be better to make the spline movement a BT task. Why do you want it to not use the BT?
cause i can't implement a task that can use the spline
Why can't you?
It’s just a timeline node right?
well i am trying but it doesn't do it and it continues to execute other tasks or it goes idle in the root node while it tries to begin the spline
How does an AI task actually receive an EventReceive AbortAI? In my usecase I run a delay on the AI code while they're animating, but if they're dealt damage to they should just use the delay from the hit reaction animation. Instead, what's happening now is that the animation that was currently playing while it took damage, is using a delay until the next logic can play, i.e attacking again.
Do I need a decorator on the Montage Task, which checks if the AI has been damaged? 🤔
Can you show your tree ?
You need to stay in that task while it's using the spline.
The BT calls the abort task when the subtree aborts. You really shouldn't use delays in BT tasks as they can cause a lot of problems.
What would be an alternative to ensuring the BT doesn't continue playing until an animation montage has completed then?
A timer. A delay is a timer you can't cancel, which is the problem.
Hmmm, sounds like a solution indeed 🤔
I think it might have been removed. The oldest entry is from 2018 and that post was older.
- Make sure there is a nav bounds volume in the persistent level. You can have them in the sublevels, but if there isn't one in the persistent level, it won't build. It just needs to exist, doesn't have to be around anything.
- Load all sublevels
- Delete any recast actors
- Make sure the persistent level is set to the current level
- Build navigation
It was not fun. A lot easier when you make a commandlet and have the build machine do it.
The worst part is when someone is working in a sublevel and they have auto regen navigation turned on. It'd break navigation for the entire level.
somehow i managed to fix it! thanks @dense owl @uneven cloud
Hi, i'm having troubles with my AI enemy, it detects me but it doesn't follow me as intended. I'll post my blueprints and other stuff here since I've been stuck for days now
BTW the answer to searching for usages of a task, decorator, or service in the behavior tree assets was to use JetBrains Rider's UE integration
so weird, today the print inside my BTT is working
wasn't until now
and I didn't change anything there
actually it works intermittently. I think the AI profiler makes it glitch out
Well for one your isValid node is not connected to anything. It’s not easily visible because you crossed your node with a stream, so I recommend you use reroute nodes and avoid doing that
You shouldn’t need to use a branch on the successfully sensed pin, onPerceptionUpdated triggers when something was sensed, so that’s automatically true. You also have that branch after the distance check not connected to anything rn, which is fine if you haven’t implemented it yet, but hard to see what you’re trying to do if you’re showing nodes that are not relevant
Successfully sensed can be false when, for example, something leaves sight range, I believe.
won't having the navmesh persistent in open world be costly?
a question regarding this, would having it's timer handle exposed and and oncancel delegate make it useful?
i use this node, and on completed i just call the finish execute....
and in c++ its a lot different for me 😅
flyto might be bugged idk, i made my own flyTo node in blueprints for more control. you can try using it. no guarantees lol. if you add the attached file to your content folder you can use the customflyto behavior tree task just like the build in one
I'll stash it away and play around with the plugin as-is, thanks!
This is written in Blueprint then?
Oh thats a good idea, I used the other montage node. Do you have that in a task, or in a event on the actor?
in task
Oh okay. I heard it was best usecase here earlier to call an event from the task to the actor, as the task would be the director, and the actor the executive
yeah you can that too, but in that case you have to store the montage time and then use timer/delay to finish execute the task.
I’ll definitely give it a try 👍 I’m in need to replicate this, but since AI is server-client anyway it should be fine right
no idea about replication stuff, I implemented it in single player 😅
Hehe ☺️ I’ll check it out though, thanks for the pointer!
I'm trying to create a C++ StateTree task (child of FStateTreeTaskBase) but I'm getting the error:
StateTreeTaskBase.h(86): [C4430] missing type specifier - int assumed. Note: C++ does not support default-int
I've made sure I'm including the right header and added the StateTreeModule and GameplayStateTreeModule into my plugin's Build.cs.
It would seem as if it's an actual engine error, because the error points at a engine file, and if I comment it out in the header, my code compiles and builds fine
odd
Does anyone know if there is a BeginPlay alternative for ai controllers? Or alternatively where is the right place to bind delegates to respond to AI perception events?
BeginPlay
But AAIController doesn't have a begin play override?
all actors should have one afaik
According to the docs it does not, and though I can still add it in code just fine it doesn't appear to be called
It does. As Max said, all actors have it. It is an actor.
If you think it doesn't, you need to take screenshots and show what you're looking at because it would have to be a forked version of Unreal with BeginPlay removed from Actors entirely.
C++ classes can override grandchildren methods right?
I don't understand the question
Parent childs can't override child methods, because parents don't know children exist
Grandchildren can override grandparent methods because they're just virtual anyway
yeah that was my doubt
so any actor can override BeginPlay
Yes
Every inherited child gets all methods of the parent class and then that parent class and then that parent class, so on and so forth. (as long as they're not private)
ye exactly
thanks for the clarification
BTW about my issue above - it was probably an engine issue, upgrading to 5.1.1 solved it.
#gameplay-ai message
Hello, I have some problems with how to structure my AI.
By reading some articles I understood that in theory all AI process should be split up in three areas: compution, database and execution. However, when in comes to practice, I have some question. For instance, let's say that my AI has two main behaviors - combat and idle, and each of the behavior should have its max movement speed. How and when should I switch between the two? I have some missunderstanding on how to correctly structure the first area.
You were correct, a clean build resolved the issue of it nod being called. Appreciate the guidance!
Well if you’re storing max speed in a variable you can change it within the BTTasks, as necessary, no?
Do you mean store the max speed for each state or store only the max speed the AI should have at a certain moment?
No reason to have separate variables, just change the one as needed
So I would need to exactly know the state I'm in from, let's say, a player controller? It's the one controlling the BT
Not necessarily
If you have 2 separate tasks, you just set the variable as needed each time one of those tasks starts
Wouldn't this intrude the execution with the logic?
Don't be too scholarly with your approach. Do what works.
Unless, of course, your goal is to be scholarly
So are you saying to basically abandon any attempt to follow a good practice?
There are many things where you can do whatever works, but then have technical debt which won't allow you to improve whatever you've developed so far
You're gettin' technical debt no matter what.
And who said to separate these things are "good practice"?
How do you know it is?
Because some articles made the claim?
Everything has context.
If you're building some super large game as a service, it matters more
If you're doing your standard indie game - it doesn't.
IMHO, you can always replace the duct tape and rubber bands later, if you find a better solution
But depends on your circumstances, like Duroxx said
The worse the practice, the more debt you get, that's what I wanted to say
I'm basically trying to learn how I can make these things in a way that would work good enough, rather than just work
So my final goal is to understand how to make good, rather than just make
A noble goal indeed. Sry, idk what is the right way to do it. That’s just how I would approach it with my limited knowledge
The "right" way is the way that ships the product with the constraints of the project.
Sure, having a BTTask that just alters the speed isn't the "right" way - but it works for this project. Game code is typically really awful. Specifically because it's often just throwaway code.
Structuring your AI doesn't fit into some neat box "computation, database, and execution". It fits into w/e box your game requires.
In this case, a BTTask could fit the computation and execution roles
Does that mean it is bad? No
Task could compute the total damage to do for example (not how I'd do it, but just roll with it), as well as actually execute the animation to do the attack
Database would be in the blackboard, the data asset, the actor, or the data table
Good structure is created by the confines of your given project.
I'm sure someone like Zoomba or Luthage can come in and give a more scholarly answer though.
The nav mesh isn't costly. It's the nav data that holds all of the data and that's saved to each sublevel.
What do you mean?
I'm not sure where you read that, but as someone who has shipped multiple games from indie to AAA, that is not a good practice to solve tech debt.
What's a better solution?
It entirely depends on the size and complexity of your game. And what you are trying to do. There is no "perfect solution" as everything has pros and cons. I typically prefer a data driven gameplay approach, but that doesn't work for every game.
Can you make an example of a data driven gameplay approach for an AI?
It entirely depends on what you are doing. Your example of different walk speeds: I would make a service that changes the walk speed while it's in a specific branch. Then the walk speed could be set on the blackboard or taken from a data asset.
Nice.
The entire point is that these approaches aren't hard rules to apply to everything, but where they make sense. If you have 5 different AI then you won't see a lot of benefit to data driven gameplay. But if you are making a live service game that can have hundreds of different AI, it will make it a lot easier to ship.
The goal is to actually ship the game. Getting bogged down in the "perfect solution" doesn't get you any closer to that goal.
All right, thanks 😄
@uneven cloud I do have a question that perhaps you could clarify; why would you use a service for that operation? I was under the impression that services should be used for tick like stuff that isn't necessarily good for tasks.
Services don't have to tick! You can also use OnBecomeRelevant and OnCeaseRelevant. Which are called when entering and exiting the underlying branch.
Fair
The benefit of using a service over a task in the case of setting the movement speed is if it's aborted at any time, the OnCeaseRelevant is called.
I just always think of them as doing some background thing but with tick 😅
hi
anyone faced a problem with the spawning ai not moving?
i checked the "placed in world or spawned"
he has a nav mesh invoker
idk what else to do and im stuck
yeah idk whats going on but if i move my target point he might spawn and might not
its weird
what if I use this in world partition?
I don't think it works in world partition, as it has a different way to do level streaming. The nav data is in the grid cell, but how it's created is different.
That is the sad part. The wp implementation is not production ready
any way to check if it works or not?
You can try it and see if there is navigation that is loaded. But I'm mostly certain how you build nav mesh for world composition will not work for world partition.
Thats a good motivation but besides what written above there is also another problem: engine(s) dictate different workflows
You might find trying to solve more underlying problems more interesting that solving specific cases like you mentioned at first
There is already a controversy about UE's implementations which will confuse you along the way if you dive into community more, some hate it while some able to make sense at least to some extent
But yeah generally thinking about data first is always the best approach no matter what but the way UE expose data to AI is kinda making you brainstorm with "just do it the working way" when you're shipping games
Rats
Is it possible to call this Task function from within a blueprint actor? I.e when a montage is completed, I wanna do this. As replicating a montage through a BT Task seems to not work
Finish execute does not call a task, it just marks it as successful or not, if that’s what you were asking
Nor should you try to use it outside of a BTT
You want to use an event dispatcher.
I have a BTT that sends an interface message to trigger an event. The latter contains an AIMoveTo node halfway through the code. Problem is, that's not where that event is meant to end, but it looks like the OnSuccess output of the AIMoveTo is signaling the BTT that it's ok to move on to the next node, which finishes the execution:
not sure how to get around this, any insight would be appreciated 🙂
What you are expecting is not how code works. If you need to wait for something to finish, you need to make an event dispatcher.
yeah, I had a feeling it might be because it tries to do it in one tick
thx, I'll try that
How are you spawning it? Make sure you're using SpawnAI rather than SpawnActor, since the latter does not spawn the AIController along the actor
I tried both
Same result