#gameplay-ai
1 messages · Page 38 of 1
Lol I edited my question instead of typing
lol yeah noticed
My bad
There's a couple builtin tasks extending the CommonBase class, they should give you an idea how it works
It's strange that you can't find any structs via the class creation menu
It's too bad
In UE's class creation menu or? I just do 'em in my IDE
Yeah the ide is annoying because it creates files at the wrong places and uses weird filters instead of showing me my folder structure
Trying to get my Drone Ai to move. But it will only move a short distance and stop. Never making it to the actual move to location set. Im assuming its because of the Add movement is only firing once. Anyone have an idea on what i need to do to get this fly AI drone to move to the location set?
yes
nice
Has anyone figured out how to do subtrees (nested statetrees) with statetree? I found the Run Behavior really practical with behavior tree, and am wondering if something similar exist or is in the works? Thanks
I am reading a bit of code about LinkedSubtree, but don't know what to make of it 😅
Has anyone ever broken their AI (animations and behavior tree) in a second level by going through a transition from the first? Trying to figure out what's gone wrong.
I need a second pair of eyes on my behavior tree.
Problem: Under Alert section, my AI, I need it to go into a state of investigate if we break sight for around 7 seconds. Any tips?
This is my controller for sensing
I added in a makeshift way for the AI to stop chasing TargetActor (player), but it's dirty. Any tips?
Also, how do I "finish" the last known hearing position. Seems like it always stays even if he moves back to patrol
Sounds like you need a state tree instead
Pretty sure there’s age settings
Thanks for answering. Never heard of a state tree. I'll have to look it up
Can I work with what I got? I feel like I'm just missing one extra task or direction. I'm not 100% on my AI systems understanding. It's close to where I need it, just need to find out how to fix it
This doesn't make any sense.
Uh mb I thought you’d said not to use BTs for stateful stuff, but I might have rmbred it wrong
If you have any tips and tricks to help that would be amazing 🙂
Why are you setting states? You are using a BT. The perception system has a max age setting for each sense, so targets can be forgotten after not sensing them after a given time.
Oh, if so that's great! I followed a AI tutorial via Unreal Engine's own page and it did that. Just followed along. How do I set the max age then?
?
Place a float and Set it again somehow I suppose
I said you shouldn't force a BT to act like a state machine. Not that you can't get this simple behavior using a BT.
Yeah, I basically just want it to work like a security guard
Ah right that makes more sense 😅
You set the max age on the perception component's sense settings.
She’s not a dude
Dude can go both ways!
I guess I misread that documentation 🙃
Nope. Dude is not gender neutral.
But to go back to your point, yeah you can prly have a decorator to check if it’s been under 7 seconds, and run the branch under it so
This is unnecessary.
I didn't mean to offend
You helped me and I was excited is all. I appreciate your wisdom. I was racking my brain over this for a bit
Can you use cooldown for this?
The Max Age worked fine, I just tried it
Oh I thought this was a separate thing
Also unnecessary. The perception system handles it.
Yeah, I didn’t realize this was all about the hearing stimuli
Next question is, why isn't the Loop working as intended. The intention is for the AI to investigate, move to location 3 times, then go on "Neutral" and back to patrol
Unless I'm not understanding how Loops work in a BT
Because your target location is still valid when it goes through the tree again.
So I should clear the Target Location and null it out
Yeah. You can use a service and override the On Cease Relevant function to clear it out.
Using a task might result in it not getting cleared. Such as if it's aborted from the target being seen.
OKay, so I need to use a "service" and "override" the "OnCeaseRelevant" function. All these are new to me haha
Make a service and override OnCeaseRelevant from the +
Ohhh gotcha, right click on node > service
Then add it to the investigate sequence node.
This is all I got haha
hit New Service at the top
Man, thanks. You guys are very helpful
Iirc there’s a button there and you can select a base for it
You can't use something that you haven't made.
Receive deactivation AI
Okay, overdide Recieve Deactivation AI made! Next up?
Add a BB key selector and use that to clear it.
Is onCeaseRelevant the native name for deactivation AI? 🙂
Yes. They changed the name for BP
When you say black board selector you mean a Get variable for a Blackboard?
Blackboard Key
Blackboard key selector is a type of variable
You need to make that variable public to use it in the BT
I made it public too
You beat me to it haha
I appreciate all the help, this means a lot
Is this it, no Finish Execute?
Finish Execute is something for Tasks. To let the BT know that the Task is done.
You're writing a service.
Roger. Thanks @harsh storm
You guys are helping me so much
So far now it's back to following me even if I break sight and stays in Alert/Has Target mode...
@uneven cloud I must of hooked something up incorrectly
The root problem is that you don't understand what you copied. I'd recommend doing something much smaller.
You're not wrong. I do need to spend more time understanding behavior trees. That said, if you have a helpful explanation as to why things may not be working, other than my understanding, that would be neat
You need to clear the target when you have forgotten it. I think there's a delegate you can use.
I thought that's what the service was doing
The AI with Blueprints course on the learning library is a good overview of the AI systems.
On target perception forgotten
But iirc it has some prerequisite you need to set, something like can forget actors I believe
The service is clearing the target location for a hearing target. Your chase functionality is using a Target Actor that you aren't clearing when forgotten
You're right!
I probably did this wrong, but this is what I set up in the AI controller.
I don't think the Service did anything
Hey guys, I am studying state tree property binding from instance data to blueprint. Does anybody know the usage of these enum entries?
enum class EStateTreePropertyUsage : uint8
{
Invalid,
Context,
Input,
Parameter,
Output,
};
Some class use it in the categories of UPROPERTIES, but I am not sure of the difference.
e.g.
StateTreeTask_PlayContextualAnim.h
UPROPERTY(EditAnywhere, Category = Parameter)
bool bWaitForNotifyEventToEnd = false;
/** When bWaitForNotifyEventToEnd is set to true this is the name of the notify that we will look for to signal the end of the task */
UPROPERTY(EditAnywhere, Category = Parameter, meta = (EditCondition = "bWaitForNotifyEventToEnd"))
FName NotifyEventNameToEnd = NAME_None;
/** How many times the animation should be run before completing the task. */
UPROPERTY(EditAnywhere, Category = Parameter, meta = (EditCondition = "!bLoopForever", ClampMin = "1"))
int32 LoopsToRun = 1;
/** If true the animation will loop forever until a transition stops it. */
UPROPERTY(EditAnywhere, Category = Parameter)
bool bLoopForever = false;
/** How many seconds should we wait between each animation loop (won't be used if RunLoops is equal 1). */
UPROPERTY(EditAnywhere, Category = Parameter, meta = (ClampMin = "0.0"))
float DelayBetweenLoops = 0.f;
/** Adds random range to the DelayBetweenLoops. */
UPROPERTY(EditAnywhere, Category = Parameter, meta = (ClampMin = "0.0"))
float RandomDeviationBetweenLoops = 0.f;
The parameters above seem to be accessed in a readonly fashion, so it's strange that Epic decided to place those in the node instance data rather than in the node itself.
Hi I am very new to BT's in unreal. So I have a service that checks if the position of an actor is less then a certain amount, and if so it sets a BB bool to true. Then i have a decorator that checks if that BB bool is set, and if so it should run the move to. My problem is that it doesnt seem the service ever runs. However, If i get rid of the decorator it constantly runs. My question is when does a service attatched to a sequence execute? does it execute after the children of the sequence or before? I placed a breakpoint in the service and it never hits, which indicates that the decorator must be aborting the path before the service ever runs. Am I correct with this assumption?
Hello! I have a design doubt: behavior trees and state machines are great, you kickstart them and they do their thing.
But sometimes you want, well I want, more determonistic execution: when THIS happens, I don't care what you're doing, you stop and do what I ask you to do.
How are ways to have these scenarios coexist? Do you use a master system that switches the types of planning system? I am happy with any pointer if anyone knows the theory or has experience with this
Hello, so I have an issue with my AI Char, it travels to the last location of the Character instead of the location getting constantly updated not sure why. 🤔
stop the braincomponent, and activate back once you're done
Is it a problem with my BehaviorTree?
It's just this.
MoveTo isn't going to get reran until it finishes because there is nothing that would abort it when the location changes
If you want it to move to the player you could probably just have it move to a given actor and check the update goal or whatever the checkbox was called so that it updates the location based on where the target actor is
(might need a custom move node, I don't remember if the builtin moveto has this but it should be available in one of the Move BP nodes)
What I'm asking is if there is any known design pattern for these things
You can start the brain component from anywhere. Let me rephrase it worse: is there a design pattern that I can look into to figure out the "where" to start stop based on gameplay events?
How would I abort MoveTo manually. 🤔
I have an idea where I check the last position and the current pos of the Actor and abort the current MoveTo if it's different or smth like that.
A decorator can abort the bt task, but if you had a custom BP node you could also trigger another moveto on the task's tick or something like that
But I think it would still make more sense to have it moveto an actor as I mentioned
This is the pattern I'm doing: #gameplay-ai message
in your case this should be implemented to AIController
because BT runs on braincomponent
two braincomponents would conflict
only caveat with this is, you're adding a secondary behavior decision on top of the BT, and if you require something more complex than "stop BT, do whatever you want, run BT back" you might want to consider something more than LIFO
usually at that point you combine BT with something else
There is also the AI resource thingy. You can claim the logic resource which pauses the brain component until you free the resource
my use case for this was to cover "distractions" - like L4D2's pipe bomb
but there could be multiple distractions at the same time, and one could finish earlier and AI had to move to second distraction before continuing BT logic so I went with stacking behaviors
was also going to add utility to allow others fight each other to be on the top but i started working on bp2cpp instead 
The use cases I want to cover are varied: from a simple stun effect (similar to the distraction you mention, in concept) to more complex stuff (eg. playing a sequence of actions in a row before resuming the behavior tree). Curious about this ai resource thingy now
if API allows you can combine both ideas too
I'm kind of confused I would have it move to a Vector location right?
instead of the actual Actor.
you can have it move to an actor also, in which case it can automatically track its position
Actor, I'm not quite sure how you would move to a class :)
Yeah,I was thinking the same but can't find a key for an Actor. 🤔
I thought there was a key type for Actor... but if not, try Object, it should give you the ability to specify which class the object should be of
Gotchu.
🤔
Expand it from the little arrow next to Key Type
ah yeah
Yeah, worked!
What's the difference between moving to an Actor and moving to a Vector value?
Nothing beyond it being able to update the position when moving to an actor
Oh.
If I were to do the same thing in multiplayer how would I do it?
OwnerComp.GetBlackboardComponent()->SetValueAsObject(GetSelectedBlackboardKey(), UGameplayStatics::GetPlayerCharacter(GetWorld(), 0));``` This is how I did it.
Would only work for Singleplayer games.
Yeah that's reasonable in sp I think. Otherwise you'd need to determine the wanted player via some means like perception or such
Gotchu.
Another way is to store multiple Character classes right as they spawn in a holder class.
Does wait node just stop all actor functionality? For some reason my stimulus is not triggering while the BT is on a wait node. EDIT: Solution is to check restart on ignore in the wait node
is there any non-linear dependency between EQS tests count and execution time? I'm having some weird issue where I run some EQS every 0.5 seconds in BT service, but it completes each 10-12 seconds, and the EQS editor shows me that each of 20 tests on average takes no more than 4 ms. Or is it the EQS editor profiling results that I shouldn't trust? 🤔
When an enemy in my game sees the player it's meant to chase after them. However, if just one enemy sees the player then every enemy AI begins to chase the player. How do I make it so that each AI has its own perceptions rather than sharing them?
are you using BTs? if so, check that the blackboard field that you use for MoveTo BTTask isn't instance synched, also if you have some C++ BTservice that checks AI perception, it can be that you are setting a BTService classes property and your cpp BT service isn't instanced. If nothing of that is correct then you need to provide more details about your AI architecture
Yes I'm using BTs, all of the variables are marked as false for instance synced - I imagine there may be something in my setup which is doing it then
How do you put new value to the blackboard field that's later used in MoveTo?
with a findplayerlocation task which just sets the blackboard value as the player location - I also have sight sense in the ai controller to provide info on if the player is nearby
I think I'm on the right track to solving this now, thanks for helping
Does a sequence not run if the decorators in its children return false? or am i wrong about this
Sequence runs until one of its children fails. A decorator which returns false counts as failure
If you want to have an "optional" child node with a decorator like that, combine it with the Force Success decorator
thank you for this
can anyone tell me why the move to never runs here? the sequence comes off the root node
Because you forgot to call FinishExecute in that first task.
(Really hard to say anything otherwise with next to no information)
lol that was it thank you @harsh storm
man i do not understand the pattern that unreal BT want me to use. I want an actor to move to a location only if its y position is less then another actors. If it is not less then the other actors I want it to perform some logic on another selector. What be the best way to set this up?
Your service will never run, because it will never go into that part of the tree because of the decorator. Services only run while the nodes below do. You need to move it up to the selector.
It entirely depends on what you are trying to do. Is it a hit reaction? Then put it in the hit reaction functionality. Is it a dialogue response? Then put it with the dialogue triggers. Is it responding to other generic game events? I built an AI message system for that.
Having a master system might be fine in some cases, but you want to avoid over engineering something that you likely don't need.
You don't need to abort the move to to change the location. Just update the blackboard location and set the move to to repath on blackboard change.
You should profile in a test build. The EQS editor profiling results are fine, but they don't tell the whole story.
You need to add in functionality to pick a target. I recommend using the EQS.
By using a decorator.
Hello, I'm encountering some issues with nav path creation. All I do is generate (and draw) a path towards a target like this:
FNavPathSharedPtr GeneratePath(AActor* GoalActor) const
{
FAIMoveRequest MoveRequest(GoalActor);
MoveRequest.SetUsePathfinding(true);
FNavPathSharedPtr ReturnValue;
FPathFindingQuery PFQuery;
Controller->BuildPathfindingQuery(MoveRequest, PFQuery);
FVector LastPoint = FVector::ZeroVector;
for (FNavPathPoint PathPoint : ReturnValue->GetPathPoints())
{
DrawDebugSphere(GetWorld(), PathPoint.Location, 10.f, 10, FColor::Cyan, true);
if (!LastPoint.IsZero())
DrawDebugLine(GetWorld(), PathPoint.Location, LastPoint, FColor::Cyan, true);
LastPoint = PathPoint.Location;
}
return ReturnValue;
}
The path it returns is valid, but it has an issue. The paths that get generated for various AI characters are crossed (screenshot). Isn't it less long/cheaper to go just forward for them, or something like that? I would understand if the paths would end at the very same point, or would be a bit distant from each other, but it doesn't make any sense for me that they're crossed. Does anyone have any explanation for that? How can I fix that?
I am using "AI move to" to go from A to B.
Is there a way to determine how close I am to B?
Other than using tick and determine distance, is there an AI way of determining it?
PathFollowingComponent->GetPath->Distance
component? I would need to add that to the AI as well?
is this locked behind C++ by any chance, I read the documentation but cannot get much going in BP
likely
I remember it as a native type
Bah gonna expose it then ty
though
distance calculation is a loop of path points
not always cheap
dont go wild using it
Hi I just started using unreal a couple weeks ago and I'm just looking for a good course or source of info about character animations and skeletal meshes for an absolute beginner. I'm using version 5.3 and a lot of info I've found is out of date. sorry if this is the wrong channel for this question.
Your target is unreachable. That means you are getting a partial path, which makes getting the shortest path impossible.
#animation is a better channel to ask
lol thanks i see the channel list now
Still, I would imagine that it's going to generate a path that's going to end at the closest position on the navmesh to the target as possible, but in this case it doesn't. Is it how it's supposed to work?
Hi, i need help with static navigation mesh not working in packaged build. I have persistent level which has multiple streaming levels (but everything is loaded at start, nothing changes during the gameplay, its just for composition sake and concurrently working with other people on enviro). I have NavMeshBoundVolume on persistent level because putting in on its own streaming level (which then i load last after everythin else is loaded) was not working because NavMeshRecast was not spawned on load in editor. (dont know why)
In editor everything works fine now but when i package the game it looks like the nav mesh is not there - the npcs simply cannot move.
Anyone knows how to do it properly? I can use dynamic nav mesh but it kills the framerate and its not even needed because for every level i only need the nav mesh to be generated once because nothing in the game changes dynamically that could affect it. I just want to generate the navmesh once per every level, save that data and package it - and it looks like this is not working that way.
and i am talking about 5.3.1
UPDATE: Its not working in editor too: it stopped after i restarted the engine
yes i am a master over-complicator, a reminder to keep things simple is always welcome. In general though i guess i am a bit confused in general on how to handle AI behavior that goes beyond BTs. Stuff id like to wrap my head around:
- patrol behavior. WHEN to patrol is decided by a BT, fair enough. But HOW to patrol that's harder: some agents i want them to move randomly within a volume. Others need to patrol using a spline mesh actor, other can go around randomly. I want to be able to switch these behaviors at runtime AND as a designer in the editor. So i need to have a variable on the Pawn and then read that variable on the controller. The BT will then call a generic Patrol function on the Controller that will take care of reading the possessed Pawn's variable and actually perform the move. So I have 3 entities involved (BTTask, Controller, Pawn) just to allow me to switch patrolling type. Maybe that's fine, it feels junky though
- staged setups: like an agent that is sitting at a table and idling gets awakened when a certain event is fired. It needs to perform an animation, play a dialogue and then start the BT. There's a lot of moving pieces that can be fired from so many places.
- hit reactions/barks: putting these in the BT is a no no. So something needs to stop the BT for a little while, perform the action, restart the tree.
it's a lot, but it's hard to ask my question in a generic way because im not even sure what exactly is my problem 😄 i just struggle with architecture and where to put things to avoid having a gazillion moving pieces that i will inevitably forget about just to achieve these types of behaviors
Hey, I can't find any info about the topic out there... The async functions of the NavigationSystem (Like GetPathAsync()) when called from a side thread, are they doing the logic in that thread or are they actually accessing to the side thread? (Maybe to access to the actor that holds the navmesh, idk)
Are there a lot of people who code AI in native code rather than use behavior trees/blackboard?
Does anyone know why my nav-mesh is not working?
It says something about water, but not sure what that is?
Found the issue, my platformer part is too small. Can I somehow change?
Can PCG generated points be used for EQS?
I have lots of ai Working as they should but this default manny and animation bp is just sliding and not walking. Not sure what is wrong with it
Thanks so much for this exchange I was just about to work on this and all the questions are answered right here before i had them! wonderful job all involved
I am having difficulty understanding the "Hierarchical Data" portion of the State Tree Overview doc.
https://docs.unrealengine.com/5.3/en-US/overview-of-state-tree-in-unreal-engine/
Suppose I create two state tasks.
USTRUCT()
struct FAncestorStateTaskData
{
GENERATED_BODY()
UPROPERTY(EditAnywhere, Category = "Context")
FMyStruct SomeValue;
};
USTRUCT()
struct FAncestorStateTask : public FStateTreeTaskCommonBase
{
GENERATED_BODY()
DECL_STATETREE_OVERRIDES
USE_INSTANCE_DATA_TYPE(FAncestorStateTaskData)
};
//...
// How do you access that ancestor's data?
EStateTreeRunStatus FDescendantStateTask::EnterState(FStateTreeExecutionContext& Context, const FStateTreeTransitionResult& Transition) const
{
// How do I access the ancestor's data?
return EStateTreeRunStatus::Running;
}
I am still having difficulty understanding the different binding usage "Parameter", "Context", "Input", "Output"
As far as I can tell, Context is effectively same as Input/Parameter, but it defaults to the actor from the ST context. Output makes it so you cannot choose what the value is bound to, because it's assumed the value is only used to output values, never to read in values from elsewhere
Oh so you can only have one UPROPERTY marked as "Context" per instance data then?
At least in the default case where the context only has that one value
The hierarchial data refers to the ability to bind input values into values from parent tasks
Eg. Crowd Claim Slot may have an Output value, Foo. Then another task like Move To Wait Slot can have its Input value bound to Foo from Crowd Claim Slot as it's in a parent state
So every descendant node must explicitly want the ancestor's Outputs via specifying inputs? I thought they would have access to it implicitly somehow
Yeah you need to have instance data on the task which allows the user to bind the value to it explicitly
Alright that sounds good. Another question I have is with regards to read-only (non instance specific data).
How would you specify it so that it's available to all nodes in the tree (or at least a subtree)? Since descendant don't have access to ancestor like that, i don't know where to place it.
USTRUCT()
struct FAncestorStateTaskData
{
GENERATED_BODY()
};
USTRUCT()
struct FAncestorStateTask : public FStateTreeTaskCommonBase
{
GENERATED_BODY()
DECL_STATETREE_OVERRIDES
USE_INSTANCE_DATA_TYPE(FAncestorStateTaskData)
// Let's say this contains anger level or something
UPROPERTY(EditAnywhere, Category = "Context")
FMyStruct MyReadOnlyValue;
};
//...
// How do you access that ancestor's data?
EStateTreeRunStatus FDescendantStateTask::EnterState(FStateTreeExecutionContext& Context, const FStateTreeTransitionResult& Transition) const
{
// How do I access the ancestor's readonly data?
return EStateTreeRunStatus::Running;
}
Same as above
You set the task which gets the data into a parent state (or before the task which needs the data within the same state)
Alternatively you can use global tasks or evaluators, their data can also be accessed similarly
Sounds, good. Though, do you think the readonly data be placed in the FInstanceData class then? This shouldn't be different between state tree instances thus why I wanted to put it in the node itself. I found some weird code in the engine source that contradicted me:
UCLASS()
class UStateTreeTask_PlayContextualAnim_InstanceData : public UObject
{
GENERATED_BODY()
public:
UPROPERTY(EditAnywhere, Category = Parameter)
FName SectionName = NAME_None;
...
/** How many times the animation should be run before completing the task. */
UPROPERTY(EditAnywhere, Category = Parameter, meta = (EditCondition = "!bLoopForever", ClampMin = "1"))
int32 LoopsToRun = 1;
...
}
I have a task which gets data like that, it just has instancedata for it
USTRUCT(BlueprintType)
struct FGetCharacterInfoInstanceData
{
GENERATED_BODY()
UPROPERTY(EditAnywhere, Category=Input)
TObjectPtr<AActor> Actor;
UPROPERTY(EditAnywhere, Category=Output)
TObjectPtr<AShCharacter> Character;
UPROPERTY(EditAnywhere, Category=Output)
TObjectPtr<AShWeaponBase> Weapon;
};
This one pulls the Character and Weapon out of the given Actor so other tasks can use those specific pieces of info
I see.. Thanks
I found the FStateTreeLinker. It seems to be more what I'm looking for. 🤷♂️
/**
* Called when the StateTree asset is linked. Allows to resolve references to other StateTree data.
* @see TStateTreeExternalDataHandle
* @param Linker Reference to the linker
* @return true if linking succeeded.
*/
[[nodiscard]] virtual bool Link(FStateTreeLinker& Linker) { return true; }
bool FGameplayInteractionModifySlotTagTask::Link(FStateTreeLinker& Linker)
{
Linker.LinkExternalData(SmartObjectSubsystemHandle);
// Copy properties on exit state if the tags are set then.
bShouldCopyBoundPropertiesOnExitState = (Modify == EGameplayInteractionTaskModify::OnExitState);
return true;
}
Yeah as far as I can tell this allows you to pull data into tasks from external sources, such as subsystems
Haven't really looked at it - seems you could just pull a world from an actor in instance data and pull subsystems from there, but I guess if you wanted to achieve that without having instance data to pull it from
if I am not wrong, Link function is no more required
that was the 5.0 thing
at 5.1 it became automated
with reflection
Ah so you can call Context.GetExternalData without needing to override FStateTreeNodeBase::Link? It would make sense if it can pickup the single right occurence of the right type, or lookup by name (except the "Handle" Suffix).
I wonder if the following would work.
USTRUCT()
struct FAncestorStateTaskData
{
//unused
GENERATED_BODY()
};
USTRUCT()
struct FAncestorStateTask : public FStateTreeTaskCommonBase
{
GENERATED_BODY()
DECL_STATETREE_OVERRIDES
USE_INSTANCE_DATA_TYPE(FAncestorStateTaskData)
UPROPERTY(EditAnywhere, Category = "Parameter")
FMyStruct MyStruct;
};
// ...
USTRUCT()
struct FDescendantStateTask : public FStateTreeTaskCommonBase
{
TStateTreeExternalDataHandle<FMyStruct> MyStructHandle;
}
//...
EStateTreeRunStatus FDescendantStateTask::EnterState(FStateTreeExecutionContext& Context, const FStateTreeTransitionResult& Transition) const
{
auto& myStruct = Context.GetExternalData(MyStructHandle);
return EStateTreeRunStatus::Running;
}
The FStateTreeNodeBase::Link, code comment says, "Allows to resolve references to other StateTree data." so I'm hoping i'm going in the right direction at least
- Patrol behavior can be done via the BT using dynamic subrees. All the controller needs to do is switch the set subree.
- Staged setups can be done using smart objects and the BT.
- We use GAS, so doing hit reactions that lock logic is really easy.
Likely more who code in native AND use the BT. It's not an either or.
You can write a generator for any actor or location. If you can get the points at runtime, you can write a generator for them.
Is the anim BP using acceleration for if they are walking? If so you can turn on Use Acceleration For Paths in the movement component.
can vislog noticeably affect performance? I'm trying to figure out why does my EQS take a lot of time to compute but at some point I've put a ton of UE_VLOG_LOCATION and UE_VLOG_ARROW for debugging purposes, so I wonder if that can actually build up into a 3-4 extra seconds for EQS to finish 🤔
I looked all around and I cannot get a good answer.
I have a packaged build but the AI doesn't want to move.
I tried rebuilding it on beginplay and a few options here and there but they just won't budge.
It works find in PIE, but on packaged build nada...
Any ideas?
my previous build had it working as well... so in between the navigation broke?
Afaik it shouldn't unless you enable the visual log recording. Easy enough to find out, just comment it out and see if it runs faster
yeah that's what I'm observing, when I enable vislog recording it takes like 2-3 seconds more, but I just wanted to confirm my assumptions here
You can access statetree node in this fashion, FStateTreeExecutionContext::GetStateTree()
StateTree.GetNode(NodeIndex).
How do you retrieve the node index?
Are you still trying to programmatically read data from another node? :D
Yes lol thing is, the data I want to link is an array of heavy structs
The Category=Output, Category=Input will lead to multiple copies no?
Not sure tbh. I guess if you had a UObject which holds your data, and put a pointer to that into your instance data then it would just be a copy of a pointer which is no big deal
I vaguely recall some folks struggling with the lack of some type of blackboard-type solution for statetrees but that was a long time ago so I might misremember
I see, ok I guess I can wrap everything in a UObject, wish there was a node accessor though. It seems so simple
I think the problem is that the state trees are quite optimized so there's not much actual instances going on so when your ST functions run, it doesn't really hold information about it and it's passed in as parameters to the function
I mean there is, just can't find the node index. I thought about exposing the parent node index via Output, Input
(don't quote me on that though it's just the feeling I'm getting from looking at it sometimes)
Can someone "explain to me like I'm five" what Observer Aborts do? I checked out the documentation and only left more confused haha
depends
but very likely
Self=the decorator will abort the execution of its own node if the state changes, Lower Priority=it can abort nodes that have a lower priority than it (smaller number)... Both=both behaviors active at same time
@misty wharf MVP, thanks! How does it determine if it's a lower priority than it?
You said smaller number in the chain im guessing
Look at the numbers on the nodes in the BT editor. The numbers are assigned left-to-right
Thanks for answering!
It should also highlight the nodes it can abort when you choose one of those options which should help visualize it
Would you say this instance is correct?
If it does what you want it to do lol
lol
You may need to move the patrol behavior more to the left so it can get aborted by the other behaviors if that's how you want it to work
That's exactly what I was thinking too
Another quick thing, in the AI controller, to break the IsSet I do it this way, it works but is this a correct or incorrect way of going about
Looks alright to me. You could consider using a BT service for clearing it as well, but there's really no right or wrong way to go about it as it depends entirely on how your game works
Another person suggested the same, however I don't think it worked the way I needed it to.
Then I wouldn't worry about it
When I ran it this way, it seemed to not clear the blackboard key, this make it not set, thus move to the next place down the chain
The way I run it in the AI controller seemed to work but this way didn't which leads me to think I didn't do it the way it's intended to
Do you think I could do the same thing with a struct containing the pointer? E.g. FMyExpansiveStructHandle, and plug that in my Output/Input instead of a UObject?
I guess you could try it and see but I think you won't be able to bind it from the state tree UI because UE's reflection doesn't support pointers to structs afaik
Keep seeing these sort of handle structs in ue code so that's why I was wondering
Hey all Im a little stuck (noob). I am working on an fps and the Character Blueprint class collisions suck for my character model , and you can shoot like beside his head and get a confirmed shot lol! I tried rebuilding my AI with an Actor Blueprint class which i can make collisions that are more perfect and work well
, but then i started to struggle when i needed to move to the dead frame and simulate physics. what is my best way to make the default character blueprint collision capsule any better or more precise for my specific character model??
sorry to impede
Most don't use the capsule for hit detection. There is nothing stopping you from adding other collision shapes or using physics bodies.
i tried adding a different collision shape inside the character controller and it wasnt seeming to stop the ai from falling through the floor
Not quite an AI issue, more of a collision problem. If you have collision but you’re falling through the floor, then you haven’t set the collision settings properly.
May be worth looking for tutorials on collision on the unreal learning portal
i managed to get it working i found some settings that let me change collision type
thanks
how do you guys get and set your blackboard values in the BTS?
in my packaged build, they default to float max
Someone about this?
I'm using Add Movement Input to make a pawn actor swim a certain direction but I cant seem to increase the speed. I've tried changing their character movement's speed values and the scale value but I've only managed to make them very slow by setting the max swim speed to 1.
Alright interesting phenomenon.
Here are keywords for future searches:
Package packaged build nav not working moveto move
So the issue was that in a packaged build my behavior tree wasn't working sometimes but always failed the move to.
It had a service to determine a random location.
The navmesh existed and worked with non BT ai move to nodes.
When testing if the air existed and possessed it was true.
Afterwards I checked if the BTS fired. It did.
However the blackboard values were all floatmax.
It turns out that since one of the value failed to get registered correctly, it would all fail. ONLY IN PACKAGED BUILDS. IT WORKED FINE IN PIE.
So the solution was to set the values in the BTS by casting to the owner and getting the blackboard all set first before using them.
So lesson learned.
Tagging @misty gale and @dense owl
🤔 that's interesting
Damn. Ty for update. 🙂
hope this question makes sense, but: how does an actor know which agent it is?
Hey! Anyone already tried to implement the ANavigationGraph class which is unimplemented since 2014?
I would love to implement wall / ceil navigation data
how do I make a decorator stop everything before waiting for the sequence to continue?
It would probably be easier to make a task wait for it rather than a decorator
Also idk how you made that decorator, but it looks wrong
Hi! Does anyone know how to disable the "easing" in movement caused by AI MoveTo? I want my enemies to stop immediately once they have reached their locations,
Disable use acceleration/deceleration for paths
it already is :c
Are they just like getting there and shimmying for a bit?
yep exactly
Could be either:
- Your end goal vector is above or below the mesh, so they can’t really get to it, but they try for a bit
- If this only happens when multiple AI, they’re all trying to get to the same spot and can’t cause they block each other, you can use get navigable point in radius to mitigate that a little by spreading out the goal locations
What do you mean know what agent it is? If you are talking about the AI controller, then you set the class on the character.
Anyone have an idea why my EQS is returning none?
Gameplay debugger EQS section shows you each test’s results
Im not too familiar with the debugger, ill check some documentation on it
But by accident is set the radius to 2000 instead of 500 and it workd
You don’t really need docs for it, just press apostrophe at runtime and use the on-screen instructions
Oh ok gotcha
I'm playing around with the Flying Navigation plugin, this might add some confusion...
so in the project settings I can set up multiple agents with different names and different preferred navigation data classes
let's say I'm adding three different flying agents and two non-flying agents.
now when I place or spawn three different pawns with floating movement components, how would each of them know which agent setup to use? like the different radii and all that?
Because you are using a plugin, you really should look at the documentation or ask the creators.
right - the same confusion persists for non-flying pawns I guess. If a bounds volume supports multiple agent setups, how does each pawn know which one to use?
I've looked at the docs for the plugin, it's not mentioned there as far as I can tell. Will ask the creator though
the first one was it! Thanks so much!
like let's pretend I'm trying to make 3 different zombie enemies, one is super large, one is medium and one is super small so I set up different agents with different radii, now how do they know which navmesh to use? or which agent setup?
@solemn rock I your character movement component there is a nav setting for acceleration
@sacred kiln I would make either a component you can cast to or setup a tag and check if owner has that and determine blackboard values
By default, it uses the agent properties to find the nav agent settings that best fits. If you don't change the settings, it uses the capsule radius and half height. However you are using a specific plugin that likely overrides the default functionality.
@misty gale @misty wharf it seems that the blackboard will not exist until the BT is fired so any instances of you setting it up will fail.
In packaged builds it seems.
In editor it seems to always exist.
so it needs to be a character?
interesting
It needs to be a pawn
alright yeah just because character has all the hardcoded capsule stuff and all that... well that's good to know because one of my pawns didn't have a capsule so far 😄
thanks!
I'd love to be able to just assign an agent profile to a pawn
this seems like things might accidentally break a lot with this auto assign business
You can make C++ changes to do that.
It doesn't break, because it finds the best fit.
I'm a bp dumbo unfortunately.. well I guess you have a point, you only really care about the radius there I guess and that being best fit does make sense. anyway thanks for chat, that cleared things up quite a bit
What would be the way to push an AI charcter back with like a kick mechanic. I need something that always works no matter the terrain. I've tried launch, add force, impulse, all of this is too inconsistent and wonky. I need my ai characters to get pushed back the exact same amount of units each and every time, no exception. I've tried faking it using add input with an animation layered on top, but this doesn't seem to work. add input on AI acts really weird and I can't even wrap my head around what'shappening but it sure as hell doesn't work. How do most games do this?
Basically simply put what I want is when I kick an AI character it should "walk back" with an increased walk speed while a "getting kicked" animation plays
Or any other way as long as it works and always gives the exact same result in how far the character is kicked back, even when standing on a steep slope
This can be difficult to do for a bunch of reasons including the AI itself attempting to walk somewhere when you're trying to run this logic
Yeah indeed I've noticed this being an issue too
The easy solution is to make it so that you first ensure your AI isn't trying to move anywhere when it gets kicked
After this, you simply move it the desired distance into the desired direction and that's it
With stop movement for example?
I think so yeah
Yeh I've tought about this too, however there is a big problem with this. Namely, that there can be occasions where the "walk to" location ends up being inside an object or some sort of collision which would return a fail on the move to, making the kick not work at times. The kick mechanics in my game is crucial for gameplay and I can't afford it sometimes not working. Hence why I also want the exact precision as to how far the ai gets kicked back, this mechanic needs to be flawless and never fail.
You need to decide how the collision is handled in that case
That's why I'm a bit iffy on using the move to node and calculating the final kick destination
You can move the AI with SetActorLocation also, you don't necessarily have to use move to
In my game I have a kick mechanic which just adds an impulse to the character movement component, but it might not give the precision you're looking for
I've tried that and it works, but not on slopes
On slopes the kick is less far and when kicking down a slope, the char flies way too far xD
Ah
Yeah sounds like you'll need some more complex implementation to handle that then
iirc there is a way to use the character movement component to just move a given amount manually, this should handle things like moving up/down slopes
It's not a gimmick in my game, it's an actual important fighting mechanic. The distance the ai gets kicked back is important for combat timing, it gives you a few seconds to react, but if it's too far it's too easy, too close and too hard. The timing needs to be perfect.
otherwise you'd need to handle the slopes manually which can be a bit of a hassle because you'd need to check the collision if one occurs, or in the other way, you'd need to trace down to ensure the moved actor remains grounded
If it needs to be that precise of a science then perhaps your combat shouldn’t happen on a slope?
There are ways to go about it if you want to do it, it's just a hassle lol
You need to move manually via ticking or such, and check for collision or loss of ground
It's a third person open world game so player is free to fight where he wants. I mean, when the distance of the kick works the combat works perfectly fine, it's just when the distance is inconsistent that the difficulty and timing is off.
in collisions, you'd need to see how far you can move without penetrating, and then move the remainder along the normal of whatever you collided with, which can be tricky to get right (there is logic for doing this in the Char movement comp code)
but you also need to keep tracing down to ensure that if you move off a slope you can adjust the position downwards
I think I may have some ideas that I can try based on your help
Yeah it'll def need to be on tick
Thanks for the ideas!
If you happen to find out what this way is exactly, let me know
I've searched for movement nodes but all I could find is input, impulse, add force and move to
It might be SafeMoveUpdatedComponent
but you may need to build some other logic around calling it also
was just looking at my crouch slide code which calls that after it calculates how it needs to move, and my code works both up and down slopes for the slide
well, here's the whole function if it's helpful
...if I could send it thanks lack of discord nitro
If you don't mind a screenshot :P
There's just some extra logic which ends the slide if it slows down too much at the end that's missing... this gets called on TickComponent if the player is sliding
oh yeah?
just a set actor location while in "being pushed" for 2 seconds and a push vector. And apparently the character even adjust itself on the floor underneath while it's being location forced.
ah, yeah that might work as long as you don't make it too fast
I guess it's a bit hacky, but it seems to work just fine 😛
also keep in mind that you most likely will end up pushing a bit further downhill compared to on level ground because the overall distance will be longer if you keep pushing along the horizontal axis
not sure whether that's a big enough difference to matter but figured I'd mention since you did seem to care about precision in the distance
A bit extreme in this gif to show the point that it works 😛 https://gyazo.com/e4f97b2438aaa15a47a4150f3215cd91
Yeah looks like it does the job
The CMC on the kicked character probably just keeps grounding it via the gravity simulation
lol thanks for tip of using a set actor location. It's honestly baffling that the movement component seems to even adjust it's floor position when you force a location
But it's def useful for my usecase
Yeah the CMC is super complicated lol
oh yes xD
In my previous game I even gave up on it and completely made my own movement system
Was a heck of a lot of work though
And I honestly don't wanna go through that again
And it wasn't perfect either sadly
Best movement system I had was one I copied from the quake 3 code lol
But for this game I need AI and wanna keep things simple so I'm doing my best to get as far as possible with the CMC
@misty wharf Final result. I'm happy, thanks bro! 😉
That’s a hell of a kick force
Haha, actually changing it so the guy is knocked over in the animation and gets back up 😛
which will look a bit less rediculous xD
For a BT Service, is there a better way than casting to the controller? Something cleaner or is a cast okay? I'm trying to limit my casting if not needed but sometimes it seems unavoidable
That's fine. People fear casting more than they should
Aye, just wanted to make sure it's not getting called a bunch since it's in a behavior tree
Overcasting hahah
I don't really know why you're doing the cast though
Yeah, I'm trying to get a ref to the blackboard so I can clear a value, this make it NotSet in my blackboard
Unless there's a far better way of doing it? I was doing it inside my AI controller but it was messy
Isn't there a Get Blackboard in the AI Controller class already?
the Owner Controller variable's type should be AI Controller iirc
@misty wharf Yeah, I figured I'd try using more services than spaghetti haha
Scary lol
Yep
Coooooool, much better. Thanks! I had a feeling like there was a better way
Possibly a silly question - but is it possible to get a StateTree state to wait until all of its tasks report completion rather than transitioning on the first complete task?
@crystal fractal yes you would need a service to get/set it on the blackboard and conditionally move when the value is correct
Why would it?
Got it, less than 2 minutes after asking for help xD
I had the abort self on the sequence before but it didn't work so I added in the selector and it worked
What are the differences between smart objects and EQS?
They literally have nothing in common
So .. everything
That's not true. Both are systems in Unreal. Checkmate.
Which part? Because it works literally the same way as it does in BPs
i have never used bp bro:)
i followed a doc , but the ai still cant detetct the player
There are quite many different reasons why that might happen, including something blocking the sight trace, or the perception settings for detection by affiliation being wrong
If you haven't implemented IGenericTeamAgentInterface on your actors, you will need to set the affiliation to detect everything
that's a fairly common issue
Well yeah, regardless following a BP tutorial for it should work for C++ also, you just need to call the functions in C++ instead of BP so it's not different at all from that perspective
yea i think ill make it using bp to understand what's going on
Just maybe easier to visualize and faster to setup
You can use the gameplay debugger to see some info on the perception system
If your actor perception updated delegate fires then it's detecting at least something
but if the delegate never fires, then there's probably something wrong with your setup
It has good visual indicators to show when something was perceived or not
i made a ue log for every line of code lol
The other thing you could be missing is a stimuli source on your target, tho I imagine the docs covered that
Pawns register as sources by default, but yeah if you want something that isn't a pawn to be detected then it'd need to be registered via some other method
nop, for now , just the player character
Really? I don’t rmbr this 😅
Yeah that should work more or less out of the box, you just need to make sure the affiliation detection is configured to see everything
Yeah they do, there's some code in the perception system which registers all spawned pawns automatically... I think there's a config variable you can change to disable it if needed
Ahhh yeah, but the docs say to disable that
Oh does it? I don't remember, rarely read them lol
Yeah, the config thing they tell you to do for affiliation is to set b.AutoRegisterAllPawnsAsSources to false, or something along those lines
Interesting, I don't think it has any effect to the affiliation system though... but I guess it avoids having issues with any pawn that might not have it set up if you use non-affiliated pawns also
Or it saves you the trouble of implementing affiliations if all you need is having enemies perceive the player
Yeah, basically don’t detect literally every pawn so you can narrow it down with stimulis
Question: I set Max Age on my sight to 15 seconds, yet the AI still continues to follow the player. How one stop the move to via behavior tree. It was suggested using a delegate for forget, how would I apply that? If I use a timer on it, it works, but I lose variation in custom follow time
You would need to run some task that stops the movement
Aye, fair enough, I'd put that task at the end of Move To right
For example yes. You could also make it a service, in which case you can have it stop movement when the service becomes inactive, which would be a fairly robust way of doing it if you always want to stop movement when this particular sequence is exited
In this instance, when the AI sees player, the chase begins, if ai loses sight within 15 so odd seconds, the AI switches to investigate mode.
I could make it a service too eh. In the service, run a timer on the way in
If see player, reset timer
if not see player, timer runs until x seconds
if timer runs out, successful event OR call abort
Well I mean if you want it to automatically stop movnig whenever this particular BT sequence stops being active, your service can simply just stop the character from moving, it doesn't need to do anything else
I'm assuming that you have some logic elsewhere that updates the TargetActor to null when 15 seconds is up
This would then cause the Has Target decorator to stop the sequence from running, thus triggering the stop movement service
Thanks for answering, I'll experiment!
How do I use the BT Gameplay Tag Condition decorator? I have assigned the tags to my AI, but the BT doesn't recognize it, I'm guessing I have to change something with the BB.
You will need to expose GameplayTagInterface in cpp
Does that mean typing it in the build.cs?
you'll need to add a dependency there iirc yes, but also needs to be added to your character class. I followed this:
https://forums.unrealengine.com/t/blueprint-eqs-and-gameplay-tags-i-need-help/242086/4
Is that the only thing that’s missing do you think? Yes that should be the only thing missing. How do I implement that on a BP project? You can’t. You need to implement it in C++. So what you could do, is: (-) let your blueprint actors inherit from C++ classes (e. g. if your blueprint inherits from “Character”, then create a new C++ class...
Honestly - with out ubiquitous GT are, it should just be added to the base Actor imo.
But something something dependencies I guess
I’ve had to do it in actor, pawn and char, because you can’t modify the pre-built classes, and you can’t reparent them to your extension either
Yeah - what I'm saying is Epic should just tack it on Actor
Ik, but I think this is like dead last on their priorities list lol
Oh, most definitely.
Imagine when it would take like 5 minutes to implement
But I get the feeling they're reversing their decisions to tack everything into actors which might be why it hasn't been added
It seemed to have done something, but now it doesn't even enter the branch with the decorator, it just skips it immediately
Use gameplay debugger to find out what’s happening
alrighty, just checking if it was another bug related to before
thanks
Does the way I set up my blackboard seem correct?
Would it be able to see the tags?
Then make more things BP friendly without the need to go into C++ 😠
Anyone have an idea why cpp AActor* Player = Cast<AActor>(BlackboardComponent->GetValueAsObject(FName("Player"))); returns null, but cpp GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, BlackboardComponent->GetValueAsObject(FName("Player"))->GetName()); returns my character class?
I've got some navmeshes that randomly appear when I change the project settings. I can't load or pin them, has this happened to anyone else?
What is the type of the Player BB key?
it is an Object with the base class as an Actor
So if you do the cast bit and then literally on the next line AddDebugMessage, the debug message shows stuff but the cast value is null?
yep, i have no idea why
What's the value you get when it prints it?
BP_FirstPersonCharacter
If it doesn't do the _C it sounds like you might've assigned the class into the blackboard and not an actual actor... I recall the UClass gives the name without _C but instances generally are _C_SomeNumber
Oh you're right
Would this work? If the cast succeeds then it gets assigned the instance, if it doesn't then it gets assigned to none?
Looks like it should yes
Yes it does
I mean it won't get changed at all if the cast fails at least in this code
Thanks homie
But if the cast succeeds yes it should correctly assign the thing you want
Btw, watch the 4th pinned link when you get a chance , it goes over all of this stuff
Will do, thank you
If you want it to get set to none if the cast fails, then you need to do another set node from the cast failed pin and have the other one set it to none
rip i was looking for a cleaner way to do that
If it’s not set yet, it’ll stay as None
oh wait, if i connect the failed cast to it
I'm using perception, and everytime it gets updated I need to know if it sees the player or not
.
If you lose sight to the player you will get a perception update where the actor is the player
but in the stimulus struct the successfully sensed value will be false
so you need to also check that
The tree handles that for you
Sry, that was a bit vague. I meant that as long as you’re updating the value, the tree will use that when it reevaluates
Hello
I have this Base Ally AI class which contains the base of an ally,stats and so on.
In game it spawns three allies that all is diffrent types and has diffrent controllers and BT.
Example, one lays traps (Lycan) and one use a sword.
The variation is on the AIController, right now I have a AIController for Lycan then a default BaseAIController but it seems it uses the BaseAIController (I see in debugger of the BT that three pawns uses BaseAIController.)
The BP in the picture shows how I set the AI Controller.
Just confused on what am I doing wrong.
how is it called?
why does blackboard wait until the task is completed before checking if it is true?
nvm fixed it
I fixed it 🙂
The AI controller is created early in the initialization process. Likely you are setting this too late. Do you not have different characters for each?
I fixed it.
This solved the trick,
https://forums.unrealengine.com/t/access-actor-being-controlled-from-aicontroller/305191
I have an Actor being controlled by an AIController. I am also running a behavior tree with a blackboard. The BT is working and my A.I is moving correctly. However, I want to set up a value in the Blackboard. I want to get this value from the actor the A.I is controlling. I can’t seem to be able to access the controlled actor from the my AICont...
Hello everyone! So I am trying to fix this problem I have: I have AI controlled for my deer, It works perfectly fine when I set its controller by hand in the details panel, but when setting it with “Set AI Controller Class”, it just doesn’t seem to work… I set the controller class like this, And this is shown in the game… I don’t unders...
What do I have to do to make the code wait for MoveToLocation to run? I'm stuck in an infinite loop and it isn't letting my AI move at all while the index still goes up cpp EBTNodeResult::Type UAIDevTestPatrolTask::MoveToPatrolPoint(AAIDevTestPatrolBot* PatrolBot) { AAIController* Controller = Cast<AAIController>(PatrolBot->GetController()); if(Controller && Controller->MoveToLocation(PatrolPoints[CurrentPatrolIndex]->GetActorLocation(), 50.f, false, true, false, false)) { if(CurrentPatrolIndex++ >= PatrolPoints.Num()) { CurrentPatrolIndex = 0; } MoveToPatrolPoint(PatrolBot); return EBTNodeResult::InProgress; } else { return EBTNodeResult::Failed; } }
You are recursively calling the function. You start the move to then immediately call it again with the next patrol point.
I do not recommend doing this in a single BT task. This should be a sequence in the BT. And use the built-in move to node.
First task finds the next patrol point. Second task is the move to node.
I'm trying to copy this BP that I made into CPP, this worked
Or is it not worth it
I didn't include the first part of my code
I'll add it all rn
EBTNodeResult::Type UAIDevTestPatrolTask::ExecuteTask(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory)
{
Super::ExecuteTask(OwnerComp, NodeMemory);
AAIDevTestPatrolBot* PatrolBot = Cast<AAIDevTestPatrolBot>(OwnerComp.GetAIOwner()->GetPawn());
if (PatrolBot && PatrolBot->GetPatrolPoints().Num() > 0)
{
PatrolPoints = PatrolBot->GetPatrolPoints();
MoveToPatrolPoint(PatrolBot);
}
else
{
return EBTNodeResult::Failed;
}
return EBTNodeResult::InProgress;
}
EBTNodeResult::Type UAIDevTestPatrolTask::MoveToPatrolPoint(AAIDevTestPatrolBot* PatrolBot)
{
AAIController* Controller = Cast<AAIController>(PatrolBot->GetController());
if(Controller && Controller->MoveToLocation(PatrolPoints[CurrentPatrolIndex]->GetActorLocation(), 50.f, false, true, false, false))
{
if(CurrentPatrolIndex++ >= PatrolPoints.Num())
{
CurrentPatrolIndex = 0;
}
MoveToPatrolPoint(PatrolBot);
return EBTNodeResult::InProgress;
}
else
{
return EBTNodeResult::Failed;
}
}```
(I'm not a bot, i just made a reddit post and it got removed so i copy and pasted the posts text) I'm trying to make a Zombie AI which is like the World War Z Zombies but a little dumber. I still want them to be fast, climb and sneak up on the players but I dont want ones where you literally cannot survive them. I have looked everywhere for tutorials but I can't find any. I have found some where they aren't as smart and can't climb and are just basic zombies but never anything too smart. I tried using behaviour trees and that was good, but I could never get it just right. Also, I need the animations to stop if the player moves away too quickly because what I had before was a zombie still playing a hit animation like 5 seconds after the player has run away. I'm using blueprints btw
It didn't really work. The logic is wrong and you'll have a lot of bugs doing it that way.
The BP has worked for me no problem. I haven't noticed any bugs
Your task doesn't handle being aborted. It's also not the same in C++ as BP. BP you are using an AI task and in code you are using a function. Those are not the same things.
You will need to break down the mechanics of WWZ's zombies and then look for tutorials (if you're deadset on using tutorials) for those mechanics and then combine it yourself. The odds that you'll find a tutorial for a game like that is extremely low. You need to understand concepts.
Ah ok I see, thank you
alr thanks
Also note - they literally built a custom engine for that game.
if I'm not wrong its AI (or physics, thats what I am not sure about) is running on havok
Also note they had 435 people working on that game.
some of the 435 is programmers of one of the most skilled game studio too 😄
(saber interactive)
in one of the dev talks they said all zombies are a single entity getting simulated through SoA system with custom networking model but this is not news or some kind of a surprise
turns out both
there's a chance zombies are not havok powered though
I honestly didn't even know Havok had an AI system. I've only known them for physics.
Luthage mentioned she used havok once here
thats how I was learned
I may have missed it
Much like Queen, I'm just a poor boy - so its outside of my grasp 😅
Do they provide BT for UE integration?
or is it limited with navigation and steering?
It's only navigation. And obstacle avoidance.
Luthage does like to wreak Havok 🙃
It's really nice working at a studio with a budget.
budgets are not for weak, license bp2cpp
🤔 seems too much like a sour grapes statement 😀
What I really like is we have monthly meetings with them and I get to say "it'd be nice if I could do X" and then they just build it for me.
Havok does?
Yep.
That’s unheard of, usually third party software is like “good luck trying to improve anything, we bought it like this, if we request any changes, it costs extra and we can’t have that”
I know someone who fixed a bug in UE and submitted a PR, then Epic wanted to charge his studio for the PR
Not really in the games middleware industry. But Havok is the best to work with, because they really want to improve their tools.
Fair, I’m used to crappier industries 😅
I always thought once you license something its only normal to expect bugs getting fixed
at least in game industry
Epic also prioritize your bugs if you're also a licensee
Then you have UE and they tell you to fix them.
They do this even to your studio? 😅
UDN perk 😉
Yeah. They have to respond to us quickly on UDN, but it's mostly telling us to fix it.
great 😄
So this sounds like, they're a pretty good middleware company.
Time to make some 💰 and then just license that for my forked Godot engine
Do they actually have a godot support
Probably not built in, but it can be integrated into any engine
A lot of proprietary engines use Havok.
Wasn't Epic supposed to be working on a new navigation system anywho?
(Not ZoneGraph)
It's great how all the engines use the same library for the navigation stuff though to be honest. (In before Luthage corrects me)
Recast has been carrying navigation for so long
It's cheaper than paying a team to do it. I've used a proprietary engine once, but all other games I've worked on have been UE.
Hey has anyone had any success creating navmesh bounds volumes at runtime? I have a huge, sparse world where only specific areas will need navmesh - so I can't have one mega-volume, but I'm having trouble getting the bounds volumes to spawn dynamically (I'm assuming this may be BSP related?)
I imagine I could update my areas to load sublevels but I'd rather not do that solely for bringing in a navmesh bounds volume. Essentially I'd just like to create one of the desired size for my content areas as needed.
Not aware, do you have source? Sounds quite interesting. Atm they are maintaining Recast and doing smaller changes to it regularly. Nav would definitely deserve some refresh. Mikko’s nav corridors looked quite interesting but it seems it was just prototype. ZoneGraph looked also promising but it seems it ended up to be effort focused only around Matrix demo.
I definitely won't be able to provide a source. Just something I thought I saw in passing somewhere.
And that is foggy in of itself - which is why I wanted to double check 😅
I don't typically like doing this, but this is the type of question that I think @uneven cloud is one of the few who have enough experience/knowledge with UE to be able to guide you. She might say to just have the mega navmesh and then use nav modifiers to tune it. UE5 has navmesh streaming with World Partition as well I believe. (CC @north vessel)
I'm not sure I'd even be able to make the navmesh volume big enough (it's somewhat limited in its overall size) - although maybe with some cell tuning it'd be possible
but yeah I literally just need these to be essentially resizable
could do something icky with a pool that I move/resize but that seems dumb
Why can't you make several bounds volumes only covering the areas you need navigation in?
I would love to - but those area locations/sizes are picked at runtime
so I have to create them at runtime as well
You can set the generation to dynamic and move the bounds volume and call On Bounds Updated on the navigation system
yeah - it's currently set to dynamic, but it's multiplayer so I will need multiple
I think the issue is that it's not able to resolve the size of the box at runtime - I wonder if I could force it to get the correct size, I'll give that a try haha
oh hell yeah
I think I got it working:
- Made a child class of ANavMeshBoundsVolume
- Override GetComponentsBoundingBox to solely return the desired size of the navmesh bounds
- Spawn this actor in the level at runtime
- Implement a function in your bounds volume class to set size + call OnNavigationBoundsUpdated
- Profit
@north vessel
I think this will require some tuning to make sure it works at scale but my small scale test works
A nav bounds manager, I like it. if it works 😀
Quick question, for a Behavior Tree Move To mode to succeed, the ai needs to reach within the acceptable radious location right?
As a quick followup to my above - this does work as expected, nav mesh is just slow as hell and kinda hitchy. Even just updating a cell via the invoker on my player hitches a bit - so I'm gonna dig more into why that's happening.
But - it can be done!
The problem is that you are using an invoker.
Even worse you are using an invoker on a moving actor.
yeah I figured something that was created for the sole purpose of limiting nav updates would limit the work needed lol
Depends if partial paths are allowed I think
I mean at this point since I'm dynamically creating them I can just do that I suppose
It's not made to limit nav updates.
I mean that's the purpose specified on the documentation:
https://docs.unrealengine.com/4.27/en-US/InteractiveExperiences/ArtificialIntelligence/NavigationSystem/UsingNavigationInvokers/
essentially supposed to be for "large worlds" where big nav volumes would be impractical + attached to agents
but I guess it just does a bad job haha
It was made before streaming navigation worked. It's not designed to limit updates, it's designed to limit the amount of area and memory the nav mesh requires.
Nav invokers is the most expensive generation option. When you attach it to a moving actor, it will update every time the actor moves.
hmm - from what I was seeing, it seemed to be only regenning the navmesh when the invoker bounds overlapped a new tile (as I'd expect) but maybe it just runs on tick, I dunno
would be a very bad idea if it was ticking compared to doing a tile bounds check
Considering I once left dynamic nav gen on and had can ever affect navigation on a character turned on…
Let’s just say it was a nice slideshow
yeah that is a bit different though - cause the "can affect navmesh" actually cuts holes/etc (so it becomes a bit of a nightmare with moving platforms/etc) - the invoker are essentially loaded into positions/distances, then the navmesh decides if any tiles need to be updated based on their positions
and it seems like aside from that initial tile location check it doesn't do any work until a new tile needs to be loaded
so theoretically you could have like 100 agents bouncing around and it would only do the work of collecting those locations, then updating any tiles that didn't already get "loaded"
my current guess is it's the amount of content actors I'm spawning that are causing a lot of navmesh updates
but yeah I believe it was a slideshow 😆
I haven’t looked at the invoker code myself but ik Luthage has, so she might debunk those theories pretty fast 😀
yeah it's in ARecastNavMesh::UpdateActiveTiles - basically iterates through invokers then decides if tiles need updating
I want to wait for my attack montage to complete in my behavior tree task before finishing the task with a success. I tried to implement the interface on the task and message it "on completed" of the montage but it wouldnt give me the message option.
There's gotta be a simple way to do this im spacing on? Just want it to wait to finish the task until the attack animation is done
I got it I guess this is the best way to go about it
I think there’s some dispatchers like onMontageEnded
as an update to my thread above for anyone who might care:
-Invokers only cause nav generation when the tiles they are in proximity to change
-Nav tile generation IS done async on a worker thread, however we were still seeing big-ass stalls on the game thread
-Using Stat DUMPHITCHES, I was able to track it down to the geometry gathering (which happens on game thread)
-As expected from Unreal, it was a magic boolean - checking the DoFullyAsyncNavDataGathering caused that work to be thrown to a background worker, and largely smoothed out the hitch
-still unsure how the perf for this will look as we throw more stuff at it
I’d no idea stat dumphitches was a thing, thx!
hi guys, does anyone experience troubles with building WP navigation on 5.3?
guys i need some help, i was working on an enemy ai meant to shoot at the player, very basic focus on target, and if cant see the player just go to the las position. This last part wasnt working quite well and i was changing some stuff and suddenly the ai just does not work at all, i mean not even the animation is working properly now. It wont focus on the player (it wont really focus on anything) i dont know what happened its is very weird, have anyone else ever find this same problem?
maybe something went wrong with the game files or something?
You changed some stuff and it broke is not a lot to go on
I've profiled invokers vs dynamic generation on 2 different projects (AA so medium sized games). Invokers are significantly more expensive.
No, probably just bad coding
i nkow but i didnt change anything meaningfull for it to break
Use the gameplay debugger and visual logger to debug your code
thats what i mean
You can try restarting your engine first just in case, but most likely you just broke something by accident
You need to bind to on montage completed in the anim instance.
This is why even solo devs should use source control. You can just revert your files.
lol yeah, I totally forgot to recommend that 😅 - assuming they’ve actually set it up
It won't help with the current problem, but it will in the future
i have a version from 2 days ago, but i really dont want to lose 2 days of work but in the worst scenario i can do that
You should be committing a hell of a lot more often
If you have it setup properly you just discard the last commit of that bp
And it’ll roll it back
Small and frequent check-ins.
Then when you're done with the feature, you can do a squash and make it seem like you actually know what you're doing! (Assuming you're using git that is, I'm unfamiliar with P4)
But what you need to do now is learn how to debug. The visual logger (tools/debugging) is really great at debugging AI. You record a play session and then walk through what the AI is doing. All the AI systems are already set up for it and you can add your own logging using the vislog nodes.
I need to learn the last part. I’ve used VisLog but didn’t try logging things manually yet
You can log text and shapes! It's so great
I've dabbled with it. It's actually pretty easy to integrate your own stuff.
90% of our debugging is with the vislog. Being able to toggle the different categories is the best.
VisLog is golden
And you can ship with them still in as they get compiled out in shipping builds.
It really is one of the coolest debug tools I've seen.
I can only imagine what people like Rockstar have 😅
Or eidos with Hitman
Most use runtime debugging, which is not great.
I'd imagine both would be useful ideally.
In interviews, I always ask candidates about using the vislog. It's very rare they know about it. So many people just use the gameplay debugger
Oh sweet. I have a leg up. Because I've even added my own stuff onto it!
💪
Can't. Too risky to move jobs for me in my current situation 😭
Right now I need stability above all else.
Interesting, was this a "full world generation" at start, or were you generating/clearing nav tiles as the game went on? I could imagine it would be much cheaper to do the generation up front if the game allows for it
Generation up front. Both were procedurally generated worlds. For a few months we had invokers in my current project, because streaming was broken. That tanked our performance hard.
ahh yeah - cause looking through the invoker code it's really not doing anything special aside from generating those tiles. Is your streaming realtime or are you doing it behind a load screen?
cause my options will basically be "invokers" or "dynamically generate the whole area when it becomes relevant" and both seem to have pitfalls tbh - I was hopeful invokers would reduce the total amount of work required (since it's like... a few tiles vs all tiles)
putting the geo gathering on a worker thread really helped though
Realtime. We got it fixed so the nav mesh is loaded as the world partition cells are loaded.
oh nice - I mean that's reassuring at least
my last game we had to create static navmesh slots for each dungeon floor cause we were shipping on switch lol
When we did full dynamic with the procgen world, that was hidden in a load screen
yeah - it's tricky for us cause our world is very large but sparse, so that kinda requires load/unload of anything expensive
but now that I've got everything off the game thread, maybe I'll do a comparison of "content area" vs "invoker" and see how they look
I do wish you could just load a pre-gen'd navmesh in for the base - I mean I'm sure you can do it with a bunch of code, but seems like a pain in the ass
How can I achieve this EQS result for strafing? https://gyazo.com/b4126335dc86c1506ba5f768bebd2f0b? Its from this Square Enix AI presentation https://youtu.be/BV2GTGbSjq8?si=uuiq0-VWDkoc6pOy&t=2077. I tried their exact same setup but this is my result... : https://gyazo.com/76ca19b7da3e08b8ea70f19fd5c10bde. Cyan is the destination, green is target. Could it be a different scoring function besides linear? Other settings that does not show up on the node? I can't reproduce it...
The first test being set to prefer greater is what confuses me the most because that would mean it will always pick points on the other side of the donut
the first test's weight is set really low though (the green bar below the test)
so it'll be more of a nudge
first one has highest weight no?
oh yeah my bad haha
I wonder if there are filters on the dot product, that's what I'd do
cause you can just straight up exclude those points based on that
yeah i managed to kinda make it work that way. Just filtered points close to querier. Its a bit janky tho. But im more curious why their query works the way it does
yeah a few things we don't know:
- I'm assuming the destination context is your current move target or something, but I'm not 100% sure
2) They could have filters on those tests(filters do show up in the text preview) - They could be using reference values on those tests (I don't believe those show up in the preview text)
- Not sure if ally stuff is affecting it (but I imagine not in the case on screen)
like if their reference value for dot product to enemy is like 0 or something that would weight 0 value dot products highest (ie to the side)
hmm come to think of it that first one is real suspicious, maybe that's where they used a ref value or something
for example: this is a query using ref values:
"prefer greater" but it really means "prefer as close as possible to 200"
hmm, trying to figure out how reference value works. Never used that before. So if the distance is 200 then that item will be scored to 1, and items far away from that value will be score to 0
this is definitely something can be achieved via dot products
yeah it has two options, but typically it creates a range from lowest value from all your points (or zero) to your highest range
and then maps that so the highest value is your ref value and it falls off from there
Also yeah, the destination context is the current move target. But i had a problem where my AI would stop for a second when it reached that target instead of constantly strafing towards the next one like in the video. So the first time it is calculated I had to offset the target with a relative strafe direction(right/left) vector so it always tries to pick the point in advance... if that makes sense
Gonna play around with the ref values
If you turn on use acceleration for paths and tweak the deceleration speed you won't have to do that hack
haha, I am just going thru conversion from invokers to streamed/pre-built nav mesh too. UpdateActiveTiles() is poorly written, it was causing up to 60ms of hitches as it is full of nested loops doing AddUnique(), it scales really bad. After changing the logic completely I was able to get to usable numbers but still there is then the constant nav mesh generation perf hit, especially when you have many randomly moving agents. So the idea was born why not just prebuild & eventually stream it instead as WP already supports it.
Yeah those AddUniques are weird - like why not use a set lol. I don't think I can use world partition for what I'm doing (procedural world at runtime) but I I figure I'll poke at invokers until they start to cause problems, then maybe try level streaming stuff in or something
But I was able to solve that nav mesh generation perf hit (I believe) by having the bool to push the geometry collection to a worker thread set
yeah, just switching it to TSet cut the 90% of the cost, remaining 10% required changing the algo.
Hello!
I was wondering if there was away to update an AI's current pathfind goal's in blueprint.
Basically, I'm trying the same behavior as one would get with "Use Continous Tracking" with a moving actor, but with bespoke positions instead.
Just tell it to move somewhere new and it should override the previous goal
Hmm @uneven cloud did you notice if you try to change the visual logger doc link to 5.0 or above, it auto redirects to unreal insights
https://docs.unrealengine.com/4.27/en-US/TestingAndOptimization/VisualLogger/ -> https://docs.unrealengine.com/5.0/en-US/TestingAndOptimization/VisualLogger/ -> https://docs.unrealengine.com/5.0/en-US/unreal-insights-in-unreal-engine/
Yeah, you have to use 4.x docs. I haven't found it in 5.x yet
I was wondering if they were trying to imply insights succeeds it 😄
I’ve seen several docs pages point to the wrong thing when switching versions
Ah
But yeah I saw that one too, prly just a bad redirect
I'm using Report Noise Event to alert an enemy to a footstep or a grenade. Depending on the magnitude of the sound, I want to report different "weights" of sound.
I thought setting Loudness (in Report Noise Event) would be what I want, but it seems that Loudness of, say, 0.5 actually can only be heard within 0.5 * HearingRange of an NPC. Am I misunderstanding what Loudness is meant to do? Is there an alternative to weighting a sound < 1.0 that can be heard within the entire HearingRange?
I've heard that insights will eventually replace it, but no idea when that will happen.
I hope it never does. vis logger is too ❤️
The idea is not really to replace it, but move it to insights. You can't use the vislog for packaged builds anymore, which is really frustrating
You would need to make your own hearing sense.
Requesting a new MoveToActorLocation every few frames seems to produced unintended behavior (Ai jitters very slowly towards its goal). A workaround seems to be to spawn an invisible actor, set that as the MoveTo goal and update the actor's position instead.
Turn on Use Acceleration for paths, adjust the deceleration speed and don't request a new move to if the location hasn't changed much.
That's obnoxious. Having them send the vislog with a bug report could have been great
Ah, didn't know about that variable on the character movement comp, will try it out!
Thanks
It was great. Epic then made the vislog dependant on the editor and now I can't start a vislog file on Xbox 😿
Anyone know a good tutorial for state tree cpp? Haven't been able to find much
There isn't one that I know of. It's too new and too experimental. This is where you have to read the source.
Yeah thought so
Anyone here used NavLinkDefinition's ?
That's an abstract class. Didn't even know it existed to be honest. I've only lightly touched on nav links in general
They also deprecated the part of Session Frontend that was most useful so yeah
Honestly the debugging tools are the one thing I'm still behind on after the transition to UE5
They don't seem to have settled down yet either
The animation retargeting was a real mess, but its already in a reasonable place
They’re pretty good tools tbh, but in some cases Frontend gave you more info than Insights and now you have to hack your way around the deprecation
Question,
How do I get the nav mesh to load and work when playing the game using world partition, data layers and one asset per object mode, while manually loading and unloading data layers under a single overworld level? Currently, the nav mesh shows in editor if boundary volumes are in separate data layers, however, when playing the game, the nav mesh does not show. Only when I remove the boundary volumes from data layers and have them all reside in the overworld map will the navigation mesh load in game and allow ai and click to move functionality. I would really like to get the nav mesh to load with boundary volumes in data layers.
Here is a video walking through the issue.
https://screenpal.com/v/c06t11VEBoC
hey devs i got glass wall blueprint in my game and what i want is that AI's sence can see player throug that wall how can i achieve this ?
The issue here , i got this shield on my player and AI's sence should see the player through this shield but the bullets that AI shoot are Hit Trace bullets and trace is done on Visiibility channel , if i set to "Ignore" visibility channel then AI's will see the player but shield itself won't work , bullets will pass throgh
You can make your own custom channels if you want
Default AI sight channel can be changed from project settings also
It's usually worth making a linetrace channel at least for hitscan purposes, otherwise if you keep repurposing the default channels it just becomes messy and confusing lol
Hi all, I'm new to Unreal so sorry if I ask a stupid question. What's the best way to implement a "chasing player" function with custom pathfinding? My guess is to have a map with waypoints on intersections and apply the algorithm that fits the best in my situation, but I don't know if it's too expensive in terms of computation. What can you suggest? Thank in advance
is there a way to get this value in BPs? When the AI loses sight of the player this starts counting up to 10, I'm trying to get that changing float value, not change the max age value
Custom pathfinding because…
I think I got it 
Yeah, that’s the one. Cpp also has a getAge
Because I'd like my AI to take a path based on some conditions and values, I don't want always the shortest path
Then sure, use waypoints, why not 😀
My concern is that it could be expensive in terms of computation. But maybe I can fix this by calculating the path every seconds or more and not every frame
Use EQS and nav modifiers then, to increase nav costs in certain areas
Why? Funnily enough, this is exactly what RE4 does with some of their enemies.
They use a combo of navmesh and waypoints
Never studied EQS, I guess I should ahah thank you so much for the help
Watch how they do it in the 4th pinned link here
It's still the single best introduction to the AI tools of Unreal.
Right? 😀
I don't know. I was thinking about the fact that I should calculate the path every time the player moves. But if the player keeps moving, I don't know what the AI is going to do with all the computation. As I said, I'm new to this, just done a couple of small things in Unity a long time ago ahah
The real crime is that my sharing of that video wasn't pinned 😠
Ignore it. Implement the simplist solution you can and then measure/profile/refactor as needed.
Going to do it rn
Don't overthink this
Ok so have a working feature and then optimization
That is the best way to do game dev
my feature is not working 😄 I'm just getting some overflow data back atm, what am I doing wrong here? I've also tried casting the Owner Controller and Controlled Pawn to my classes but no luck
The EQS is time sliced, so perf is less of a problem. If you check that a path exists as an EQS test, before picking a location then pathfinding is cheaper.
What is it that you are trying to do?
sorry should have given more context - this is what I'm trying to do
I might have misunderstood the Actor input though - tooltip says sensed about not sensed by (testing...)
alright getting closer I think that was it
fixed it. I thought the data was on the AIC but it's on the stimulus source actor
is there a way in bp or cpp to check if my current AI controller is implementing a BT?
I want to make a check and if false do a backup
I'm trying to make my visibility EQS query return false when my actor has a certain gameplay tag (Idle.Hiding) but from reading the forums a little, this does not seem possible with a BP project because I would need to implement IGameplayTagAssetInterface via C++?
is that still the case / are there any workarounds to get EQS working with gameplay tags in BPs?
That’s true, you need to implement it through C++. It’s quite easy but can be challenging for someone who never touch C++
Is there a (relatively) easy way to set the up arrow of the navmesh to be something other than (0, 0, 1)? For example, if I want the navmesh generated on a wall, is it possible to set the up arrow to (1, 0, 0)?
(I can handle the CMC and gravity stuff. Just curious about the actual generation.)
Nope.
Relatively easy impossible, rather
You'll need to look into non-Unreal solutions for that
Making a game that is based on spherical trig is a bit of a nightmare in of itself, but you almost always have to deal with the AI pathfinding situation that results, which is the difficult - or at least, expensive part
It is exceptionally rare that your game will be worth making with a spherical world over a flat one
The spherical aspect would have to be critical to the gameplay, and that gameplay would have to be really fun
Question,
How do I get the nav mesh to load and work when playing the game using world partition, data layers and one asset per object mode, while manually loading and unloading data layers under a single overworld level? Currently, the nav mesh shows in editor if boundary volumes are in separate data layers, however, when playing the game, the nav mesh does not show. Only when I remove the boundary volumes from data layers and have them all reside in the overworld map will the navigation mesh load in game and allow ai and click to move functionality. I would really like to get the nav mesh to load with boundary volumes in data layers.
Here is a video walking through the issue.
https://screenpal.com/v/c06t11VEBoC
You can create a custom Context through Blueprint, so you can check the tags
could you expand on that a bit? Would I add that context as a test?
https://docs.unrealengine.com/4.26/en-US/InteractiveExperiences/ArtificialIntelligence/EQS/EQSNodeReference/EQSNodeReferenceContexts/
You can make your own contex to filter anything you need
You can also create generators in blueprints, so you can make a first filter without using contexts
Does anyone know why my dynamic nav mesh modifiers dont work on mobile (Android)? I use them to change the nav class between null and default. On PC it works, on Android it doesn't...
The nav mesh is set to fully dynamic and otherwise works
Why are you hell bent on having bounds volumes in a data layer? This doesn't even make sense.
Not at all impossible. Just not easy. I shipped a game with relative gravity navigation, which is far more difficult than just wall walking.
Did you watch the video? I explain it in there.
We are working as a 12 person remote team. We are using version control. World partition and data layers provides the most flexibility when multiple people are working in the same world. We would use the automatic tile loading but it is severely broken. So we are manually loading and unloading data layers as the game progresses. As you can see, we have an overworld level, and a data layers for each section of the world (point and click adventure). The workflow is seamless compared to other workflow we’ve put into practice. I’ve worked in games development for over 15 years and have used various systems of collaboration. This workflow is by far the most efficient and reliable… aside from this one thing. So either we can use navmesh, and have a volume per data layers that is streamed in and out or we cannot. If not we write our own navigation AI move code. But we’d rather get the navmesh to correctly load when the boundaries are in data layers so the entire world navmesh is not loaded all at once.
My question still stands, how do we get the nav meshes boundary in each data layer working so we can unload and load them as needed, instead of requiring all boundary BSP volumes to be in the over world level.
Thank you for your help with this btw. Very much appreciated.
I work on an 80 remote person team and we use world partition auto tile loading just fine. The nav data lives in each world partition grid tile and is loaded in when the tile is.
It breaks our project every time we use auto tile. Plus, we are not creating a huge open world that would require the use of this system.
5.3
Also, our team does not have a huge budget where we have the luxury of dedicating personnel to the maintenance of systems that do not function smoothly out the gate.
The bounds volume only defines the area that the navigation is built in. When building navigation, each cell is loaded to build that part of the navigation. The WP generation tool is not really built to do what you are trying to do. You'd need to change it to get what you are looking for.
Okay, thank you. This gives me a better place to start. Ill replay this with the team.
Can you provide me with some starting points ill need to look into in order to get the WP generation tool to function like we need?
You can try putting 1 bounds volume in the overworld and the rest in data layers to see if some legacy functionality from world composition still exists.
I’ll give that a shot and report back.
I really hope this works but any time I separate the boundaries the man mesh fails to load.
Just to clarify, I was able to set the generation to to use cells in a test world. The build paths function worked well for this and chunked the recast meshes. Wish we could put the boundaries in data layers and have the system build separate nav messages per volume in different data layers by default.
I'd start with the generation functions in the navigation system. I haven't dug too far in WP recast as we use Havok navigation. But a breakpoint will give you the call stack
Okay, perfect. Ty. Ill relay this to the team.
Does anyone have an idea as to why the AI doesn't move towards the last seen location when the player comes out of sight please?
I can see that the last seen location is set, but the AI just stops as soon as the player exits the line of sight:
It seems to work when I walk into the enemy, but no idea why...
You are using a sequence. A sequence executes nodes until one fails
Therefore if the first node fails as a result of the decorator being false, the second node will never execute
That makes sense! What should I use instead please?
Spot on! Thank you!
would anyone have any advice on how to make an AI not slow down and speed up when patrolling between points?
turn off use acceleration for pathing
@dense owl @dense owl in character or nav?
On the CMC
Converted mana cost?
Character Movement Component
Np
You do understand that this causes a full stop between patrol points, right?
I know, but I thought that’s what he was asking for
Hi
I'm trying to force Enum to change the behavior of my AI, but it's not working.
In the branch the Macro is activated to change the ENUM.
In the screenshots you can see the BTS that runs every 0.15s to see the state of the character, and the Behavior Tree with the 2 tasks, If Running or AngryRunning, but only Running is executed even if the BTS orders it to change to AngryRunning
Thanks in advance
I wonder what was the big idea with the State Tree component's "start logic automatically" not actually doing anything if the state tree is in an AI controller...
You need to set the decorator to abort self on both the branches if you want the nodes to stop executing when the value no longer matches
Has anyone used the AI perception component with State Tree?
State Tree doesn't really care about that
The way you can do it is for example store the perceived actor into your AI controller, then use a state tree task or evaluator to read it from the controller
I am not a fan of the ST. The only good thing I see from it is the property binding stuff.
Otherwise, it's annoying to work with.
How so?
Just telling the ST to do something from outside of the ST.
Didn't like that I'd have to loop through every event sent to the ST and check if it's the event that I care about.
Thank you.
Interesting, I didn't really do much with that yet but I had some event based transitions which seemed to work in a fairly simple way
How were you doing it? (This was back in like 5.0/5.1 before I went back to my beloved BT)
It lets you set it up like this, not sure if it's different from before because I din't use it until 5.3
And admittingly, I would've stuck with ST most likely, IF the property bindings didn't randomly lose connection and then not allow you to reconnect unless you recreated a whole new ST asset.
Yeah there seems to be bugs in the bindings still. You can only bind into sub-properties for the Context actor as far as I can tell, it still gives you the option to bind into sub-properties on other things too but they always error out
Works fine as long as you don't try to do that though
Oh, my bindings were bugging out on the context actor themselves. Not subprops.
The one thing that I don't like is that I can't run a child statetree like you can with behavior trees
Yeah, that really sucks too
I was testing some stuff with it and I had two NPC types which basically had to behave exactly in the same way, except for a small portion of the tree
I ended up just having one tree and having it choose which branch to go into based on the type of the NPC :P
I'm working on my boss AI here soon. And I'll be revisiting ST for that.
I find bosses are easier done with state machines than BT
It would be nice if they made interoperability between them actually possible
run ST from BT, run BT from ST, etc. - but that seems pretty unlikely because they made both of them BrainComponents
I didn't see anything in the roadmap about more work being done for the ST either
Sections like these are why I find automatic nav generation a bit annoying sometimes. I'm just like, "please just connect 😭"
And where I'd like to just do a quick "paint".
😭
What do you have to do to fix it now?
Actually adjust the agent radius settings 😠
Haven't quite figured out how to avoid the mesh from generating on top of desks like this though.
Or why the navmesh doesn't show on top of some slopes, but does show underneath
¯_(ツ)_/¯
And stairs have always been annoying to deal with as well (at least for me)
TIL that the nav link component doesn't show the visualizations of the links in the BP editor 😭
The nav link component seems...lackluster
So, my options to handle doors are:
- Manually place smart nav links around all the doors
- Have the doors spawn them and place them (I won't use CAC due to some issues, especially with multiplayer, that people have reported)
- Use nav modifier component and do dynamic modifier only for navmesh generation
- Turn off can ever affect navigation on the doors and have each AI linetrace in front of them to determine if a door is there and try to open it if it is
Any other ideas?
How can I do this?
I'm going with option 3. Seems to work fine thus far.
Hi, I would really appreciate help, please. I have this issue with navigation: https://www.youtube.com/watch?v=3AVa-qJRCPQ
My agents for no reason break after they reach about 1/3 of the map. The map is pretty large and the target is on the other side, in the video the camera is roughly at the map's centre.
I'm using rvo avoidance and detour since the defaults where even worse.
The map itself is two rows of objects just duplicated all across so when the agents move through first two rows just fine I'm lost at why they randomly stop later on.
Any ideas please?
#gamedev #gamedevelopment #indiedev #godot #godotengine
Twitter: https://twitter.com/NickGenFailed
Twitch: https://www.twitch.tv/nicknamegeneratorfailed
More videos: https://www.youtube.com/@Nicknamegeneratorfailed
I checked if the path is reachable and it says it is. I checked the last point in the path array and it is at the target position too.
I use "AI MoveTo" node in blue prints to move the agents at the BeginPlay event.
Strangely if I set the "AI MoveTo" on a timer and call it repeatedly the agents don't break and get to the other side of the map just fine - though that seems incredibly inefficient (to keep calling for new path every once in a while?).
Click the decorator and in the details panel it should have options for aborting
You should not use RVO AND detour. It should be either or.
Are you using a partial path? What errors is it giving you for stopping? If you don't know what errors it gives you, you need to debug it using the visual logger.
I tried having rvo enabled/disabled but it still has the same issue unfortunately. I also tried disabling Accept Partial Paths in Project settings but no change either.
No errors at all.
What is the visual logger please?
The visual logger is under tools/debugging
I assume this is ok and before the issue:
And this is where the issue roughly happens:
For some reason it seems to lose the path?
There's also this which is way earlier (time stamp):
The red error happens at the very beginning it seems.
But I have no idea what to do with this if anything?
So apparently when you check if an Object Key in the blackboard is valid, it returns true even if the object is set to "None". What would be the best way to counter act this? Or am I misunderstanding something
A simple blackboard based condition seemed to do it for me 🙂
should you put the attack logic in the BT, AI Controller, or the enemy chracter BP?
I have the move to in the BT. The actual attack and damage logic I have in the enemy character bp
You can do that but you need to use custom schema for ST. As ST is just a structure, you can put it inside BT Task or run behavior tree from ST Task. ST is great in this, just BT is limited, so keep in mind you can not do nested BT calls as it will always override the main one.
You can, just that there is no nice UI for it. Create ST Task which contains another ST. You might need a different scheme for that.
I try to avoid using default state tree component and its scheme. It is what is limiting you to use the singular brain component. If you do the exact same thing but without inheriting from brain component then you are free to run as many nested STs as you want.
I didn't look into creating my own scheme. Maybe that's where the secret sauce is.
Imo it is a mistake that they decided to inehrit state tree component from brain component. Should have been generic ST component.
My main problem with ST is UX. A lot of clicking in nested detail panels to configure something and for every transition you see just (?) icon in the graph. It is hard to read, maybe harder than graph representation. Would be nice if they add alternative tab / window to be able to see it and work with it as graph. I know.. it is probably exactly thing they wanted to avoid but I feel it would be sometimes easier to read.
Thought you had an issue with how the Tick/Enter/Exit states were handled as well. That they're functions instead of events that is.
Yeah I looked at the schemas in passing and it looked stupidly complicated
I don't quite understand why they didn't just make it so you have a state tree that you can run separate from the component, and if they wanted you to have a convenient interface to it, just have the component wrap it
but instead if seems largely tied to how the component functions
Tricky with Recast. It takes just two inputs geometry + modifiers/areas. Geometry is just vertices without any context, so it can not easily decide what is top of some prop and what is top of floor. You can configure your mesh to output collision data as modifier with Null Area instead (look for Dynamic Obstacle option). These have no mesh generated on top. However, I can not resist the feeling that it feels hacky and can have other negative impacts. In the past I used Flood Fill nav modifiers (e.g. https://github.com/EpicGames/UnrealEngine/pull/8571 ) which recusiverly jumps to neighbors and indentifies reachable navmeshes, unreachable ones are then marked with some nav area to distinguish them and filter them later in the process. If somebody finds an easy way how to get rid of these, I will be happy to know :D
There si also setting on the Recast Actor in the level which gets rid of small islands but it stops working as soon as there is a nav mesh tile boundary in the island :(
Looks ok, nav mesh is just approximation generated from voxels and then simlified. You can control simplification by properties on Recast actor. Setting simplification to very low number should provide better visual answer of what is going on. Simplification ignores everything and can even lead to navmesh going into collision but you still need it to some degree as you don't want navmesh made out of squares.
I used 1,2,3 in the past. Recently I prefer 3 more because of possibility that the door can be quite wide / gate like. 1,2 was giving also some edge cases when you mess with the pawn while it is traversing the navlink but should be possible to work with. For 1,2 I like its performance and simplicity.
Yeah, I ended up just doing 3. Thought it was pretty easy to handle.
My game is largely indoor, so door handling is important.
This should be resolved https://github.com/EpicGames/UnrealEngine/commit/03109406a88d35b610b2395d7e5b5be1c83db8aa
I haven't used ST in like 2 versions.
I also use them sparingly, I realized most of the stuff I want is sequential behavior and it is much easier and nicer to do in BT. So I have ST brain which decides on some base states like Combat, Idle, Investigation... and each of these states is then implemented as BT. Some tasks in BTs can be still ST if needed.
I hope we can one day get something better than Recast generator. The control over it sometimes painful. You chnage properties because of one part of the level just to break some other part. Cells are axis aligned, so doors can be untraversable if cell is not fitting nicely there because of the rotation : (
I heard some designers even say that they would rather draw nav mesh manually :D
I'd like the option for both. Do the automatic generation and then be able to manually tweak it by painting. Kind of like skin weights.
Hey guys, have you ever had AI see behind it's self and trigger sight stimulus? Seems to only happen after a montage plays
@tough tulip wrong you need a n additional decorator that checks the condition on the blackboard prior
For some reason, if I press the 'quote key to bring up the AI debugger the engine crashes when using State Tree.
I am now getting a different error relating to FStateTreeInstanceData.
Within my Smart Object behaviour, I would like to rotate to the slot rotation. Seems like a straightforward and frequent thing to do. But I don't have any access to the specific slot I'm using, within the behaviour, so I cannot get the transform
Am I missing something?
the smart object definition has a set of slots and you can pull the slot offset and maybe some other values from it
yeah but I'd like to grab the exact one I'm about to use
the claim handle is known in the code that activates the Gameplay Behaviour, I've no idea why it doesn't get passed down.
Should I have one task per state? I am just trying to workout what's the best situation.
You may have to write your own bits for it in C++
You can have them in whatever configuration makes sense
I am writing bits as we speak 😛 the issue is that this is a pretty core thing and ideally I'd just add a Claim Handle parameter to the behavior's Trigger method. If I change one bit, I'll have to write custom code all the way up
anyway, posted to UDN.
Do let us know what they say, even if it’s “do it yourself”
Yeah curious to hear
My "Use Smart Object" AI Task just faces the actor towards the slot before calling the behavior
Ah, yeah I'm still using the vanilla AI task, although I made my own BT node so that I can separate the SO search and use
sounds cleaner to rotate where you are doing it
Yeah I have a bunch of custom stuff on top because as far as I can tell for example if all slots are in use the smart object will effectively disappear from existence
So instead of using the builtin slot system I have a custom system on top which handles it in a way that the smart object can still be found
What class do I used to defined State Tree tasks in C++.
I found this type FStateTreeTaskBase. Do I just derive from it or is there another type I should use?
Idk state trees but base sounds like a pretty good option
You need to use the ones with CommonBase
Nothing's gonna break but they just won't show up as being available in your state tree if you don't use that base class
I wonder what the other one is for
As far as I can tell, the system supports different "schemas" which define how the state tree is set up in some ways
And different schemas support different tasks
so the non-common one is I guess intended to be the base class for creating schema-specific subclasses, and the CommonBase is ones which should work across different schemas (or at least the builtin schemas I believe all allow using CommonBases)
Makes sense
I am overriding the method EnterState. What can the Context parameter be used for?
Pulling instance data and some things like that. Check the engine builtin state tree tasks, they should show you some examples
Okay.
Is it bad practice to call the K2 prefixed functions?
As the functions with that prefix in the navigation system are more convenient.
If it works it works. I would check the function code to see if there's any hidden surprises, but if there aren't, I'd say go for it
I checked the definition; this function looks okay.
So I've got a design question for y'all:
I want to do a sort of 'tear-away' player control system, where by default the player will automatically carry out a string of actions unless the player interrupts said string of actions by inputting a key. For example, I double click a vendor and my character starts walking to the vendor to then open up the shop/vendor window - however I interrupt this series of actions by pressing the 'turn left' key on my keyboard to get a look at an approaching enemy. How do you think I could most effectively implement this system of semi-ai-control?
The goal would be to make the semi-ai-control strong enough to have the character act as a bot after the player records a path - running along a path killing monsters, healing, and looting
Seems some kind of queue of actions that you can deifne in some fashion
eg. doubleclicking on the vendor queues up the tasks that you want to happen, but pressing buttons would abort the queued tasks
perhaps controlling those queued items with gameplay tags?
forever ago I imagined having an ai controller possess/unpossess the player every time an action is taken, but that seems expensive and unnecessary
this is a wonderful idea
Would setting this queue up with a behavior tree be smart or not so smart?
having an AI controller possess/unpossess could in theory be an option also, but it kinda depends on what you'd wanna do with it
f.ex. if you have a behavior tree that would run when the player isn't doing anything, then having an AI controller possess it could make sense
hmmm, ok yeah I see what you mean
cause yeah, there would be unattended 'botting' as a feature
you could implement the queue in whatever way you like... behavior tree isn't really for queuing tasks, but you could certainly have each task include a behavior tree which is used to actually execute the steps to the task
I wonder if anyone has documented making a gameplay-queue of this sort somewhere
Thanks for pointing me in a smart direction!
You could probably just make a custom UObject type which includes the configuration for your task and some functions that you could use to determine the state of the task, maybe some delegates to notify when the task is finished
Or you might be able to piggyback off existing Gameplay Tasks support
Then you'd just have some array of the tasks the player has queued up and you'd have some logic pick up tasks from the queue, or do the default logic when it's empty
OOOH RIGHT! I forgot about Gameplay Tasks! Good call
Damn, you've got quite the handle on this, hah. Thank you
Haha, yeah my NPC's in one of my projects have kind of a task queue system :P
The only surprise is that the Radius and Location parameters are flipped.
I guess the difficult part of implementing this queue system is getting from task/subtask to task/subtask without having a "was an interrupting key pressed?" boolean between every bit of code
which I think was part of Unreal's goal with the gameplay ability system?
GAS might allow you to do something like this I guess yeah but I'm not sure if it really does queuing
The way I would go about the queue+interrupt is having the task object include a function like Abort() which would clean up whatever it needs to clean up
This way you can just abort the active task and then proceed doing whatever the player wanted