#gameplay-ai
1 messages · Page 56 of 1
Are you sure the move to target location task actually finishes at some point?
Uh
Hm... actually it might not be
I'll past the task code, opening IDE right now.
90% sure I'm doing something wrong cause it doesn't work lol
{
FMoveToTargetLocation_InstanceData InstanceData = Context.GetInstanceData<FMoveToTargetLocation_InstanceData>(*this);
if (AEnemy_AIController* Controller= InstanceData.Enemy_AIController)
{
if (APawn* Pawn = Controller->GetPawn())
{
UAIBlueprintHelperLibrary::SimpleMoveToLocation(Controller, InstanceData.Location);
/*
if (Pawn->GetActorLocation() == InstanceData.Location)
{
const FStateTreeTransitionResult TransitionResult;
ExitState(Context, TransitionResult);
}
*/
return EStateTreeRunStatus::Running;
}
}
return EStateTreeRunStatus::Failed;
}```
I commented out a test case for exit state because that didn't work either.
I'm guessing I might need to change that return from Running to Succeeded? I thought that would also make it stop executing though
Oh and move it into the scope for that if statement checking locations
I do not use the Tick function so I don't know for sure, but at least the "EnterState" will keep you in that state if you return "Running".
Anything else will immediately move to the next state (or whatever you have set up)
For the movement logic, EnterState was not working. The AI Actor wouldn't move at all
I had to use Tick to get it to actually move
Success and Failure will end the state
And do the MoveTo on tick
Oh I see
Also there are some bools you might wanna check
{
FMoveToTargetLocation_InstanceData InstanceData = Context.GetInstanceData<FMoveToTargetLocation_InstanceData>(*this);
if (AEnemy_AIController* Controller= InstanceData.Enemy_AIController)
{
if (APawn* Pawn = Controller->GetPawn())
{
UAIBlueprintHelperLibrary::SimpleMoveToLocation(Controller, InstanceData.Location);
if (Pawn->GetActorLocation() == InstanceData.Location)
{
return EStateTreeRunStatus::Succeeded;
}
return EStateTreeRunStatus::Running;
}
}
return EStateTreeRunStatus::Failed;
}```
/**
* If set to true, the task will receive EnterState/ExitState even if the state was previously active.
* Generally this should be true for action type tasks, like playing animation,
* and false on state like tasks like claiming a resource that is expected to be acquired on child states.
* Default value is true. */
uint8 bShouldStateChangeOnReselect : 1;
/** If set to true, Tick() is called. Not ticking implies no property copy. Default true. */
uint8 bShouldCallTick : 1;
/** If set to true, Tick() is called only when there are events. No effect if bShouldCallTickState is true. Not ticking implies no property copy. Default false. */
uint8 bShouldCallTickOnlyOnEvents : 1;
/** If set to true, copy the values of bound properties before calling Tick(). Default true. */
uint8 bShouldCopyBoundPropertiesOnTick : 1;
/** If set to true, copy the values of bound properties before calling ExitState(). Default true. */
uint8 bShouldCopyBoundPropertiesOnExitState : 1;
/** If set to true, TriggerTransitions() is called during transition handling. Default false. */
uint8 bShouldAffectTransitions : 1;
/** True if the node is Enabled (i.e. not explicitly disabled in the asset). */
UPROPERTY()
uint8 bTaskEnabled : 1;
Refactored to this and it still doesn't work so I'll try some more
You could also just use the delegate-based moves instead of SimpleMoveTo
If you make a UObject-based ST instance data, you can bind delegates to it
I may have to do this. Doing more debugging shows the AI Actor is not reaching the target location exactly, so the succeeded case is never being called
Is there a built in movement delegate you're referring to or would I just make my own on the actor class?
look at how stuff like AITask_MoveTo are implemented
Could anyone here share some links that expand on how to read visual logger info?
what I'm finding is leaving me very... wanting
the vlog stuff is kinda contextual, you have to read what it says and understand it
bit difficult to say exactly what everything you might see can mean since there's a lot of different systems that log into it
but in general, yellow=warning, red=error
Also the vlogger is like a timeline, you scrub through it. Something I didn't realize when I first started using it lol
Yeah the vertical lines in the vlog timeline are the points in time when something was logged
ok
when it comes to Ai, like the move to node
it will tick multiple times saying something like "moving directly to goal"
is this telling me that it just picked up a new instance of attempting to move
or just the same instance over time?
does that question make sense?
if it logs that a lot it kinda sounds like it might be restarting the move again as a result of a new move request
but I recall if a new request comes in, it should say something about it and aborting the previous request also
ah ok then if that's the case it may be the same call
this is what i'm trying to interpret
specifically the top line which is all blue ticks (the second line is an actor outside of the navmesh so fails every time)
this last segment to actor visual thing
is that where the actor wants to be or where it is?
or is it the red arrow?
I think the red arrow is where the moving actor was at the time
You should be able to see it if you look at the different logs when it's moving, the red should move with it then
ok that makes sense
I'll try to do that
I'm also trying to figure out how to see the target its moving to
is there a button to see these visuals as its logging?
instead of just as snapshots?
iirc the gameplay debugger has a navigation category which shows the navigation stuff as it occurs
' should open that one when you are in PIE
if it doesn't enablegdt in console opens it
ah yeah
i guess I was trying to see it after though
but that's ok
neoexcidious gave me some advice but i'm not really sure how to execute on it
I think I need to understand these tools better
ok after looking close at how the behaviour tree runs I don't think it is having issues of overwriting ongoing tasks
I actually got an interesting recruitment email from id that I was considering before the last round of Microsoft layoffs. Glad I didn't pursue it.
You want to block pathfinding. How you do that depends on if you are using C++ or not.
Well you are using pathfinding which is constrained to the ground.
we're using c++
You should not be requesting a move on tick.
The first go to is to lock logic. The BT and path following component both have functions to lock the logic.
I don't want to lock logic, I still want the BT to run
because movement can be blocked, but the AI can still attack or rotate
You can lock the path following component without locking the BT
i tried to search but i didn't find where
do we have a method to pause path following ?
LockResource

