#gameplay-ai
1 messages ยท Page 54 of 1
Maybe explain the issue a bit more, not sure what the question is
Sounds like youโre describing a collision issue but ๐คทโโ๏ธ
The thing is I am trying to create a Cover system Eqs in unreal as you can see in the image using overlap box but when using EQS testing pawn it is also creating points that are colliding with a pawn
I only want it to go near world static objects
only
I seem to remember Luthage saying the testing pawn has some issues
also no idea what the testing pawnโs collision settings are
Either way, try testing differently
Like how Should I test it differently
Likeโฆ with a regular pawn
Is there a way to delete just a single entry in task or transition within a statetree? It has yet to become an issue, but I can see myself needing to remove something I no longer need; Do I just leave the entry blank and hope it's not too much an eyesore? (Because I will)
Huh? Isn't that just a regular array editor so you click on the little arrow icon and it should allow deleting it?
I have two character classes, with AI perceptrons. The Friendlies and the Virus's. I want them to hear each other, but for some reason they don't sense each other. Why?
Here is the code in the Friendlie Character
Here is the code for the Virus Character
Here is the code for the Friendlie AIController
Here is the code for the Virus AIController
Ok, I worked on something else, and now their sensing each other, so.
There's a pinned GDC talk that's about picking the right architecture for your project. It also has a table that shows the pros and cons of each one.
I haven't had the time to really look at state trees yet. They aren't ready for production and I'd already decided on our utility/BT hybrid when they came out. From what I've seen, I really don't like it but it's a better option for those that can't grasp the concept of a BT.
Unfortunately the overlap test does not ignore the quierer. I recommend picking a collision channel that is ignored by the pawn and not the world.
The testing pawn doesn't work for anything that only works at runtime. Like a context that gets the player or gets a value from the blackboard.
No. You'd have a BT task that gets all the attacks from the pawn and picks the best one. Then another BT task to execute it. Though tutorials would never get that "advanced" ๐คฃ
Ok, I am very frustrated right now. I have these two character classes, Friendlies and Viruses. They make noise. I make them play sound at location. I want them to hear each other. When the viruses hear the friendlies, they go to the noise the friendlie made. I am stumped. I am struggling with the behavior tree. When the Virus hears the Friendlie, they go to the sound location. I can't get the blackboard value to update.
Sorry to necro this old thread but to you have any idea why this is off by default, is it very expensive for some non-obvious reason? It seems like expected behavior for this to fire and quite confusing that it requires a project setting. it also seems like something that should fire reasonably infrequently if you have a reasonable max age and thus not something I'd expect to be a performance hog. I find the event useful, but want to make sure there isn't some major hidden cost to turning it on.
You're setting "can see player" while using "can hear friendly" in the BT.
Ah, I was thinking I was limiting myself only knowing BT, prly because I donโt know enough about FSMs or Utility (tho I think I should stay away from the latter at my level, based on some of your remarks on it)
Good to know
I donโt know why itโs off by default but profiling is always better than speculating when it comes to cost
Understanding the different architectures and their pros and cons is actually really helpful.
It's really not that expensive. You could profile it, but given what it's doing it's unlikely to cause any problems.
state tree question: how does hierarchy work with transitions?
for example, imagine I have a state "attack" that runs until my AI character gets a retreat signal from an external coordinator. within attack there are multiple sub-states to position the character, do the attacking logic, etc.
is it sufficient for me to put the "transition out of this state when I receive the event 'retreat'" at the parent "attack" state or does this need to be put into each child state of "attack" as well?
im trying to make my ai go through doors and im unsure how
Enough to put it in the attack state. All parent transitions are considered
wooo love that, thank you!
im trying to make a horror game and i want the monster to hear chase roam and open doors would anyone have a yt tutorial on any of those things
hear
AI perception
chase roam
Navigation, doable in e.g. BTs
open doors
Some interaction system, could use GAS or smart objects
im a bit new to this could u explaing chase/roam and open doors
In BehaviorTrees you have the "MoveTo" node.
With Roam you'll just pick random points in your level around the character and use the MoveTo node to move there.
With Chase you'll pick the player's position and use the MoveTo node to move there.
"Open doors" can be implemented in multiple ways, off the top of my head I'd just play an animation on the monster, give the animation a notify and play an "open" animation on the door when the notify is triggered
But all of those are tightly linked to Behavior Trees (or state trees if you prefer)
can i call btt within another btt
Can? Maybe
Should? Doubt it
i want when the ai can't chase anymore to do something else, not sure what the best way to do this is
Thereโs nothing wrong with running subtrees, if done right
because when it finishes execute, it just gets stuck in a loop when player is unreachable
do i need to use a decorator or something?
I thought btt is behavior tree task
Oh, yeah I misread ๐
so any suggestions on what the best way to handle this is? i kinda figured something out but the behaviour tree is conflicting as the player is in sight, but unreachable, so it keeps aborting and starting again
This might help you
https://forums.unrealengine.com/t/getting-ai-to-interrupt-abort-behavior-tree-moveto-task/306919/23
This is an old topic and there are many conflicting ideas for making this work spread across the forums. Hereโs what I feel is the most elegant solution for UE5 using just a few very simple custom nodes. Use case is the following: the AI agent should MoveTo a TargetActor. If during movement the TargetActor becomes unavailable, abort the MoveTo....
Thanks, I will have a read
It depends heavily on how you're setting the target location in your blackboard
i just feed a reference to player in the aic
blackboard then stores the variable and i use it
I might misunderstand but why does this even need the parallel? Can't you just put the decorator on the MoveTo?
Also be wary of repeated looping of a node that finishes immediately - this can have a noticeable impact on performance, but maybe it's not so bad when it doesn't have to search through multiple nodes for it
Well no, because it will move as long as it has a target
could do decorator target is not set but tbh it's not working and also it's giving me a headache
You have to conditionally unset the target, then MoveTo's observer will abort it
I mean the decorator failing would abort the MoveTo node so I'm not quite sure why it wouldn't work like that
I seem to never have any actual usecase for the parallel node so just curious lol
It can't go faster than the tick frequency you give it, since it's not an actual parallel task
I don't think it aborts the actual move task
The execution, yeah, but not the task doing the movement
I'm fairly sure it should, if aborting the MoveTo BT node doesn't abort the task that seems like a rather strange oversight
I mean I can try it
I guess it's possible it might not, but at that point personally I feel like I would rather make a new MoveTo node that handles it correctly :)
Too much work for me ๐
heh
I'll try it later though and report back
Also regarding the perf thing - I had a scenario in my code where an idle AI was repeatedly just going back to its "do nothing" BT branch which was effectively just a node that did absolutely nothing
I had a bunch of them idling in the level and they all kept looping into the idle node over and over again
I was doing some profiling in Insights, and the "BT Search" cost was quite high - I replaced the do nothing node with a Wait that had some random time on it, and it immediately got rid of the BT Search cost in the frame almost entirely
But in my case it would've gone through at least a few other possible branches during the search, so the cost of the search would probably have been higher than in a loop where it just has that one node and nothing else to consider
For some reason my AI gets stuck in attack mode and the simple node isn't making it work
I'm doing ''ai'' with behavioral trees for my units in rts game. It's gonna be quite simple thing, like if player click on enemy, it sets it on target and as long as the unit has target set I want the unit to follow > check distance > attack etc. So now what I'm brainstorming is, because I have Units that can be both, ran by player and ran by computer or by 2nd player (mutliplayer game).
The question is about general approach.
Should I create universal AI for unit, and then everyone can use it in the same way (it's kind of like I'm creating a way how the combat between units looks like, when they retreat, when they engage, when they are idle etc.)
Or should I create different AI for the player, different AI for the enemy and different ai for the 2nd player? Or I will be actually able to use the universal AI for general behavior of all units, and then maybe I could make ''computer'' ai a little bit harder / different than the ''universal one", so you know, it looks like pc is trying to do something better from time to time.
Is there a big difference in the base in DetourCrowd and NormalAi?
There's an AI with Blueprints course on the learning library that is pinned here.
Absolutely nothing besides detour using the crowd avoidance system
Ok, thank you. I'm doing some tutorial on Ai and I know this detour is good when handling big amounts of units (or at least more like than 1 ๐ ) so I decided to go with that from the start and follow the tutorial, hope everything else will work with it
In theory the "universal" approach is the best in terms of requiring the least amount of specialization but depending on how your game works it may require some AI player specific bits as well
So I think I will go with overall universal AI for all the units, and then I will specify probably some behaviors for different types of units (warriors, archers, healers) so there will be base for all, and then I will override or add additional for these different types. Does it make any sense?
And If I could ask, i'm thinking about future already, but are things like, let's say I want for my warriors to have mechanic, that every 1 hit they gain stack of bersker, which gives them 5% boost of dps etc. There is max set of stacks, and also if they don't attack in some amount of time, they lose the stack.
Is this a mechanic I should create in just blueprint (maybe as component?), or this is something I should create with behavioral trees?
or I will want for the archer to every 3 hits, deal aoe dmg at the target where it shots, for example
That should be on the character not the AI.
Not enough information to give advice.
but If I'm doing 'attacks' on behavioral tree I can give info to the unit that it actually hit so I can count how many hits it made? and mind it that these are units, so it's not a 1 character.
I guess this I can somehow solve, so nvm.
What else should I provide?
More details or like perfect example how I want the gameplay to look like?
@uncut rune I'm not an expert at all, but maybe my setup will give you some hints or inspiration on what you could do:
My BehaviorTrees don't really contain any logic in terms of animation, or gameplay rules or whatever. All they do is request movement using MoveTo and then activate an ability (GAS) that may or may not be available.
This is the same thing my player is doing: requesting movement via input and activating abilities via GAS.
Then your behaviors become very generic "commands" and the AI is agnostic of how exactly it is supposed to do something, but only needs to care what to do and when to do it. This means that whatever your player can do, your AI can do, too. Varying AI enemies is then just a question of tweaking variables on BTs or injecting new subtrees.
Attached is a very simple "Go to target and pick it up" behavior in my project as an example. The AI moves to a target actor, activates its "PickUp" ability (which is exactly the same ability the player is using) and then handles success/failure accordingly.
The BT should not be doing "attacks". It should be telling the character to attack.
Well, for starters you need to know what the actual differences are between them.
Why aren't you waiting for the ability to finish in the task that executes it?
Thank you, always good to see live examples!
Should I? I have several abilities where I don't care to wait for them to finish
How would you cancel the ability if this part of the tree is aborted?
How would the tree be aborted at that point?
Also the pick up ability auto cancels if e.g. the target becomes unavailable
You can make the waiting to be conditional, though I don't know of any use case where you wouldn't want to wait.
Death, the world shutting down, you add an abort later, you have other abilities that are affected by observer aborts.
You also have 2 BT tasks when only one is actually necessary.
Hm, good point, I'll add another selector with WaitAIMessage and if this fails I'll send another GameplayEvent to cancel the ability.
I'll consider putting both tasks into one later on
That doesn't solve the problem. You need to handle when a BT task gets aborted.
What would be optimal then?
It's optimal to have the task that triggers the ability to also wait for it to end. Then use the abort functionality of the BT task to cancel the ability. If you are using BPs it's the Receive Abort event.
Oh okay I get it now, if the tree is aborted shortly after sending the gameplay event it won't even have a chance to wait for the AI message to come back. Gotcha, thanks, in the backlog it goes.
What is a good way to make my AI start blocking attacks?
How can I integrate the Wrestling part into the Enemy Behavior Tree like this. I had Animation. Thank for helps
man that looks painful af lol
this is more than BT though
this is basically A-B sync between two animations where code checks for a specific input
It absolutely, 110%, is
And I am doing it in a MP context ๐ญ
Still haven't gotten it right.
This is RE3 remake btw Eren
didnt know it had remake too
Thanks!
Synced animations in multiplayer is real hard.
Nothing in that should be in the BT other than triggering the attack. I highly recommend using GAS for that.
I regret my life choices everytime I return to trying to get it to work ๐ญ
agree !
thank you, i'm learning it
why anims has to be synced
as long as desync kept within 0.2ms which always happens
cant you get away with server being a bit ahead of server
either way, god of these things are vori
might wanna ask him when you see him around but its very rarely he visits slackers anymore ๐
Hello
Currently, I have a small combat system, which what it does is that when viewed with the Sight sensor, the AIController changes the character's state to Attacking; When this happens, he basically hits and strafes for 1 second.
There is something I'm seeing that is wrong, the Attack and Strafe occur because I can't execute anything else since I don't have the enum at any value that the Behavior tree can take
It is highly recommended (According to what I read and I think I understood) that this has its own state and the logic of when to execute these things from the same AIController is handled, right?
I want to make sure I have understood correctly some things that I didn't understand completely well before.
Anyone an idea why my AI fails to reach this selected actor?
what does the vis log say? ๐
The Simple AI Move to always return aborted but for no reason. I even added it to a blanck character and just called it on begin play once to test it
Navmesh is shown like this in the debugger
Again, look at vis log [VisualLogger] (what you're showing on the screen is the gameplay debugger, not the same thing). But by what you do show I can already tell you either have different navmeshs settings in the project settings and in the map itself, and/or you have multiple SupportedAgents and the AI agent in question question is using the "large one" and the goal location fails to project to navmesh (which will be explicitly mentioned as the failure reason in VisLog).
Yeah I have different agents for AI and vehicles. How can I change the agents assignment? What I found was it's using the radius to determine the agent but apparently it's not working ?!
It should "pick the best match" so something that's equal or larger than given agent's radius (and other parameters to a lesser degree). Make sure the navmesh you'd like this agent to use has the AgentRadius equal or larger than the actual agent collision radius. There's also a way to indicate a specific navmesh to use when requesting paths, but I don't remember how to use it ๐ And I don't think it's exposed to BP, in case that's what you're using.
It actually is the working when I change the values. But not expected. The Character Agent has a Radius of 40 and the navmesh was set to 40 and it did not work.
Setting navmesh to 50 and still nothing. Setting it to 75 and it 'works' But still can't climb a slope
i know this is quite broad but does anyone know why my on perception updated event is not triggering? I set everything up correctly :/
got a stimuli on player, got sight set on player stimuli and ai stimuli, enabled stimuli, set default stimuli on enemy , everything :/
even debugging looks good and everything set but event is not detecting the player
Which delegate are you subscribing to?
in English please? ๐
There are multiple delegates (events) that you can hook into: OnPerceptionUpdated, OnTargetPerceptionUpdated...
oh
Would be good to see which one you're using and how you hook into it
I tried both, but I am trying to get On Perception Updated (AIPerception) to work primarily
I did try target perception, same thing, no joy
obviously this is a testing mess
but regardless doesn't work
And you have the sense configured in your AIPerceptionComponent?
How about detection by affiliation?
and ai controller is set up in the enemy bp
this is on my character bp
not sure if that's what you mean
You might wanna checkmark all of the boxes in "Detection by Affiliation" too
In the sight config
Neat
Happens too often, not sure why they're all disabled by default. Or at least they could have the category uncollapsed by default.
Yeah especially because I heard the only way to put them to use is through cpp which is no good when working in bps lol
Is it okay to use BTS in this way? Within the BTS what I do is define with a series of things whether I should attack or strafe
Why not use decorators?
I never understood how to know when to use decorators and when to use services
Decorators can affect the execution flow of your BT, so it's used e.g. for conditions, guards, blocking etc.
Services can't really do that and are (among other use cases) for prepping the data in your blackboard. They can e.g. tick which makes them more suitable for this
I prep some of my data in the AIController beginplay or even within certain tasks, is that bad practice? I don't really use BTSs
Of course, I used a tick and a delay that changes to Strafe every 5 seconds just as a test, my idea would be to obtain, for example, life and hits and based on that increase the probability of block and strafe, but still I don't know if I should do it in a service or in a decorator
i make this only for test and works well
to obtain, for example, life and hits
This is a service, because you're writing/reading the blackboard
based on that increase the probability of block and strafe
This is a decorator because you're conditionally entering a different branch of the tree
Oki, thanks!!
It pretty much always boils down to this:
Decorator: Conditions
Service: Writing to blackboard
Task: Executing some logic
I'm going to get this tattooed, thank you
@floral compass i write to blackboard using tasks/the controller bp, instead of services. Most of the tutorials I've seen never really use it, is that bad?
sorry i meant tasks
One particular feature decorators have is that they can control the flow of the graph execution, although in custom BP decorators you can't really affect it, just in C++
It depends, sometimes it doesn't make sense to have yet another decorator just to get a variable into the blackboard that you had in your previous task. I wouldn't sweat it too much.
Services are also useful for doing stuff like "guards", although you could do those as decorators also I suppose - basically ensuring that certain logic always runs when entering and/or exiting certain branches of the BT
General good practice to avoid using too much Booleanโs and replace them where possible with float values
?
If value > or< do whatever ?
That depends on the use case. Some things are boolean, some things aren't.
Here is an example of a workflow I've done
In many cases designers want both: a boolean to definitely enable/disable a behavior and a float to give it a chance to proc
Obviously find reachable gets random point in radius and sets value as vector in blackboard.
I guess it's alright? Though I don't know why you wouldn't want that as a service instead which gives you the added benefit to configure when the service executes: OnBecomeRelevant, CeaseRelevant or on Tick
This also forces you to always prepend a sequence node before you can use that, no?
I mean I have the exact same functionality as a Service node, I can send you the C++ code for it if ya like
I am a rookie in C++, I mainly use blueprints unfortunately, but thanks anyways ๐
Sure!
Which of these should I use if I want to switch between attack and strafe with some calculations like hits received, maximum health amount, etc?
I thought about using the tick but it seems a bit heavy for me
Is there one that runs when I send a signal from the controller?
Maybe I can use some event dispatcher from BP_EnemyAI but I don't know with what event
Which of these should I use if I want to switch between attack and strafe with some calculations like hits received, maximum health amount, etc?
You're trying to do like 5 things at once, you should break it down and implement step by step:
calculations like hits received, maximum health amount
Calculating something and writing it to blackboard makes this a...?
I want to switch between attack and strafe
Switch is synonymous with conditional which makes this a...?
Calculating something and writing it to blackboard makes this a...?
Service? ๐ค
Switch is synonymous with conditional which makes this a...?
Decorator
I don't understand, so for what I want to do, should I do the reasoning and find out if it does the strafe or the attack from a service and then change states with a decorator?
I've only just now realized that you're trying to do a state machine in a BT
But basically yes, your service would do some calculation (which is kind of intermingled with decision making in the case of state machines) and your decorator would simple ask the question "Is my state X, Y or Z?"
That being said, BTs are not really suitable to implement state machine logic
Depending on the planned complexity you might want to try something else there
Do you recommend using State Machine and not Behavior tree?
Everything always depends on something hahahaha
I wish they made it easier to combine state trees and behavior trees but nope
I don't think I would want them to combine them, that sounds like nothing but trouble
How would you want that to work?
I don't want my AI to do anything more than Attack, defend, strafe and patrol, I think it's something quite simple, I will continue using the Behavior tree, if at any time I feel stuck I will try to use the State Tree
That is absolutely reasonable to implement in BT, don't get discouraged
Well to be fair I haven't thought about it that much, but it feels like there are situations where you want to have a state machine that gets triggered via a BT, or you want to have a state machine which runs different BT's
Thanks for all the help mugenmelon
Anytime!
I just have to see what events to use in the service and in the decorator to be able to make the system
Can I use tick on both? I really didn't like the tick at all.
Both of which you can implement relatively easily yourself, no?
For example I have kind of stateful AI logic where certain behavior trees run based on the task the NPC has. I also trigger things like putting the NPC into a conversation/interaction mode from the behavior tree, which is a more of a state machine
Creating a latent BT tasks that triggers a ST shouldn't be too hard. Have you tried prototyping it? ๐
Well yes and no, I'm not sure how easy it would be to have both a state tree component and a behavior tree component on an AI controller due to there being a direct dependency to the brain component
Well you gotta be careful with that. Are we talking about AI state, or are we talking about pawn state here?
Yeah something like that could potentially work, but I've got several dozen other things to work on in this project so haven't gotten around to it :D
Depending on the answer the state machine goes somewhere else
having both at the same time is not supported by AIController's design. One or the other should be the "main thing" and the other run component-less. Since BT cannot run without BTComponent then ST would always need to be run component-wise. I'm not sure that's supported though, running a ST on AIController that has a different BrainComponent.
AI, for pawn it wouldn't probably matter as much given you can easily have a ST component on the pawn separately since it doesn't have brain component related logic on it to begin with :)
Yeah that was pretty much what it looked like to me as well. I was looking at if it was possible to run a state tree without the component as it kinda looked like something that I could do, but at least preliminary investigation made it look rather complicated :)
Ah right, gotcha
It's definitely possible though, Mass-driven crown in the Matrix Demo / CitySample runs STs, and there are no components involved (by design).
Interesting, is this somewhere in engine or would I need to look at those demo projects?
I'd start by looking at UMassStateTreeActivationProcessor::Execute and see where it leads me.
Thanks, I'll have to check that out
Speaking of @crystal hatch , do you think the UHTNBrainComponent will ever get some love? ๐
I don't think so. I'm off to other things (#mass) while no one else on the team seems to be interested in picking it up. There's also no internal need, so it would be a hobby project, and I have plenty of nicer ones ๐ Then again, who knows. If there was a PR improving our HTN I'd definitelly consider it ๐
I have this in a reception activation AI in my service, I am making the greater the difference between the maximum life and the current life, returning a percentage with a fairly simple algorithm, but I should use a decorator to change between the states , and not from the service, right?
Services cannot control the BT graph flow so yes you need a decorator if you want something to change which BT branch runs
Right now, the big issue for me has been getting the timing right for the client to break out of the grab before the server says they were damaged. Then actually cleaning up the code a bit to make it more followable ๐
I'd say to just pick up the HTN Planner plugin by @brittle lynx. It is very nice.
But the only thing I did in the service was to calculate the percentage, when this is executed, the behavior three changes because the state from the AIController changes
With this
Is it wrong to handle it like this? Should I use a decorator yes or yes?
I don't think it really matters that much which one you use if it works and does what you want
The only real difference between services and decorators is that decorators can directly influence which BT node is active (eg. they can abort trees or loop trees or whatever)
Otherwise they are more or less the same in terms of what they can do
Any reason why you're using timers there?
Hello everybody!
I also have a problem with the animals (I have the ones from the "AnimX: Forest Animals" marketplace), namely the animals do not move in unreal 5.4 (my project was made on unreal 5.3 and they worked perfectly).
Does anyone have any idea what the problem could be?
Thank you!
So that it stays in strafe for a period of 1 to 2 seconds and then attacks the same target again only if it is still valid (if it does not stop being seen)
That kind of flow would also be possible (and probably cleaner) in BT tasks, just a suggestion
How could I do it? Without delay?
A quick fix would be to use the Wait task in conjunction with your desired behavior
After the wait task is over you could change the state from within your BT without your AIController needing to get involved
Alternatively it would be possible to do something with latent tasks, but possibly requires C++
Something like this?
Well no, you want to strafe for 1-2 seconds and then switch to attack, right?
Yes
What you've sketched there will strafe, then stop and do nothing for 1-2 seconds, and then attack
so any one knows if Mass is still being actively developed?
Instead you would need a simple parallel node:
Left side is your Strafe sequence
Right side you would Wait 1-2s -> Clear "PointOfInterest" from blackboard (this aborts the MoveTo) -> Attack
welp, guess I didn't scroll enough today, thanks for the info.
What is the best way to clean the PointOfInterest Vector?
There's a "ClearValue" node on the blackboard
Thanks
Thanks
The Blackboard is from Controlled pawn or the Owner Controller? 
I think is from Controller
Controller usually owns the blackboard, yes
I think I followed everything to the letter, but the point of interest is generated again, also I don't have any logic so that if there is no point of interest, it changes state, should I do it?
Well first off you're using a selector, not a simple parallel
Second you've implemented what I've told you not to implement before ๐
What you've sketched there will strafe, then stop and do nothing for 1-2 seconds, and then attack
And what is the Main task?
I can't put the sequence as if it were the main task, but I don't know what task to put as the main one, I suppose that the sequence with everything from the EQS would have to go in the parallel connection
and the attacking have a invalid abort setting
You can plug in just your MoveTo, like this
I use MoveTo towards a target actor and then conditionally clear the TargetActor to cancel the MoveTo
The parallel part is not executed, only the main task
I think it is because it never finishes executing because the point of interest is generated in the parallel part
I don't know if my assumption is wrong
Wait I'll sketch it out for ya
oki thanks
Like this
The simple parallel will execute the MoveTo AND the wait until either:
- You've reached the PointOfInterest
- Wait 1.2s is done
After which you can go to your attacking state
Trying to model state in BTs is always a pain
Oki thanks
Last question, what is "Set state to attacking"?
I dont have a task for this
Also make sure to have "Observer aborts" checked on the move to.
As far as I saw you set the state to attacking after strafe, right?
Yes
With calling a function in my Controller
But, now, this function is called from the service in the top of the BT
I now, the service not is for that, the service is for change blackboard values
but, i dont know implement service + decorator
Oh how does the service decide whether you should attack or strafe?
Obtain the max hp, the current hp, substract that
Divide this in 40% and compare with a random number in the 1 to 100
if the random number is in the range of the number selected:
I guess that works? Then you don't need to explicitly set the attack state
I thought the whole point was that you want to Strafe for 1-2 seconds and then attack
Yes i need that
That works yes
But i use timers for that
And that's not so good, is it?
It's not optimal
You're outsourcing part of your behavior outside of the behavior tree
But if it works for you it works for you!
I can imagine it getting complex after a while tho!
Sure no problem
Does anyone have advice on adding hysteresis to EQS queries?
For example, I have an EQS query for target selection, but it bounces back and forth too quickly in certain situations. I would like to add some logic to prevent this -- potentially, I want to say only choose target if you have a score greater than 1.x times the previous target's score. Is there a way to do this without manually tracking the previous target's score via a Blackboard and using a custom EQS filter test?
It shouldn't be bouncing back and forth. Are you using this as a service or something?
Target selection should be a Task imo, and then the next task would be to do something with what is found.
It could be either (but assuming it's a task), and it will still happen. For example, in my ranged combat behavior tree the sequence could be: choose target, then fire weapon. If it selects a new target each time it fires, it looks like it's bouncing back and forth too much.
So, you can store the previous value wherever you want, but then you also have to consider a way to "forget" that previous value.
But if you want some kind of history, that is custom territory as far as I know. Not like it is too difficult to do mind you. Heck, it could literally just be a value on the AI Controller.
Yeah, that makes sense. Thank you!
Store it in the BB, store it in the AIC, store it in the task memory. Just overall, there needs to be some way to track the history.
And make sure to have logic to handle cases where it needs to be zeroed out entirely
It'd be weird if it got stuck on like 100, and no one can get that high again until they're in the AI's face
So maybe a service that will zero it out when the nodes cease becoming relevant or something. But then you have to handle the cases where they should still be attacking, and then the sequence completes, so the BT reevaluates - thus firing the service's OnCeaseRelevent function
So, just think about that kind of stuff.
Hmm, any ideas why this enemy guy cannot see me? Did I forget to change something in settings ?
do you have a stimuli source on your pawn?
Do you mean this?
this is AIC_Enemy and it's assigned to that Actor (Enemy)
no, read the question again
I don't know what is stimuli source?
there's your problem
assuming you followed the usual setup of disabling all pawns as sources, your target's bp needs a stimuli source component added
I don't remember disabling anything on pawns or something like that
Hi! I want to change the move speed for my bot when it enters a specific NavArea. Could anyone help me? NavArea defines a specific type of surface, such as water or sand.
I forgot to check these 2 ๐
you should probably watch the pinned video on AI Perception and Behaviour Trees, so you can see how it's normally supposed to be setup and how perception works etc
I'm watching one series now and I'm trying to kind of implement it into the game I want to have. It isn't too much different but in the tutorial there is like 1 player which is you, and the other player which is enemy so it's simplier than when I have 10 units and who should do what etc. After I finish one series I will check it out for sure. And If you are talking about behavioral trees I watched this series already.
it's not a series
it's one video
ok, i will check it out for sure
but if you're doing AI with Blueprints that's a good start
I didn't say that
I was talking about the series
if you're watching anything other than those 2, you shold probably scrap it
lots of trash "tutorials" out there
I mean it's only 1 video with 26min, always good to listen
I found actually really good one
from Ali Elizohery maybe you know
In this Unreal Engine Game development Tutorial you will learn the following:
- AI Perception: How to setup the AI Perception component
- Sight: How to get the enemy to attack when seeing the player
- Sound: How to get the enemy to go investigate a location where sound came from
- Damage: How to get the enemy to respond to getting damaged and at...
haven't seen it, but I'll take epic official ones over randoms any day ๐
but I feel like it's easier when you have kind of 1 enemy to track, than to 10+ units
idk, still confused on tpic ๐
i'm on the right track, but still long to go, and i'm getting confused because someone said I should actually make my rts unit behavor only in the blueprints, but I find behavioral trees actually kind of nice, but maybe I don't really need this for the units? Where I think I could use them is to create good ai monsters / enemy etc. ? not sure where to use what yet ๐
for an RTS you will likely need BTs
or some form of AI system beyond just AI Controller basic stuff
you know, right now I'm trying to just focus on making units behavior which is basically attack coroutine (attack, wait for cooldown, check distance of target) and something like if have target then do coroutine, if not have target then idle, and the way to feed target to the unit is either it get's into collision with enemy (detection range = sphere colision), or when a player sets target with right mouse click.
I'm thinking about doing the attack coroutine inside behavioral trees and the rest I think I could do in bp, but then I found about these senses, which could be maybe better to use than sphere colission etc.
I'm confused. you know bt = behaviour trees right?
Ah I c typo haha
yeah ๐
So I'm mapping out my project and need a little advice on StateTree structure.
My characters are intended to use the same AI, but are driven by needs and goals created from a suite of parameters that will, hopefully, organically sesperate a human from a horse.
This will probably get pretty messy in a single state tree, but it doesn't look like I can nest statetrees each other, only replace them entirely at runtime, and that presents a challenge in passing state data to the new tree; is that a better practice or should I use one huge tree and deal with how long it might get?
and that presents a challenge in passing state data to the new tree
How so?
Transitions across state trees
fwiw 5.4 includes the ability to have subtree assets
That sounds off to me, could you explain?
I saw that, but it's not immediately stable and ate my project when I tried to upgrade lol. I'm waiting for .1
Yeah probably would also wait, it seems to have a lot of random issues
I don't have a way to transition to another state from another tree. I can think of some ways to buffer data via the AIC to shuffle around the root, but I'd prefer going directly to states to avoid unforseen complications with that method
No the question was rather why would you need to transitions to another state of another tree?
Organization, hence my framing of my question on advice for statetree structure.
Oh, gotcha, didn't catch that
Subtrees are the only "solution" for now until 5.4 is stable
Splitting each character's status (we'll simplify it into idle and alert, for now) into separate trees will be much easier to debug, but what if I want them to go from trying to find and drink water to immediately fleeing to safety in the alert tree?
I was just going to use a new "root" for each status
I've worked with behavior in DECORATE for 15 years. I'm not afraid of a long list of states 
... But I do like my code to be readable; so 5.4 it is
Thankfully I can work with my current implementation and split it up easily enough in a few months. If not: well that's just more experience, then
Your root state in the alert tree would be set to "select children in order" and the conditions on those children would be set up such that "fleeing" is the next transition
Aye, but doing that every time I need to cross states is fairly rigid. At least when hotswapping the ai tree on the character
If you want to trigger it via event (which it sounds like you do) you'd just send a state tree event
But true enough would take a bit of implementing to switch the tree and send the event
I'll keep that in mind. I'll try a few implementations as I grow the library of tasks these little brats need. They thankfully just run around and scream about where they saw the player and avoid their location history for pathfinding.
Presently, at least. I'm making a mountain of a project for myself and I'm ready to hurt.
That's the spirit!
Also events buffering state changes will be easy to swap for 5.4's subtrees. Just gotta go through every transition. 
Don't use a timer in a service like that. Use the tick. The service should only run when that branch is active. Not on a timer. Services also have a tick interval built it, which is the same as using a timer.
Why are you doing this with a simple parallel and an empty task instead of directly on the move to? That makes it unnecessarily complicated.
In C++ you can get the area class in the path following component during the move.
On the move to it would be a service that checks the condition and clears the BB entry?
Yes.
Back when I implemented that tree such a service seemed too specific for me, so I opted for a more composable (?) approach
Also considering that I want to add further conditions but would hate having to adjust the service all the time
Or having to add new services for this
I just searched for something in the UPathFollowingComponent, but unfortunately, I didn't find anything. Do you have a code snippet, or maybe you remember the function name or delegate I should look at?
You're already using a service. Making it a simple parallel for no reason doesn't solve that problem. It actually just creates more of a problem by adding unnecessary complexity.
but the timer is in the ai controller
But it's an abstract, reusable service that I don't need to change, that's the reason.
Or do you have a suggestion how you'd extend the service once new conditions are necessary (ideally supporting both logical OR and AND)?
The function is SetMoveSegment. It's been years since I've done it (we no longer use recast), but this post has the instructions: https://forums.unrealengine.com/t/navlink-and-making-ai-jump/3154/4
A proper C++ solution would involve following steps: Implement a new Navigation Area class - you do that by deriving from [FONT=Lucida Console]UNavArea. Letโs call it [FONT=Lucida Console]UNavArea_Jump Define a โjump flagโ - the implementation details donโt really matter, but a enum would work best here. Set the โjump flagโ in [FONT=Lucida C...
thanks a lot
I have a level that i've made - stupid simple with a landscape + navMeshBoundsVolume to cover it.
I have AI thati'm instructing to AIMoveTo - and when i am playing IN This level specifically - things work fine and the AI moves....
if I Load the level via OpenLevel(levelInQuestion) - then the AI will fail this task.... how can I debug this?
the AI Controller IS VALID at this call in both scenarios
Hi. I'm trying to add nav agents and engine gives this message.
In a world partitioned map, changing this property changes the partitioning of actors.
For the change to take effect on partitioning, actors needs to be resaved.
Run the WorldPartitionResaveActorsBuilder to update the whole map.
Whats that?
Also i want to know how these Navigation agents work and if i can achieve better results if i use them. Now i'm adding agent and bots stop moving.
there is a world partition documentation
it has WP commandlets at the bottom
run the one for resaving
agents are only worth it if you have bots of drastically different sizes, unreal will decide which NavProperty goes into which agent
you can get the same size but different nav behavior with navigation filters and modifiers
Yes, i need that. I changed agents and bots stopped. Where i can specify what agent they should use?
iirc you can't
if you have a dog and an elephant, the engine will make them different agents, if you have 2
if you have a dog and a wolf, they will be the same
Is there tutorial that explains how to set up agents and what it variable means? I created 2 additional agents, put new navmesh volume and choosen new agent as supported (with different color). Nav plane don't appear. Whats i'm doing wrong?
You don't need multiple volumes, unless you have distinct areas for navigation. You should delete the recast actor(s) and rebuild paths.
The navigation system picks the best nav data for a character's agent settings. By default it takes the capsule radius and half height. The supported agent settings MUST be > than those values. So if you have an agent that is 20 radius and 80 half height, the agent settings have to be at least 21 and 81.
In our company we managed to do subtree ourself and so far so good, but we hope subtree will bring new features with StateTree that we don't have
That's indeed pretty handy for organizing stuff and debugging
Note : in our subtree, send an event to the main tree, propagates the event on the whole tree hierarchy
I finally got around to trying this:
The MoveTo does not get aborted just by the decorator condition. Probably cause it's a latent task, or because it sends a nav request to the movement component and doesn't actually "move on tick".
You'd have to explicitly clear the nav target in the decorator, which I am not willing to implement ๐
Hello everybody!
I also have a problem with the animals (I have the ones from the "AnimX: Forest Animals" marketplace), namely the animals do not move in unreal 5.4 (my project was made on unreal 5.3 and they worked perfectly).
Does anyone have any idea what the problem could be?
Thank you!
Huh, that's interesting. It definitely seems like it could easily be implemented into the BT task to have it abort
why does my navmesh disappear in runtime ? I built my navmesh but as soon as I play I get a navmesh needs to be rebuilt warning.
Hello, is there any way to know what state my character is in? I want it to execute a montage when receiving damage only if its blackboard state is in Attacking, but I don't know if that data can be received from my BP_BaseEnemy
You can on damage event call ai controller, from controller you can call bt and send variable.
Get value from blackboard in ai controller
how would i make it so if an ai touches something they get telported
Question about decorators. If I check for a condition and Observer Aborts is set to None, I guess it's only being executed once before whatever was below the selector is completed? I'm asking because I want to have add some randomness to a decision where 80% of the time it goes down one path and 20% down the other, but if the condition is continuously being checked that would cause flipflopping.
Same way as you can make anything else teleport, f.ex. make a teleport actor which does that on overlap
You could use EQS for that and choose to get 25% of the best/worst option. And if you have Observer Abort None, then it will never abort and if already started, will always finish whatever it started.
hi
my AI goes around in circles looking for a path
I use Detour Crowd AIController
I don't know if this is the reason, but at the beginning there was a regular AIController, now I changed the parent to DetourCrowdAIController
- Create Event Overlap on the box.
- Add event dispatcher OnOverlapTeleport (input OtherActor and Hit)
- Call that event at the end of Eventoverlap.
- On the player bind to that event and specify what it will do in the player blue print (so after triggers, set location of player to be random in radius for example)
- When player gets in contact with the box, it will trigger the event and will teleport.
We're not using EQS, so I'm just making a custom decorator
someone?
this only happens in a group
Hello!
My animals don't move on unreal 5.4
I tried navmesh regeneration but it didn't work
Check in Visual Logger what output it gives
It usually shows more info on why stuff is failing to navigate
Where exactly is this?
Tools->Debug
thank you very much, i will try
could this be the cause?
Yes that seems quite likely
How can I fix this?
where are you calling the move to node? maybe you can check acceptable radius to 10 or 20 so the units wont try to get exactly into the perfect location
Difficult to say, you need to debug what the point is they're trying to navigate from. If these actors are in your level, I would start just by wiggling the actors and resaving and trying again, it could just be some weird corruption in the map.
A strange thing, I added another animal (the same) and now one of them is moving
Is it the one you added that's moving?
Yes
Yeah try wiggling the others, feels like that might fix it in that case
Or you might just need to remove and replace them
Initially it didn't work because I added the bear again, but the second time it did
Thank you very much for your help
Anyone noticed a crash upon enabling Gameplay Debugger to debug AI behaviors while running a State Tree with a subtree?
Apparently the problem has not been solved
This is incorrect. A decorator with an observer abort does abort the move.
Decorators are only checked when the BT is searching for a new task. Observer aborts work on delegates, when something happens (typically a blackboard value change), check to see if it should be aborted.
Yeah, if you set it to observe value changes of the key, If you change the key and its set to abort, it will abort what it is doing.
What do you mean by this? How are you actually setting up the behavior?
you might also want to have some ''states'' that are not possible to be aborted ๐
Then I must've done it wrong?
Okay perfect, thank you ๐
Did you implement the observer abort or are you inheriting from the blackboard based decorator? If it's the latter, it's because your blackboard key is set to self which that's what it's binding to by default. So it'll only abort if the self actor changes.
I don't understand why you are sending the self BB key at all. You can always get the controller and the pawn.
I think you have error here.
If you change this, and you have observer abort self, THEN if you change target, it will actually abort (because value of blackboard was changed)
In the future it would be better to have States of what is doing for example
AttackState
PassiveState
InvestigatingState which are all set by the blackboard key
and when you change blackboard key the tree will abort and look for other
Hi
I have a basic combat system, I would like to add a system that every x time my AI makes a special attack
Can it be done this way?
Should I calculate when to launch that attack in a Service? and if I do it in a service, I change the value of a variable in my AiController and then I execute that montage with a Task (That has a decorator that looks at the boolean that changes the service) that calls an event in my EnemyBaseAi
I thought about doing it this way, is it well thought out?
GAS might be better
I don't want the time to be fixed, I would like it to be more something that is decided by the amount of life of the enemy, the number of hits given, among other things to consider
You could set the cooldown-float variable with service which will handle the behavior you want
or you can write your own way to calculate time and also change it in service
and yeah you would change the value in aicontroller and execute montage with task
It's the latter.
So do I understand this correctly? The decorator observes the SelfActor and only aborts if that SelfActor changes? Does it check the condition again with the new SelfActor?
Yes, but you can set ''SelfActor'' that you see to be different key (AttackTarget)
This is incredibly terrible advice. Don't force a BT into being a FSM.
I would call to change the states from the BP which would also change blackboard key so it runs the behavior I want. Why it's bad?
That would not be the same logic at all
The decorator only observes the value of the variable Blackboard Key, which you have set to self actor. If you want it to observe a different BB key, you either need to change the key that is set to that variable or add the functionality to listen to a different one.
So in short I think you can abort tree if blackboard key changes (or maybe there is other, additional way).
It can be done that way. You should use the blackboard instead of a variable in the AI controller, though.
A boolean in my blackboard to activate special attack and deactivate?
Yes.
A BT is not a FSM. Forcing it into a FSM loses the benefits of actually using a BT.
Thanks
What is a FSM?
F... State machine?
Finate State Machine
I'm sorry but I don't understand, maybe I get the whole concept wrong :/
But I don't want it to observe a different actor
The decorator should execute a query on SelfActor
The MoveTo towards TargetActor should be either:
- Aborted if the decorator's query on SelfActor fails
- Switched to a different TargetActor if TargetActor changes
I really don't see how this can work other than a simple parallel.
I could use the TargetActor in the EquipmentQuery decorator, but that would still require a simple parallel to update TargetActor and also I wouldn't be able to run queries on actors other than the AI possessed pawn.
So in what situation do you need to abort that tree?
You are trying to force a behavior tree into acting like a completely different architecture, a finate state machine. While doing so, you lose all of the benefits of using a behavior tree.
What do you mean by "executes a query on Self Actor?" Are you talking about the condition check?
By default, the abort only happens when the blackboard key is changed. If you want it to abort for any other reason you have to implement it.
I still don't really understand my mistake. I should not change the value of blackboard key from AIController based on what is happening around my ai? For example:
Did my ai sight sense see something? HandleAttack -> Set Blackboard value as Attacking and do Behavior Tree, if lose target, then go back to passive state which is standing in place or patrolling?
or
Did my ai hearing sense hear something? HandleInvestigating > Set Blackboard value as Investigating and do behavior tree where it goes to the location of the noise and checks.
At what point in time did I say that you can't set the blackboard from the AI controller?
I said that forcing the BT into acting like a FSM is terrible advice. Which isn't about just setting a blackboard key. It's about setting up your BT to be broken down into states and forcing the logic based on that.
What do you mean by "executes a query on Self Actor?" Are you talking about the condition check?
Sorry, yeah, the decorator "EquipmentQuery" checks the given blackboard key actor for a condition
Okay, but why it's terrible advice and what do you mean by FSM for any example? Is Patrolling FSM? I will gladly hear feedback.
A finate state machine. Which is a different architecture than a BT. If you look at the pinned messages, I go into reasons why.
You don't need a simple parallel, especially not to just update anything. I can't really help more if you don't actually explain what it needs to abort on.
Ok I read it and I think I'm brainwashed because I really don't get it. Too many people say different things, you know...
I will try to read it 3 times more
This explanation wasn't enough?
The decorator should execute a query on SelfActor
The MoveTo towards TargetActor should be either:Aborted if the decorator's query on SelfActor fails Switched to a different TargetActor if TargetActor changes
No. Do you want it to abort when the conditions fail and the target actor changes?
When the condition fails, but not when the target actor changes.
A lot of tutorials give really terrible advice.
How often does the condition need to be checked?
Every tick I guess
You can try overriding the tick of the decorator, checking the condition and aborting if it fails.
Can you then explain to me how should I approach for example when I want the unit to Attack (follow target, hit target, cooldown, follow, hit when cooldown over etc) without switching states for example when they have target or not? I would set the target with mouse click, and set target null by clicking on ''ground'' for example. If it's that simple behavior, should I even bother with BTs. And then there would be also sense that if unit sees enemy, it will set state to Attacking and follow, hit target, cooldown etc. )
Like on this example give me perfect solution that you would go and how to implement this mechanic.
I recommend doing the AI with Blueprints course on the learning library. Also pinned here. It will explain how to use the priority of the tree to give you that behavior.
I would really appreciate it you could also put it in your own words. Do you mean that I should just avoid ''states'' and focus on making the tree don't rely on setting states, but rather on for example doing something if has target, and something else if has no target?
So in perfect word we should try to achieve the behavior we want without using states at all costs?
even if it's something simple like 3 states?
I'm not going to design your AI for you. I get paid a lot of money to do that professionally.
xd
I'll give this a try, thanks!
Someone here asked how to set blackboard values
the KeyName needs to be exactly the same name as you named Key in your blackboard
If you are in the BT, you should use a blackboard key selector instead of hard coding the key name.
why doesnt my decatoror show up I made a isinmelleRange bool but It wont show
I think you made a task not a decorator
Hello everyone, currently trying to implement my own custom UNavMovementComponent in CPP.
ABaseCharacter::ABaseCharacter(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer.SetDefaultSubobjectClass<UBaseNavMovementComponent>(
ACharacter::CharacterMovementComponentName))
{
NLOG(-1, "Custom ABaseCharacter Constructor Called");
InitializeComponents();
}
'Custom ABaseCharacter Constructor Called' is being logged.
UBaseNavMovementComponent is my custom UNavMovementComponent, and still the AI doesn't use it. Doesn't seem the constructor is being called, no log is being output:
UBaseNavMovementComponent::UBaseNavMovementComponent()
{
// Set this component to be initialized when the game starts, and to be ticked every frame. You can turn these features
// off to improve performance if you don't need them.
PrimaryComponentTick.bCanEverTick = true;
NLOG(-1, "CONSTRUCTOR");
}
Any ideas or tutorials on implementing a custom UNavMovementComponent?
Do not initialize components in the constructor. You don't actually need to call this at all, because the base actor will call it when it's appropriate.
I don't think that you can set the movement component in that way, because the base classes don't match up.
hey! I'm currently making a game where i need to analyse live video from a camera. I already implemented the video input but i can't figure out how to analyse the video. I'm using blueprints. To be more precise, I need to detect golf balls and track their movements in a short laps of time. any ideas or suggestions?
I would like to implement my own custom movement logic for ai. Any ideas?
Havok ๐
You're on the right track, but you might need to drop down to using a pawn instead.
I have this "traphole" that I want AI to be able to walk into, is it possible to make AI think this is normal flat ground and try to walk over it?
put a mesh over it for it to generate nav, then remove it when something steps onto it
(it doesn't have to be visible)
Nav Modifier Volume and you can drop it on that place
How to change the value of wait Task in behaviour tree on run time?? i searched the forums and found something called "Wait Blackboard time" but thats a blueprint node how to get that in c++??
Found good tutorial for recast, this should be pinned. https://www.youtube.com/watch?v=II5agHlxUe4
But that was for ue4. Now there is resolutions, what are they doing?
How to get rid of gray deleted recast? It annoys me ๐
Optimize your NavMesh with the Recast Object and Fix common NavMesh Problems like bald spots and the NavMesh clipping through geometry. Also get an explanation of each setting including Region Partitioning, Layer Partitioning, Tile Size, Cell Size, Cells per Tile Side, Cell Height, Agent Radius, Agent Height, Agent Max Slope, Agent Max Step Heig...
Also what these checkboxes do in agent settings? Does it mean i can do jumps without links? Swim/fly?
afaik these map into the CMC settings with same names in some fashion but never really looked at it in detail so it could be something else
I don't think it means the agent can somehow go across mesh boundaries without a link though, at least not by using the normal navigation methods
Hmm, what is the difference if I use OnPerceptionUpdate inside AIC_OfMyUnit instead using it inside Actor?
So is there an up-to-date GOAP AI framework that works with UE5?
Nothing whatsoever other than you'll get a nag about it if it's in your actor
Didn't understand? nag if its my actor? do you mean if i would have it in both places?
No I mean if you have the perception component in your pawn you will get a warning in the output log that it's not intended to be there and it should be in the controller instead
(It didn't use to do that in earlier versions of UE so I guess a lot of people had theirs in the pawn)
Unclear why they made it work in both the pawn and controller if it was intended to be in the controller :P
hmm because I'm watching official tutorial about AI
and he is doing that inside BP_Thirdpersoncharacter
instead in the AIC_ThirdPersonCharacter
Which tutorial is that?
Classic Epic quality documentation I guess...
Although to be fair that looks like a pretty old tutorial from how that UI looks like
So maybe they hadn't decided it should be in the controller at the time
so what raised my eyebrows was that then he casts to the AIC XD
and i was like wait what ๐
Yeah
like, why not do it inside AIC then since it's on every character that you want it to be, right?
it's like componentso every ''unit'' has it ๐
and the other tutorial i was watching before did everything in AIC and then it made sense there
Yeah, it seems it's intended to be in the controller as of UE5 or so, so best to just put it there
I had some old projects where it was in the pawn because for some reason I had put it there, and when I migrated them it just started logging lots of warnings about it
ok, maybe he will actually put it later into AIC or something like that
thanks for claryfiyng ๐
According to Luthage, if you want to use GOAP, you shouldn't. Use HTN instead. It does everything GOAP does, but better. (Paraphrasing - but you can search in this channel GOAP from her)
Oh, I'm exploring that option as well, but the only HTN plugin I know of is expensive as hell, lol
And it is well worth the price
It literally saves you months of work
It also very regularly goes on sale
I wouldn't consider $300 expensive. Unless you're looking at your own time worth like $0.50 an hour.
Slap it on your wishlist, wait for the next sale. Very regularly goes on a 50% sale.
Oh, neat, I'll keep that in mind, thanks.
Utility AI is the other AI framework I'm considering, but HTN looks good enough for my purposes and the way the plugin is doing it looks more intuitive than behaviour trees
Granted, a lot of AI systems use utility on some level rather than governing the entire system
Hello. What's the best way to have a behavior tree branch or re-evaluate based on a Delegate/Event? I need a character's Move task to be interrupted if they take damage.
I think you would add a blackboard decorator to the nodes in your BT and have the event modify the value when damage occurs. Maybe you want some bool to flip after taking damage but then flip back after a certain amount of time.
This is my understanding of the systems in UE5; I think this is a decent way to break down my critters, but I'm open to suggestions before I'm a year in and tearing my hair out restructuring. 
Its always troublesome with price as solo dev, when you gotta front the money vs front the work
Imo anyways
I have to spend a decent amount of time learning it aswell, along with realizing its quirks compared to doing ones own solution
(Where i only realize it when i port it to my next never released project)
I get it, but I also understand that you can make more money, but not more time.
Time only ever flows in one direction.
Dang, I didn't know the "AI" in this channel stood for existential crisis
Indeed, the older I get the more I realize.
Right? The game in you pfp released 24 years ago...
Me again with agents. What i'm doing wrong. This wheel bot should use his agent, but he using other agent.
1 pic my agents, 2 pic bot nav data, 3 pic in game debug.
Anyone implement influence maps in UE? Any pointers? ๐ค
I have an event on the character I can bind to, but I don't know how to make a decorator properly bind in that wayt.
Updating some systems in my game atm and one of them is like a "dirtiness" thing where NPC's are affected by how dirty some part of the map is... and this kinda feels like maybe it should be an influence map (dirtiness map)
Essentially, I need to abort a branch if a particular event happens, and then if the branch fails due to that event I have to run some extra code.
https://dev.epicgames.com/documentation/en-us/unreal-engine/unreal-engine-behavior-tree-node-reference-decorators?application_version=5.3 you setup a blackboard variable first, perhaps a boolean. Then you right click a node on the BT and add decorator. Choose blackboard then you can set if it aborts self or not. Set the blackboard key to the variable you want to use.
If I run a sub tree, does the node always return Success or does it return the actual result of the sub tree?
Make a big texture and map the character's coordinates into the texture ๐
Regarding the AI controller and its pawn: where should the statetree and navigation logic go; the actor or the controller? Let's assume this controller only ever controls one NPC until it's destroyed.
I have the logic on the controller for now but I'm not sure if that will cause difficulty later
By default the AI controller has a PathFollowingComponent that handles navigation, not sure why you have any choice here?
And assuming that you mean to use your StateTree for AI it should go on the AI controller as well.
Excellent! Thank you.
do decorator orders matter?
are brain messages for BT tasks guaranteed to be processed in immediate next frame after calling BrainComponent::HandleAIMessage? I think I observe that this is actually not the case and brain message can be delivered to BT task like 20-30 frames later ๐ค
also is there a node for 'can you reach this'
I think, I hope, they should short circuit
FindReachablePointInRadius is a function on the navigation system, pretty easy to make a service with that
Yeah this is actually something I was thinking about but maybe more for visualizing it, can draw the map into a render target which is used then to display certain areas as dirty
I have an usual setup happening and I'm curious how to deal with it.
- I have my character performing a long move.
- If they take damage during the move I want them to stop that branch of the behavior tree and run some additional code/tasks.
- If the move ends for any other reason I do not run the additional code/tasks.
- Damage is tracked via a Delegate and does not leave a record.
My current setup is a custom decorator that subscribes to the event while active and ends itself when it fails, running code if it is marked as Damage Occurred. However, I find myself wanting to do more and more elaborate tasks, to the point it doesn't make sense to bake them all into one decorator.
Question is how to get the damage task to last for the duration of a single execution of the tree.
Hmm, maybe I can make a separate service that sets a flag on the blackboard while active and removes the flag when the service ends?
Make your custom move task, make it so it fails if your pawn takes damage,
you can from pawn access ai controller by "Get controller" node then "Cast To Your Custom Controller" (3rd pic), and from controller set bb value. Add BT in "Begin Play" with "Run Behavior Tree" in ai controller. Set values you need with "Get Blackboard" node.
Put it first into selector. If it fails it goes to second task in selector which is your additional code. If move task success it skips additional code.
Problem is that the move task can fail for multiple reasons, such as no path available
Make task not only fail but also put some code in bb. Make one sequence with decorator in each child node that checks your code. My decorator checks my enum. And i have mini tasks that i can use to switch (3rd pick).
Which turns all these trees to state machine. I don't know how complex behavior can be represented with only boolean result.
BT is old thing and didn't get updated much. Also it performs one task per tick, wich makes it hard to do tick movement.
I'm making an ai object detection in ue5, I'm trying to detect specific objects by shape and color. How can I achieve that?
You using ue shapes? Capsule, sphere, box?
kinda. I'm importing a video and try to detect object in that
so shape, color. need to detect a white sphere to be precise
@astral mist Are you able to mark if the object is white or spherical before playtime?
Or do they need to be able to look at any arbitrary actor and decide if it's a white sphere
they need to decide
but it will be the only white spherical object in scene
so pretty easy
Oh okay. So you want them to find a specific object?
You can use GameplayTags for that.
yeah
what is that XD
They are a feature where you can give an arbitrary object arbitrary labels.
and then ai detect those arbitrary labels and at the same time, detect the object
You want image recognition from video? Sorry, didn't know how to approach that, probably some neural network.
So a human decides if something is a white sphere, tags the object as a white sphere, then the AI can check if the tag is present
The human does the decision making at Edit time
neutral network?
what is that?
What do you want. You want your bot to watch video you imported and find something, is that correct?
yeah
Its one video, or its different videos where white sphere different each time?
different videos, but the same one at the same time. Live video recorded and played in slowmotion each time
i already made that part
So sphere appears at same time each video. Variable position/size?
White spheres ( golfballs ) appears at the same time at the same place on each video. it just need to be tracked through the slowmotion video so it first need to be detected (So it can be tracked )
Looks like you need some kind of image recognition, i didn't worked with that so i can't give advise in this.
But if your videos are pre made and there is limited amount of them there what i would do.
I would create ball tracker from timeline, timeline can contain 2 curve that represent ball position. Curves will be set manually for each vid.
For bot need to create datatable, with struct that contains video number and link to tracker actor with timeline.
It should work like this: Playing video 3, bot takes 3 and finds tracker link in datatable, in tracker it looks on timeline and get coordinates of ball.
So videos are not premade and you need some image recognition. Can't help there ๐ฆ
if it can help, the upright spool would be the golfball on the tee/grass and i need to get the game to say "Oh! this looks like a golfball, Let's detect it's next movements"
what it really sees without the "detection range"
Is it possible to get The color of an object from a picture?
because a slowmotion video could be analysed frame by frame to get the movement of the "color"
I think you'd get better answers in another channel this is mostly AI for games fwi
We unfortunately don't have a computer vision channel which is more what you are looking for
There are lots of resources on computer vision. Just need to Google.
Yep though I wouldn't think they should use unreal for that unless it's a really specific use case lol
for the small update, I think i can identify the golf ball by analysing each pixels of every frame fith loops and arrays so it can say if there is a golf ball in range, or no.
Can anyone confirm if StateTrees in 5.4 are still limited to a depth of 8 even with nested/linked tree assets?
It had such an arbitrary sounding limit to it? That's awkward
I'm also curious if 5.4 fixes the property binding bug which caused an error every time you tried binding to a nested property in eg. an actor, I think it only worked without errors in the context actor which made it difficult to use outputs from tasks
Yep, and get this: if you use subtrees and linked states they also count. So you can link 4 states deep at max.
There are way more property binding bugs than just that. This one is targeted for 5.5
Oh really, never ran into anything else with state trees thankfully
That's not great it's gonna take them until 5.5 to fix such a fundamental issue...
Other than that there are also issues with using BP structs for property types. Those will crash your editor. Native structs only.
Also issues with binding elements of an array.
Definitely needs some more time in the oven
Sounds like it. BP structs in general are not recommended for anything anyway, they are a fun way to cause corruption and other issues if you ever change them at all
At most I'd consider using them for something that's only gonna be used in very limited capacity as a helper/utility maybe
Huh, good to know. I'll definitely avoid them.
Hello, I have a 3D sidescrolling platform game and I need a drone AI that follows you on on bottom-up and left-right directions (not in depth since its 3d i also move in depth), how do I make the AI path, I mean on floor i use navmesh to say here he can walk but on vertical axis how can he avoid obstacles and understand a path to follow even to reach player etc...
Sorry for bad drawing but its the best with mouse hahahah, basically the red are the walls and yellow are the floor on the left part of the image, the purple arrows means that the player just can move also in depth in that sense and the camera is looking on the front only.
So player can follow those stairs and platforms to go on the next floor but the drone (the little green thing) checks for you and I want him to follow on 3d space each floor too but avoiding obstacles, any idea?
How do you make ai chop trees? Do you use smart objects?
Hi, does anyone know if nav mesh could possibly effect AI perception?
i'm having this weird issue, where my ai character cannot see the player character on one side of a broken bridge, while it could see on the other side..
The gameplay debugger's perception mode should show you the linetraces the perception system attempts to do which should hopefully give you some insight
i tried directly print the value of On Target Perception Updated, it didn't even update anything when the player character in it's sight area, but it can see its peer AIs
Yeah I mean if it isn't detecting the player then it isn't going to run that function
There's some geometry blocking the trace on the sight channel (iirc visibility by default)
Meshes attached to the NPC or player can also block it if I remember correctly
Hi! If I have to kill my AI, what is the most recommended? Handle things from the AI COtroller or with tasks on my BT? With a decorator, check that the life is not 0 or less and then execute the task
Maybe I'm not looking to destroy it, I just want to make it disappear for a while and then rearrange it with everything started again, thus saving me the kill and spawn of the actors
It dependsโข๏ธ. You can do it whichever way you find works best for your particular case
If you're handling hp-related things in the BT already then it could make sense to handle it there, but if you're handling logic related to that elsewhere, it might make sense to do elsewhere
you're right, i found that it was the default Trigger Volume placed there was blocking the sight, which needed to change the object type from world dynamic and ignore camera trace
thank you!
hey!
I have this simple EQS query, which I'm using to spawn some pick-up items at the beginning of a level.
Now my issue is, that this query often spawns these items suuuper close to walls.
I'd like to make filter our items that are close to other meshes. Is this possible?
Example: If the given point is within 50 units of a wall, filter it out.
oki thanks
right, so Ai MoveTo does not work with nav links
I'm trying to use a dynamic set of subtrees via RunBehaviorDynamic. But I'm also to let the tree wait for a short time at the end of the tree before restarting. Is there any way to abort the wait if the dynamic node has a valid behavior asset set? Not looking forward to maintaining an extra variable to manage it in a custom decorator. :/
Only way I see is to both inject the subtree and send some kind of event to the tree, or change an observed value in the blackboard. I don't think there's a "hook" for subtrees getting injected
Yeah.. Eh. Could be worse.
I've got a function on my AI Pawn which basically forces it to detect a target. I use this for when the AI is responding to the player tripping a security system, EG they step on a laser so a missile gets launched, the missile should just immediately be detecting them. But it doesn't work, and I can't figure out why.
I've also tried moving the test portion of that into a separate event, which I'm calling on a 1-tick timer in case perception isn't instant. Still no dice.
I would like to constantly check if the player is overlapping the box, but only if the AI โโsees player
print string "ssss" is only called when the AI โโsees the player for the first time, not when his position changes
i need to use Event Tick, ir can it be done by using AIPerception
Nav link don't move ai automatically ,they can start logic once ai reaches one of the end point. Watch tutor on smart nav link, go to nav link, check how 'Event receive smart link reached' works.
the problem is that the ai doesn't even go near that ledge
it doesn't move at all
cause the destination is on that lower platform
someone?
Use these functions, they also have filters
Haha, so, this is interesting: It takes TWO ticks for AI Perception to update, apparently. This check fails when run on the next tick, but RELIABLY SUCCEEDS on the tick after that!
is there some event that is triggered every time the player changes position within the AI's line of sight?
i really have no idea how to do this, it feels like a dead end
When do you call that test event? Begin play?
what is the proper way to get an ai to turn away from you, as whenever i try to do this, the on sight perception makes it focus back on the player, and those are conflicting
i mean i focus on sight and i defocus on whether player is reachable is not, if not, defocus.
so the ai is stuck in an endless loop of focus defocus focus defocus when i'm not reachable, but in sight.
I would really appreciate it if anyone could help point me in the right direction with this. Thanks.
It's called in that force target detection function, but on a "timer for next tick by event"
So it's like:
- Tick 0: Pawn created, ForceTargetDetection called, reporting damage event. Target is not being perceived yet.
- Tick 1: Target is not being perceived yet
- Tick 2: Target perceived
Sounds like some tick dependency shenanigans to me, maybe?
Frankly I'm not surprised at all that sending an AISense event and then checking for perception that same tick encounters a race condition or odd behavior. I am a little surprised it takes two ticks to report the perception, instead of being aware of it next tick.
(Also I feel it's important to point out, I'm testing all this with my player pawn SUPER far away from the spawned AI pawn, so there is no chance that it's actually picking up the player through a different sense)
maybe that's why? lol
Keep in mind that there are 2 components at work here, AI perception of the AI and the StimSource, might be worth debugging both
Remember the ForceTarget function just looks like this
There's no stim source component for a damage event, is there?
nah, I added that to my player pawn and it doesn't change anything
Tbh for "forced" targets I would just bypass perception entirely unless there's some reason to go through it
Huh, guess that's for proximity stuff
does anyone have any idea how i can handle my enemy having conflicting focus / defocus statements? ๐ฆ
So, the reason is my pursuit behavior logic checks to ensure that the target can still be detected. Which obviously fails if the target has never been detected.
Maybe block the player from being perceived? Kinda depends what you do on perception event
That said, I do think this is what I need to fix. I need a method to "lock" target detection and ignore that negative signal, but I do need that to be temporary
Ideally I want the enemy to turn 180, leave and have perception on but also i can't just outright disable it or use timers as they might see another player that is in range and visible and should chase after that one
so i think what would fix my issue if the focus node had a - on complete
as the BT tasks move too fast
and the enemy doesn't have time to rotate fully
before the next task kicks in
any idea how to slow this down / wait for task, without using timers?
Slow down I'm an old man ๐
So
Question
Do you want your AI to actively turn 180ยฐ and leave once it perceives the player, or do you want it to just ignore the player and do whatever it happens to be doing at that moment? Those two are different
So what I want to happen is, when player is out of range, the enemy turns 180 and leaves.
That's it. Really. But the issue is that the enemy does not turn fast enough.
So he sees the player, and turns back, and freezes.
As he is now stuck between turning 180 and leaving and turning 180 and focusing on player.
So rubberbanding, right? So you can kite the enemy until a certain range is exceeded upon which the enemy returns to patrol or whatever?
โป๏ธ
Put a service on the task that is rotating the AI, on activation, turn off the sight, on deactivation, enable it.
Yes, I guess you could say that. Only issue is that the sight radius needs to be bigger than the exit range
Which is causing me problems as once out of range and enemy tries to leave, the enemy sight kicks in and basically makes the enemy continue attacking
Even though I am telling it to leave.
One thing you can do is play around with Max Age on the sight config
I am aware that I am asking it to both leave and stay at the same time, but the ideal fix would be that upon a 180 sucessful turn, the enemy can no longer see the player and runs away
What do you have set for peripheral vision?
but during the turn, on the next tick, the enemy sees the player just as it's about to turn 180 fully
so it goes into an endless cycle of trying to turn, seeing the player, turning to the player, etc
75 degrees or so
if I wouldve been able to use delays, a one second delay, as you can imagine, fixes the issue.
But I don't want to use delays, so it seems like I hit a dead end.
I cannot check when focus is complete, I also cannot delay. How can I tell when the enemy AI completed the turn?
Another relatively easy kinda custom fix would be to track a grace period to each sensed actor, such that you will only re-sense the actor after the grace period expired
You do get an "unsense", right?
Or is it permanently sensing?
yeah but i don't really want the enemy to technically be 'blind' for a while
as it might see other players inside the reachable area it should seek instead
No, not blind, just ignoring that single actor.
All others are still fair game
You'd track grace periods per sensed actor
okay, I will look into grace periods
can't quite do that as the ai should be able to see other players inside the reachable area? unless I am misunderstanding?
So a naive thing would look like:
TMap<TObjectPtr<AActor>, float> GracePeriods;
Do you, by any chance, have the native code for the Focus node?
I want to understand how it works
Why would I have it? ๐
Then do a check inside of the logic that fires off when the actor is perceived. If it was the last perceived actor, ignore it.
Use an overlap test.
This is an incorrect assumption.
You should not be doing any AI work in the pawn.
The perception system only notifies when it first senses a target or when it stops sensing a target.
You need to fix your logic. We can't help you fix it without knowing how you are actually implementing it.
well I did mention it, it's pretty simple, on out of range > look away, on see player > look at player
so the issue is when out of range and looking at player, the AI is stuck.
There's a bunch of different ways that can be implemented.
Show how you are doing it
Inb4 another scolding about state machines in BTs
What ?
You'll see ๐
also @uneven cloud , the escape happens in the move to, if the move to fails, the player is considered out of reach, and the state is switched back to passive
Here's a perfect example of why forcing a BT to act like a FSM doesn't work. Because you aren't using the priority of the BT, fixing this is harder.
You are setting the attack state whenever the perception is updated. Regardless of anything else happening.
I am not familiar with the jargon, I've never heard of FSM ๐
Finate State Machine
I tried Googling it but I'm only able to find tutorials, are you recommending I use state machines instead of BT?
No. I'm saying you shouldn't force your BT to act like a FSM.
Yeah, I mean, ideally I wouldn't want the AI to go into attack mode unless the full focus turn is complete.
Well how else can I use it?
Because you are forcing "states" you need to add logic for changing the state to take into account your turning problems.
Here's a perfect example of why forcing a BT to act like a FSM doesn't work. Because you aren't using the priority of the BT, fixing this is harder.
Just so I get that right: BTs priority goes from left (high) to right (low), but trying to model an FSM into that can't work due to arbitrary priorities of states, right? Probably other reasons too though
Speak plain ๐ญ
Correct.
Basically, BehaviorTrees model "fallback" behavior. You try the far left branch first, if that fails you fallback to the next one.
Your use case has no such static priority. It's not like your "Passive" branch always has higher priority than your "Attack" branch, right? So far clear?
pathfinding disabled means it go in straight line
Yeah but since it's to the left it's technically higher priority
So it will execute from left to right, based on the state
No. It will only execute based on the state.
okay but the state itself will execute left to right
that's why there's the little numbers next to it
to denote priority
right? ๐
or I guess, order, same thing in my head
Yes, but it'll never go into a different branch without your external logic.
Okay well fair enough but how can I remodel my current 'model' to account for the turning timeframes and stuff?
It's difficult for me to even phrase the question you see, I've been trying to sort it out for days
It's because you don't understand the language
So if you want to keep this bad structure, you have to change your state transition logic to not go into attacking if X is true.
what is a better structure? state machines?
And going through the pinned resource about AI. So you can establish a language to communicate in
There is another pinned resource for this
The Introduction to AI course and the Flame Retardant AI talk
this guy that seemed like a genius used bt so i jsut copied his tutorial and made some amendments
You don't know what a genius actually is with BT, so everyone is going to seem like it as long as they try to speak with authority
Well his tutorial is clearly not good.
Be wary of YouTube UE tutorials
Nothing wrong with BTs though
Just need to know the pitfalls
Which tutorial
Ali Ezoheiry
Software Engineer, educator, game developer, gamer, and content creator
He made a whole series on AI, and seems knowledgeable enough to teach, and somehow made an entire boss battle using behaviour trees
I haven't implemented the more advanced boss battle features as they were not needed for me, so currently I am just trying to work on my own version of a basic AI using behaviour trees, and I have been stuck on what appears to be a simple issue for days ๐ญ
https://www.youtube.com/watch?v=iY1jnFvHgbE Also this video from Unreal Engine themselves, explaining how to create responsive AI using Behaviour Trees
It seemed like the right move forward, and I like having everything in one place, making sense, and with decorators and services providing so much functionality, I thought I would be able to make a very basic AI using BTs, it seems that I was wrong ๐ฆ
I also found him on LinkedIn, he works as a Senior Developer / Engineering Manager at Adevinta and has 10+ Years of experience
Either he has a lot of experience in doing it wrong, or it's just a very basic tutorial and he didn't want to complicate it for beginners and maybe fixes the problems later on? I've only looked into it shortly but the 2nd video he starts implementing states in his BT
Never understood the point of trying to "shield" beginners from complexity
Well, I guess YouTube clicks would be one such point
Well for beginners, I can actually understand what he is saying
And that is what the process of learning is, right? First you learn the alphabet, then you learn how to write, then you write poems.
Imagine telling a baby that they must write a 3000 word essay by end of play tomorrow
That's you guys talking to me right now ๐ญ
No, don't misunderstand, nothing wrong with doing it wrong!
He's a web dev.
But you learned how to ride the tricycle and now want to go on a mountainbike track ๐
Ali's tutorial is my tricycle lol
I just want to adjust the wheels a bit
but it's all falling apart
You'll have to upgrade to a mountainbike first!
You just need to learn how to actually use a BT. They aren't that complicated.
The pinned stuff by Bobby Anguelov is a good place to study
Have you watched those?
I know, I've been trying to, I think I get the basics? Like, sorta can make a moving / attacking guy in BTs
But anything more complex I would struggle
Looking now ๐
Just start with the AI with Blueprints course that is pinned here
Hard disagree with that statement
Bobby is not good for beginners
Okay I looked through his video it looks like a 2 hour study session about how AI works
And since I am not completely new to Unreal, it might be useful?
Seems like average first year game dev course stuff imo, which is nice cause I can't afford going to uni
Ah, well, might be a good argument
So it appears to me that @uneven cloud is not a fan of Behaviour Trees and would much rather program AI into blueprints directly
Just scrolling through pinned posts
Ever find something your AI is doing and it's like "wait, why"
My missile pawn does this inexplicable little zigzag right as it's about to reach its target and I cannot wait to figure out what is happening here
That couldn't be farther from the truth
There is no one-stop solution to complex AI
maybe I'm misinterpreting but since I have no knowledge of state machines I assume it's like a Blueprint collab with AI
That course goes over all the AI systems, including BTs
Right right, perhaps worth looking into it
BTs are something a lot of people misuse, but that doesn't mean they aren't useful
It's how to use the systems, not write AI with Blueprints.
What tutorial do you reccomend for me to watch to get a better understanding of just what I need to know for now
The AI with Blueprints course on the learning library
Oki
Are you out there making tutorials with really bad practices and using your web dev experience to prop up your game dev skills?
Not in UE AI ๐
Haha
Are you from Portland Oregon
Vast majority of my tutorials are in Godot. And no - I don't use my web experience as a position of authority.
Really wish commenting in the behavior tree graph had more space - and if there was a better way to select all nodes in a subtree
can i modify a blackboard value on my enemy base character?
I have this decorator in my BT, this BTD check my BB bool called "IsSpecialAttack".
In a service, i've a little algorithm for generate a random number, if the number is equal or less of my porcentage, the bb bool IsSpecialAttack change the value to true, but the Selector never entry in my left side, what is the mistake on this?
I don't understand why you are doing that as a service instead of a decorator when you are picking an attack. Or why the decorator is inversed or why it aborts.
Why does the random need to be updated on an interval?
curious if anyone knows, im working on a custom rigid body movement component for pawns, and I was wondering how I can get my movement input system to work with Unreals navigation and movement system. I am using C++. for example If I use AIMoveTo I was hoping perhaps a few function overrides or something would allow my input system to work with it.
Your custom movement component needs to be a child of the nav agent movement component.
thank you! thats all i needed to know
I wanted a custom acceptance radius in the MoveTo Task, i created a child class of the MoveTo Task and im overriding the PerformMoveTask to Set the Acceptance Radius but whenever i start the game it sets acceptance radius as 0 and then it takes the defined radius.....how can i make it so that it updates the user defined radius as soon as the game begins
Isn't AcceptanceRadius exposed in the BT editor?
Not last I checked
That not it at the top?
Dynamically I meant
Mb if you were talking about default values
Ooh, that was the question, now I understand
I thought we're talking about initializing it
Well tbh, idk anymore ๐
๐
i wanted to make that a custom variable in actor which will pass the value to BT
How are you overriding the PerformMoveTask?
Paste some code
EBTNodeResult::Type UBTTask_CustomMoveTo::PerformMoveTask(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory)
{
if(AAIController* AIC = Cast<AAIController>(OwnerComp.GetAIOwner()))
{
if (ATurretBase* pawn = Cast<ATurretBase>(AIC->GetPawn()))
{
AcceptableRadius = pawn->AcceptableRadius;
return Super::PerformMoveTask(OwnerComp, NodeMemory);
}
return Super::PerformMoveTask(OwnerComp, NodeMemory);
}
return Super::PerformMoveTask(OwnerComp, NodeMemory);
}
Idk if its the right way to do it
hmm?
Oh, well nevermind, I thought the AcceptablRadius gets overwritten in the Super:: call again but I just checked and that doesn't seem to be the case
I'll see if I find something
I think I misread your question, so let me clarify this part:
whenever i start the game it sets acceptance radius as 0 and then it takes the defined radius
You want the radius of the actor to immediately take effect on BeginPlay?
And that is not happening right now, right?
Hmm
Sounds off. Can you debug and confirm it's related to the BT task and not how you're setting the variable?
also i kept a breakpoint in this code but its not getting triggered
You're certain you are using your custom MoveTo and not the original one?
Does your Pawn exist when that node is reached? Is the pawn actually a child of ATurretBase?
YES
yes
Because the behavior you described sounds like what would happen if this evaluates to false:
if (ATurretBase* pawn = Cast<ATurretBase>(AIC->GetPawn()))
i kept a breakpoint there didnt worked let me try printing log if the cast is failed
I want to add option for ai to manually specify what navigation agent it should use. Where to look for it in code? I made my changed path following component in c++, but i didn't look at how navigation works yet, may be someone did. I asking because you can't make two agent with same size but different walking properties. And i think there should be option to manually correct anything automatic.
Is there an async move to task that can succeed directly if path exists towards the target key ? It appears that default MoveTo is considered in progress until goal is reached.
Hi guys, do anyone know any tutorials or resource on how to implement GOAP(Goal Oriented Action Planning) in unreal engine, thanks.
guys I made a Enemy AI,but I dont know how can I change his Chase Run Speed?
If it's a character, the CMC has a walk speed value that you can change
When the variable is false, the special attack branch is executed, but I only want it to be executed only when it is true
Isn't there an invert condition option on decorators by default? If not, just flip the condition, or flip the nodes and move the decorator on the other one?
Yes, i have an Inversed option but the same thing happens to me, the special attack is always executed and never the basic attack
I found a way to do it, it is without using a BTD, it is using a blackboard type decorator and putting the value of the boolean, when it checks the value of that boolean if it is true it executes that tree for me, is it okay to do it this way?
Sure, if it works it's fine. Although to me it seems like it should work via the custom decorator also
I think the same but the custom decorator never works for me, I end up passing variables from the AI Character to my BT, I don't like doing it this way but I don't know what's wrong with my decorators
Have you tried printing the values in the decorator when it runs?
That seems like the only thing that could be going wrong with it ๐ค
I tried it, and the strange thing is that it never prints anything
As if the function is not executed
Did you put the print before or after the cast
because if you put it after the cast in the success branch it kinda sounds like the cast is failing
I added it after but it seems strange to me to think that the cast could fail when the object is provided to me by the same function
The cast will fail if the actor is of a different class
It's always best to verify things like that if it behaves in unexpected ways instead of assuming it's correct
How do I get the nav mesh closer to objects? The distance is to big for my characters and changing the cell size as no impact
This should be affected by the agent capsule radius
Note that your actors can go all the way to the edge of the mesh, so that the actor's origin is at the edge
so their capsule will be outside the bounds of the navmesh at that point
Thereโs also making custom agents
The Agent Radius does also not affect it. Set it to lower values and nothing changes (currently at 75), higher values do increase the distance
Make custom agents in project settings
I've got this AI right now that's either patrolling or pursuing, depending on whether it's detected a target. I want to add a new mode to it, where it just sits and waits until it detects a target. If it loses the target, then it starts patrolling, it never goes back to waiting.
I know I could do this by having a new blackboard var that's like an "is waiting" bool, but that seems clumsy. Is there a way to make a BT branch that can't be re-entered like this?