#gameplay-ai
1 messages · Page 59 of 1
...except no, because all that does is... find smart objects in the actor which owns the component you pass in because this definitely makes sense
Also how am I supposed to call this function? Why is this BlueprintPure? Wtf lol
Well, so it's not all negative - smart objects does work quite well. It's just... pretty rough around the edges lol
UNavigationSystemV1 has a OnWorldInitDone and a OnNavigationGenerationFinished. Which one is better to subscribe to after calling ReleaseInitialBuildingLock?
Probably depends on what you need the event for. I think world init done probably runs a bit earlier but seems like it might not have all the data available
But probably best bet to look at the code and see where those are getting called from so you know it runs at the time you need it
on a slightly tangential topic, is there a way to save the navmesh with the level?
(dynamic navmesh, that is)
Did the behavior tree decorator "Close Enough" disappear in recent releases ?
Woops sorry it might have never existed, I have to create it I guess
hello
I got ai pawn (child of APawn). Set auto possessing with my AI controller. Also set Placed in world or spawned rule.
In my BehavirTree i got one custom task, where i call MoveToActorOrLocation task node, but it always fail, ONLY (!) if i spawned pawn in runtime. If i placed pawn in world, everything is fine. Why its happening? Destination loc is same in both cases
Did anyone manage to create an own composite note that works like a switch statement?
You mean for behavior trees? I would look at how the simpleparallel works since it allows you to connect things to multiple "pins"
Tbh the easiest way to go about this would probably be to just use a selector with the nodes under it having a decorator that checks the enum value
yeah i found out they are using a BehaviorTreeGraphNode
but it looks like i cannot make use of that since it gives me a linking error whenever i try to compile
What error?
even tho i had the BehaviorTreeEditor in my build.cs
the unresolved external symbols error
It's possible it requires some other module
yeah thats true
it has the BEHAVIORTREEEDITOR_API macro on it, so it should be exposed for extension
well i didnt find it
Yeah hence what the error was
It might point out the exact class it's trying to get instead of BehaviorTreeGraphNode
Likely to require at least SlateCore
Module.AIExtensionEditor.cpp.obj: Error : LNK2001: unresolved external symbol "public: virtual class UBehaviorTreeGraph * __cdecl UBehaviorTreeGraphNode::GetBehaviorTreeGraph(void)" (?GetBehaviorTreeGraph@UBehaviorTreeGraphNode@@UEAAPEAVUBehaviorTreeGraph@@XZ)
Still no difference
Hmm 🤔
maybe try adding GraphEditor
and the aforementioned SlateCore if you didn't have that yet
I have that but only in private
yeah no difference
Yeah it shouldn't make any difference for this where it is
Do you have BehaviorTree in the deps in addition to BehaviorTreeEditor?
Ah sorry actually it might be AIModule which contains the runtime BT stuff
so you might need that also if it's not there
PublicDependencyModuleNames.AddRange(
new string[]
{
"Core",
"BehaviorTreeEditor",
"AIModule",
"AIGraph",
"UnrealEd",
"GraphEditor",
}
);
PrivateDependencyModuleNames.AddRange(
new string[]
{
"CoreUObject",
"Engine",
"Slate",
"SlateCore",
}
);
thats my file atm
I wonder what was it that you needed for those... I'm fairly sure I saw some plugin somewhere extending a custom composite node...
Maybe you can extend UBTCompositeNode instead?
well yeah that works but i cannot add more output pins to it in that class
Ah right you need the graph node for it then I guess...
This seems like it should be possible to do...
Well it just happily built for me lol
ahh whaaat
class GAMEJAMREWINDEDITOR_API UTestBTGraphNode : public UBehaviorTreeGraphNode_Composite
{
GENERATED_BODY()
};
I just had this and it compiles just fine
#include "CoreMinimal.h"
#include "BehaviorTreeGraphNode_Composite.h"
#include "BehaviorTreeGraphNode_SwitchOnEnum.generated.h"
/**
*
*/
UCLASS()
class AIEXTENSIONEDITOR_API UBehaviorTreeGraphNode_SwitchOnEnum : public UBehaviorTreeGraphNode_Composite
{
GENERATED_BODY()
};
where is the difference
The only difference is you aren't using UBehaviorTreeGraphNode_Composite
I am
Oh I see you edited, are you using that then?
i have tried both
Hmm 🤔
You aren't trying to do this via livecoding are you
I wouldnt dare
ok good lol
which engine version do you have
PublicDependencyModuleNames.AddRange(new string[] { "Core", "Engine", "CoreUObject", "GameplayTags" });
PrivateDependencyModuleNames.AddRange(new string[] { "GameJamRewind", "UnrealEd", "ComponentVisualizers", "GameplayDebugger", "EditorFramework", "AIGraph", "BehaviorTreeEditor" });
this is what I have in the editor module deps
5.4.2
hm im on 5.3
let me test it with yours
nope still the same errors
I did notice there was some deprecation added in 5.4 in one of the BT graph classes so it's possible they changed something with it since 5.3... but seems like you would have been able to create custom BT graph nodes before 5.4, surely...
And your project is compiling if you change your node to extend UObject?
Just to rule out there isn't any other nonsense going on
yup that works fine
Well I'm out of ideas what it could be then 🤔
Maybe you'd better ask on #cpp, could be there's something weird going on
I wanna see if it works in 5.4
yeah I did but looks like nobody could help me
it compiles successfully in 5.4.2
at least some progress
now idk what the issue is in 5.3, since i cant switch to 5.4
That's weird, could it really be this was impossible before 5.4 lol
(without a custom engine build that is)
hm
that would be
weird
yeah
Yeah I suppose creating fully custom BT nodes might not be that typical of a workflow 🤔
in other engines i just write BTs from scratch, so i always end up building custom bt nodes 😄 hopefully this behavior wont bite me with unreal haha
I mean, you still can in UE if you want
Though I think UE's BT is pretty solid for the most part
i think you miss my point
i mean making a ton of custom tasks/nodes etc.. since most games will require some unique node types
i figure doing those in c++ is probably fine
my point anyway, was that making custom bt nodes is pretty common when building a behavior tree, HOW custom i guess can vary, like if you have some way to do loops, sequencers, selectors and various decorator types, most custom nodes will be leaf nodes that execute some behavior specific to your game
I think the main custom composite type node that gets added is something for utility ai selection
Other than that, leaf nodes do most of what most people need
Photosynthesis? 🙃
I’m trying to research ways to optimize my state trees but not enough users yet. Currently I have anywhere from 13-15 AI in a scene running one of 2 state trees. They all do the same thing except with slightly different data. Currently they are taking up to 5ms of my frame time. Which is crazy since the docs say “Users can create Highly Performant Logic”. I should also add that all of my tasks are written in c++
That's kinda odd tbh, what are the tasks doing?
I was playing around with it a while back and it took barely any frame time at all when implemented in C++ even with AI numbers similar to yours
I mean, I can have 50 AI with the main issue still being the CMC and not the BT/ST
I'm currently working on adding support for my AIs to actually interact with other AIs in similar situations as where the player can interact with them and ugh this is getting so complicated lol
Basically they come to a counter and then the player can interact and select some things from a menu and the NPC responds to this with some actions which then continue in this way until finished
But I also need to make it so that they can do this with another NPC acting on behalf of the player and the exchange needs to generally look similar to how it looks like when the player goes through it
I’m using mover so while AI movement is still barebones I incur no cmc cost.
The task on enter state fetches a spline that is stored on the owning pawn, then basically it requests a move to a point on that spline from mover. The over head must be that I am waiting for a delegate so the state tree has to run through a UObject but I didn’t think it would be that chunky
I could on tick compare the pawns location to the target location and keep the task running if it’s not within an acceptance radius to test the cost of a raw task node vs one that is routed through a UObject.
Because most of my frame time seems like it was just waiting to complete the task.
It doesn't seem like 15 create UObject + wait for delegates would be that costly even if they all hit on the same frame
and I'd imagine that particular action probably isn't triggering for all of them exactly at the same time
I agree, but I’ll test to make sure. The action is activated for each pawn contiguously when the signal is fired but they all complete the task at different times which shows in unreal insights since I see the same exact task take different chunks of time in the frame. This is because they each have different routes where some may be longer than others.
If your ST code is calling into blueprint implemented logic it could incur a penalty
But I'm not sure if it still would be quite that large 🤔
No bp at all. The UObject is there because a state tree task can’t bind to a move complete delegate but everything is running natively.
On average yes. The sum of all of these state trees processing takes up about 4-5ms of frame time. I’ll run some more test tonight when I go into work.
This is packaged, right? Not PIE, I hope ?
PIE. I can test a packaged build later this week after I iron some things out. Still even in pie 5ms is diabolical lol
PIE is filled with bloatware, at the very least test in standalone
I’ll trace a standalone build tonight before making any code changes. Thanks
Hey
is it possible to have a a element that execute only 1 time? like a kind of init
into a Behavior Tree
what's an element in this case, a task?
What's the point of the dynamic behaviour tree task if the tree has to share the same blackboard?
is it a question for me?
is it a question for me?
Yes it's a task
I guess? you could have it under a selector that checks for a specific condition which, once set to true never changes back, so at that point it'll always abort over it. But depending on what this "init" is, perhaps it would be best to have it outside the tree?
i have notice that everything here is looping. So instead of looping and checking if the condition is met and go to the next, it was to avoid to loop into that things. I was thinking it was possible for a task to be exclude after beeing selected. Maybe i don't understand correctly how that tree works.
But, as my understanding, it like a Giant LOOP 😄
Maybe you should watch the BT video pinned here if you haven’t
And the first things i would like to do is to sent the Tree to the Actor Ai to be able to manipulate it, but that's something that i only need to do once.
One specific video in mind?
5th pin or so
will start with the one from Unreal Engine itself. I have learn with some tutorial first, but let's start with the official this time
mmm, in fact it was the video where i learn the AI
That’s the one I’m talking about
i remember the example
no, I just meant in general lol
from the start im watching, i things the Selector with a boolean to make it fail each time should be the good one. But sounds brutal 😄
I might be mistaken but I don't believe the "entire" tree re-runs on tick, tasks that return "running" do and decorators with aborts do, but I don't believe it's a top down run from the root node per tick
either way - I wouldn't be worrying about optimization at that level if you're just starting out with ai
what i will do will probably need to be optimised, it was just to learn some little trick to work with that things. You may face strong use case when you work on something big. but for small things, you don't have and you start to implement bad things in fact.
So for example, the first things i did, was to sent the BTT to the Pawn... like that i can control the BTT inside the Pawn. Is it something that we need to do or not? hahah 😄
because i have some limitation inside that Task, so i try to go outside the task itself
i gave an example earlier
That was my task
i notice after test that my bind is done each time it's called.
but i would like the IA to handle that task only when the other actor send the signal
I was thinking, instead of checking all the time if i can do the task, let's the other tell me when i can do the task
but i'm bringing the check outside the task, into the pawn itself.
decorators are what you want to use for checking if you can perform a task right?
not 100% I follow what you want to do or are doing
is the decorator a node?
it's a core part of behaviour trees - I suggest you look up some youtube videos on behaviour trees, I reccomend the video series by Ali Elzoheiry, specifically the smart AI series
no Timeline available inside a task?
Not sure, using delays, timelines and time based checks inside a task would make me nervous, generally I'd be either using the wait task for something that explicitly needed an ai to wait or I'd be using function callbacks, notifies from animations, event based etc
you could have the timeline on your pawn, trigger it with a task, bind an event dispatcher which calls when the timeline completes and return running until it does
but that's basically a scuffed wait task
Timelines are actor components so they are only available in actors
But yeah having that sorta logic in the pawn is probably a decent idea with the event dispatchers. I have a lot of those kinds of BT tasks that wait for some event from the pawn
thanks
That is not a good plan at all
You disagree that decorators are important to behaviour trees?
Where did you even get that from what I said? Look at what I am replying to. It's not a good plan to send the tree to the actor and manipulate it. The blackboard is what should be used to data drive the BT.
It's also a bad idea to add an init task to the BT. Initialization should happen in the controller or the pawn.
The example task you shared is also not a good idea as it returns immediately without waiting for the event.
Anyone have experience with NavMesh resolution and NavModifier Volumes?
I have a multi floor building and while NavAreas work correctly and only change the area the volume touches, resolution seems to project on every floor.
Moving NavModifier Volume on z-axis has no effect.
TLDR: How to make nav mesh resolution on nav modifier volume only affect tiles/areas it touches and not affect every floor?
<@&213101288538374145>
Oh it was the thumbs down on my earlier comment I was referring to, I hadn't meant to reply to that message. I don't know what task you're referring to either?
Can anyone tell me why this was not triggered?
Is it specific to C++?
could anyone show how I can setup a one way path for AI so they can only exit an area but not reenter
You could do that at least via navlinks
If you wall the area such that only the navlinks are valid paths out of it, you can make the links traversable only in one direction
is there a way to have just walk across or do i have to launch them?
Have you turned on forget actors in the project settings?
Thank you very much, I was looking for this.
the one you didnt notice
Discord's really good at telling users about new features when you always learn about them only after you see someone use it... like since when do they have polls? :P
how the hell are we supposed to compare ai for starcraft against the sims 😅
Im having issues with the StateTree, when i'm using the StateTreeComponent as a schema everything works fine, but when i change it to the StateTree AI, none of my tasks get called kinda looks like the whole thing doesnt get inited
Are you using the state tree ai component instead of the regular state tree component?
and it's on an AI controller?
Never heard of the ai variant of the state tree comp until now tbh, guess it must've been added in 5.4 or something? But based on a quick look at the source code for it it doesn't seem to require anything particularly special beyond those two things I mentioned
yessir
Im doing everything as the source code says
It just doesnt wont to work :/
Are you getting an error or it just doesn't run any of the states?
No erros just no init
Check in the Output Log and also Visual Logger if there's anything
No erros and brake points EnterState doesn't fire too
What about in Visual Logger? Is it outputting anything at all relating to the state tree?
Nothing too
You would probably have to start breakpointing the engine code then to see if anything is happening
Usually the Visual Logger has at least something to indicate that the ST started even if it gets stuck (typically global tasks can cause this)
One thing that can cause it to get stuck is if you're trying to access data that isn't available
Alright, will keep it in mind ty :>
Could just use the normal state tree tbh cuz that one works
but will try to figure it out
could be engine bug or some
as in, if you use LinkExternalData to something that's not there, iirc this can cause it to silently not do anything
Yeah I'd breakpoint the st component and see what it's actually doing then 🤔
Tbh I can't really tell what is the use of the ai component anyway, seems to barely do nothing that the regular st comp isn't doing
it just provides the ai controller as well as the actor
I think thats it
I could ofc just get the controller from the pawn actor but i spend whole day trying to make ai component to work i might as well spend few more hours : P
Heh
You can also get those via LinkExternalData directly in tasks if you write them in C++
Iirc there was a fairly straightforward way to extend the external data with custom stuff also if you wanted to link to more things
Looks like the AI controller was inited before the pawn so state tree was getting nullptr as a desired actor thats why it didnt run
Ohh, I thought that would only occur if it's with LinkExternalData 🤔
I take it it works if you run it from onpossessed?
Yeah
Im suprised that epic overlooked it in QA
It's kinda of no brainer
Yeah there's a lot of random things like this in the ST where you just have to know
It will silenty just not do anything or otherwise just behaves in weird ways and you just gotta know what could be causing it
np, I spent a lot of time trying to figure out a lot of these random kinks in there also lol
Well you'll prob here from me soon then : P
TIL Task Wait Delay will happily sit in your BT task graph and won't give you any errors or warnings
Meanwhile it will do absolutely nothing whatsoever
You have to actually expand the node, and fill in the task owner as the owner controller of the BT task - then it will correctly do what you would expect it to do :P
if i start my level with an enemy already there, it works fine
but if i use other methods to spawn in the actor, even though it looks like the behavior tree is firing ok, they just stand there
despite the vector returning right
the patrol locations are being updated
but the move to patrol location node just returns false
is the blackboard key that holds the location updated with the vector?
yeah
i even manually set it to just 0 0 0 and its still failing
if i set the node to self actor it passes fine and goes to the next sequence node
but vector just COMPLETLEY breaks it
this STILL doesnt work
You want to send your pawn to 0,0,0?
no but i did it as a test
because nothing else was working either
Sorry, I may have missed part of the convo. But if you’re testing moveTO, 0,0,0 is not usually a good option
Depending on your level it could be above or below the navmesh
well forward vector didnt work, random point didnt work, i even made it follow MY location and nothing is working
its automatically generated, and each room has its own navmesh in the preset
Use visual logger to debug AI
where that at
Tools -> Debug
Pending kill means getting destroyed
Could be a diff issue tho, see if there are any red frames on the AIController category
also agree, move to world origin sounds like a bad plan, preferrably you move to a place you know has navmesh under it
i re hooked it up to my full bp
(still does the same thing even if i connect both ends of the branch to the simple vector forward)
also i noticed something
im not that bad i promise lmao
just forgot to connect
Vis log saying path is invalid. Try placing something in the level where the navmesh is/will be, copy its location vector and use that as goal for testing
theres multiple navmeshes
every room is its own seperate entity that the generator picks from
by entity i mean like they are thier own entire levels
ahhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
so i think
its trying to move to a spot thats in a completley different level
i was about to say i dont really like "random position in radius" because its way too simple.. you could pick anything, it could be right next to where you are, or across the map on some other elevation.. usually you want more rules about position picking than that
same with your fail case, it can generate points right next to or directly on where you are standing
or it could generate a position through a wall
sure, all of which i can and plan on changing, rn i just need to get it so its not failing every run
then i can adjust the algorithm from something simple and for debugging to something actually good
the fact it doesnt work currently says to me you should probably just implement something at least a tiny bit more sophisticated heh
also, its random REACHABLE point in radius, so it wont pick a point that it wouldnt be able to walk to
well the problem isnt the location itself
and yet its not reachable x_x
its the navmesh being completley wrong
the location its trying to get to is in a different level
you arent passing navdata .. i havent used this node, but wonder if that matters 😄
i dont think it does, the tutorial i was following didnt use it
because the actual moving is being done by the move to node in my tree
which runs on the nav mesh
looks like GetRandomReachablePointInRadius defaults to the main navdata if you leave the feild empty btw
so i guess is there connected navmesh
the connected nav mesh is in a different level
thats what this is
the red dot is the spot the ai is trying to get to
i mean sounds like maybe it has to do with level boundaries then
isolate the random position to the level you're in
idk how to do that
what i think is happening is because of the way its set up, they are picking a spot on the nav mesh, and then the nav mesh says no im not actually here, im in this other level
ive fakin quantum entangled my nav mesh 
is it me ,or there is really no indebt Ai resosurce for learning
There isn't
thats sad
It's a very complex topic so I think it's kinda hard to have a very indepth guide for it
Especially as the requirements of how it should work vary based on how the game and its mechanics work
Ugh, why does the blackboard decorator still not support gameplay tags lol
I had some legacy stuff in my BTs from back when gameplay tags weren't supported by BBs, so handled it with just a Name field and some custom decorators... but BB's have supported gameplay tags for a good while now, and the Blackboard decorator still thinks they are names...
There's literally no good builtin way to compare a gameplay tag in a BB field :P
Not that it's hard to make your own decorator for it but come on Epic
They're just like any other actor. If you want to pool them, you can.
I typically don't though.
Hello, a question, I made a service that determines what state my character has to be in, between Strafe, Attacking and Roll, I would like it to return to the attacking state after making 1 roll.
What is the correct way to do this?
I know I don't have to do a task for this because it's not good to use the BT as a state machine, so I don't know how to do it.
And so it begins 🥳 https://github.com/EpicGames/UnrealEngine/commit/cf36d09b40f42523015af7af503f407ab546f1f4. Hopefully people stop using this dang component now.
i'd say this is hard to make a one size fits all guide .. everything is very game and genre specific.. any sort of commonality between games is already provided by the behavior trees, blackboard, and controller/pawn setup UE provides out the box
so most of it is how to string together nodes to represent the logic you want to create
mostly you are gonna write your own leaf nodes for stuff specific to your game, and no one can really tell you what that will look like.. but like the same kind of rules apply to any part of game making "break the problem down into a series of less complex steps" then build up your tree from those steps
Check the AiPercepcion Age
Thanks but it gives the same result. (I made the value 30 and 0)
does it stop maybe because the position its trying to reach is no longer on navmesh?
what happens if you make the space way bigger ?
No it's not worth pooling controllers. If you pool the pawn, the controller is automatically pooled with it.
That's completely unnecessary
Yes, it's more common to define it on the pawn
I got the PR merged to officially deprecate the PawnSensing component Luthage!
5.7 I'm straight deleting it.
No more new tutorials using it gosh dang it!
That's going to break a lot of projects
you think those will just go away? hehe
it'll just change the questions from "why isn't pawn sensing working for me" to "where is pawn sensing?"
That's fine imo. They've had like 7 years to get off of it.
and 5.7 is at least another year out prly
5.5, it'll finally be "officially" deprecated though.
no huge loss imo
I take it you accidently read it as the AIPerception stuff and not the PawnSensing stuff 😅
projects that still use it likely haven't upgraded for other reasons
What else is there besides AIPerception?
Not at all
Oh, why do you think it'll break a lot of projects when I remove it in 5.7?
Because a lot of people still use it and most tutorials teach it.
I'm not saying don't do it, just be prepared for that
I'd rather point people to the only perception component than explain why their tutorial taught them incorrectly.
Now we can just be, "its outdated"
fwiw i didnt know there was a pawn sensing 😄
I am using a behavior tree 'Move To' task on a blackboard actor key to get an AI to chase a player. However, the AI slows down as it gets close to the player. How can I get the AI to run into the player without slowing?
What are you trying to do
I want the AI to try to trigger an overlap without slowing down
I feel like move to probably specifically avoids this case. Usually you dont want to bump into a target actor. And in truth you likely want to transition to a different action once you are close enough to your target
Like I see a world where you move to target then execute an ability that handles this
can i skip a test on a generator in an EQS query based on query params?
Not easily and not without C++. Possibly even needing to edit engine files.
That sounds like a hack though.
Do you have use acceleration for paths turned on and the deceleration speed set really low on the character movement component?
was basically going to just skip checking whether the location has a path to the target for enemies that aren't going to try and be in melee, and only check if they have a path to the location (melee mobs check both right now)
What do you think about StateTrees?
I think I'd want to go for a more state-to-state transition for animation and states
The only thing I'm worried about is that UE's StateTrees still seem to be not ready to use (not production ready)?
Is it still worth using right now?
why not use 2 different eqs for each type?
but aleast there should be somethng
STs literally exist to allow arbitrary jumps between nodes
I dont know if ST is production ready, last time I seriously focused on AI in unreal was early 2023
sure but building ai for a game is somewhat agnostic of engine imo
my view is probably skewed tho, i've been an AI engineer in games for 17 years 😛
a lot of it is about what the game needs which isnt so much tied to engine as it is working your way through the needs of the game
and the ability to break down problems into smaller components
so maybe what you should be looking for are high level game ai concepts and ways to apply those to your project, lots of GDC talks and stuff out there that talk about some studios processes is more useful i think.. tho i guess on some level you need to implement in engine but thus far ime lots of the docs out there and reading engine code in UE has been pretty good for my purposes... like i dont have tons of UE experience, but i have a lot of high level experience with game ai in general, and have implemented from scratch a lot of what i see in UE, but in other engines.. so its mostly about applying that in a way that UE likes... because like i was saying earlier, UE does do lots of the common stuff for you out of the box, so mostly its about extending that for your needs.. new behavior nodes, designing your blackboard and trees, how to process and track targets that get sensed, moving the pawn around, etc
and that stuff is mostly game specific and dictated by the needs of your project, so .. its not super easy to tell you what to do in some kind of generalized tutorial..
Thats why being able to break up your tasks into smaller easy to understand and implement chunks is useful, and thats just a skill useful across the board, its not limited to AI.
A better way to do it is to have separate EQS queries and use the blackboard to differentiate between different AI types.
I placed my character is behind the AI but inside its sight radius, My Ai generates random points to move so when I enter the play mode and if generated point is in the direction of the target it faces that direction and sees the player but sometimes it goes in another direction even when it sees the player and sometimes it looks like the head wants to see the player but the legs dont and they go away in another direction and I get stimulus sense like this from on target Perception updated event. Im having a hard time figure this out does anyone know about this?
and the result is always random and sometimes its alternate
Fixed this, i forgot to use SetFocalPoint function.
I want the AI to be able to open the door if need be, instead of ignoring it entirely. All it ogtta do is call "interact" on the door actor to open it.
i need to setup like nodes or smth in front and behind the door so the ai will pathfind to that if its faster, open the door, and go thru the door
Nav link
^^
hello devs , i am new to state trees , and i wanted to make a bull that will select a point around the player (when debugging the point i get good points) and then move to that point and plays a buff animation , will add a charging attack from that point to the player later but for now my bull is not moving or doing anything seems to be only finding points
the logic for finiding point is in the second image
and i am passing this point to the next state which is move to that point but i don't know why it's acting like this
also would be great if there a way to debug it at runtime like behaviour tree to see where the ai mind is at
the move to location is simple ai move to and i hook the location got from the find
Why did he compare distance by squaring them? I don't think distance can be negative so I'm not sure what's the benefits?
Dist sq avoids doing a square root operation which is “expensive” (relative to not doing it).
When does the square root operation happen? I don't immediately see a square root anywhere here
i fyou take just the length of a vector its the sqrt
When you calculate distance, you end up with distance squared and have to get the square root. If you use distance squared, it just skips that last step
quadratic equation and all that
rule of thumb is you should just always do square distance checks
there's no real reason not to
at least workingin code, i cant say if there's any added cost for bp nodes hah
Ah, gotcha
Thanks for the clarification
might not matter as one off operations mind you, but if you are iterating over something, or iterating over stuff in a tick.. its an expensive math op you can skip
and i find, distance checks can happen quite often for AI, so easier to just have the habit imo haha
is there anyway to turn the AI perception debug on begin play?
like what the console command for it?
You press ;
Then use the numpad keys as directed
No, it’s the shortcut
ik the shortcut
i wanted console command, i need to check something on the first frame but i cant
ah ic. Dunno if there is one but why not just use visual logger
Your eyes can’t record 1 frame anyways
Not sure what the gameplay debugger can show you in one frame anyways, it takes a second to register iirc
It doesnt call any perception events when AI goes out of sight
if you set the option luthage talked about you get the forgotten event
you could always manage your own target tracking
how? rn target tracks on the basis of stimulus
Im using unreal 5.0 and I m facing this weird bug in my AI sight Perception, it doesnt happen every time but sometimes when the Target detected by AI goes out of its lose sight radius, none of the AI Perception events gets called. Usually they do but only sometimes they dont give the call when target goes out of sight and cuz of that it still ke...
this the bug im facing
you know when a target is detected, and you know what actors are currently percieved
so you can do your own tracking to cull the currently percieved targets when picking one
im doing that, the issue sometimes i dont get the callback of the perception events player gets out of sight
u can check my post i think u misunderstood my issue
I keep hearing people who use the forget settings have issues like this, I'm starting to think there's something wrong with how that forget functionality works or something people misunderstand about how it works
I kinda get the feeling that if you have forget enabled it won't immediately forget the seen actors even if they go out of sight
and that's why you aren't getting those events
the age of stimulus is 0.1
but I've not used it more than looked at it superficially in passing so I'm not sure, all I know is that this is a very common issue with people who use the forget functionality
and forget is disabled
i havent had any issues with forget fwiw
i get forget when the sense timeout happens as expected
u mean the stimuls age?
yeah
i mean this doesnt apply to you due to version but i get the forget time out and the sense that forgot
then i use those events to update blackboard keys and shift into a different part of the tree
doesnt look like 5.0 has the event?
i searched the source codes
im on 5.4 and i can set a call back on forgotten
i do it all in code tho, my target management
.
Tbh, even TargetPerceptionUpdated is not that reliable, esp. when more than one target is present.
dunno if its bp or c++ only i use c++ for it tho
target forgotten is not cpp only
i checked the github onTargetForgotten was added in 5.3
Idk, I seem to recall using it in 5.1 but I could’ve hallucinated it
ultimately i wonder if im gonna end up writing my own perception stuff instead of using ai perception heh
maybe they added in 5.1 but 5.0 source codes dont have any forgotten function
EQS is what makes it really shine imo
nodnod eqs is pretty nice
if not from scratch ill probably end up writing target management on top of it instead heh
not very dynamic tho...
I've never had any issues with it whatsoever with multiple targets
I had to use perceived actors EQS generator because the former wouldn’t fire reliably
i honestly havent had firing problems with my ai senses events at all
i should try in a multi target env
i should set up teams for that x_x
yall lucky...never having any problems with ai senses
my ai is like a rebellious brat
IGenericTeamInterface? 🙂
also i did multi target and target switching on distance and other factors
worked well for me
hah i just am lazy and havent done the work 😄
Strange.. The only thing I can think of which could cause it to not fire when you think it should if your perception is getting timesliced
i tend to build my ai such that it doesnt really require instant reaction to anything.. i let events eventually change the blackboard state, and then the tree reacts to that
I mean I was even more green when I was working on that project so god only knows what I did to it 😅
i feel like that all can happen over many frames
True, but you prly have a lot more control via cpp
true, and also ive been doing this a hot minute x_x not a ton of UE experience but i have built all this kinda stuff from scratch before
i kinda miss my code only trees haha
Could always use STs, they’re oriented more like code 😁
yeah looking at the code i dont immediately see a place where the events wouldnt fire
hah i could, when i made a some mass demos earlier in the year i used state trees to drive behavior on individuals in a group
it worked pretty well? i didnt do anything super sophisticated tho, mostly they ran toward things or away from things, or used smart objects
and nav mesh x_x
I miss fiddling with AI, my current project has very limited use for it
yeah seems that forgotten delegate isnt there on 5.0
cant update? x_x
delegate's there in 5.2
the only thought i have otherwise is to regularly evaluate your percieved targets and send an event or call a function when an actor is forgotten by the timeout
i didnt tried this, but i saw some posts on forums they tried that but didnt worked
nope
The sight sense doesn't trigger an update when sight is lost. Which is why I recommend using the EQS and not rely on the perception updated events.
EQS ;-;)
will try that
What, it 100% does this 🤔
That's the entire reason "successfully sensed" exists on the stimulus struct
I've seen the code that skips it on purpose
Huh, I wonder if that triggers with the forget settings tweaked because it sure would explain why folks with that always have problems with it
It definitely sends an event every time sight is lost in my projects
It doesn't in any of my projects until I make an engine change.
And you're not changing any of the forget settings?
Nope
That's... extremely strange lol
so i have to change the source code?....
No. Just use the EQS.
its not possible currently....still thanks for the suggesstion i will use that next time
Hey any idea what is the max value these two can be ? I don't seem to get any valid grid when I increase these two(seems like 1024 is the max already). I am looking for a way to find navigable points using this method when the Player is in the air but 1024 is too low for that.
Project up / down means how far it will attempt to project the point from where it's generated in an attempt to place it on a valid navmesh point
If your querier is standing on the navmesh then 1024 should be more than enough
(unless your querier is enormously huge)
yeah senses without the forget option out of the box arent super useful when tracking stuff that drops off
so you have to do something to track that
Yeah I know that. my querier is in the air. and this number doesn't go higher than that apparently. but for the simple grid it worked tho 🙂 idk what's wrong with pathfinding grid
Huh, that's odd
Do you happen to know what's the difference and what we should be using?
as far as I can tell the AI comp just puts the controller into the context
there's no other difference
Hm, I see
Since my AI is pretty simply I probably don't even need a custom AI Controller so I would use just State Tree
I guess it could be slightly more convenient to use the AI one if you run the state tree in your AI controller... But if you run it in a non-ai controller, then it wouldn't work
It mostly depends on whether your AI controller has any properties you might want to access or perhaps functions you might want to call from the tree
You can access it via LinkExternalData even with the non-AI component but it's just a bit more of a hassle
I see. Testing it out, the State Tree can be put in your Pawn
But State Tree AI **must ** be putted in your AI Controller, doesn't work if you put it in Pawn
Yeah, since it assumes the owning actor is an AI controller
In that case, I definitely want State Tree Non-AI
Cause then you can have hundreds of ST_ files, but just need to use one AI Controller
Instead of having hundreds of ST_ files and AI Controllers for each type of Pawn
I'm not sure why you would need hundreds of AI controllers for it 🤔
To use one ST_ (State Tree AI), you need create and set it in a AI Controller
That means each ST, you need one matching AIC
If you have like 10 bosses with custom ST, that's going to be 10 AIC
I tried but couldn't find a way to set the ST inside a AIC during runtime
Ah, yeah I guess that could be a problem if it can't be set
Right? The new AI systems all seem to have these kinds of bizarre omissions :P
At least Smart Objects are slowly gaining the features that felt like should've been there since the start
smart objects worked for me with mass and state trees last i used it
it was pretty neat hah
The thing I struggled the most with with SO:s last I tried (which was a while back and I never did super thorough digging) was creating good transitions for actors when the BT aborted their SO usage.
So for instance an actor sitting down until something else happened in the BT (from an Observer Abort for instance), at which point I would have liked them to stand up before moving on in the tree.
Most demos I've seen always end up doing a simple montage that plays and then ends quickly, and never needs to consider states that "stick".
i feel like the BT shouldnt abort in those cases, and instead it should request an exit from the Smart object and wait for that to complete then abort
It probably comes down to a misunderstanding on my part of BT:s in general. We use it in a pretty basic capacity.
I envisioned something simple like this
Of course with a few more nodes sequenced
But I realize it might not in line with the design of BT
UE's variant is a bit weird from traditional trees, and it makes sense why they chose what they did, but its definitely a departure
yeah you have to really consider if something should be aborting stuff lower on the selector or not, and like i feel this can be counter to what you might want in the tree design
in a more traditional tree structure, boolean checks like these decorators tend not to be decorators, and instead are just regular leaf nodes that return success/fail based on the bool
and thats a bit more flexible
you could totally write a node that does this fwiw haha
true enough! I might do some trial and error at some point!
thanks for the advise!
I am trying to implement AI, it works fine when I drag and drop the character into the scene. But now that I spawn it using C++, it all works fine except for the Move to. I have checked everything but I can't tell what's wrong. Any help is appreciated
Likely your AIController is not set to possess on both placed in world and spawned
But seeing as there’s an AIController showing above that one, assuming it’s the right one, you’ll need to debug using visual logger to find out for sure what’s going on
Anyone have any resources on how the npc system was developed in games like half life 2? Im looking through the source engine source code but Im wondering if someone has already done some analysis on the code base and could share their findings.
what are you trying to learn out of curiosity?
Im building a source inspired game engine thats faithful to the technology of the era. Im going so far as to use the same compression algorithms and shaders and other various technical limitations of the time. This includes ai complexity and animation. Theres a lot of cool behavior from games like half life 2, such as if you stare at an npc they will look at you and then eventually look away out of awkwardness. Other games like FEAR already have their ai systems documented a lot online but I cant find anything for the half life games.
Half life was just a FSM
Im looking for more detailed technical analysis like this: https://www.gamedevs.org/uploads/three-states-plan-ai-of-fear.pdf
For example it talks about the various behaviors some enemies have and the strategies they implement. In the half life 2 code, I see stuff like
//-----------------------------------------------------------------------------
// Am I in safe place from my enemy?
//-----------------------------------------------------------------------------
bool CAI_FearBehavior::IsInASafePlace()
{
// No safe place in mind.
if( !m_SafePlaceMoveMonitor.IsMarkSet() )
return false;
// I have a safe place, but I'm not there.
if( m_SafePlaceMoveMonitor.TargetMoved(GetOuter()) )
return false;
return true;
}
Theres a lot of states and a lot of design decisions, I dont want to read all the code. Im just wondering if theres some compiled resource that lays all this stuff out already.
theres an entire system for deciding safe places, such as marking places as unsafe so that other npcs know not to go there
That is not hard to implement.
You can set up a BT task to do that very easily.
yep yep pretty straight forward
i more meant that to get the behavior right for this case, thats what they would have to do in order to abort the smart object properly
definitely there is a time and place for blackboard decorators and aborting sub branches of the tree with them
How you set it up is that the BT does abort, but it doesn't finish the abort until using the smart object has completed
nodnod i havent looked at all the decorators, and imsure writing your own is pretty useful too for stuff your game does specifically
This has nothing to do with decorators.
Like I said, it's about setting up the BT Task to wait for using the smart object to complete
Observer abort triggers -> smart object is notified to be cancelled -> BT task waits for completion -> smart object behavior triggers a get up animation -> BT task gets notified when animation is done -> BT task finishes abort
i wasnt being specific about this case.
sorry mind was just wandering on stuff i hadnt really looked at yet since i havent had a need
basically having an inner monologue out loud on "yeah there's a bunch of stuff ill eventually have to look at" hah
How do i adjust how close the Pathfinding points are to the edge of navmesh? I have tested just increase the AgentRadius and some other values, i don't se the waypoints getting affected. i am using the FindPathAsync function working with MassEntity. The blue dots are waypoints.
I have a naive solution to this problem, but i would like to be able to adjust the edge distance on a navmesh.
Are there docs that cover more on how behavior trees handle blackboard updates / interrupts? If I update any blackboard key, does it rerun all decorators between root & current node to see if an interrupt is needed? Or does it only rerun decorators if the blackboard key is in a Blackboard Based Condition decorator? (I'm guessing not since you can make your own decorators and Unreal wouldn't be able to keep track of which blackboard keys impact control flow vs which are just dumb data)? Or does it rerun all decorators period? E.g. if I am at the rightmost side of the graph, setting some blackboard dumb data key, will it rerun all of the decorators to the left to figure out if the state changed? Is there any special behavior where updates from within a task won't trigger a reevaluation of decorators? I want to make sure when I'm updating blackboard keys that don't affect control flow that I'm not triggering unnecessary work. E.g. if I have a blackboard key that I use just to hand of data from one node in a sequence to another, setting it shouldn't ever run decorators again since updating that blackboard key will never affect them
Iirc decorators effectively place watchers/event listeners on the blackboard in situations where they care about the value change
If you look at BTDecorator_BlackboardBase it uses BlackboardComp->RegisterObserver
How does that work then for a custom blueprint decorator that manually calls Get Blackboard Value as Enum in Perform Condition Check AI rather than Blackboard Based Condition? If it were C++ I could call RegisterObserver in my own decorator, but I don't think that's exposed to blueprints
Ah, I see, it looks like if you add a BlackboardKeySelector variable it will automatically be observed based on the variable name
but if you make a BlackboardKeySelector at runtime to read a random data blackboard key, it won't ever get observed
Thanks!
How to make the engine take altitude into account and put waypoints for NavMesh on elevations?
On the screen - the light line is the navigation path that goes through the elevation. It is necessary to create intermediate points on the surface of the elevation.
hi ihave the issue that the ai always runs the player event on server altough the target should be a client
have you checked what the actual nav mesh looks like?
it is a simplified representation of the terrain
chances are the navmesh is flat there as well
Whate are the differences between HFSM and BT ?
isnt a BT just a HFSM in visual scripting?
or in other words, isnt a HFSM a BT in code?
cant grasp the real difference
in which case it would be better one or the other
Read the 2nd pinned post
done, but is talking about FSM, not HFSM
Which is just a FSM
Wrapped around another FSM
Same problems apply, just at different scopes.
I made a "Tekken" kind of ai with BT
I am trying to understand in which other types of games, or features of same game, would be better a FSM/HFSM
and GOAP
Go through the talk that is the 7th pinned post
is it ok if I first finish these 3? I just started with the 1st one
Sure
ok thank you!
Thanks for this! I've somehow managed to miss the existence of ReceiveAbortAI. I guess we never needed it. This will be very useful!
The biggest problem I remember having though, is finding out from where to request an exit from the smart object.
If I should try to manually call EndBehavior on the definition, and if so -- how to get it from the claim -- or if there is some preferred way through the subsystem to request an exit.
(pic is just nonsense, attempts to find relevant nodes)
The communication between the BTTask and the Behavior I suppose is the part I don't understand.
The AI only exists on the server.
No you shouldn't call anything on the definition it's just a data asset. You should call it on the behavior, which you should hold a reference to when starting it.
I'm testing the BT based gameplay behaviors in some of my new AI stuff... it's actually kinda workable if your "base" logic doesn't use a BT since it's completely useless to trigger the smart object's BT from another BT since it can't return to where it was
It really seems to be missing some basic features like actually setting the smart object into the blackboard for the gameplayb behavior's BT... but you can do that up front yourself before you trigger the behavior, just feels like something that should've been done out of the box
But beyond that it seems to work alright
All good found a solution
Makes sense. Where is the best place to retrieve the behavior, though? And should the blackboard store the reference?
For instance, this node (which I assume is quite commonly used) doesn't really return the behavior (nor, as far as I can see, any good way to retrieve it).
I assume I could create a new task in C++ which emulates that functionality, which would allow me to retrieve the behavior proper and store it in the BB for later.
I could also, as I've actually done previously, create a new subclass of GameplayBehavior, which reports itself being used to the Avatar using it, via an interface. Then the avatar could be in charge of storing and cancelling the behavior. This method feels a bit convoluted to me.
Maybe I shouldn't be using that MoveToAndUseSmartObject... node to begin with?
Sorry, I feel a bit lost in all these systems! There are so many moving parts I don't really know where to begin, lest I risk ending up with a really convoluted solution.
I created a custom BT task to run subtrees without the vanilla limitation that they have to use the same blackboard as the source tree (kind of neuters subtrees since no matter how granular you make your BTs, you still need to use a monolithic blackboard). That said, there are a lot of different ways tasks can get interrupted/end, so although the task appears to be working, I'm worried I might have missed an edge case. Is this sufficient state management for the task? https://pastebin.com/eQGD3HUK
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
I mostly find that the SO BP APIs are very limited and only work for basic usecases... so if it doesn't do what you want is probably just the result of that, and you can do what you want in C++
Yeah, I'm sitting in C++ right now trying to figure it out!
I'd probably just copy the moveto+use SO AITask and change it so it does what you want :)
Still, there's a lot of moving parts here too. I'm looking at the FindAndUseGameplayBehaviorSmartObject node for reference.
It spawns a new internal AITask too (UAITask_UseGameplayBehaviorSmartObject), which does own the GameplayBehavior pointer.
So the main thing I'm trying to figure out now is how to chain the abort gracefully.
I suppose I'd want the AbortTask of the FindAndUseGameplayBehaviorSmartObject (subclass) to abort its internal UAITask_UseGameplayBehaviorSmartObject (subclass) task, which would in turn somehow request its GameplayBehavior to exit, wait for that to complete (I suppose I must subclass GameplayBehavior to add a delegate for that)... then sort of pop back up the chain of aborting!
I mean like Luthage suggested can't you just abort the gameplay behavior?
Also looking at the code for FindAndUseGameplayBehaviorSmartObject, it seems if you AbortTask() it that cancels the behavior also
Oh wait sorry I was looking at the BT version lol
FBTUseSOTaskMemory* MyMemory = reinterpret_cast<FBTUseSOTaskMemory*>(NodeMemory);
if (UAITask_UseGameplayBehaviorSmartObject* UseSOTask = MyMemory->TaskInstance.Get())
{
UseSOTask->ExternalCancel();
MyMemory->TaskInstance.Reset();
}
Wait yeah that's the BT version and thats' what it does, no?
It calls ExternalCancel which sadly doesn't exit the behavior gracefully, I think it just ends up calling OnDestroy or something
🤔
At least doing it that way doesn't end up calling BehaviorFinished (or whatever the event is called) on the behavior
So the "standing up" montage doesn't end up playing
That was the part that annoyed me a bit! Feels like it should logically do that?
Yeah
I've not yet had to do anything with SOs that would need to actively abort
But yeah calling AbortBehavior or EndBehavior is what I'd try first (neither of those are BP-exposed)
For now I've hackily merged the functionality of the StopGameplayBehavior and the FindAndUseGameplayBehaviorSmartObject nodes to at least stop my robots from sliding around in a sitting pose.
Oh wait it does have K2 versions of those but yeah
I should be able to figure out a better solution with some trial and error
Yeah it does!
But they're not really useful outside the definition since you can't really access the Behavior from outside itself (in Blueprint).
In C++ it certainly seems easier, now I just have to untangle some extra AITask sorcery to figure out how to gracefully abort the whole package.
You could have the custom aitask node expose the behavior it creates
For example via using a OneParam multicast delegate
Yeah, right now I've just created some extra difficulty for myself because I'm subclassing FindAndUseGameplayBehaviorSmartObject which also does a MoveTo.
If I started with the regular task which is self-contained (no owning tasks) it would be easier to figure out.
I might do that.
Altering the ExternalCancel() method in UAITask_UseGameplayBehaviorSmartObject to call Abort() instead of simply EndTask() seems like it would do the trick.
Thanks for the advise and ideas by the way! This sure is a good opportunity to learn some more about AI/BTTasks...
Yes, okay, it's on track to working as I want it now! Thanks for all the help. I think the AI system is a little freaky to get into with its bazillion module dependencies, mysterious node memory system, task ownership, and what-not -- but somehow it managed to resolve itself quite quickly once I started copying some code :)
Hi, does anyone here use the "Learning Agents" plugin?
I get the following error from a clean install of 5.4, and trying the Learning Agents Tutorial.
Hey guys! I'm trying to call TestPath() on another thread but sometimes it crashes the engine with getTileAndPolyByRefUnsafe() returning a nullptr dtPoly. Can anyone tell me if there's things I should check before called TestPath() on another thread?
Right now I am trying to mimic the structure of PerformAsyncQuerie() like using graph task with EGameThreads::BackgroundThreadPriority.
Hello, a question, in your AIs, how handle the block state?
What do you mean by the block state?
Yes, I just did something simple, it is a decorator that looks at the variable of my class called "blocking", and I modify that variable according to the number of hits that the Ai received and a random probability
Very simple, but functional hahah
Why are you using a RPC? Server RPCs don't work for NPCs as they are server owned actors and don't have an owning client. Also the AI only exists on the server.
So I don't need the server to know that I changed the boolean variable?
The server should be the only thing that changes variables. You can't send anything from the client to the server with a server owned actor.
I suppose if it's functional. We don't use states in the BT and use GAS for things like blocking.
Thanks!
what is GAS?
If i used that, i dont know what is that and why i use it hahaha
Hey, I asked on multiplayer but didn't get a reply so I'll ask here. How is ai handled in multiplayer settings? Is it entirely server based, or for example can the target location the ai is walking towards be adjusted on the client to account for latency, e.g. walking towards a clients character, but the client has moved on the client's session.
Or hypothetically if something only exists on a client machine, and you want an ai to react to it.
Gameplay ability system.
The AI systems are only on the server. NPCs are server owned actors so they don't have an owning client.
Sure, but I'm talking about a more advanced client side prediction
So this info wouldn't have to be sent to the server
Well if the AI systems are not on the client, then anything client side only has to be on the pawn.
OK, good to know
You would need to send something to the server via a player channel, because server owned actors can't use server RPCs.
Yeah. I wasn't sure if unreal did some client side ai adjustments, so that's why I was asking
Is there a solution for navmesh walking in multiplayer?
I just tested it in 5.4.2 fresh project and it's still broken (sloped ground, client)
Is there anything like Begin Play for BTTasks? Or how would I best do and store a cast?
I want to cast to my enemy base and get certain variables.
Just cast it on the normal task event. If you want to store it for some reason you can store it in a variable
Although generally there's not much of a reason to do so unless it's just for convenience (eg. so you don't need to keep dragging the pin everywhere)
Anyone know of a good way to do an EQS which gets points like this, but wouldn't return points so close to the edge?
As you can see the points on the left are basically exactly on the edge of the surface below them and I'd rather they would not be there
Hi everyone! Is there a way to have the AI move to nodes use a custom pathfinding? I built a grid system and a custom grid based A* pathfinding. Currently I am testing the pathfinding based on player position and destination location, and it works. But I would like to add this on the enemy/ai and allow the ai to move to locations using this pathfinding. basically some way to override the default pathfinding
(im using blueprints)
Wondering if anybody can help me debug this flickering issue.
Game is multiplayer and I am using AI move the player's units, the player assigns a target, which sets a state (enum) on the controlled unit, and the BT does a thing based on the unit's state & target. In my BTT, I set that enum to a value that invalidates the "Move" sequence after successful movement.
I am specifically having issues with AI movement. Sometimes my unit's position will flicker to what appears to be the target's location. This is only for about one frame or so and I cannot replicate 100% of the time.
I thought it was maybe my animations or some server sync issue, but I unplugged all of that logic the flicker still happens. I also swapped out my custom BTT with a vanilla "Move to" and the flicker still happens.
Attaching a video, it happens fast but you can see the unit's HP bar flicker a few times whenever the unit attempts to move.
Any ideas on how to pinpoint the root cause, or what I can try differently?
If you have the BTT debugging during this, does it look like it jumps around the different branches quickly? I just ran into something similar, it would get into a state where it would jump between rotate to bb entry and move to, rapidly, because the BB conditional wasn't properly updating. Have you tried tweaking the acceptance radius of the move to in the simplified example?
No odd skips in the debugging from what I can tell and the tree does not appear to be stuck. It will abort the branch, as expected. I've just tried disconnecting the sister branch and the logic jumps back to the BT root, but still flicker on the unit.
And yeah, I've expanded to acceptance radius to the point where no movement would be required, yet still flicker (sometimes). I also played around with adding a Wait between tasks, but no luck.
So for some reason, rotate to BB entry does not work properly (I have UseControllerRotationYaw unchecked, Use Controller Desired Rotation on, and Orient mesh off), when I execute the move to, the enemy moves in the direction and looks in the direction of its target. But then when it moves onto the next branch of the behavior tree, it is not looking directly at the target. So when it does it's attack, it misses, and then just sits there attacking air.
If I hover over the Rotate To Face BB entry node during execution, it does say that the FocalPoint location is invalid but googling finds nothing excepts for a post on vehicle nav mesh, as part of the source code there.
The thing I want it to focus on, is just a subclassed Actor, is there some specific component the actor needs in order for the rotation task to properly work?
Okay, so documentation sayd I need to have UseControllerRotationYaw on, so I changed that (bad forum post said to have it off), and that did fix it half-way. They now face, but now it looks like the MoveTo and the Rotate are fighting each other, and so the mesh just quickly glitches back and forth
Not if you are only using Blueprints
To close this out: My issue was unrelated to BT or AI, I had an upstream "Has Authority" node that was screwing up my network sync.
Does anyone know why my AI is rotating like this ? Seems like it is an Avoidance problem, but i'm already using Detour Crowd Controller
Hey all!
I have a custom UStateTreeComponent attached to my character.
I also have a custom UStateTreeComponentSchema. I have a State Tree asset in blueprints that derives from this custom schema.
If I attempt to use this custom UStateTreeComponentSchema in my UStateTreeComponent State Tree however, I am unable to. Only when I use only the original UStateTreeComponentSchema am I able to actually use it in the UStateTreetComponent.
Any idea why? Thanks!
Solved... solution:
For whatever reason, a State Tree Component will only accept the one kind of default schema within Blueprints. The work-around that I developed is to simply override the State Tree Component's InitializeComponent function like so:
{
StateTreeRef.SetStateTree(StateTreeToUse);
Super::InitializeComponent();
}
The variable StateTreeToUse is just UStateTree* StrateTreeToUse = nullptr declared right on the custom State Tree Component - works great, the logic works.
is there any way to get rid of this warning ? (nothing breaking but just annoying) https://forums.unrealengine.com/t/state-tree-bug/1848143
Hello, i found this bug when i added Parameter in state tree and then removed it, now gives me this warning every single time character with this state tree is spawned. LogStateTree: Warning: Parameters for ‘ST_TricksterTest’ stored in StateTreeReference were auto-fixed to be usable at runtime.
Hey, I have a really weird bug with perception.
I have an AI Controller with a perception system that has sight and damage.
When I call ReportDamageEvent, it works as expected, but also sends a sight event for the player character that was successful and immediately one that wasn't successful.
Here's my config and handle sight function: https://blueprintue.com/blueprint/kidze9-r/
Any ideas?
Thanks!
Where are you calling the handle sight function from? What does the AI do when damaged?
The handle sight is called like this, and the AI turns to face the direction of the damage.
I have the pawn set up to not use controller rotation yaw, so it turns slowly.
My guess would be that the turning causes the sight to be lost, or potentially if you use a projectile the projectile is blocking sight, or some similar situation
But the problem is that it's gaining sight immediately, and there is a projectile but it's destroyed. So I would at least expect it to see me, lose me, and then see me again. And that too, not immediately
Maybe you have some collision on the shield or something like that.
0 collision
Try to make visible all the collision spheres boxes or even mesh that you have on the unit and check if they are not creating some friction with each other.
but I actually realized it's similiar in my game now that I tested it, so I also would like to hear how to fix that, my guess would be to create some kind of extra local avoidance for each unit with linetraces and checking if it hits something, but that's way over my level yet
Figured it out! The controller snapped to the correct location but the pawn rotates slowly, but since the AI perception is on the controller it caused some weird behavior.
The solution was to edit the AI controller's C++-only GetActorEyesViewPoint method to use the controlled pawn's location and rotation.
If I want to copy the value of a blackboard key from one blackboard to another, it's fairly straightforward if I know the type:
if (keySelector.SelectedKeyType == UBlackboardKeyType_Object::StaticClass())
{
UObject* o = SourceBlackboardComponent->GetValue<UBlackboardKeyType_Object>(sourceKeySelector.GetSelectedKeyID());
DestinationBlackboardComponent->SetValue<UBlackboardKeyType_Object>(destKeySelector.GetSelectedKeyID(), o);
}
but if I want to generally copy any arbitrary type (after I've verified that source type == destination type), it seems much harder. The only way to do that seems to be CopyValues on UBlackboardKeyType, but it's protected, so I have to go through a really roundabout way to use it:
static uint8* GetKeyRawData(UBlackboardComponent& blackboard, const FBlackboardKeySelector& keySelector)
{
const FBlackboardEntry* key = blackboard.GetBlackboardAsset()->GetKey(keySelector.GetSelectedKeyID());
const uint16 DataOffset = key->KeyType->HasInstance() ? sizeof(FBlackboardInstancedKeyMemory) : 0;
return blackboard.GetKeyRawData(keySelector.GetSelectedKeyID()) + DataOffset;
}
class UWorkAroundBadUnrealApi : public UBlackboardKeyType
{
public:
void CopyData(UBlackboardComponent& OwnerComp, uint8* MemoryBlock, const UBlackboardKeyType* SourceKeyOb, const uint8* SourceBlock)
{
CopyValues(OwnerComp, MemoryBlock, SourceKeyOb, SourceBlock);
}
};
uint8* RawData = GetKeyRawData(*DestinationBlackboardComponent, destKeySelector);
uint8* SourceData = GetKeyRawData(*SourceBlackboardComponent->GetBlackboardComponent(), sourceKeySelector);
const FBlackboardEntry* key = DestinationBlackboardComponent->GetBlackboardAsset()->GetKey(destKeySelector.GetSelectedKeyID());
const FBlackboardEntry* sourceKey = SourceBlackboardComponent->GetBlackboardAsset()->GetKey(sourceKeySelector.GetSelectedKeyID());
reinterpret_cast<UWorkAroundBadUnrealApi*>(key->KeyType.Get())->CopyData(*DestinationBlackboardComponent, RawData, sourceKey->KeyType, SourceData);
Is that really the best way to generically copy data from one key to another?
Hello, I had a custom solution to make my AI to get out of stuck situations, but since I've switched from Walking to NavWalking it stopped working.
When I was using regular walking in CMC, the characters were sliding along a collision of an obstacle to achieve their target, but with NavWalking they simply stop moving if they have anything in front of them like. On the screenshot you can see the potential movement of the top enemy, but it can't start moving as it's slightly touching the other character, note the yellow area. As I said, if using walking, it would've simply slide a little bit upwards.
Is it possible to have something similar when using NavWalking?
The cyan spheres are the AiMoveTo targets
That solution doesn't make any sense. It's already using the pawn's location and rotation by default.
Yeah, motion warping is designed to let you do this sort of thing
usually you motion warp in the attack so that it doesn't penetrate to begin with
It doesn't, I saw it when debugging the C++. The perception system uses the location and rotation of the actor it's connected to, which is the controller. And since, on the pawn, I have "use controller desired rotation" and not "use controller yaw" for the pawn to turn slowly, the location and rotation are different between the controller and the pawn.
I've looked at the code. It's taking the pawn's view point. Not the controller.
Got lawyered, lol. I must have missed something while debugging because I swear that that's not what I saw.
Regardless, that doesn't explain the behavior I saw in-engine: The sight debug moved independently of the pawn. And the only thing that solved it is overriding that function.
It looks like your viewpoint == nullptr 🙃
In Luthage we trust 🙏
So any ideas on how to get the sight rotating with the pawn like it should? Or why wouldn't it do it in the first place? I must have messed something else up
What I usually do is add a socket to the mesh and call it LineOfSight. Then override the pawn functions for getting the view point and rotation and use the socket location and rotation. That way when/if you add look at rotations, it moves with the head
yeah that kinda thing is nice once you have some animations in there and you can really see the telegraphing of the actor's head turns and stuff
sorry isnt the ai perception component meant to me on the ai controller itself
?
please any documents on the best practices to follow when implementing artificial intelligence
...
probably best to be more specific? best practices for what exactly
Read the relevant chapters in the UE docs, check the pinned messages, not much else for it. There's info on google for various topics but you have to search for yourself
I have a few odds and ends related to AI perception written down here but it doesn't really cover every imaginable facet of AI https://zomgmoz.tv/unreal/AI-Perception/
(there's also a few bits on behavior trees and state trees in there)
Gotta love these dumb fire questions
is there somewhere a BT and ST pros & cons ?
i find it very hard to find what would fit the best and whats the most "optimized" and "modular"
They are different paradigms for different purposes
Check out the 2nd pinned post where Luthage covers BT vs a State Machine. It is short and sweet.
ST is pretty much a State Machine
tanks bookmarked it
i see in some instances black board keys are implemnted as int 32 on the controller class on cpp
logical?
Huh? Where did you see that?
Thanks
Yeah I mean where's that?
I mean you said "in the controller class in cpp" so I'm not sure what you're referring to
Looks like you can look up stuff from the BB based on the key ID but yeah still never seen it used in this way
uhmm its like storing the refrence to the bp black board key in cpp to be able to set them from codes i guess
Yeah it's probably intended to avoid having to hardcode the key names in more than one place
right!!!!!
...not that it still makes that much sense because you could just declare them as FName properties on the class
but I guess if it works ¯_(ツ)_/¯
lol nice use of apostrophee
I just have mine in a namespace with inline FName's
namespace BBKeyNames
{
inline FName TargetActor = FName("TargetActor");
}
So something like this
To reference it, it is BBKeyNames::TargetActor
nice coding practice
i still doubt it is the use case
let me show you an example of what iy is used for\
Already not a fan
the person still made a raw string
And it looks like they're potentially doing a state machine inside of the BT
hahahaha
this looks concise ...no use of magic numbers i love the approach
did you create a seperate header for this?
Yes
named BBkeynames
You get that emoji with /shrug on discord lol
What? No. I'm not a savage. BlackboardKeyNames.h
hahahahha
this guy is funny how is your dog
Fine
my regards
I wrote a test that scores locations based on how close they are to the locations other enemies have already chosen to move to, but i'm not really sure why it isn't working.
for (FEnvQueryInstance::ItemIterator It(this, QueryInstance); It; ++It)
{
const FVector Location = GetItemLocation(QueryInstance, It.GetIndex());
const float Score = GameState->GetScorePenaltyForLocation(OwnerActor, Location);
It.SetScore(TestPurpose, FilterType, Score, MinThresholdValue, MaxThresholdValue);
}
is this gist of it (that's in RunTest), it's returning values between 0 and 3 right now, and I have it set to Inverse Linear, but it doesn't appear to really be doing anything to keep enemies from pathing to the same spots.
Any ideas?
I have not written an EQS test before so i have no idea if that score value needs to be normalized somehow, or how to make the weight of this test higher than other tests
can it be that UNavigationSystemV1::GetPathLength is broken in 5.3? for example, it returns me 1.35m when actually there's 7m of straight distance between 2 actors 🤔
guys bp ai or c++ ai?
Replying to my own message in case anyone searches for stuff like this in the future, i just bumped up the scoring factor to 50 and it works, so the problem was just that the distance tests were outweighing this, the actual scoring logic was fine.
What is the score penalty doing and why is it on the game state?
i basically keep track of where all enemies in combat are moving to at any given time, and if you pass in a location it will basically pass back a number representing how many other enemies' goal locations are close to that location weighted by distance
Uh whatever for?
so that enemies dont stand inside of each other when they're attacking the same target
unless theres nowhere else to stand
Is it used for anything other than the EQS?
not at the moment, but at work we have a similar thing that we use for making enemies flank so i figured having it somewhere i could easily access (not necessarily this score, but just the values for where enemies are pathing to) might be handy in the future
That would never pass a code review at any studio I've worked at
why
The game state isn't a dumping ground of "random things I don't know where to put it." And "might be handy in the future" isn't a good excuse for it.
where would you put it
The answer is always subsystems
Make a world subsystem that is only on the server and put stuff there.
making an entire subsystem for 1 tmap's worth of data and a helper function or two to access it seems like overkill no?
Any rejection of subsystems is heresy!
(I wasn't following the convo entirely. I just know the answer is always subsystems)
You don't need to make a subsystem just for that. It's tracking AI locations, so it's typical to have an AI agent manager (subsystem) to track the AI and manage AI LOD.
I call mine AIDirector so it makes me feel as smort as L4D, but in reality, it just holds AI stuff
Though, I disagree that you should be tracking their move to location just for this EQS test. KISS
Keeping things simple (KISS) will help you to not over engineer your code.
Haha same
I've been promised twice now that I'd get to make an AI director and both times dropped.
Except for you, it's probably higher up telling you and then dropping it. For me, I am the higher up 😅
One of them had the designer tell me that the enemies should just "know where to go"
No. The entire map populated with enemies and they just know how to disperse
So many follow up questions
So did I. No answers were given though. That project was a shit show
The other one they gave to a different engineer, because design didn't think AI was important in that system. I ended up building the spawning systems though. Then they dropped it for base spawns, which completely went against the game pitch.
Designers are the worst
They never really tried it
Maybe too many excel sheets?
Didn't make excel sheets either
We still only had one enemy type after 2 years, because design couldn't get their shit together and design any.
i am still very early in working on AI so it would probably make sense to go ahead and just make an AI subsystem for this kind of stuff
I have like 9 designs, but only about 3 or 4 implemented.
So they couldn't test the spawning systems. Which not only could spawn enemies, but props too.
You're not a AAA studio burning lots of money every day
Soooooo you're saying I can be a designer for AAA
If they let you into the toxic boys club of bros who don't actually do their job
I'm not at all salty today
Didn't pick up on that at all. Nope.
Although I can see AI Director being higher than AI Architect, the latter just sounds better to me. Lead AI Architect with a Director pay and responsibilities would be even cooler
how do you add your detour agent to detour avoidance system??
I don't necessarily want to break stuffs without knowing things properly
ime half the nature of being an ai programmer in games is realizing no one has your back so you end up doing what you estimate is right for the game
currently feeling the pain
Much easier when you have actual models and animations for more than 1 enemy type.
definitely
i usually make terrilby colored alternates and then be like "well you guys can figure out that part" haha
i have also been itching for a kind of AI director to help flesh out encounters
anyone?
I have a basic patrol AI generating random points and moving to that location using behaviour tree, im trying to add a wheel turn animation to the AI so i need to know when AI is turning in which direction. AI pawn is not from chaos vehicle its derived from Character class
This kinda depends on how you're handling the rotation. But typically you could either look at the rotation speed or the difference between current facing vs. movement target facing
the rotation is coming from the AI controller itself
and Attach controller to pawn is true
also orient rotation to movement
It doesn't matter where it is and what's what. Find where the values are you need and read them
what if I do something like Mass based avoidance?
regardless i will try something in the meanwhile. Thanks a lot!
I've not used Mass so can't really say how that would work
iirc the mass avoidance stuff is more or less adding a repelling vector to the entity movement that pushes them away from neighbors
@misty wharf one last question how exactly you get the avoidance velocity anyway? I'm seeing only registration part
whats exact difference between RVO that CMC uses and Crowd Manager?
RVO uses velocity to try to avoid other characters while Detour changes their path.
hmm. Alright rn im seeing Avoidance and Crowd are two different things. In my case I think ill need rvo. Its 2k npcs in question
Crowd avoidance uses the interface and the functions, so you can use the pawn movement velocity for example. Not sure what RVO does
is this something that could be solved by ensuring the npcs dont go to the "roughly" same position? aka being smarter about destination picking
less similar destinations would mean fewer similar pathing results and a lower chance of bunching
there would still be need for some amount of avoidance, but it would be less obvious (and probably look better) if they didnt bunch and all go to similar places
i guess partly im wondering what the greater context is
Sorry to bring up old stuff, but today after fixing some bugs I found out the same perpetual stream of suspending/resuming branch actions. However NPCs seem to be working fine. So is this something to worry about? And what does this suspending/resuming branch actions mean?
it might be just the tree waiting for the tasks to complete though I'm not sure. Seems to be part of normal tree operations though.
Hmm, ok, thanks. It’s just weird to me that this wasn’t happening just yesterday and now it appeared. It also just makes vislog even harder to read 🙈
For something with a number of enemies on the smaller side and no complexity outside of how they engage the player when the player arrives, like a survival horror or a Soulslike, what approach to AI do people think makes the most sense?
Behavior trees, state trees, just script 'em in BP (is that one ever correct, or is it just 'good enough' sometimes), etc? Or would it just be whatever is easiest for me to wrap my head around, they can all do it fine?
I saw someone saying here once that BTs would suck for something like a Soulslike boss, but I didn't/don't really get them enough to know why someone would have that opinion or if it's accurate.
come on, why is UBehaviorTreeComponent::OnTaskFinished not virtual. Am I going to have to fork UE source just to check when a behavior tree finishes a latent abort?
new code review policy pls
if (!private) { check(isVirtual()); }
“We understand why you are requesting this PR but we will not be implementing it anyways”
It actually supports latent aborts?
I was always wondering about this but felt like it didn't despite the API looking like it did lol
Yeah, it has to for parallel tasks
and you can also get it to happen with your own C++ tasks
just return EBTNodeResult::InProgress; in AbortTask
The BP API for Receive Abort where you have to call Finish Abort at the end seems like that would allow latent aborts also
well, I guess tick will have to suffice for now since I don't want to go through the trouble of forking yet. And for some reason bNotifyTick keeps getting reset unless set in the ctor, even if it's an instanced node, so I guess I will have to run tick always * numbe of AIs and not just once an abort is triggered
By the way as it sounds like you've been digging in the BT APIs, have you noticed if there's some way to serialize/unserialize the BT state itself?
For purposes such as saving the game
Wouldn't you store your state in a blackboard and serialize its values?
Well I mean the actual node execution state. If your BT is in a particular node state and you save your game, it seems it ideally would be possible to put it back into that state
You can access node memory, but you might run into blockers traversing all of them / setting them in the middle of tree execution
not worth the trouble IMO
Are you going to save animation state / exact physics state of all objects too?
Yeah, I was looking into it a while back and it seemed like the answer was "no", but someone was here at some point and said that you can just run it through serialize and it would do that but I never had the time to confirm it myself so not sure if it does that or not
And yeah, it does seem like it could be problematic in more ways than just that
ugh savegames
lol
It kinda seems the entire BT architecture of your game needs to be designed in such a way that if you need the AI to be able to load back into whatever it was doing, the BT can do it based on the AI/BB data or something which feels like a bit of a hassle
Honestly, I see BTs as a toy feature in vanilla Unreal. Unless you have very minimal AI in your game, they just don't scale. A global, monolithic behavior tree is unshippable in real games. There are plenty of games like The Division that have these monster BTs, but those are the same teams that dig themselves into a hole where oh no we can't ship our game it's gonna take 5 more years because of tech debt tech debt we gotta refactor everything & the game gets cancelled if they're a smaller company or it eats up the lion's share of the engineering budget in AAA games. This should have been one of the foremost problems any dev tools PM / designer was thinking of when planning BTs for UE. But what do we get? Some hacked up Run Behavior node that copypastes nodes from one tree into another without distinct state. You may be able to split out subtrees, but how useful is that when all of the state you need for monster BTs like The Division's is forced into the same blackboard? And within a day of trying to make anything useful in BTs it's clear that Blueprint's async support needs a lot of work too. The frustrating part is it's actually not that hard to add proper subtrees with their own state (that's what I've been poking around in BT source code for). AI Controllers and tasks are already compatible with multiple blackboards & multiple behavior trees on the same AI controller, so you don't need any major engine/AI module changes. The footprint of proper subtrees actually looks like it's less than that stack-based copypaste tree implementation they've jammed into BTs currently, so all of this headache for nothing
AI Controllers and tasks are already compatible
Are they really? There are a lot of assumptions in the codebase about BrainComponent, or at least it looked like that last time I was poking around there
I'm using BTs for NPC AI in my projects, one is a shooter and one is a video rental store simulator - seems to work alright without any particular issues tbh
the rental store sim has more complex state in the BT which may be part of the reason why saving is a hassle on that one... the shooter just lets the enemy AI reset because it doesn't matter :P
Yep, you create one Blackboard and one BehaviorTreeComponent (brain component) for each subtree, disable some on init stuff they do to auto-discover each other and instead manually link the blackboard / BT component, and then they always use their internal link to find each other rather than asking the AI controller
Ah, interesting
I was considering running a ST and a BT together and it seemed like the existing architecture in there was kinda getting in the way, but maybe not if that's how it works
Hey, anyone's know where I could learn or what programs I should use for make a physics animation with AI like this? https://youtu.be/1kV-rZZw50Q I saw this video, but the ASE seems deprecated using Isaac Gym.
Or maybe with procedural animations I could archieve something like this?
Thanks ^^
❤️ Check out Weights & Biases and sign up for a free demo here: https://wandb.com/papers
❤️ Their mentioned post is available here (thank you Soumik!): http://wandb.me/ASE
📝 The paper "ASE: Large-Scale Reusable Adversarial Skill Embeddings for Physically Simulated Characters" is available here:
https://nv-tlabs.github.io/ASE/
📝 Our material s...
Hello, is it possible to create a series of navmeshes that can be swapped on runtime? I have a few layouts for my map, and I would like to not dynamically compute the navmesh when the world state changes, but to use one that I bake prior to playtime
TBH in truth, behavior trees dont need to be very big or complex. You dont need to simulate reality with them... if your tree has gone super deep or super wide, something is wrong in the design of the AI from a gameplay mechanics perspective.
I have messed with the division AI a bit (explored its code base and tree structures) And while this screen shot looks ridiculous, working in it actually wasnt as ridiculous as it seems, yes its entirely too complicated imo for what it delivered, but you also dont know the context as to why it got that way 😛 .. Anyway the thing they dont tell you in this pic is this is an old screen shot used to be ridiculous. Lots of these nodes are things like math or function calls or similar, and a lot of these nodes are wrapped into sub trees and function macros.. This image is a FULLY expanded view of every atomic piece of the tree. In reality its broken up into a few different nested subtrees, each pretty understandable about its purpose, and each reused..
Fwiw the division (both of them) are 10 year projects iirc 😛 but the fruits of that labor is the tech which is used on a good chunk of games now, both divisions, a south park game, the star fox ubisoft game, avatar, the new upcoming starwars, etc etc.. but ubisoft runs pretty long project cycles for some of its properties.
Anyway its not perfect because what tool is, but also its not terrible either.
IMO there's no real reason to save individual node state
design your trees to recover from just blackboard data
Yeah that's probably ideally what you would do, it just gets pretty clunky if you have complicated logic there
But it may be that my BTs are currently a little bit too state machine -style. As an example, a customer has a sequence of actions where it 1) finds a queue 2) queues 3) waits for a certain event 4) speaks/animates 5) performs some actions 6) waits for another event 7) Performs some other actions...
In this, 1 and 2 are something it could check from its state (eg. am I already in a queue) and skip, but it doesn't really keep state on whether it already did 4 and 5 because they're part of that particular sequence, etc.
A lot of this would have to be moved into some kind of internal state enum or tag so that it could return to the appropriate step and at that point it feels kinda like duplicating logic/rules
Tbh things are weird about unreal's bts. Im not totally sold on it ahha but yeah in the case of sequencing and waiting on events that does complicate it
Behavior trees are kind of interesting in that you can do a lot of things in them, but its hard to decide where to draw the line
Because a lot of things about them can also be done in other ways
Yeah I was about to write something similar. Ultimately it's a game design decision but I've had some pretty involved AI in games easily encapsulated in several BTs you can swap out at runtime and managed by a state machine. Any data you need to restore a state can be saved in a game object and accessed when booting up the state machine. That said, if that doesn't seem viable in your case, there are other good options provided by the engine.
is there some kind of special setting that allows ais to walk on slopes
i have a problem where mine jsut stops when its near sairs and stops chasing me
how can i check ai path blocked objects in cpp
Hey guys
Am having. A minor issue
I want my ai to aim and walk but it doesn’t transition
And the variables change as soopose
It either runs
Or aims
Sometimes I want it to do both
When close to enemy any idea
you need to provide more context than that
what do your trees look like? how does aim work in your game, etc etc
Ok I’ll do so
There is a max slope setting. You should also make sure that the navmesh actually connects (press P to visualize) to the stairs / upper floor and that you didn't accidentally hardcode the Z value in the target location to ground level
AIController->GetPathFollowingComponent()->IsBlocked() (or bind to PathFollowingComponent OnRequestFinished which passes FPathFollowingResult result & check result.code == EPathFollowingResult::Blocked)
If you mean find the specific objects blocking the path, then I don't think it keeps track of that. Looking at the source it just keeps track of the AI's past positions and flags as blocked if it hasn't moved sufficient distance
i need check its blocked By AObject
I'm not sure what you mean. There's no such thing as an AObject. Do you mean AActor? Then there's no way since that's not how Unreal keeps track of whether a path is blocked or not (it checks distance travelled as mentioned earlier, not anything related to other objects)
Perhaps you mean UObject .^
what is the end result you are after?
i can do by line trace
is this image the tree of your AI ?
so unless Drew works at massive, unlikely, this is a slide from one of Ubisoft's GDC talks a while ago
I've actually played with that tree a bit when i worked on the division 2 tho, but most of my tasking was else where on that project
ok I haven't seen the GDC, I'm going to see it
not explained here, is that they actually wrapped every enemy ai archetype into one tree (they had a separate one for the civilian NPCs).. so there's a lot going on here but most AI only use a fraction of the tree at a time
It looks pretty cursed still lol
I hope there was tooling to search the tree... UE's has some for that but not as much as I'd like
agree, its far too big imo for what it delivered
yeah it was pretty searchable and stuff collapsed into subtrees and stuff
easy to get around, but yeah they did this huge amount of complexity, and the ai doesnt really feel that sophisticated in game, at least not any more than other loot shooters imo
they could have definitely done less and gotten just as far
hey guys, there is an AoE visualization for players in Albion Online, I want to do the same thing for AI to make it avoid this area. So I created a NavModifierVolume with a custom shape(cuz AoE can be with any shape possible) by using Pen in Brush Editing Mode, and got the result that I needed: AI avoids this area and still can walk on it. But I don`t know how to spawn the NavModifierVolume that I created(and is it even possible), maybe you know how to solve this problem or can give me a better way to create this area
Hi, for EQS has anyone find out best way for AI to avoid taking points that already been taken by other AIs?
I can see how it can be done in couple ways, but maybe there's a good way that anyone from experience can suggest?
Make a scoring (or filtering if you really just don't want to let them overlap at all) test that checks against the points taken by other AI and scores locations badly if they are too close to any of those locations. You need a way to get all other AI locations, so you either need to store them in a central place or iterate over other AI.
Shouldn't need to spawn a whole actor just for that, you just need to store a vector somewhere and check distance against it.
Random but did you use to hang out on IRC with that nickname?
nope sorry
Haha no worries
Yeah though of some kind of manager that keeps all the locations and manage by passing each AI it's target location. Sounds messy though, but closest to useable.
you could do it the opposite way where the AI just tell the manager what their target locations are
i just use a TMap<AActor*, FVector>
in past games i've had a "claiming" system.. basically ai claims a spot or tile or area or whatever, and then when other ai are picking a destination those locations are denied.. once an AI finds a good destination, they claim it.. once they change destinations they release it
yeah essentially that. depending on how strict you want to be you either filter out claimed locations entirely, or just score them poorly compared to unclaimed locations
yeah tbh ai dont have to be the only ones that claim spots either
Sounds good, thanks
So…kinda like smart objects but for a space ?
probably, except smart objects boviously dictate a behavior right, play some animation, face some direction, etc
this just says "this space is unavailable" or "undesireable"
i use the pattern in a few places haha i use it to help pick positions around a target .. positions would be some off set from the target, and groups of ai could claim a spot around their enemey to prevent crowding and control how they move around between those points.. similarly, a token system to decide how many simultaneous incoming attacks or how much dps can be incoming to a single target, claiming a token lets you attack, finishing an attack releases the token, etc etc
lots of claiming and releasing going on 😄
Hello, i am very new and trying to make an Ai Move with a Behavior tree, i have a topdown project
I have an enemy with type of Character that uses the AiController i have created
i have an object with type of Actor that is the target
the behavior tree seems to be working as far as i can tell, and the blueprint in the controller is this, and the string is printed so it should work ?
EQS context is nice for generating spots around the enemy
You haven’t said what is not working precisely
The AI character that i have is not moving at all
Start by watching the tree at runtime to see if it is firing, then gameplay debugger (“ key), then visual logger
should probably also show your tree
does that get actor actually get the right actor?
looks like its doing its job
The BP_Bas is the object that the enemey shall walk towards
the behavior tree is blinking all the time, i guess it means it is constant shooting ?
it shouldnt blink once the move to has a valid patha nd navigation stuff
it should have a steady highlight for the duration of the move
sounds to me like the moveto is failing so your destination is probably invalid or cant be pathed to
May want to also put a decorator on that selector, currently it can only go left branch
do you have a navmesh setup?
In the behavior tree or the ingame debugger ?
in your map
Don't know what that is but I will read up about it tomorrow
I added a navmesh bounds volume that is covering the whole area
Watch the pinned video on BTs
What is the best way to get an enemy character to rotate to face a BB Entry? The Rotate To Face BB Entry doesn't seem to work for me (in debugging I get "Focal Point: Invalid location")
I have a BT where if the enemy is not in range, it will move towards the target. Once in range it will attack, but if the target moves (but stays in range), the pawn will not rotate to face them, so the attack looks strange (and in the case of melee attacks, misses completely).
I can add a custom task to rotate, but then the character just slides around, while the MoveTo properly rotates with animation (but then of course moves).
Maybe you can use the "Focus" function
I have been stuck on AI for so long.
Is there anything on the marketplace that is good enough to be recommended?
I'm not sure if anything on the marketplace will magically solve all your AI problems tbh
My AI problem is that i simply dont have the time resource to sink into it. I would prefer to focus on high level decisions like "do this attack".
for now atleast
What's the problem with doing that? You can make a behavior tree for example which moves and does attacks or whatever
I've seen some combat AI things on the marketplace which I guess could simplify it if it does what you want, but that seems it would largely depend on how your game works
This is why i'm looking at marketplace assets. To focus on high level decisions. I know what behaviour tree and state tree can offer but they require me to spend hours i need elsewhere.
Question about recommendations was mostly if there is anything popular and working.
I am ofcourse scouring the marketplace as we speak ;D
I've noticed folks don't usually have much luck with getting recs for stuff, I think a lot of it is just so niche. Hard to imagine how I would even integrate someone else's AI into mine :)
I have a situation like this - I have an item on the table and I'd like my NPC to move as close to it as possible. However, in this situation, the closest navmesh point seems to be on the right side near the arrow... and if the NPC is on the left side, it would make more sense for it to go to the spot marked with the X instead
Any suggestions on how that might be done? Projecting the point to the navmesh ends up on the right side because it's closer... the only solution I can think of is using EQS to create a bunch of points around the item, and then scoring them by distance to item and distance to npc
...also this, once again, for like the hundredth time, exposes the biggest weakness in EQS...