I'm calling Ai MoveTo every tick, is this bad for performance? Should I just use add velocity for basic enemies?
Im talking 50-100 running at once
Build, profile, adjust
There are optimizations you can make if your perf suffers
Is there an alternative to AI MoveTo that doesnt bug out with launch character?
wait nvm
Hey @crystal hatch I can't DM you since the server changes. You put me onto a good contact for the animation stuff and we got fixes in for 5.4.
I'm using the Mutable plugin in production and the initialization path is undocumented and broken. I've made a plugin that handles initialization but a lot of this should probably be incorporated into the base plugin. The plugin works with all net modes. I've made a few PRs too since you literally can't initialize in a sane manner without it.
I do have UDN access but we don't use Mutable for work so probably better not to use it for that.
Could you pass along my plugin to see if they want to use it as a resource for fixing or improving Mutable?
Links:
https://github.com/Vaei/MutableExtension
https://github.com/EpicGames/UnrealEngine/pull/11859
https://github.com/EpicGames/UnrealEngine/pull/11864
https://github.com/EpicGames/UnrealEngine/pull/11870
So what i have to use?
Is it ok generally to use 1 blackboard for all different kind of characters and different behavior trees? Or should I create own bb for each even if they share some keys, but other characters don't use them and use others?
EnterState didn't work, tick was the only thing that worked.
Tried to implement this but I can't figure out how to bind the delegate for OnMoveFinished. Just keep getting errors or making my IDE mad.
You would need to make your instancedata an Uobject and then bind to that
there's some builtin ST tasks which do this
I think making use of the hierarchical feature of blackboards in UE is a good approach
Have 1 root blackboard that has very generic info
Then derive more blackboards from it that extend with more specific info
Finally, got it -almost- working.
Basically rewrote the StateTreeMoveToTask to do it, albeit a slightly simpler version.
Just kidding, I broke it again 😄
Why didn't EnterState not work? Right now you are requesting a move every tick, which not only doesn't work it's very bad for performance.
The simplest way is to use move directly towards
hi, how can I take the point where the AI goes without setting it in a variable?
is this even possible?
Anyone has time to brainstorm idea with me ? 😄 Sorry for bad pictures I'm not artist. I'm trying to create behavior tree for ranged unit that when commanded to attack, will go to attack range and attack. After thinking a little, I think I have to use EQS to make that and I would just make the ''location to move'' based on furthest distance from the enemy and the shortest path to that point from my unit. Is this correct approach?
can yall help me with a problem im having.... I have a mesh as the floor and its all one mesh but the NPC can only walk on one side????? I have 2 nav meshes for both sides so i have no clue on to why They can attack but they dont walk on the one side but they can on the other
If you are using pathfinding you could just have it move to the enemy and if it reaches attack range have it stop moving any further
What is wrong with having variables? That's the basics of programming.
Shortest path is usually unnecessary. You can use the dot product for more intelligent location selection.
Are you wanting to send it to another actor? You could send it via an interface or event dispatcher depending on what and how you want to send that data or you could use a variable there's nothing wrong with them like Luthage said lol
Hi, how to make an AI that can walk on walls and ceilings. I want to create an AI spider. Thank for your help
Good question. Not sure if you can do this with anything built-in
I wonder if you could change the direction of the navmesh internally somehow? Surely it's doing a floor trace/scan downwards somewhere, no?
I guess, but normal navigation is tied into the CMC/PMC so not sure how deep you’d have to go to achieve this
True, down is the assumption across the entire nav system.
But for a spider (assuming no obstacles on the walls) you could do something manual with BP instead maybe?
I mean, yeah. You could hack your way around it, turn the mesh upside down, and use a trace to set its relative location so that it looks like it’s walking on the ceiling
The old smoke and mirrors can work, depending on how contained the scenario is
Would you mind telling a little bit more details? Do I still use EQS for that or it's something else? Currently I have behavior tree that when clicked it moves to target and then attacks, but even if someone has attack range, it will move 100cm from the target.. im looking for a way to stop it in inteligent way at the range of target and at the same time don't make it always run to max range when clicked to attack.
Actually. crazy idea, just rotate the room lmao... duplicate the room out of sight and flip it 90 degrees, then do navigation with a proxy actor on that. Map the proxy actor's position to the original room, just rotated -90 degrees. No performance guarantees 😄
Not 180?
For ceiling 180 yup
So duplicate the room 5 times, for each wall and ceiling. I'm sure this has no performance hit at all...
You can have a decorator that checks distance to the target and aborts the move to branch of the BT
If I want to change the circle radius based on what is unitRange, i have to run task before that query to set that?
I think I found it
will this make the value as UnitRange blackboard key?
ok I made it work ! 😄
Guys im making a utility system, do you guys know any reference doc of the system in unreal?
You probably should ask the author of the plugin
First time I see that kind of thing
AI Controllers don't have a "parent" character... I assume you want the character the controller is possessing, which you can do via GetPawn and then cast it
hey does anyone have an idea what i need to do so the character can step up on this Stage? I tried adjusting the Cell Height, Agent Max Step Height and Max Slope and nothing seems to work for me, the collissions for this object are complex so they shouldnt be the problem
Hey,
I have a bug when using AIController with FloatingPawnMovement, I don't have this bug when using DetourAICrowdController
When I do a MoveTo, the Pawn is going up and not staying on the floor.
Capsule collision is set to BlockAll, setting it to no Collision does not change anything.
Mesh collision to no Collision
Anyone having an idea on why it could happen or how to fix it ?
Check if you have checked ''actor can step on it'', maybe they are stepping on each other?
Yes tested but not fixing it :/
Why you don't want to use Detour btw?
I don't but its the only one not making it bug
I think it's because they are all trying to reach the same location and are stepping on top of each other
which may be something with normal AIController just not properly avoiding other units
meanwhile Detour just does everything better if you have ''crowd''
I see you are doing something like rts, then you might want to use Detour AI anyway
Yes totally, but the detour is also not working probably like the Avoiding feature is not working 😉
Also every component is having "actor can step on it" to false
I’ve seen that before, I think it’s because you’re giving them the same destination as was previously said. You can use an EQS context to give them different points around the same point to go to, otherwise if you don’t want to use EQS you can prly do it yourself with a bit of math
If you were using chars I’d say also increase the capsule radius so they can avoid each other better but yeah
Also try to use AI Move to and not Move To node, I think it's better for character movements
I'm using the node from the behavior tree but I can try a custom one
Yeah, I recommend doing custom one, it's much better and you can be more flexible if needed.
Also you can check Acceptance radius to be bigger to like 100 so they will eventually stop before reaching ''exact'' location, but I guess you have it done.
Yes tested already and they are going up also
There is no built-in utility system in UE.
Navigation settings only work for asking "can I move here?" In order to actually move there, you need to adjust the character movement component.
How exactly do you think it's better for the character movement component? How the move works is exactly the same.
This is bad advice.
So do you have any advice for this bug or hint ?
You're using the floating pawn movement component and trying to get them all to go to the same place. That's not a bug, it's bad logic. If you want them to stick to the ground, you have to actually add that functionality.
Nop asking them to move to another actor, and its working totally fine with the AIDetourCrowdController
Of course it is. They aren't trying to go to the exact same spot.
Detour crowd changes the path so that they aren't going to the exact same location.
Having them move to another actor means that they are all trying to go to the same location, that other actor's location.
If A move to B and B move to A this is not the same location or I'm missing something
Hey, I have pawns that have variable step heights. They can have it increase/decrease dynamically.
I baked my navmesh with the max step height possible in the game, and now my agents don't treat steps that are within that max range, but above their individual current step height, as an obstacle. Leads them to get stuck in those steps, continuing to apply movement as if the path is clear but they can't step over the obstacle.
Any solutions to something like this? I'd ideally want them to treat steps above their current step height as obstacles.
If A moves to B, then it's trying to move to the same location as B. If B moves to A, then it's trying to move to the same location as A.
You can't change the step height dynamically for navigation. You'll either need to use area classes and filters or nav links to change where they can navigate dynamically.
So in any project, all agents must share step heights for a given navmesh setup?
No. You can make different agents settings in the project settings.
You shouldn't make a lot of them, because each one creates a new nav mesh.
So if I have multiple agents setup, I'll have several navmeshes baked, to fit each agent.
And then if I modify an agent's max step height they'll still be bound to their specific navmesh?
They aren't bound to a nav mesh. Each time they use the navigation system, it gets the correct one based on their agent settings in the movement component.
What's it using to get the correct one? Just the best fit based on parameters like radius, height, step height etc?
Definitely radius and height. Maybe the others, but I haven't looked at that code in a while.
In theory then, I could setup 2 different agents with 2 step heights, and then if I modify step height dynamically it could select another navmesh to use?
I'll test some things, thanks a lot for the help!
questions for ai controller and getting an ai enemy, i got a smash bros like fighting platformer, so all the characters are made, my question is how should i get the ai to work, there are no nav mesh bounds as its a sprite based game and is made based of paper 2d is there a way I can write code into the controller to identify which actions the character to take or should i write bp into the character or what
You need to store that animation somewhere and then have a way to get it. There are many ways you can do that.
Do the introduction to AI course that is pinned here. That will go over the AI systems.
There is more to the AI systems than just the navmesh
- IGenericTeamInterface
- Detection by affiliation
Tutorial over.
You mean this handy dandy page with links to more info also? https://zomgmoz.tv/unreal/AI-Perception/Perception-Detection-by-Affiliation
I'm curious how many people use blueprints vs c++ for ai setup? I started with using blueprints for ai as it seemed fairly easy, but I wonder if it quickly becomes a bit overbearing given all the different components of it (i.e. blackboard, behavior tree, ai controller, etc).
I use both depending on what makes the most sense
Don't think there's a clear cut answer, it always depends on the circumstances and context
Also all those components exist in c++ too
Yea that's fair. I'm having a problem with my ai and I'm having a hard time figuring out how to fix it in blueprints. Not sure if it will be easier in c++ or not. I can't seem to get the ai controller to take over the player character when I need it to.
I doubt doing it in c++ will magically fix it
Have to figure out what's wrong with it
Well yea I know that I just am wondering if it might be easier for me to figure it out that way. Debugging in blueprints always feels clunky to me. I can't for the life of me figure out where the problem is. All my googling is showing me what I'm already doing. All of my debugging is showing as all correct up until it's... not. lol. And no idea why.
My approach would be to first unpossess from the player controller, then possess from the AI controller
You can debug the blueprint function in C++ too
You have to unpossess first???
Well shit, that might be the problem. I thought when you called Possess it would just put whatever you're trying to make possess it in control. I'll try that. Would be fantastic if it's that simple, if not a little frustrating that I've been pulling my hair out on this issue. lol.
Never make assumptions, need to be pragmatic about it.
Never is a strong word, but you get what I mean 😄
lol yea. Well, that didn't seem to work right off the bat, but it gives me some ideas of new things to try at least.
Also I don't think AI controller starts its logic automatically on possess, you might have to manually start it.
But that would be the next step after successfully possessing
Yea I've got that stuff in there to run the behavior tree. but for whatever reason the unpossess and possess doesn't seem to be working. I put print strings after each execution node here and each time it's still displaying the BP_ThirdPersonController. I've gotta be doing something wrong but I don't know what?
First off I'd get the controller from the player character instead of calling "GetPlayerController"
That would at least assure that you're trying to unpossess the correct controller
Next you can check if your player character is actually being unpossessed by debugging their "Unpossessed" event
Also your "Third Person Character Ref" variable doesn't seem to actually have any value. At least not from the screenshot alone.
Since you're doing a "Get Actor of class" I assume you'd have to set that into the var first
Ah ok now we're getting somewhere. Ok so let me ask you if you don't mind, why did the GetPlayerController not work? My understanding was that Player Index 0 should always be the player if it's a single player game. To my knowledge, I don't have any other player controllers in the game (if I do maybe that's a problem to investigate) so why wouldn't that work the same as getting the controller from the player character?
That's the BP_PlayerCharacterAIController and that's the one getting passed into the Possess node.
No idea, just a shot in the dark
But you're passing it into InPawn. Why would you pass a controller into a pawn variable? Does that even work?
no, i'm passing the BP_ThirdPersonCharacter into the InPawn.
Controller should go into the Target pin
Oh ok!
That's your player pawn, right?
Correct
Then why do GetActorOfClass if you already have it?
The GetActorOfClass is getting the ai controller, not the player character.
Ooh, gotcha. It only says "Player Chara-" so I thought it's the player pawn
And maybe that's the problem? maybe i'm getting the ai controller in a way that's incorrect? I see one in the outliner though and i assume that's the one I want to get, right?
I mean
Is the AI controller spawned in the level?
If you haven't spawned it then you can't get it
Yea it is there, I've looked to verify that it's there (in the outliner) and I've also debugged the return from that isValid to ensure that whats getting returned from there is the ai controller.
And that AI controller is not possessing anything else right?
uuum it shouldn't be. is there a way to debug that?
I guess gameplay debugger? Backtick is the hotkey for it I think
So I've never used this gameplay debugger before, but if i'm understanding this correctly, it looks like the ai controller is possessing the player character? So I'm not sure why it doesn't read with that when I print out the controller.
Looks like it to me!
Again, you'll have better info if you debug your character's "Possessed" event
Yea that appears to show the ai controller. so, that's working but I'm still getting "none" when trying to get my blackboard.
How and when are you getting the blackboard?
In the BP_ThirdPersonCharacter, I have a custom event that gets triggered after the controller is switched. On that event, I have a GetBlackboard node that takes a Target which I've tried several different ways of passing in the target. I've tried GetController, GetPlayerController, GetAIController. None of them seems to work.
Have you tried this event in your character BP?
And then getting the blackboard from that controller?
No, but I suppose that makes more sense than how I'm doing it now. I'll try that. I gotta run real quick but will be back to this in a bit. Thanks a ton for your help!
Does anyone have any cool resources for how to think about NavMesh when working in large open-worlds? Both regarding dynamic generation (such as with the NavMesh invokers) but also NavLinkers, and just general landscape construction to make the process less painful?
The builtin systems for this are unfortunately not implementable in bp. You would need to make some custom system which for example casts the detected actor and looks at a variable on it to determine whether it's friendly or not
It depends on what the problem is really
When it sees an enemy you probably would want to assign it to a variable and have it keep chasing that one instead of choosing a new one to chase when it perceives another
I can't get AIPerception hearing to work
Hearing config is added to the senses
with a 3000 range
The pawn that makes the noise has both "AIPerceptionStimuliSource", and "PawnNoiseEmitter" components.
What am I missing?
Probably want to check "Detection By Affiliation" in your sense config
All are set to true
Doesn't work.
OnTargetPerceptionUpdated I hooked up a simple print string, to check if hearing triggers at all. It doesn't. So it's not like a complex system where somewhere along the way something goes wrong.
The most primitive possible setup.
Sight triggers, hearing doesn't
The N definitely works, checked with print string.
But hearing doesn't trigger.
Also tried the same nodes hooked up to an event on character jumping, because I thought that N input making the noise might be the issue. The event works, the hearing still doesn't.
Can someone explain to me the Difference between these two nodes?
Just one is a Function and one is a Variable?
Anyone know how to or have resourceful links on creating a Utility AI behavior tree? For example having the selector nodes switch task actions based on the Utility Score of the AI?
If you want it to stop when sight is lost, check the successfully sensed value on the stimulus. This will be false when sight is lost to something, so you can use this to remove the active target or choose a new target from the other perceived enemies (you can use get perceived actors to get a list)
The only one I've seen is this, which adds a new type of composite into the BT to allow doing utility value selections https://github.com/kamrann/BTUtilityPlugin
It's possible there's no difference beyond function vs variable. You would need to look at the C++ code for the function to find out if it does something else
I'll try this out! Thank you! 😊
Here for advice on what would be the clean way to do it: I hae a building with multiple rooms and I need NPC to wander from room to room. Most rooms will have a default "wandering" inside but for some I'd like something more specialized.
Would it be better to swap their behavior tree when they enter a room? Have one BT for wandering outside, one for wandering in room and one for acting in rooms?
Or is there something more appropriate to do?
Seems entirely up to you. You could for example use smart objects in the room and have it use a behavior tree on the SO or something, or use gameplay behaviors instead of BTs, or not even use smart objects
There's a significant amount of functionality that is not exposed to BP, so only using it can cause a lot of problems. Plus you have all the normal issues with BP.
Then why are you unpossessing the AI controller? You need to unpossess the player controller from the player character first.
That's exactly what I'm doing.
That AI controller wire does not go into the unpossess node if that's what you're thinking. I just hadn't taken the time yet to clean up the wires, so it's straight across, I noticed after the screen shot that it might look confusing.
There's an article in Game AI Pro for a BT/Utility hybrid that works the way you are looking for.
No you are not according to the image you posted.
Some redirectors would help :p
Ugh. I hate BP.
agreed. I just hadn't noticed before posting the picture.
I tend to use both bp and c++, but ai is fairly new to me so I'm trying to get used to a bit. I'm sure at some point I'll move to c++, but it's a lot to take in all at once.
Run behavior tree should also not happen outside of the AI controller. It should be done in the AI controller's possess function.
That is the ai controller.
Why are you doing any AI work on the character? That should be done in the AI controller. Likely what is happening is that you are running the BT after the possess function while you are trying to access it when it's being possessed.
You are unpossessing the player controller in the AI controller?! That should be done in the player character.
Heya folks, I feel like a dummy but I'm trying to follow: https://dev.epicgames.com/documentation/en-us/unreal-engine/behavior-tree-in-unreal-engine---quick-start-guide .
I finished it, and ... nothing really works aha! Watching my BT, it tries to find a random position, triggers a moveto, but the value stored for PatrolLocation is null everytime. Breakpointing to look at the value being assigned, screenshot shows that the Key struct seems to be trying to assign EnemyActor key type, not PatrolLocation key type.
In the tutorial it simply says "Promote the key off of Set Blackboard Value as Vector, and rename it". That doesn't appear to be enough to actually have this BTT tell the BB what key to assign? I simply named a variable, and I don't see a way to tell it what key type to choose unless I go through constructing a Key struct fully. Is the tutorial simply wrong here or have I overlooked something?
Thanks rubber duckies haha. If I instead do this and construct my own key struct then it works as intended.
I'll read through again but it sure seems like the tutorial is missing this?
The tutorial is correct but it's missing a step where it says you need to make the patrol location instance editable and then assign the BB key to it from the BT editing view similar to the other variables you can edit there
Oh I see! And it kind of autograbbed it, interesting. That was definitely the intention they had
Thank you
I don't think it'll autograb anything so if it got some value to it by default it was a coincidence lol
I think that because you name it identical to the key in the BT it's picking it up once it's instance editable. When I tabbed over it changed the BTT_RandomPatrol node value "PatrolLocation: None" to "PatrolLocation:PatrolLocation".
Oh really, it didn't use to do that at least I'm fairly sure
You need to set the default value to the BB key name. While promoting it to a BB key selector works, it's completely unnecessary. BB key selectors should be used as variables to set the key in the BT, which is a better option than hard coding the key name.
I agree yeah. Seems odd they chose to do that in the tutorial, it was a really confusing part for me
Then it sounds like you have a nav mesh problem.
It's a quick start guide, not a best practices guide.
True
although it does continuously say best practices through it which gives the impression that it is trying to be : P
I have a GameplayAbility that i'm using to drive a MoveTo task - and at any given point I need to PAUSE this movement... for certain cinematic effects, which afterwards I'll be resuming movement on the cinematic completed.
I cannot use CMC->StopMovementImmediately() - because this will trigger this MoveTO() task OnMoveFinished() branch :/
Any other solutions out there? I've been searching at all forms of AIController, CharacterMovementComponent, even pausing/cancelling the GA ... but none of these methods are working :/
What’s wrong with the move finished triggering ?
If bCinematicInterruption -> MoveTo previous goal
because in all honesty i want to cancel this ability - but i'm having the HARDEST time of doing this....
Its a turn based strategy game.
Logic:
1: MoveTo (as seen above)
2: Overlap enemy sphere (detection)
3: Play cutscene on overlap, pausing movement (desired) OR cancelling ability as i'm caching the destination that hte player SHOULD go to...
4: OnCutsceneFinished - resume movement OR do a new MoveTo ability with the destination from teh cached location.
I would ask #gameplay-ability-system if you need to cancel a GAS ability
The movement part can be easily resumed with another move order
been there - tried it. i'll work with Khaos - because hes got a doc that says how to do this.. simply put my UGameplayABility* is NOT VALID (CDO) - which shouldnt be the case.
There’s also time dilation or pause game
pause game - wont allow for cutscene to play no?
i should say ...
this is NOT a rendered cutscne
rather...
I honestly don’t know. I know some things can be set to run while paused but idk about cinematics
camera switch to the enemy overlapped camera and play a AnimMontage + audio clip
so.... i dont think PauseGame will be a solution
Fair enough
Why are you trying to do AI logic via GAS?
AI use gameplay abilities - yes?
That's not what I meant. It looks like you are trying to do the actual decision making in an ability.
The answer to your question is to lock the path following component while the cutscene is playing.
It works just fine. If it returns an empty array then the NPC isn't currently perceiving any other actors
Is there any new feature in UE5.4 that will reduce the cost of 100s of regular AI?
I don't think there's a magic bullet that will optimize your game for you
In order to determine how to reduce their cost you would first need to find out what part of the AI has the performance cost
just saying "AI" means very little in terms of what it could be (could be CMC, could be skeletal animations, could be perception, etc. etc.)
Hello guys im seeking help and advices from you. If anyone can give me a hand, tip , advice , information or anything please do .
I need to finish working on this project and i still dont know how.
I need to make an AI that learns from the player gameplay and then plays just like the player and i dont know how or where to start (im using ue5).
I have reduced my task it to just a bossfight to minimze the complexity of the project
There's the "learning agents" plugin but it's relatively new. No idea how stable it is.
Is the actor affecting the nav mesh? You can use the visual logger to see if it's failing to project the goal location.
Yeah i have read some about it and i dont think it can help me achieve exactly what im trying to do here.
That's a very large topic with no easy solution. Like PhD level research.
exactly what im doing 😭
im doing this for my engineering final study project
I honestly wouldn't recommend it if you are looking to get into the industry. We don't use it for agent behavior, because it doesn't make fun player experiences.
There are 2 good GDC talks about it. One from killer instinct and another from Warframe.
is this for me ?
Your AI can't navigate to something not on the navmesh.
Yes.
well its not about "FUN" player experiences. Its more about how far or if it is duable at all
Is there a way to make Nav Link Proxies treated as 0 distance? I have a teleport door that NPCs can use, but having issues where if the distance between the NavLinkProxy start & end + distance from NPC to start is >the distance from the NPC to the end, it will walk the long way around rather than taking the instant teleport door
The 2 talks I recommended are from games that shipped using it. There are more talks that are theoretical, but those are the only practical ones that I know of.
Making games is about creating fun player experiences. When I'm hiring, I prefer resumes that have projects that understand this.
That has absolutely nothing to do with it.
Dont get me wrong i totally agree with you. Afterall we are doing this for ... FUN. 🙌
You affect the weight of pathfinding by using area classes.
What would be the best way to toogle ai senses on character? Like Imagine I can click A and S, and they will turn on and turn off, so:
if Ai can sense again, will get targets around it and attack
if Ai cannot sense, will lose targets and stop everything
and then again
Does AI Perception works on tick?
- Could I use boolean after AI to tell it if it senses or not?
- I also tried with this enabled node
So far I'm able to ''stop'' character, but I'm not able to enable it again so it will start looking around again (like if he is in range, he should get them imidiatelly).
I will keep trying but if anyone has hints what to use for this I would appreciate it.
Currently I'm testing so this is how it looks
keep in mind I'm changing it all the time as I work on it right now but if anyone can give me hints I will be thankfull
I would try to toggle the sense off and see if it causes on actor perception updated to trigger
If it does, then you could use that to update your logic (eg. when sense is disabled, it would probably lose sight and successfully sensed would be false)
But if toggling the sense doesn't trigger on actor perception updated, then I would just sort of fake it. Basically whenever you toggle it off, you would remove the current target it has or whatever and stop reacting to sense events. When you toggle it back on, you would check get perceived actors to see if you should update the target immediately, and again react to perception events as normal
Also I see you are using on percetion updated - I would generally suggest using on actor perception updated as it will trigger once per type of stimulus received for an actor, which is usually a lot easier to work with than the array
isnt this updates only on "trigger"?
once your target is seen will remain seen until its not seen again?
Yeah this triggers once per sight / loss of sight. While something is actively being perceived, it does not trigger again for that particular actor until sight is lost
On Target Perception Updated
On Target Perception Updated is called when something becomes visible, or when it is no longer visible
And only on those occasions
If you need to do some logic while something is visible, then you would need to use Tick or a timer
(If you need to run it repeatedly like that)
Do you mean On Target Perception Updated? I don't have actor. And yeah toogling it, doesn't print anything from the on Perception Updated.
Yes, The Target Perception Updated one
It's far more reliable than On Perception Updated
(At least in my experience)
Also contains more info, no idea what you would even use "OnPerceptionUpdated" for aside from very simple logic? Also having to wrangle that array of actors seems like a pain
Yep target perception is what I meant :)
guys anyone can share me their door bp for ai that open door when player is seen and when not seen it moves to its location as usual
and i am not using behaviour tree
I doubt anyone will have that for ya
can u give me good video for that i am making game like granny
so
specfically
door are main issue i am facing
🙂 than there will be way more to come.
Problem: AI not moving in package/build game
The AI works fine in editor but when I pacakge the game, it does not move from its current location.
Does anyone know why that might be the case?
I am assuming this is to do with nav mash not being build? not sure.
nah i have all the game i made
all way till
end i have most of the trash
doors are the main issue
The solution depends on how you want it to work
The simplest solution is to have the door open automatically based on an overlap
I came up with something and just want to ''write it out loud'', so you can analize with me if you want. For now, I think toogling sense isn't the best, because it seems a little bit complicated, because for example, let's say I have 5 enemies around me, I sense them all, and they are probably put in the array in some kind of order. Now, let's say I switch my character to ''fake not sense anything'', let's say in these 10seconds, enemies regrouped and the one with index 0, that was the target, is the most far away. If I turn back sense on, it should ''recalculate'' and find the closest target, at least this would make it more organic, than if it sudenly went for that guy in the back. Possible fix? When sense back on, check array, get distance to every target and choose the lowest one + check first if the old target is still in the sense area?
2nd solution I'm thinking is to have states of my unit like:
Stop , Hold, Attack and these would be linked to the behavior that it should be doing while in that state. So like in Stop, I would have only Wait 5s looped.
In the Hold, I would have task that checks if are there any sensed enemies? Wait 0.5s and check again and loop, if enemy is found, it would go and attack, with addition, that when first enemy was sensed, i save current position, and if the distance from ''starting position'' is let's say over 2000, then it should not chase anymore or just simply, lose target? what would happen if the target came back, it should find it again, gets complicated a bit
and while in Attack, it would just have sequence that if any target is in the sense area, go attack it and chase it to death, and if dead, check targets around and just continue find targets and kill them (in the sense range?).
Any flaws?
Probably some, but I can't get what you're saying easily into my head xD
more or less, i'm prototyping and i will watch some video to check if it makes any sense xD
just making notes
I would suggest just trying to implement it and seeing how it behaves
Sometimes the behavior is better to actually see in action at least when it comes to gauging whether it behaves in the way that works well in the game
I will try 😄
Hey, I can see that 5.4 includes updates for the NavMesh generation.
Does anyone know if it includes some changes related to NavMesh streaming ?
Or on-demand tiles generation ?
(As far as our problems go in 5.2, we're using world composition, Level streaming, with ModifiersOnly NavMesh generation which randomly doesn't generate the NavMesh properly in streamed sub levels)
We chose not to use Dynamic generation for performance reasons.
Requesting periodic NavMesh updates would be a way to go, but we never managed to make it work.
oh god, my engine bugged and wasn't printing anything and I was looking for mistake in code while everything was fine.. just needed to reset it ugh xD
What would I have to put or change to make AttackTarget be set to none, when it leaves the IsInChasingRange? Or maybe I should put AttackTarget not set on the WaitForTarget, and execute node IsInChasingRange to clear AttackTarget when it's true or false. I will try. xd
Cross posting in case someone here has run into this #animation message
Basically my animation blueprints are not firing properly when the controllers are controlled by an AI Behavior Tree. The ABP never seems to understand that the controller is moving or rotating, it never fires its sequences to even check anything. It's like the ABP doesn't exist, although Idle is firing the whole time.
(figured out some of it, by default it seems the CMC will not get acceleration data from the MoveTo function used here, have to enable Use Acceleration for Paths. This does not fix the rotation issue though)
Did you just remove the collision? If so, that's a hack and not a solution.
Solved mine, #animation message for posterity in case someone searches for it in the future haha.
Forcing a BT into acting like a state machine is never a good idea. Also your first one is completely overthinking the problem. Just use the EQS to find targets. There's a built-in generator to get them.
This is incorrect. The path following component doesn't do anything with acceleration. The CMC doesn't use acceleration unless it's turned on.
I'm not sure how it works under the hood, but, I do know that if it's disabled, Get Current Acceleration from the movement component will return a null value to the ABP, resulting in all animations that rely on that changing to never fire
The CMC won't have a valid acceleration unless the value "Use Acceleration for Paths" is checked?
Correct
Because the CMC doesn't use acceleration for paths unless it's checked.
Which is completely different than what you said. That it doesn't get the acceleration. You might think it's not an important distinction, but it is.
Thanks for helping me understand, I think I don't understand enough of the underlying systems. So "use acceleration" to me sounds like I have a variable called acceleration, and I am going to use it, for a path system.
But I actually don't have a variable at all until I check that box
it's null
I'm sure a large part of this is "For paths" I don't fully get the implications of. I assume paths along a navmesh
There are 2 solutions to that problem. 1. Turn on use acceleration for paths or 2. Use velocity in the anim bp. The first one does change how things work, which might not be ideal for every project.
The CMC doesn't use acceleration for following a path without it turned on. I'm not sure how to make you understand that.
Do you understand what acceleration is?
I think you're not understanding my question, so, that's okay I'm gonna move on. Thank you though
Oh wow, thanks for the tip with the finding actors. I will change to that definitely. For the other aspect, well I don't have any other idea how to make it so it will behave the way I want. And FOR NOW, it works as I have Attack and Hold ''states''. I will see what problems will be in the future, but so far, it's ''ok''.
If you want to tell me alternative I will be happy to take feedback, but any examples?
so far I made Hold like this and attack, which can be switched with A and S key
I just called it States but it's more like Commands, I don't understand what is the real problem I should study
See the pinned messages
I watched them all. Still don't see problem with what I'm doing.
It's not a video
I don't believe this works in my case because I need to connect commands with behaviors. It's not computer ai thing that will get blocked, but units should do what players tell them, and nothing else.
I wonder since so many people post pseudo-state-machine behavior trees here:
What would be an appropriate, beginner-friendly model to handle a set of complex behaviors with behavior trees (since they already exist in UE) that does not result in a huge mega-tree?
I mean
Surely you would have to at least split your BT up into multiple smaller trees, right?
What people don't seem to understand is that forcing it into a FSM actually causes the huge mega trees
So what instead? Make custom events and put logic in there because of that? or what
Well true. But that's something you only know if you know.
Wonder if there's something inherent to BTs that makes people go "oh yeah let's put some states in here"
like you are saying it's bad, but you won't tell example (even simple) how to do it other way
Aside from bad youtube tutorials lol
It's not inherent to BTs. It's the tutorials.
The main problem is that people have a hard time understanding the flow of a BT. Another problem is that they tend to completely over think it, instead of starting with the simplest version.
Yet another problem is that there isn't one way to do anything, but that's what everyone is looking for.
Especially so with AI it seems!
How could you then reinforce the fact that priority is key instead of arbitrary transitions across the whole tree?
The latter being what I assume to be the motivation behind shoehorning states in
People want arbitrary transitions across the whole tree.
Which is fine, make a FSM. It shouldn't take more than a day.
In other words: At some point the way a BT flows might not be the right tool and you need to switch tools, right?
Yes
Switch tools, means to do Events in blueprints instead of behavior trees?
You can also use the state tree if you want
Ok I will check out state trees
Is there any way to learn why a Move To Location or Actor, or AI Move To might be failing/ aborting?
Some like in-depth logging?
Currently fighting an issues.
Nav mesh exists, I can move to other nearby points, but not that specific point
I use a utility/ BT hybrid, because I need some things that the BT doesn't work for.
Just because UE offers it, doesn't mean you have to use it
Realistically, if you only have a handful of states - FSM's are more than adequate
The visual logger
I'm not familar with that?
Context?
It's the tool to debug why the movement failed
True, but at least BTs are more stable that StateTrees right now at least
I didn't say to use StateTrees
What is the Visual Logger in Unreal Engine 4
Source Files: https://github.com/MWadstein/UnrealEngineProjects/tree/WTF-Examples
Note: You will need to be logged into your Epic approved GitHub account to access these examples files. https://github.com/EpicGames/Signup
I have my FSM right smack dab in one of my units. I don't do anything fancy. Because I don't need anything fancy.
Hey all! I've been trying to install this plugin but it's not working (probably not compatible with 5.3?) https://github.com/kamrann/BTUtilityPlugin?tab=readme-ov-file#readme
Are there any other sources or ways I can set up my behavior tree to simulate Utility AI? For example the selector would calculate utlity with each selection then execute based on the score of an action?
How does that tell me the abort/ fail reason though?
That involves me logging in my own logic, which doesn't provide a good fail reason.
Can you reach out to the creator of the plugin
The navigation failures are already logged. Along with all the other AI systems
It logs the move stuff already. So you just look at the log.
Unfortunately not, even the inprogress mod they were working on does not exist anymore
I'll have to do a work around for the way i wanna do the AI then 🤔
What are you trying to score?
Weird.
Says it fails to project to a nav mesh, but I'm staring at the nav mesh all around.
Currently I have these actions for my AI; Roam, Eat, Sleep, Play (virtual pet AI in progress lol)
I have it set up in blueprints where it works and selects actions based on calculating a score, but would like to put the core logic into behavior trees (selecting what task to perform)
My utility/BT hybrid works differently than that plug-in. The utility selection happens outside the tree and each one has it's own BT.
Ohhh like a function that the BT executes in the controller? does it use an enum to switch the current action?
No. The main BT only has the run behavior dynamic node. Then the utility action sets the tree to use.
Ohhh that's an interesting way to do it actually
so you just create multiple BTs for each action?
i think ill try that out 👀
BTs aren't really made to jump around.
Each action only has 1 BT unless a different character needs different behavior.
Hmmm.
I found the issue, but I'm usure how to handle it.
I move to an actor, but I also have a collision on that other actor to block the nav mesh, so that AI know to path find around it.
But, since it tries to move to an actor location that isn't on the navmesh, it fails.
Does that actor move? Because doing that on a moving actor is really expensive. There are better ways to do dynamic obstacle avoidance.
It does not move.
Its just static
You either need to not block the navmesh or find a location on the nav mesh that is close to the actor. For the 2nd one, I recommend using the EQS.
Or you can calculate it yourself using math and project location to navigation function.
I thought this would've helped for the 2nd possibility.
I may need to use EQS then, never touched it.
Brand new to AI in general
Random is not a good way to do it. You'll get points on the other side of the actor, which makes the AI look dumb.
Its better then my AI actually being dumb right now. 😛
But, also didn't work
It doesn't work because the origin is not on the nav mesh
The EQS generates a bunch of points around a location, can filter out any not on the nav mesh (projection) and run tests to find the best one.
I assume EQS is performant?
It does say its experimental, and not to use. 😛
It's been experimental since at least 2016.
Yes, the EQS is performant. It's time sliced so it only does so much work each frame.
Guess its time to learn EQS, and AI stuff. 😛
The intro to AI course that is pinned here is a great place to start.
Is that better than switching the entire tree at runtime?
I do something similar but so far always switched out the whole tree
Cool.
I shall check it out. 🙂
It's more performant and causes less bugs. If your way is working it shouldn't be a big problem.
I'll know what to look out for in case of bugs tho!
I shipped one game doing a full switch out. It was fine, but I found that the dynamic subtree just worked better.
Can you inject trees into subtrees?
Oh! The biggest reason is because you have to set all BB keys.
Ah, true I do that every time
What do you mean?
Like using a "RunBehaviorDynamic" within a tree that itself is a subtree if the main tree
Nesting subtrees at depth >2 I guess
Yes you can. Not sure how deep you can go.
Okay good to know 👍
So to make sure i'm not too tired, You're using one BT for the core of the AI, then run other BTs for the actions it selects in the core BT in one AI Actor?
No. I'm using one BT that only runs a subtree. That subtree is selected based on the utility selection that happens outside of the BT.
OOHH SUB TREES of course dfkfdjgkfj
gotcha, i'll keep that noted then! Thank you lots
Run behavior dynamic is a node that runs a subtree that is set dynamically at runtime
For some reason the AI are moving to completely different locations than the given transform. If I draw a debug sphere on the transform it shows the exact place I want them to go, yet they don't. It doesn't fail either, it goes to the On Success with a movement result "Success"
Any ideas why?
Hard to say, I would try using the visual logger to see what's going on with the path and navigation
It's possible that your goal location is not directly navigable and it ends up projecting the point into a weird location for some reason... can't really think of much else
how do i enable the visual logger?
It's under Tools->Debug
Press the start button on the vlog window, then run PIE and it should show stuff for you
Thanks 🙏
Evaluators in ST are kinda like services or eqs in bt?
i could be dumb but whats the basic needed for StateTree to work?
like where to add components exactly?
There's a StateTreeComponent which you would add to your AIController if your intention is to use it for AI. Then you configure the StateTree asset on that component. Just make sure that the asset has "StateTreeComponent" schema selected.
Also make sure you have no other BrainComponent on your AI Controller, otherwise you'll have to resolve it yourself
When you guys have a melee enemy pursuing the player, and are using EQS to determine where to stand, how often do you re-run the query? Every frame? On an interval? Only when the previous position is no longer valid (the player moved a certain distance)?
Every frame is probably not a good choice because the query might not resolve in a single frame always
But in general it sounds like this depends entirely on how you need it to function. For example what is the point of querying for a new position often if you're not going to move into it?
Why there is so little about state trees on youtube 😦
just 1 example from epic's officials that is repeated across 4 tutorials xD
Too new system and it's complicated to understand unless you dig through the code which the average UE youtuber doesn't seem to do much
I wrote a few odds and ends on it here https://zomgmoz.tv/unreal/State-Tree/
Is that thing with the Succesfull enum node still bugged where you have to go around ?
Huh?
That you have to manually tell the task to finish because it will get bugged
so you create fake Succesful thing
I have no idea what you are talking about lol
hello, I have pathfinding problem that causes AI controlled pawns to get stuck almost always in this particular layout
so basically pawn #2 tries to reach its destination but is blocked by prop on the one side, and pawn #1 on the other side
RVO is enabled on both with 140cm radius, navmesh settings are pure default
can something be done about this?
I just implemented it in my project. Not using the Gameplay State tree plugin.
I read the source for Mass StateTree, Gameplay StateTree, and the StateTree plugin
It may just be my first unreal engine blog post 😂. It's a bit complicated to get into, but quite easy once you understand it
Is it possible and easy to do to switch these states with keys on keyboards?
I'd use state tree events for that
Tree events? 😮
this is something inside State Trees?
how do I contact from playercontroller to there
UFUNCTION(BlueprintCallable, Category = "Gameplay|StateTree")
void SendStateTreeEvent(const FStateTreeEvent& Event);
This function
What melon said
wait I have to use C++ for state trees, fuck me
BlueprintCallable means there is a node yes
ohh xD
Even if you don't know C++ it's always useful to have a look at a component's header file just to see what else it can do
How do you structure folders in project for that? Like AI > StateTrees/BehaviorTrees ?
There's two schools of thought for it in general
- Organize by type
- Organize by relationship
by type just means you'd have something like AI / BehaviorTrees and all your BTs go there
For now I had like AI > BehaviorTrees, Tasks, Decorators, EQS
by relationship means you'd have something like NPCs / NPCGuy which would contain all kinds of assets related to this particular npc
not sure where to put StateTrees 😄
well its the least problem, ill figure it out
btw can I fully translate something like this to StateTree and not have anything in behavior tree or I will have to divide this a bit?
No problem
so I fully can use StateTree and forget about behavior trees?
Depends. Pick the right tool for the job
Some people use both
Some neither
BTs are more flexible at the moment. But if you don't need such flexibility it's not going to influence your choice
Also StateTrees are quite buggy when you dig deep into property bindings, but otherwise work
I would advise trying to build something in STs first before committing to moving anything to it
doesnt sounds inviting xD
For simple things it's really no problem!
As far as I know there's only one kinda annoying bug with the prop bindings
Also supposedly will be fixed by 5.5
But it has a ~reasonably easy workaround
What's the bug, cause I just threw all my eggs in for my RTS game
It won't let you access nested properties unless it's the context object
Eg. SomeActor.SomeProp won't work
The workaround is to make a task which takes SomeActor and pulls SomeProp from it, then you can bind to the task's output
I'm trying to make first thing in state trees for testing and learning, since I don't need the actor to be character or even have aicontroller, i could maybe use StateTree for something like Tower?
Yes, I think even UE's own docs show state tree used for some moving target thing
i feel like soon I will transition all my blueprints into state trees and the game will be only statetrees lol
Oh I see. I should be fine then. I'm not really using objects besides a subsystem
There's also a 100% crash in case you're using BP structs
And binding in container elements is problematic (e.g. binding to the first element of an array)
And some linked subtree bindings are wonky
I imagine the new linked subtree asset feature won't be spared from a few bugs with binding, too
Oohh. This is quite a number of bugs. For BP structs, I think you have to create a custom schema that accepts UUserDefinedStruct
I'll tread carefully and limit my use of bound data for now
BP structs should generally be avoided anyway
I just avoid the plugin altogether. Wasn't a fan of having to recreate my ST when it would bug out.
Not too terribly difficult to write a FSM either
Now that I think of it, it did bug out on me once. I had to delete some states. Something with serializing a previous version of the tree and running that instead
ohh, wait do I create individual statetree of every state?
Nope
I thought I would put like Attack, Stop, Hold, in 1 state, but it turns out it's all alone?
These sound like states that you'd have in a single state tree. Each state then has a bunch of tasks.
You don't necessarily create a new state tree for Attack, Stop, Hold
oh ok
This was the worst.
Luckily it seems to be fixed
And I'm too dumb and lazy to implement anything that approximates the comfort of property binding in a custom FSM
Yeah, the custom UI is quite convenient. Although I think there's a lot of indirection with objects. The entire setup could be made a lot more simpler
Too many proxy types and containers within containers
And also you just can't bind UFUNCTIONS like you can with property access nodes in the Anim BP
Which really sucks because now all the variables that your ST needs have to be cached somewhere instead of just being able to call a function to get them..
is there a way to bake recast in midair?
About the bug I was talking before, Is it still bugged that these nodes doesn't trigger Succesfull in the tasks?
and you have to go around
by creating branch in Tick ?
🤔
If it's a latent task then I could see it potentially working that way
But if it isn't then it seems like it shouldn't need to be set up like that and returning from EnterState other than running should end the task
Is there a max number of navmesh volumes you can have on one level?
Is it better to have multiple navmesh volumes over only the specific playable areas, or one large volume covering everything?
Rather a theoretical question. How does one implement stealth based on environment illumination using UE's built-in sight sense without manually placing volumes everywhere which denote how bright this piece of map is? 🤔 I mean so I can handle the situation when my NPC sees someone in a restricted area, I have my custom logic to build up the detection meter, but how do I take into consideration how illuminated the threat is?
I don't think there is limit and also it might be better to have multiple navmesh, reallly it's up to you how you prepare it so player can move or not move to certain areas
What is the default cost of the NavMesh?
Is there a way to receive an event when bot reach any point of navlink?
@uneven cloud just wanted to thank you for pointing me to StateTrees, I started to understand them a little bit more and seems like it's gonna be much easier and more flexible to do what I want with them, also thanks @floral compass and @misty wharf for notes, very usefull
Hmm, did they changed something in 5.3 + ? I'm trying to override function in the task, and it gives me event instead of function?
Shouldn't I have it like this?
There's been some changes to ST's in 5.3 I think, so it's certainly possible that changed
Okay
So How do I call now return node with the succesfull or running or failed?
I changed event to the Function
but I'm not able to edit Return Node like in tutorial
Does it mean that you don't have to specify right now that it finished?
Just when the whole event finishes it counts as done
If it gives you an event by default when overriding it then it means you can't really return any value from it directly
I recall you might have to call Finish Task when you want to finish it
this can be done from EnterState or from Tick or such as well
I always have doubts, is the AIcontroller and the blackboard different for each AI, or is it the same for every AI?
One controller is spawned for each pawn and one blackboard is created per controller
Blackboard properties can be configured to be shared across all instances of the blackboard in its settings, but other than that they are not shared
So they removed these nodes with enum On Succesfull, On Failed etc?
and now it's this one
so this will either fire Sucess of on Failed
Yeah
You can't really finish the task with any other state anyway so I think this makes sense
If you want to keep the task running, you just don't call finish
Okay... so this is it. Finish task will lead to On State Succeeded or Failed
and what about State Completed?
Completed is either success or failure
Oh, okaaaay
I guess it's mostly a convenience feature so you don't have to configure the same settings for both success and failure if you want them both to result in the same transition
So I would basically call it like Event Start > Finish Task and then EventOnCompleted and add logic here? 😄
I don't know why you would need to add logic to event on completed unless you need to do some kind of cleanup but yes
Alright I wanna make a simple state tree with custom function. Basically would be something like
- Check if Player is valid
- If Valid then go to player
- If close enough to player then attack otherwise move close to player again
- If dead then go to Idle
dunno where to look for to make something like this
Look at the state tree docs, it shows how to set up a state tree with some tasks and things in it
Saw only this
didn't saw API or indepth talk about making custom states and more details about how to use it
it does say something but im mostly confused on this one
I think you can make it with Behavior Tree
is it expected behavior that Finish Execute does not end execution of a task immediately? Like, calling it in a for loop does not break the for loop?
Yes, nodes cannot just exit out of the code with the exception of the return node when you are in a function
Nodes are effectively just function calls as you might have in C++ or other languages, so they have no capacity to exit the calling function. The Return node in case of BP functions is the equivalent of the return keyword, so it has this capability in that particular case
alright thanks
USTRUCT(DisplayName="DoTask")
struct EXAMPLE_API FSTT_DoTask : public FStateTreeTaskCommonBase
{
GENERATED_BODY()
using FInstanceDataType = FMyInstanceData;
virtual EStateTreeRunStatus EnterState(FStateTreeExecutionContext& Context, const FStateTreeTransitionResult& Transition) const override;
virtual const UStruct* GetInstanceDataType() const override { return FInstanceDataType::StaticStruct(); }
};
Saw this from your page @misty wharf didn't got this part about GetInstanceDataType. Why exactly you require that anyway?
Allows you to get data like this:
const UStruct* FSTTask_StateConfig::GetInstanceDataType() const
{
return FSTTask_StateConfigData::StaticStruct();
}
EStateTreeRunStatus FSTTask_StateConfig::EnterState(FStateTreeExecutionContext& Context, const FStateTreeTransitionResult& Transition) const
{
Context.GetInstanceData<FSTTask_StateConfigData>(*this).Enter();
return EStateTreeRunStatus::Running;
}
void FSTTask_StateConfig::ExitState(FStateTreeExecutionContext& Context, const FStateTreeTransitionResult& Transition) const
{
Context.GetInstanceData<FSTTask_StateConfigData>(*this).Exit();
}
what data FSTTask_StateConfigData should contain @floral compass ?
Whatever data you want that pertains to the task
It's probably worth noting that the Enter and Exit things in there are custom functions in the StateConfigData struct and are not something that's built in - the instance data is just a custom struct that you define yourself
is there any superspecific rule like must be derived from some class?
In my case it looks like
USTRUCT()
struct MUGENTEMP_API FSTTask_StateConfigData
{
GENERATED_BODY()
UPROPERTY(EditAnywhere, Category="Parameter")
UAbilitySystemComponent* AbilitySystemComponent;
UPROPERTY(EditAnywhere, Category="Parameter")
UAnimInstance* AnimInstance;
UPROPERTY(EditAnywhere, Category="Parameter")
TArray<FStateTreeStateConfig> Configs;
TArray<FGameplayAbilitySpecHandle> AbilityHandles;
TArray<FActiveGameplayEffectHandle> EffectHandles;
void Enter();
void Exit();
};
No such rule no
Does it still require C++ to put characters in teams? For perception of Ally, neutral and enemy?
I have this issue with my AI where they stop detecting the player. This seems to only happen when I spawn them with SpawnActor. AI placed in the level functions fine. I printed successfully sensed in the bp and it's not false unless the player gets out of range. Yet the bt says that HasTargetActor is false.
#include "CoreMinimal.h"
#include "StateTreeTaskBase.h"
#include "SOM_StateTreeMoveToTask.generated.h"
//USTRUCT()
//struct FMyInstanceData
//{
// GENERATED_BODY()
//
// UPROPERTY(EditAnywhere, Category = Input)
// int32 Foo = 0;
//};
UCLASS()
class UMyInstanceData : public UObject
{
GENERATED_BODY()
};
USTRUCT(DisplayName = "SOM_StateTreeMoveToTask")
struct ALSV4_CPP_API FSOM_StateTreeMoveToTask : public FStateTreeTaskCommonBase
{
GENERATED_BODY()
virtual EStateTreeRunStatus EnterState(FStateTreeExecutionContext& Context, const FStateTreeTransitionResult& Transition) const override;
virtual const UStruct* GetInstanceDataType() const override { return UMyInstanceData::StaticStruct(); }
};
Why this code results in error @misty wharf ? Am I doing something wrong here?
You are using a UObject, they don't have a StaticStruct member. Use StaticClass instead
If you want to use a UObject based instancedata, there's a builtin task or two that use it as well, check those for more examples of how it's used
Hello AI's Does state trees have debugging tools ?
It has a debugger in one of the menus when you have an ST asset open, and it logs into visual logger
hey devs , please help , this ai should chase u and attack when he is close to the player but somethimes it is tryying to move but stuck at some points with some objects , u can see how he stops movement and jitter a bit (he is trying to move but can't ), as an example 0:17 or 0:41
why is that happening and how i can fix it? can EQS be a solution may be?
Looks more like nav agent properties aren't set up to support the larger character
Search for agent properties from Luthage in this channel. She talks about it from time to time.
Luthage is a person? how can i find this properties?
You go to the search box of Discord, do From: Luthage and then search agent properties
guys this is how my behaviour tree looks, is it not wrong ? it is blicking and idk why I think it should be just white and not blick or?
oh on video its not as visible but on my screen its blicking af
If the task finishes immediately then the tree will restart search, that's the blinking
I kinda need NPC to walk on these. Any easy solution?
NavLinks maybe?
Just a guess, not sure about it
More than one problem there I think
You would also probably need to add supported agents and lower the agent radius, if you want the navmesh to encompass the whole width of the escalator
I presume this is in the capsule component?
Project settings, navigation system iirc you should see supported agents
Capsule component does also come into play if it’s a char
I believe Luthage said capsule radius has to be at least 2 higher than the nav agent radius but I could be mistaken
If I give an interface as a base class for a blackboard key, does it mean any class that inherit the interface?
Might be tricky, would definitely try it first. Especially with BP interfaces
After installing Learning agent plugin and restarting UE5.4 it stucks here loading python script plugin at 75% any idea guys ?
I got the BP interest spot
Which is inherited by the BPI InterestSpot
Move target in the Blackboard is a Bp_Interest Spot
I have a task with the variable InterestSpot which is exposed
But the Task in the behavior tree does not see the Move Target in the blackboard. Did I miss something?
How are you trying to access the MoveTarget from the blackboard? Can't see that from your screenshots
Move target is a BP interest spot and I'm trying to pass it to the BTT_Handle_InterestSpot Task. The other tasks I created managed to pass a blackboard key without issues simply by adding it as a variable for the task. But here it doesn't work.
Move target is setup when a character is created.
Yeah but I can't see "MoveTarget" being used anywhere in those screenshots.
So I'm wondering how you're trying to access it, cause I can't see any reference to it.
In the AI Controller, I add it. To then be Passed by the blackboard to the Task
That's where you're setting it, what I'm asking is where and how are you getting it in your task?
Because all I see is the variable "Interest Spot" in your task which does not seem to be populated ever
What I would expect is something like
That's the issue I'm trying to figure out why Behavior tree doesn't see "MoveTarget" as a valid value for "Interest spot"
How do you expect "MoveTarget" and "Interest Spot" to be connected?
Those are 2 different "variables"
Not connected in any way according to your screenshots
Interest Spot, at least from your screenshots, is always empty
Btw don't copy paste the example I posted, there is a better way to access blackboard variables than "Make Literal Name"
When i add a character with a custom orientation to a level, if it has an AI Controller (even a default one), the pawn get its orientation reset when i play the level. How can i avoid that ?
I was under the impression that I had passed the blackboard key "Movement speed" in that manner to my task in the past. I just realized that I didn't pass the blackboard key at all but hard set it and moved on. So I was expecting the other thing to work the same way.
Problem solved.
Would also be good to check whether the blackboard entry now really only allows objects that implement your interface..
hey there guys , is there a way to make so that some AIs use one navmesh other AIs uses another navmesh? i got big and small ais
Maybe a weird question but how do you organize your blackboard values(using blueprints)? Like if I want to access a blackboard value I have to use a name. I was thinking of a way to mitigate this because using names seems kinda problematic, especially if you wanted to make a change for whatever reason
There are FBlackboardKey structs specifically to avoid having to hardcode names. Check how it's being used e.g. in Blackboard Condition Decorator
oh wait I think you meant something c++ related
They're not exclusive to C++
Sorry I did use the wrong name though, you're right
Hi, why my RecaastNavMesh reset it's parametrs? Like Agent radius and Height
And every time it recalculates, will it do so in build version?
Did you configure the settings from project settings or directly on the recast navmesh actor?
Directly
Yeah do it from project settings. The settings on the actor are configured from there when the navmesh gets regenerated
Ah, i see
Thanks!
Btw, can i bake them somehow?
Like to generate them only one time
I recall there should be a setting somewhere which prevents it from being regenerated automatically in the editor
Meaning when you want to regenerate it you need to go through the Build menu to do it
Okey, i ill check, thanks!
They do get baked in that sense though so it won't regenerate in packaged games, unless you turn on runtime navmesh generation
Yeah, that's what i was curious about
Thanks again!
With EQS, is there a way to make a line of points to the left and right of an actor only (without front and back), so basically a grid that only extends to the sides, if that makes sense?
With a custom generator sure, not sure if there's a builtin one
yeah i was looking at the built in ones, they all seem to have some kind of radius
i guess i gotta look into making customs, thanks for stirring me in the right direction
If you use C++ you can check the code for the builtin generators, you can probably pretty much just copypaste one and modify how it generates the points
I'm not sure if it's possible in BPs at all
will have a look at this
https://www.youtube.com/watch?v=vUy-UIEHqFA
I was checking this video, which uses an experimental plugin (GameplayBehaviorSmartObjects). Of course the video ignores it, since the video is about that plugin, but should I avoid it and give up on that tutorial? Is there somewhere I can check the feedback on that plugin and see if many people got troubles with it?
I use GameplayBehaviorSmartObjects in my project and it works fine
It doesn't do a whole lot as far as I can tell, basically you just get a GameplayBehavior class which you can use to create logic for how something uses the smart object
Since you're just working with standard blueprint stuff I wouldn't worry about it too much. If for whatever reason you need to replace it with something else, it should be reasonably straightforward
It's weird. I know it should be safe, but the simple fact it told me to be careful stops me dead in my tracks :p
Is this still the same in 5.4?
https://forums.unrealengine.com/t/ai-perception-sight-only-traces-to-middle-of-actor-capsule/875516
I'm in the same situation, need enemies to be able to detect the player if their head is poking above a crate but it seems they need to see the origin point of the player before they react ... would prefer to use the stimulus system but will default to a cone trace if I have to!
Hi all! There is a problem with AI perception Sight which simply uses the target actor location to trace and see if the target actor is visible or not. The AI trace “origin” itself can be modified in the character blueprint by simply going to the Camera (?!) section of the character BP and modifying the Base Eyes Height. Which is great, since ...
I vaguely recall there is a eye offset head offset or some other such value on characters which affects this but it might only affect the start position of the trace... otherwise you need C++ and IAISightTargetInterface (which is fairly trivial to implement if you know C++)
I always wondered what does EPathFollowingResult means?
Does it refer to finding the path and returning it? Or actually moving the Actor?
You are incorrect. The capsule radius needs to be 1 less than the nav agent radius.
Ah, sorry thx
The step height on those stairs is way too high.
The navigation system automatically picks the best fit nav mesh based on the agent properties.
I need to abort this selector from the blackboard BOOLEAN value - but its still executing it... what is the logic here?
my boolean values are false - is there a more appropriate way to handle this?
Set != True
Set means it holds a value other than nullptr
Iirc there’s a Boolean decorator you can use instead
@uneven cloud You mentioned awhile back defining custom EQS / Blackboard code for selecting abilities. I imagine you set up a custom Blackboard key type -- if it's not too prying, did you also edit EQS so it could return something other than an Actor or FVector?
I made a BB key for holding the ability handle. Then made an EQS item type for it. It's a lot of boilerplate code, but if you follow how the others are set up it's not that difficult.
They're not stairs, they're escalators. I don't need the NPCs to step up to them, I just need the NPC to stop and wait at the bottom.
Then you need to use a nav link proxy.
Yeah, but then the AI doesn't stop there.
It will if you add that functionality when they get to the link
Interesting... Now the issue is to make it wide enough for them to reach the moving part of the escalator.
speaking of which
how do you make navigation agent
without touching the actor system?
Like making it for something like Mass/Other ECS solution?
You need to have the agent properties struct.
explain? So far I know simple FindPathAsync but doesnt feel too good lacking avoidance and other stuffs
There's a struct called agent properties. I'm not sure what is confusing about that?
i mean like using the struct like where to put it and how to call onto navigation system with all those avoidance mind
It's on the movement component by default. If you aren't using the UE paradigm, then you need to figure out where it makes sense to put it.
See what I told you about supported agents, with this correction #gameplay-ai message
Ugh, I'm trying to come up with a formula for calculating "item desirability" for my game and it's such a pain in the ass 🤦♀️
I guess it's basically similar to a utility score but trying to think of good ways of incorporating all the factors into it so they work in a way that does what I want is so complicated
Need to have like a "base score", eg. does the AI want the item at all to begin with, another score for outside factors that can affect it, and a situational score based on where the item actually is... and then it needs to also take into account the price of them item and whether it's considered to be too high
...and ideally this should also be slightly chance-based so that it's not a guarantee that the AI will always want it
oh yeah and there's also items of different types that could satisfy this score by different amounts
I am entirely ignorant on the matter, but is it so that the more utility calculations you do the less "control" you have?
Since you're setting up fuzzy rules it's gonna get increasingly harder to get desired outcomes the more variables you have.
If so personally I'd probably try to keep the number of variables as low as possible. Otherwise my brain would explode trying to reason about all the possible combinations.
Yeah that's true, however the things listed here are generally something that would be part of the gameplay considerations the player would do to get some result they want... Eg. an advertising campaign or such is an outside factor the player could trigger, and placing drinks into a cooler would make the AI more likely to want to purchase it as opposed to it just sitting on a shelf
But there is certainly a possibility that maybe these things make it very complicated for no reason and the player agency from these things could be implemented in some other fashion into the system
If I have a building with multiple floors, is there any particular reasons to split it in multiple navmeshes volumes? Or should I just keep it all on a single one?
As far as I can tell you'd mostly want multiple volumes if you have parts of the map where you don't want a navmesh generated
So by using multiple you can shape the area where it generates better or such
Or other design reasons, eg. maybe it just makes it easier to work with a volume for each area of your map as opposed to one ginormous one
I personally quite like to throw a bunch of variables in there to make things more unpredictable. The one thing I would say is to make sure you capture data when decisions are made so you dig in to how the decision was made, and make sure it's more or less what you had in mind.
Yeah I'll probably need to do that, currently I'm mostly playing around with ideas in spreadsheets to see how adjusting the values with different formulas affects the result
That's a good idea. Creating a control group.
We made an attack target system that took in 37 data points
Perhaps a little on the excessive side
:D
Yeah that sounds like a lot
In my fps project making the AI more complicated in that regard had a tendency of making the behavior worse for the type of more straightforward shooter it is
I read a study once on player reaction to various AI approaches to decision-making. They programmed about 10 different strategies from "target the least health" to "closest to me" to "random". 1) the players were terrible at inferring what the strategy was (the go-to was that the AI was somehow cheating). 2) the strategy deemed "most fun" was the random one. Take from that what you will.
lol, yeah there's always something like that... but I think it largely depends on the type of game. For something where the goal is to just let you shoot a bunch of guys and give you like a power fantasy thing you probably don't want the AI to be trying to be super smart, but in something more "tactical" in feel it would make sense for the AI to be like that
If reducing the amount of variables is not an option then maybe their cardinality?
So just categorizing like low/medium/high and then mapping those to static score points for the selection
Hi we're using a dynamic navmesh with navigation invokers on a map with world partition enabled. (UE5.3.2)
I keep getting warnings that meshes add an oversized dirty area and I have no idea why that happens or how to fix it without ignoring those obstacles in navmesh generation. Most of them aren't even very big
LogNavigationDirtyArea: Warning: (navmesh: RecastNavMesh-Default) Added an oversized dirty area | Tiles marked: 1 | Source object = StaticMeshComponent /Memory/UEDPIE_0_M0ZDOAAVNOC97P5GS7W72J6FD3.Worldmap:PersistentLevel.sm_Prop_185.StaticMeshComponent0 | Potential comp owner = StaticMeshActor
this is doubly interesting to me because almost all of the actors referenced aren't even close to the invoker range, it seems it's just whenever world partition loads or unloads tiles it throws warnings no matter if they affect the current navmesh area
I think crowd avoidance should work with any kind of pawn
maybe
Yeah not 100% sure - but I think if you use the crowd avoidance controller, and implement the crowd agent functionality so that it works correctly with your pawn type, it seems like it should work
C++
I would try it first with the crowd avoidance controller and see what it does with a non-character pawn
im having this bug messege using StateTreeAIComponent on cpp, LNK2019: unresolved external symbol "private: static class UClass * __cdecl UStateTreeAIComponent::GetPrivateStaticClass(void)" (?GetPrivateStaticClass@UStateTreeAIComponent@@CAPEAVUClass@@XZ) referenced in function "public: __cdecl ASpyAIController::ASpyAIController(void)" (??0ASpyAIController@@QEAA@XZ)
i added the module and all
You need both
"StateTreeModule",
"GameplayStateTreeModule",
"GameplayStateTreeModule"``` its already added :c
i tried to put on character and aicontroller but doesnt compile
Did you refresh project files?
Other than that I have no idea :/
alright how exactly you pass actor data to state tree?
like I want to ref my player on state tree
By using an evaluator
Or if you have the player stored in a variable somewhere you can property bind to it
how exactly I cant directly ref actors on level on the state tree
Doesn't have to be on the state tree, can be anywhere
The AIController's PerceptionComponent could be one such place. It entirely depends on your use case and how you're getting the player.
Also whether you only have 1 player or multiple
just 1 player. Regardless i mean I am not seeing good ways to pass stuffs onto state tree. Atleast from what I know of...
Evaluators and property binding. The latter being a very comfortable way to get anything into your StateTree.
basically just get something on runtime
Here's an example for an evaluator
And here's how you use property binding to access anything your evaluator spits out
Bit buggy atm since you can't access nested properties, but that should be fixed by 5.5
alright alright what's the base C++ class for it?
You do this by not having different scores as that makes it really complicated, but having things that modify the score.
Yeah I mean that's the gist of it but you have to determine how they modify it :)
I think I figured out a not terrible method of determining whether the AI thinks the item is fairly priced or not so at least that's something lol
Although now that I mentioned it, it occurs to me it would probably work better if that's a separate check all things considered 🤔
RVO is in the CMC. Detour crowd is not.
But the problem with it is also partially that the level of how desirable the item is could potentially be used to allow for a higher price to be charged.... so you can probably see why this is annoying and complicated
RVO and detour crowd are 2 different avoidance implantations. They are completely separate, but both do avoidance, just in different ways.
FStateTreeEvaluatorCommonBase
No. You should use one or the other. Detour crowd should work fine with a pawn.
I think I have the same problem, I understand that OnTargetPerceptionUpdated performs an execution pulse so it will not keep anything running until something changes, what keeps running and updating is the sense,(vision, audition etc.) I also need that once detected, a function keeps running until it goes out of the vision range.
Have a variable like CurrentTarget in your class, assign the target that's perceived into it. Then in Tick check if CurrentTarget is valid and if it is, do whatever you need on it
does the "abort lower priority" option work for a branch in a dynamic subtree to cancel a lower priority branch in the overarching tree that's running that subtree?
like if i have a sequence or selector, where the leftmost option is "Run Behavior Tree Dynamic" and a branch in that tree is set to abort lower prio
No, branches above are higher priority
even branches to the right of the dynamic tree task?
Not in regards to the run BT task itself but your decorator would have to be on the Run Behavior Tree task
Outside the subtree
hmm
im trying to make ability selection a dynamic subtree, so that the general flow of "use ability -> move to position -> cast ability" is on behavior tree that everyone uses, and the different ai just have different ability selection subtrees, but im having trouble with implementing a system where some ability selections should override the current running ability but others shouldnt (and should just wait until the next time we run the tree to select a new ability)
just having trouble figuring out how to let some branches abort the main tree but others not
Thanks, I was trying to avoid an Event tick, since in my detection I calculate illumination values and it is a bit costly, I was thinking of having a reference of the sphere that appears in the debug view, that way I can make calculations etc when the sphere changes position. That way along with the auto success range from last seen location it would update within the view range, but not on every tick. Any idea if the sphere is accessible in BP or c++?
Why are you putting ability selection directly in the tree like that instead of a task or service?
i was writing it in c++ but i found that the ability priority system i was writing i was just remaking a behavior tree.
so i figured i would just make it a little tree dedicated to only ability selection
and just run that as a dynamic tree within my generic combat tree
The sphere in the debugging is just getting the data from the perception info. You should be using the real data (perception info) and not the debug dump of it.
How could that be even remotely remaking a BT? Now you need a BT for each AI instead of being able to share one.
i mean i have to make ability selection for each different ai regardless, why is it worse to make it a behavior tree than to make a stack ranking of abilities with different requirements (which end up jsut being decorators by another name) for each one?
Why would you need to make an ability selection for each AI?
because they all have different abilities and different requirements to use them
So?
It doesn't make sense to hard code that in the AI, when the different abilities can do that just fine.
Right, but in my code I set the TargetActor variable in the BB when the AI senses the player. So while it's in range of the player, it should always be able to detect the player.
what do you mean? when i say ability selection for the ai, i mean the priority list for each ai for what abilities they should use. Like if I have 2 enemies that both use some generic "Arcane Blast" spell, they don't necessarily both want to use it in the same scenarios and at the same priority level. One of them might have other higher priority abilities and only use it as a last resort, while the other just uses it occasionally and has some melee abilities if it gets too close to its target. For boss enemies they might also only want to use it in specific phases. All of that kind of logic seemed like it would make sense to write as its own priority list, but when i started writing the priority list, it essentially just turned into "if this condition and this condition are met, use ability 1, if this condition is met instead, use ability 2" etc. which just ends up basically being a selector node with a bunch of decorators on the various branches, is it not?
Alright, first time working with Navlinks here. I have an escalator. I want NPCs to only go 1 way in it, so I created a navModifierVolume on the elevator itself to remove the default navmesh that was built on it, added a Navlink that went from bottom to top, making sure Left was at the bottm and Right at the top. I set the Link on Left to right. I kinda expected the AI to just walk straight "toward" the Right link and thus scale the escalator, but it didn't. The AI stopped, not sure of what to do.
What am I missing?
Afaik you always need to implement the logic to navigate the link yourself
Just having the link just tells the AI "go here to get there" but how that happens is up to the smart link to implement
According to the video I'm watching, no. As soon as the link is built, the AI just start walking.
https://youtu.be/iu7cjp1Gg7U?si=rTt8XI9KO4WBW1Cx&t=77
Granted it was UE4 and the ground is flat, but the dude has no navmesh in between, just places two links, and the AI start going through.
Use Nav Link Proxies to control the flow of traffic, jumping up and down from ledges and across chasms, and collecting power ups for bigger jumps. Create both basic Nav Links and Smart Links and use them for different types of jumps.
Follow Along:
00:00 - Controlling the flow of traffic
02:34 - Jumping down to a lower ledge
03:11 - Jumping up t...
Where does that walk through the navlink? I see it jumping but that's been programmed into the navlink
Wait it was right in the start was it? lol
At exactly eh timing the video should start (about 1.17).
Is it because the two spots have the same elevation?
Are you using the navlink proxy like he does or a custom link like later? 🤔
I definitely recall the proxy not really doing anything but maybe I'm mixing it up with a custom smart link
I believe a Navlink Proxy
Now, I don't really mind, I setup a system where the NPC "Walks" straight toward the direction of the other link for a bit, wait for a bit then resume (while it may be unclean, it'll ensure the AI will start moving again if it gets stuck) but I expected it to...
heh
yeah I mean I don't think anything's really changed with the navlink stuff since UE4 so it seems like it should work like it does in the video in that case
Alright, at least I'm reassured it's not just me seemingly not being able to follow a 40 second explanation.
Worst part: It was working without the link and the Bound volume to remove the Navmesh :p But they could also go down. And it's supposed to be one way.
Well you might want to do it via a custom smart link anyway right? Cause you can have the AI actually step on the escalator, do a lil animation, etc. instead of just walking it down
Oh I see you just posted about this on the ue subreddit lol
yep. While yes, I might actually wanna do it myself, I also want to understand how things work. If my assumption of something is wrong, I kinda want to learn still.
And also yes, I do post on the subreddit when I don't find an answer quickly here.
Yeah I'm kinda curious also 🤔 It seems strange it would behave differently like that
Hello, don't know if anyone can help figure out how to get around this, I've been trying to create a small isometric game, with two player-controlled characters, one of them was going to have the ability to knock down destructible barriers. I've created a geometry collection for this door and added an Anchor field at the top, but after despawning the fractures the navmesh doesn't rebuild correctly, giving inconsistent behaviour when trying to go through it.
I've been looking into the RecastNavMesh class to understand how the navmesh building occurs, is there anything in this that can help me get a more reliable result? Thanks to anyone who's willing to land a hand in this 😄
I would try disabling can affect navigation on the destructible part
And/or set it up such that it generates a nav area which blocks the other character from navigating through it and only allows the correct one
Although it seems if you have runtime generation enabled for the navmesh it should regenerate
Yes, I set it to dynamic, and I can see it regenerating the navmesh, but for some reason it never gets rid of those gaps even though the fractures are gone.
Yes, that was going to be the next thing I was going to do, but the issue I've got right now is that no character can go through the navmesh when it is like in the picture.
Yeah if you turn off the affect navigation from the mesh it will allow it to generate the navmesh under it
Wouldn't that cause the AI to try to go through the door even when it's still intact?
Oh wait, the collision with the door and the Character capsule collider would stop the character from moving though..
I'll try it right now
It seems to have worked although the character keeps trying to walk through the intact door and playing the walking animation. 🤔
Yeah it depends on how you want it to work. If it bumps into it you could have it stop movement, or set it up with a different nav area so that it won't even try
I'll try setting up a new navmesh area inside the walled section of the level where the Character can't go, but I'd have to find a way to change this to a walkable area once the wall is destroyed.. 🤔 , is there maybe a way the Chaos system can tell the rest of the game when the geometry collection's fractures have finished moving/gone to sleep?
I would just do it with the wall piece itself
So you'd have f.ex. a collison box in the wall piece actor which is set to use a nav area that makes it impossible to navigate through it, and you hook up the events from when the wall gets destroyed to adjust the nav area to a navigable one again
hook up the events from when the wall gets destroyed
Is this a chaos event I can bind code to from the geometry collection actor?
I have no idea but I would assume there must be some way to do it
If it doesn't have an event to tell you when it happens, then you could probably just trigger it simultaneously when you destroy it
If anyone has any idea why this doesn't work, I'm all ears. I tried more complex ones as well, to no avail. I got two of them, one simple and another smart. Both are configured left to right, left being downstair. Just for trials, the smarter one has a function that makes them jump rather than move toward.
I'm also interested if anyone has a way to check if the AI at least tries to path with it. Thanks
I'll look into this. I'm hoping there is, but I'll live it I can't implement this the way I want ahah 😄 . Thanks for helping, really 👍🏻
any way to debug a behavior tree being run by the "run behavior tree" or "run behavior tree dynamic" nodes? if i open the asset while the game is running it just says "no matching actors found" even though the main tree is running and is on the branch where i'm running a subtree
Is there any way to edit the parameters of AI Perception (Sight) at runtime with Blueprints? Like increase the radius if a stimulus is detected or enable/disable the perception when needed ?
to expand on this, i have a parallel node where the left branch just runs another behavior tree, and it doesn't seem to actually do anything
Try placing breakpoints on the nodes, and when running in PIE, try using the dropdown in the BT editor's top bar to select the appropriate controller. Sometimes it won't detect it right away. You can also try detaching from the pawn, and selecting the AI character you want to debug as this should also track the appropriate one in the BT editor
Not with blueprints, but it's fairly easy to expose this functionality to BPs via C++
Although you can enable/disable, just not tweak the individual settings
I tried all this, the main tree is running, and is on the correct branch in the debugger, but inside the subtreethe dropdown shows no options. chatgpt says that you can't use the RunBehavior or RunBehaviorTreeDynamic nodes as part of parallel nodes, so it seems I'll have to do something else
I wouldn't trust anything ChatGPT says but this seems plausible if it isn't working
i havent really found any other answers, but the chatgpt answer lines up with what i'm seeing 🤷♂️
I would try placing the Run subtree node outside of the parallel... if it works, then it seems the parallel is the issue
And yeah ChatGPT is occasionally correct but I would treat it as "assume it could be wrong, so verify its claims yourself to be sure" lol
yeah if i move the node outside of parallel and into a regular sequence it works
:/
bummer
dunno why i can't wrap my head around how to get the system i want working with behavior trees, its been months of trying to make something work, failing, and then just doing something else until I get to the point where I need AI in the game to test what i've been working on
What are you trying to make it do?
I've still not found any use for parallel in any of my projects :P
the way i want the ai to work is basically: each enemy has a priority list of "combat choices" which are just made up of an ability to use, an EQS query to run to get a move to location BEFORE using the ability, and an EQS query to run to get a move to location DURING the ability usage. both of the queries are optional, so if they aren't set for a choice, then the enemy just defaults back to some default movement logic. so basically Select Ability -> Pre-CastEQS -> Move -> During-Cast EQS -> Move/Use Ability (parallel) -> Restart
I wanted to run the ability selection in parallel so that I could mark certain choices as "high priority" which means if they become available while I'm doing a lower priority choice they just abort the whole sequence, while other choices won't do that and will just be chosen later. this seemed to me like I should just use the built in observer aborts stuff that decorators have, so i would just make the ability selection for each enemy a subtree that gets injected into the generic "use ability -> move -> etc." tree that everyone uses
luthage said this is a bad idea but i'm not sure how you get around doing either that or just writing the same logic but without a behavior tree, which seems silly since the ability priority functions like a selector node with a bunch of decorated branches that can abort or not (to me)
i've used this example before, but I would like to be able to write enemy ability selection like a wow priority list, where the same ability can be in multiple places with different conditions
Behold my probably completely-unnecessary-but-I-can't-think-of-how-else-to-do-it parallel node usage and despair!
Didn't we talk about this lol
As long as it isn't in my codebase it's not a problem 
Hmm yeah hard to say, you could also run the selection as a service or such I think
maybe, i dont really want to select abilities on an interval though, i only want to select when i'm finished with the previous ability OR a "high-priority" ability becomes available and wants to interrupt the current ability
How would the high priority ability become available unless you're checking whether it's valid on some interval or such?
well ideally i would just have some delegate fire off so i don't have to check stuff on an interval or every frame
(if im not just going to use decorators on branches)
Right, well I mean the service could just listen for those delegates, or you could use something to update the BB which causes some decorator to trip
maybe, i think im just dumb but at this point i feel like it would be easier to just write the whole thing in c++ than try to contort what I'm trying to make to fit the behavior tree architecture that i apparently just don't understand
heh
Hey guys. Any idea why RVO avoidance is not working with my npcs?
Hello guys, I'm making a simple AI system with the PawnSensing. The issue is that, when the player go out from the Perphal vision angle, the AI instantly stops to chase the player, freezing completely on its local position. So how can I fix that? How can I avoid this? Could somebody help me please?
hi there, i m trying to make basic example with state trees in ue 5.4, and i canot get to work move to premade task, in debug alway says fail to move to, but dont know why, i tried, put vector or target actor both the same problem
Remove the sequence and place the delay and what follows after the AI Move to, basic out exec
Something like this?
Yep ! Think about setting up your speed too, but that's how I did it, and it works, when I'm not detected anymore, my enemy goes back to patrolling
Yes it works. However it follows me but it still freezes itself instantly when I go out from the pawn, like forgetting to see the player. It seems innatural. What I'm trying to do is to make the enemy AI remember my last location when I just came out from the pawn
Do you have any idea? 🙈
Oh, I thought you just wanted to make it go back to walking after losing the player
Ok wait no
then why do you need to remember the last location?
I make you a video
to have it walk there before going back to patrol ?
to show it
Here we are sorry
This is what happen
When i go behind the pawn visual cone, it behave like lagging and then restart to move in a random location
I think I finally figured something about my Navlinks. I managed to get it to work. The important part is the thin black arrow. Here I have the navlink set to Both ways, it works. They can go up AND down without too much troubles.
If I set Left to right, it works, they can go up without troubles.
If I set right to left, the arrow disappear (and does not appear on the other side) and the link does not work. For some reason, the game cannot understand it. It feels like something prevents the arrow from being created.
I'm starting to think that the issue is collision. The game probably tries to generate the arrow as the path of "the jump" and realize that there is something in the way and does not generate it.
I solve it! Wire the ‘On Success’ pin back to the ‘Cast To’ node. So that whenever it succeeds it is re-triggered.
Hey guys, so I am trying to make an enemy move continually towards the player, I do this but rapdily firing off ai move to calls and this works fine as long as the enemy can reach the player. One problem I'm having is that as soon as the player is in a place where the ai can't reach, even just on top of a tiny rock, the ai will stop moving. I'd rather them still keep moving towards the player even if they can't reach them. I could probably brute force this with some logic that makes them go straight in the player's direction if the ai move to fails or something, but I just wanted to know if there's a way to do this with ai move to or some other node instead? Thanks in advance for the help!
pulling my hair out a little here. I have an AI state machine, as below. for whatever reason, it never begins running. it's assigned to the AIController, as I'd expect from that class (i.e. the AI specific state machine class) and set to start automatically. but it just never does.
docs are naturally missing for the component, but figured I'd see if anyone here knows what's what.
What I mean is that it's certainly not the only way or even the best way.
Why are you using pawn sensing, which was deprecated in 2016?
Your problem is that the AI is moving to the target actor's location. Instead of finding a location close enough to the target they can reach. A better solution is to use the EQS to find a location near the target and update it on an interval.
Hi All - I've got a problem where I'm using AI Move To function in a behavior task but when I switch to another behavior task the AI still keeps moving to the original Move To destination from the previous task even though it's aborted and is no longer running. Any ideas why the AI Move To is still functioning after the task has been aborted and how I can fix? Thanks!
how are you aborting it?
In my AI Controller. If my player is too close and in sight the AI should switch to a new branch "RangeAttack". When playing, it shows that the tree correctly switches to the new branch, but the AI is still moving to the desination of the old branch ("Return"). Here's the screenshot of my "Return" condition which has the Move To function in. Am I aborting it properly or should I do something else?
call StopMovement if you want the Move to abort immediately. Otherwise all you're telling it is "don't move on to the next task, stop the branch there and move up the tree"
there's also a BT MoveTo task but afaik you can't change the acceptance radius dynamically, out of the box
This seems to work, thanks. I just put stop movement at the start of my RangeAttack. It's weird as switching to other behaviors doesn't seem to have this issue. Anyway, appreciate the advice.
other behaviours such as?
Seek, Investigate, Idle etc. Anyway, no worries, the stop movement works great.
What approach would be best for selecting the most fitting ability out of a set?
Almost sounds like utility thing already
And what should I use?
AI Perception System
Hey guys. Any idea why RVO avoidance is not working with my npcs? I don't know what to try anymore, they keep bumping into each other and they get stuck. I can't get on with my game with the npcs like this
Make them pass through each other and get on with the more important parts of the game. You can go back to this later.
I'm now looking at having NPC interact with objects in the world. Sit in chairs, inspect stuff in shops, etc. Tutorial I've seen is about smart objects, but I've seen that it's still in beta. Is it safe enough?
I also saw the option of using components, but I am not sure of the limitations.
Hi guys! I'm trying to set up a smart object bed that my ai can use to sleep in but I'm unsure how I would implement the gameplay behavior of the object to add energy to the ai as they use it (ai is constantly getting energy replenishment from the bed as they use it)
Anyone have any ideas as to how I can structure this?
If you're using GAS, I'd add a buff to the character for sleeping, and have a persistent AoE ability for the bed to replenish energy if they have the sleeping buff applied.
Hey guys. Any idea why RVO avoidance is not working with my npcs? I don't know what to try anymore, they keep bumping into each other and they get stuck. I can't get on with my game with the npcs like this
My AI is walking through the landscape like this. I'm using floating pawn movement
how can I fix this?
and they also like to float
My first guess would be to not use floating pawn movement? Why was there a need for it?
There can be hundreds of ai moving at the same time in my game and charactermovement was too expensive
floating pawn is a lot cheaper
Not sure how to help there. I think the floating pawn movement is working as expected there afaik.
is there another way to deal with optimization while using charactermovement?
when having loads of AI
There are a number of things that can be done to speed up CMC, in particular you can change it to use NavMesh Walking instead of standard Walking and some other things like that
But to make floating pawns stop floating, you would have to implement some kind of mechanic on them that "grounds" them, eg. keeps track of where the ground below them is and makes sure they stick to it
Hi, my AI NPC perception has this issue, if my player roll quickly into a cover, the AI perception lost sight and then gain sight again, and stuck in a move to loop. But if i move into cover at regular speed, the AI can lose sight normally. Has anyone encountered this problem??
Thank you!