#gameplay-ai
1 messages · Page 27 of 1
DetourCrowdAIController isn't exported from the AIModule. So you can't derive from it in C++. But if you look at it, it is literally just the AIController with a different component passed in the initializer
Really no additional code.
So you can just copy that.
but yeah thanks
I'm just trying to figure out where either the crowd following component or AI Controller recalculates the direction vector relative to the crowd following component's velocity, or some other thing. Looking at the AI controller's cpp tick it only updates the control rotation and not the direction vector if it's moving
not a lot of this is commented or documented very well lol, making it a big pain in the ass 🙂
so as far as I can tell the Path Following Component's tick updates the pathfinding and the CrowdManager (which registers every Crowd Following Component on every character associated with a Crowd Following Component) updates each of the crowd following component's characters' crowd velocities to determine where to move
Its the detour framework itself
Pathfollowing is the wrapper around it
MoveTo:
- Makes a pathfinding request, if succeeds, it routes the found path to PathFollowingComponent
- PathFollowingComponents keeps its own state, checks if pawn reached the goal etc
- MoveTo listens to the state and other variables of the BT/BrainComponent to manipulate the behavior of the task (not the movement), so it can cancel itself or re-trigger path etc
PathFollowingComponent: - If there is a valid path to follow, it does bunch of vector math to follow the path along point A to point B, point A being current location of the pawn and point B is the next path point from the path array
- On
FollowPathSegment, it moves the pawn by adding move input to its movement component, it also lets you manipulate the direction via a delegate but it does not exist in CrowdController
real crowd stuff happens at UCrowdManager
Is the crowd manager's tick dependent on the path following component / move to? I guess I'm trying to figure out how I can take my existing direction vector and manipulate it based on information from the crowd following component. But it looks like the crowd following component is only ever made to interact with the crowd manager and generally isn't used outside of that since the crowd manager keeps track of all of the information relative to each crowd following component
And if I'd want the information for how I should redirect my AI's direction vector it sounds like I would need to get information from the crowd manager for each crowd following component
This would be so much easier if I didn't have custom locomotion logic instead of using move to 🙂
ApplyCrowdAgentVelocity is the function that you are looking for.
You need to build with the debug editor config to get breakpoints to work on editor files. If no breakpoints are getting hit, then your setup is wrong.
You probably cant with detour
At least not via PFC
I didnt read the Manager class' code so I dont know about it
Like I told you before, use the move to and override the functionality that sends to force to the movement component and send it to your locomotion system.
Does move to do that though? Its Path Following Comp who sends the force/accel to movement component
First rule of working with UE is don't fight the engine. There is usually an easy way to do what you want to do, you just need to find it.
Yeah I thought Move To only sends a location or actor to follow and is only called once, then the tick of the path following component handles the rest
On tick
That's what I meant. Override the functionality in the crowd following component to send the force to their system instead of the movement component.
thanks, maybe I'll end up creating my own crowd following component and override ApplyCrowdAgentVelocity
What are you trying to achieve by the way?
I'm trying to achieve the same thing as the default Detour Crowd AI controller logic, except I have custom locomotion logic which isn't using Move To or character movement. I instead have a separate component for all that stuff that handles all that move input through curves and animations. Basically I'm trying to find a way to convert the existing detour functionality into my custom locomotion system
actually hm, I'm not sure if calling an overridden ApplyCrowdAgentVelocity would even work since it would still be dependent on the crowd manager to listen for all that, which would probably require Move To
I'll try anyways 🤷♂️ 🙂
Like I said several times now you should be using move to.
Something is wrong somewhere but if your end goal is to manipulate the FVector direction that detour provides you just need to override ApplyCrowdAgentVelocity and use your own logic to call RequestPathMove or RequestDirectMove from movement component
you seem overthinking or overengineering something or both
I didn't end up creating this custom locomotion system, but right now my project's pretty tight and would require a lot of time to refactor my entire system into character movement using Move Tos
but honestly might be worth it given the amount of time I've spent banging my head against a wall over this specific problem
You are currently on fire.
how come your system is not using MoveTo
its just a fancy wrapper to call MoveTo() in pathfollowing component (the BTTask)
are you not using pathfollowing component at all?
because my characters' movements aren't using character movement, so using Move To would just cause them to slide along the ground, the entire animation blueprint is set up with all this custom locomotion logic rather than using traditional character movement
nope lol
so you are just trying to register your own system to detour?
so you can make it provide you velocity
nah I'm trying to use the existing detour system in Unreal but it seems more trouble than its worth
I've spent a couple days on this and it's been drivin me nuts, so much of the actual movement re-calculation is dependent on stuff thats already built for me
I have this already working in the sample third person project on the official unreal docs which specifically tutorializes how to use all this stuff
this doesnt seem right either, PFC just provides a normalized FVector to make movement component post-process it by adding velocity
it doesnt matter which movement component you are using as long as PFC provides a valid value
(Detour <-> PFC) -> movement component
It sounds like he didn't make a new movement component. Just made a new component and ignores the movement component. Which the movement component is likely still doing expensive checks.
I didn't make this specific locomotion logic lol
I would just use what's given to me if I could 😄
what do you have right now? from which base classes derive from?
just an actor component completely unrelated to character movement with a bunch of custom logic
literally an UActorComponent?
yea
I gtg figure this out tho I'm wasting more time complaining than actually making progress lol
but thanks for the help sorry that my problem seems pretty vague without specific examples and stuff
I can't show a lot of code specifically bc of NDA
detour is abstract so if you provide info to it, it will return you a FVector that represents current direction agent should follow
UCrowdFollowingComponent is responsible of registering its own agent data to crowd manager, and crowd manager calls UCrowdFollowingComponent's ApplyCrowdAgentVelocity
create a new manager class based on crowd manager, see how it registers agents, do the same for your own actor component
CrowdManager is specific to UCrowdFollowingComponent but actual detour is not
otherwise prefer the sane way, refactor to proper classes 😄
It's not vague. You just are trying to rewrite far more than you need to. And fighting the engine.
I'm not trying to rewrite anything, just trying to learn how this all works for my specific application
problem is once you get rid of gameplayframework elements you end up rewrite a lot of stuff
you got rid of two core things to move something
pathfollowing comp and movementcomp
those are hundreds of lines in total
and each function serves a purpose
what worse is you're trying to interop something something specifically written to work with those which increases your burden
again I didn't write any of this custom locomotion logic lol
I know but just trying to make the fire you're in more obvious to you 😄
ye I know I'm on fire lol
dont solve the tech debt with more tech debt
The movement component doesn't even need to be a character movement component. Just a nav movement component, which is really light weight.
Amen!
thanks guys. sorry I made a bigger deal of this than I should. I guess I need to learn when to draw a line in the sand when it comes to overcomplicating problems that can just be solved by doing it the easy way
The guy who made your custom locomotion is a bastard 😀
It's so common, even in big studios, to rewrite large parts of the engine because of the "not built here" mentality. It always causes so many problems.
[haven't read the whole conversation, so forgive me if I'm repeating something someone else said, but:] KIS! 😄 Complexity should come from composition of simple things rather than monolithic complex things. Howgh!
I've been meaning to actually dig into this so I can create my "Zombie Game Maker" framework inside of Unreal 😅
Epic used to follow "not built here" policy for ages. It started going away with UE4, but we still have some of that. I'm actively fighting it!
My favorite two big studio things that I keep hearing from... friends:
- Rewriting stuff or doing things unity way
- Trying to add multiplayer after everything is written (😭)
lol
I have experience in other engines that seem to follow the same philosophy (NBH syndrome). Maybe it's just an engineering problem 😅
More of an ego problem
Trying to add multiplayer after everything is written (😭)
Oh man, this brings memories of me retrofitting bots into a "we'll never need AI to drive Hero characters" game (Paragon) 😄
I worked at a studio where they tried to get everyone to write all systems outside of UE. It was an absolute shit show.
Rewriting stuff or doing things unity way
With the rise of using components for everything in Unreal (even coming from Epic apparently), I don't know if this is as big of a con these days 😅
I still like putting stuff in Actors!
I guess you don't like to have a lot of stuff 😉
Mass is too volitile for me. I know that old is what makes games. Not new and shiney!
I enjoy mass but get lost in codebase a lot 
Complexity should come from composition of simple things rather than monolithic complex things. Howgh!
this is the exact definition of mass
Hehehe, I wonder who authored that 🙃
I'll let the masochists figure it all out, then come in and reap the benefits 😈
The main thing Mass is missing is a good debugging toolset. We're working on it.
How's mass replication comin' along? And does it have any tie ins with Iris?
I live to serve! 🫡
I don't know if it is said enough or not, but I do most certainly appreciate you Mieszko!
what a nice community lol
we actually were dragging our feet on Mass replications because we were waiting for Iris. Now I'm working on an internal project that does need Mass replication, so it's going to get a lot better.
why "lol", eh? 😉
Ah - so Iris will aid in its development. That's actually kind of exciting.
damn y'all must be canadian too with the "eh"s 👀
Same, especially for interacting with community ❤️
How it will work differently than regular network programming we used to with actors? For example will actor channels, RPC functions etc stay or will there be another workflow we need to get used to?
There isn't much actual concrete info on Iris yet. So I'd imagine it's still a bit in the design phase for Mass Replication
ECS allows tons of cool stuff like better rollbacking and maybe even slight possibility of implementing lockstep especially with reflection system but I guess it's mostly relying on Iris's internal architecture
Since it does not affect high-level systems workflow wise decisions might be up to Mieszko AI team 😅
I'm still excited to actually see Iris for just the high-level systems.
Let alone mass benefits 😅
I'm actually staying away from replication, there's another dev working on it 🙂
I struggle understanding what is mass built for. What are the use cases where I'd want/better make use of it?
Zombies. The answer is always zombies.
Imagine you want to simulate a huge world, with a lot of things having internal logic like growin, or spreading fire, or flooding, or whatever natural large scale phenomena you want. Mass would be the right tool for that.
if you want regular FPS with 20-30 AI opponents you don't need Mass
Unless you want those 20-30 AI to go brrr
Ok so it's definitely going in the direction of supporting big worlds.
You can check out flecs to get an idea. There is even a pretty simple integration for UE out there.
I am a solo dev working on a small project. I'll keep looking at mass from the right distance 😁
Workflow wise difference TL;DR explanation:
- It's an ECS framework, an alternative to default Actor/Component system (but still interops with it). Actors and components rely on object oriented programming while Mass/ECS focuses on data oriented programming
- DoD has advantages of easier parallelism, better CPU cache coherency etc. which makes it naturally faster than OOP (you can watch Mike Acton's 2015 talk about data oriented programming)
- Entity is a collection of Components which are just structs with data only and Systems execute entities (runs the code)
Hey, I have ran into a problem, the problem is that my character cant move to the next targetpoint if its on the right side of the character. If its not it has no problem moving to it, a tried debugging (in my bp i still use the debugs) but i cant come to a conclusion. I tried to rotate it 180° so the target point is relatievely on the left but it doesnt work, even if it would would it wouldnt be my final solution. I would really appreciate some help. I used a yt video for this but it simply cant turn right. I did it over several times but it still doesnt work. https://www.youtube.com/watch?v=SfnvbzfGZnE
Hello everyone. This is a quick Tutorial, how to create a simple NPC System.
I used the Version 4.27.2 of the Unreal Engine for this one.
Discord: https://discord.gg/exuHzHjahe
Level: https://www.unrealengine.com/marketplace/en-US/product/modular-houses
State Machine: https://youtu.be/u4avH99F6FA
Animations: https://www.mixamo.com/#/?page=1&ty...
Now - if we could get the transform updates to go brrr 😅
We had to, there's already too many components in Unreal, and (Sub)Systems.
Makes sense. I figured as much. But a boy can still dream!
No he cannot! Don't be silly! :some-monty-python-emote:
While you're here Mieszko - what is one thing you wish was different about the BT in UE? 😈
I wish the developer had time to work on it more before he was dragged away to other projects 😉
It's no longer the hotness 😭
but seriously - local variables. It's something I even prototyped - a BT node could declare variables that could be utilized in child nodes, and the vars would get auto reset on node's "cease being relevant"
a kind of extention of BB
Wouldnt it replace the blackboards directly?
no, a suplementation of BB
BBs store global state, but sometimes you just need something local to a given branch
Ah, I see, BT variables are for execution logic rather than AI state
I've seen some bring up that they don't like that the BB isn't shared between all the BT users - was there any particular reason for this design decision?
the asset is shared. And if you want to share specific key values there's a way to do that.
I know the asset itself is shared, but the key values are unique to the agent.
there is a per key checkbox you can enable to make them shared
I'm so disappointed...
BT included in engine is great but I find it way more comfortable programming ai with state trees at least for standard idle patrol chase cases. It feels just more natural to think of it as state machine
Don't be! I hardly need them to be synced 😛
That was a great addition in UE 5 that nobody basically spoke about
Classic Unreal though. It's just a checkbox away 🤣
all right then! 😄
Nah - ST's were talked about fairly often. Especially here.
Oh here yes but I mean in official communication channels. Some brief mention is all
Listen to the sales pitch
I'd like values in BB to be regular FProperty values instead of UBlackboardKey's and has property extension support instead of FBlackboardKeySelectors, would solve majority of my issues
"We have fully dynamic, real time global illumantion AND unlimited polycount"
vs
"We have a fancy state machine"
Which is going to garner more hype?
Let's be honest here.
BB is older than FProperty 🙂
What is under the belly of ST is pretty neat though 😅
Wait.. isnt FProperty is from UE3
its even referred as "UnrealScript variable" in source code 😄
I guess you mean UProperty :P
yeah was UProperty back at the day
I think it's been a good choice for the company
that's what I meant. FProperties are a modern attempt to get rid of a lot of Unreal slack (one of the attempts, we have smart people working on getting rid of unnecessary stuff).
I'm mainly waiting on more bug fixes for ST before I pick 'em up again. Mostly surrounding the editor. Was having the states just randomly no longer be able to bind to stuff.
Did API also change with new FProperty system or was it same as UProperty?
Also found it kind of annoying on how you update data in the ST at runtime. Never even figured out if the way I was doing it was "correct" 😅
turns out it wasnt
How I see it is that in the beginning the engine was just growing, there were even no plugins and every team was inventing what they needed for their feature. Nowadays it is a bit different when we are getting more standardized reusable stuff like property binding, instanced structures, MVVM and in general a more consistent experience between all the systems. I am sure BTs could be significantly different if it was made from scratch nowadays.
because there isnt a correct way
Yea sometimes they lose a binding but overall they are already quite neat
Yeah the modularism attempt coming with each new version is awesome
Mass was my favorite because it directly provides an alternative for gameplayframework itself
I still love the GameplayFramework
If I could have more than 3 brain cells maybe I could figure out how DOOM Eternal does that "no game thread" thing and I could not love gameplayframework again
but since I dont have any choice I love it too 😄
I don't love it out of necessity though. I love it 'cause it's generally pleasant to use for a majority of games that I like to make.
being too used to regular workflow of actors provide is a huge selling point for me
I actually sometimes hear designers prefer ECS over OOP in other studios, its not less pleasant to work with either
I know. I enjoy ECS as well to be honest.
But ECS is still quite young in Unreal. And I want to make games.
Cant say I used enough ECS to love it, I just know what I dont like in OOP
but I often find myself in a situation where I thank god virtuals and inheritance exists
I guess I'd prefer a scenario where low-level side of things go brr with ECS and scripting doesnt even care about yolo with OOP
The gameplay framework is perfect for small projects. Having modular systems is great but I think they become more and more useful as projects start to scale. I have a background in backend web development where modular architecture has taken over but i feel like the complexity of managing these systems has increased tenfold. Sometimes the benefits justify the effort. Sometimes the don't. And I feel the same risk exists in game development
I dont think gameplayframework is going anywhere anyway 😄
GF is fine for bigger projects as well.
A lot of games these days don't actually have a lot of moving actors anyway.
Pheeww 😛
MoveComponentImpl 
Not to mention, they're also doin' work on multithreading animations. So anims go brrr
I finally found a way to both get immediate physics callbacks and run logic on another thread for MoveComponentImpl btw
and its not even hacky ( FSimCallbackOutput
)
cant wait to shoot myself on the foot again while trying
Does EQS based AI need nav mesh volume still?
Yes
Only for projection onto the nav mesh and using the pathfinding tests.
Back in the early days, BB keys were set to shared by default and you had to manually turn them off.
Hi guys, does AIPerception have debug lines in editor similar to pawnsensing?
the only thing I found is to press ' at runtime
yes, press Num 4 after you hit the '
Also, not sure you should be using both PawnSensing and AIPerception at the same time
oh ye that's what I meant
oh dw, I was just using it for screenshot haha
was wondering if it's possible to see those debug lines when editing
though now I run into a problem, the detail panel of AI Perception is gone
window -> details
usually when this happens, restarting or renaming the name works
yea it's checked
I can see other component's detail
ah
had to comment it out then compile then uncomment it then compile
thx
I haven't played with PawnSensing, but if you use EQS, it can draw pathing and hits for you at runtime
I’m def using wrong terminology here, but if you watch the first pinned video you’ll understand
since you mentioned EQS, I'd like to ask do we usually use EQS or AI Perception with BehaviorTree? or both?
is it this one ? https://www.youtube.com/watch?v=6Po7YGGvl_g&list=PLbRBWFaQHaW__LcCtV-KnqqgIFOyyFhr5&index=1
Just a quick talk about what I'd like to do with this channel in the future.
Perception with EQS. And I meant 3rd pinned link, from Eren
Hiya! How would I go about having my AI robot climb a wall? is there a nav mesh way, or do I have to basically play an animation ?
there are multiple ways but easiest one is putting a nav link to the edge of the wall and once AI reached to the navpoint play climbing animation or drive the movement until it climbed
what would be a good approach to run a (dynamic picked) task (executed from BP) on top of a running BT?
if I understood correctly thats not the ideal way to execute BT (you shouldnt make BT to jump arbitrary nodes externally)
can you elaborate more
Hi guys, I'm testing collision with AI in multiplayer with ~200ms latency because this is a non-competitive co-op game when played in multiplayer so would like to support that much. For this I made a third person template and duplicated the character, made it walk 100cm/s, and added AIMoveTo random point in radius. Not much else besides debug stuff (ping widget & p.netshowcorrections 1). The second video shows with 425cm/s speed which is more realistic for a game to use, notice how it becomes truly egregious, even more so with larger capsule radius.
First off I work with Character/CMC and prediction all day every day so I understand how/why this happens. But it did seem quite extreme so I'm wondering if there is actually anything I can do to assist or improve it. Basically, when the player character moves into the path of an AI controlled character the desync can become truly extreme and will thoroughly desync.
As an oceanic gamer (NZ) I'm used to the uphill battle of playing games with this amount of latency and I don't think it ever becomes this extreme even in competitive games when involving other players, but I do suppose I never had the opportunity to test with AI. I don't have a secondary player to test with at the moment but I'll get my sister to help when she visits on Sat.
I think some games either steer away from player or wait player to pass and stop NPC
and you shouldnt support beyond like 150ms or something even for co op, maybe 200ms at max
its too high to recover
from what I can see problem occurs because AI is pushing the player and since this hapens in server, client is not aware of its new position yet
so server ends up correcting
You might consider making AIs not push the player
This is actually what I just arrived at. I made the player character affect dynamic navmesh - actually attached it under my blob shadow component because it sticks to the floor so it still works when jumping (reserving their landing space, effectively). Combining that with disabling collisions between the two is a good start. I have a dither effect already for characters (AA faking transparency for hiding meshes without the cost), so if two players overlap their characters I can just dither the non-local character partially.
player character affect dynamic navmes
thats generally discouraged
Without that the player can walk inside AI - I still plan to have AI collide with player while idle
if you're using GAS, have the AI give the player gameplay ability that pushes the player back
rather then doing it by force
Ooh that's a good one
it should avoid corrections
In my case I do need enemy AI to body-block players from just walking through them
So I will disable collisions for non-enemy AI and then try the GAS solution for hostile AI
Well, I can disable collisions for hostile AI too, and the GAS solution will mimic it
Why
prone to bugs for AI movement and relatively expensive
i have a drone, where the usual BT is for stuff such as following actors, etc. but the drone also has the function to lift off/land where for the later the motor should turn off when it landed
so i would like to execute some task, which runs until it's landed and shuts the motor off
but i don't want to clutter up the BT with small things like this
In that case maybe Zlo's solution is best, just have AI push player away, I could make it opposite of assassin's creed where they shove you instead 😄
deactivate braincomponent
run the task
when its finished activate again
but what kind of task should i make?
i've seen AITask in cpp, would still like something which can be implemented in BP
so its a complex thing and should be decided properly based on your design
issue comes from you cant jump to random nodes in BT
you can only prioritize behaviors with BB values and selectors
so you have multiple options
and i don't really want it in the BT aswell
this is by design and makes debugging things and predicting a lot easier.
StateTrees let you jump around.
yea there's an article which also says to not try to implement a state machine in BT
so i try to avoid it 😄
I have a "stack" (TArray .pop/.push) BTs in my own braincomponent, I treat BTs as tasks but sometimes they are GAS abilities or raw UObjects
if there is any other BT/task/ability in the stack BrainComponent runs it instead
and after they're finished they are popped from stack
and default behavior is running
This is a generic way I thought a while ago
a simpler thing would be just locking the braincomponent in somewhere
and running the logic whereever you want until its finished
so just something like a latent action / coroutine for the task?
that's the article 😄
(I'm so ashamed of how terribly I wrote that)
wait you really did?
it doesnt really matter tbh, key point here is keeping the "main" behavior deciding BT alive and locked until you finished secondary tasks
yes
I'll remove it later and re-write in my blog one day though
nice, thanks for that overview 👍
well it's a good overview to not run into a bad design pattern
Yep but my 3 brain cells junior brain misunderstood some things about AIModule's design choices back then and quite shitposted about it 😅
Here's what I did
FBehaviorTaskwith virtual functionExecute()TArray<FBehaviorTask>for LIFO stack logicUBrainComponentderivative class, whenever a newFBehaviorTaskis added, it runs it, newly added tasks can decide if current ones should be cancelled or notUBrainComponentderivative also listens for end/start events ofFBehaviorTasks, if any is ended pops the LIFO array and if nothing left in the array continues executing the BT, otherwise switches to next prior task and ticks it
Execute either runs a BT or triggers a GAS ability, each task type has its own derivative of FBehaviorTask
could this also be extended with a 2nd array where i can push tasks which are allowed to run in parallel to the BT?
or is deactivating the BrainComponent necessary to run other tasks?
nope thats also a good idea, you can also lock the execution of secondary parallel task (which will run the main behavior BT) with a decorator from the other parallel
so you can prevent conflicts of tasks
UBrainComponent derivative here means UBehaviorTreeComponent btw
BTComp is a brain component
guess the FBehaviorTask is a custom struct!?
yep
everything in the list is custom
if you want to reference them in editor use a uobject though not struct
BTs doesnt support instanced structs too yet
i'm thinking of just using the existing "system" of UBTTask_BlueprintBase
that way the tasks could be implemented in BP and i could use them for BT and my custom execution thing
i think they are meant to run on BTs, though, prefer UAITask instead
and see how MoveTo node is exposed to BPs*
thing is that UAITask isn't Blueprintable
so i would have to write every little task in cpp
then I'd say create a new UObject, UBTTask_BlueprintBase is BT dependant
well it runs on the BrainComponent after all?!
i don't think that it's much aware of the outer flow tree
UBTTask_BlueprintBase is the UBTTask itself
you wont be able to execute it outside of BT
BrainComponent is something different, its a generic AI thingy that runs AI logic for AIController
StateTree also runs on it
you're looking for something to lock/disable BrainComponent and run your external logic until its done or do it with parallel nodes in BT
if you're okay with having your secondary/blocking tasks as BTs you can prefer Run Behavior Dynamic too, but if you want to queue secondary tasks, want them to execute different things etc. create a new object class and poll them on parallel
Any info on how you implemented this? The idea in my head ends up similar to the way lyra did their interaction ability/task - an ability & task that scans using a sphere trace, and when overlapping something that implements the interface, it gives the ability
so digging a bit through the source... UAITask seems to be supposed to be used with UGameplayTasksComponent
i can't believe that there's no engine feature for something like this
this seems to be quite common requirement for AI stuff, or not?
Hello ppl, is there any easy way to check is my character on some specific nav area? I have characters whom is forbidden to use some nav areas, so I need check if they accidentally drop on forbidden area and than do something
Hello everyone, simple questiom, how can I make this character walk through the middle of the nav mesh instead of the side?
If the navmesh only exists in the center it would walk in the center. Or if you use Nav mesh modifier volumes you could make the cost of the center lower. That would be the easiest solutions.
Don't do the string pulling? If I recall there's an offset value somewhere for the string pulling.. you'll have to look at the code
or interpolate the path direction from path following component
FMath::CubicInterpCR
I'm using Blueprints for this.
then you're very limited with options, none of two is exposed to BPs
Is this how you'd go about making them actually round the corners as well? That was something on my todo list and wouldn't mind some resources covering this
(as opposed to just snapping around)
yes
wouldn't mind some resources covering this
sadly there arent much
but I think GPT4 can help
GPT3.5 can partially implement the math part
4 would kill it
TL;DR get Path from path following comp, bind the PostProcessMove delegate, calculate new interpolated direction with FMath::CubicInterpCR
T1, T2, T3, T4 are path point FVectors
Exponent can be around 0.5 and 1.5 i guess, depending on path lenght you can lerp
🤔 If you just interpolate the direction how do you avoid errors compounding over a few turns getting you off path?
i dont know how it works but it magically never went out of the path for me
generated "spline-ish" path was always inside of the navmesh
Hm, fair enough
my 3 brain cells are not enough to explain nor understand why it works
math scares me
but i guess its about tangents being calculated properly
Yeah, its about the continuity of the spline.. it depends on which spline you use, there's a nice article about it by Natalie Taterchunk from AMD or NVIDIA If I recall
Basically, look at the spline maths implementation and you'll find one where you give it the same tangents and it maintains continuous values at each spline point
Typically, I'd look at the string pulling, figure out where its doing the pulling (funnel algorithm) and find the pre-pulled points and do a spline between those through the pulled point (i.e. only pull the corner point and use a spline position relative to that with some clearance offset)
Hard to explain without a whiteboard
You can also watch Freya Holmer? videos about splines for info
On an off-topic note.. I really shouldn't watch korean street food cooking videos 🙂 hahaha
I don't know what any of it is, but I want its deep fried goodness! 🙂
The first point in the map works but the others dont
the move too is being triggered but character doesnt move
NEVER MIND I FIXED IT
I want to increase the cost of nodes close to nav-mesh edges, what is a reasonable way to go about this without having to rip out too much engine code?
I have Enemy AI which can detect players and Can attack when close to the player but when I play attack anim montage it rotates the player in a different direction. But If I set the anim montage to none it works fine no rotation happens.
There is a way to get edges from navmesh but I dont know how
You can generate a spline along the edges in editor time and build nav modifier
but you also have to ensure modifier's radius wont block whole path
if nav corridor is too narrow
Hm, well the idea is to make the cost higher, not impassable so blocking seems okay. Nav modifier volumes are always boxes though arent they? How would one generate one around a spline?
More spline points and smaller boxes 😄
as long as edge is straight line it doesnt matter anyway
either box or not
its actually a rectangle not directly a box
True, I suppose, but not if you want dynamic generation to handle stuff like breakables or whatever. Not sure if anything is cached if your modifiers are static but it still feels like a pretty awkward approach
On yeah that would definitely explode your cpu
not sure if this belongs here but I'm trying to get my enemy class to move from A to B (for now just a straight line, later I want to change it to a spline) but for some reason they're just refusing to move. I have a nav mesh volume over my scene and I have an AI MoveTo node but it just refuses to move there
I also have this set so I know it's not that
Use the visual logger to debug.
I'm assuming this is what I want to see? Or rather, don't
Hit P to view the nav mesh. Is there anything blocking the path from your AI to the goal?
Nope.
You can alter the cost by subclassing one of the Get... Cost functions. Can't remember the exact name. GetNavPolyCost or something similar. Basically, it gives you a navpoly which you can then query the nav system to get the edges of the poly and each edge has two navpoly id's if its an internal edge and only one if it hasn't. So you can just increase the cost of the navpoly traversal by the number of edges with only one connected navpoly. I think the starting point is GetPathCost or something.. follow the flow of that.
When are you calling move to? Is there any other logging? Turn off all categories other than the navigation ones to make it easier to read.
Ah, that sounds like what I'm looking for, thank you
Can anyone please explain to me why when I spawn in a character (which has auto possess by AI when spawned) and immediately possess it by the player controller, there is still its original AI controller hanging around? Now there are two controllers (AI and player) but only one character, i dont understand this
Did you unpossess it before possessing it with the player controller?
Iirc I had a similar situation, and I was advised against trying to switch the character’s controller at runtime. Rather just spawn it with the right controller to begin with. I’ll check to see what I ended up doing
but the nature of the game requires changing the controller at runtime. I was making a similar project back in 4.27 and i had no issue with this, i could just switch between characters seamlessly and the ones i didnt control were automatically taken over by ai
the difference here though is that im using AI perception, and like this the unused AI controller keeps sensing everything even though its not controlling anything
Then maybe destroy the perception component ?
Controller is an actor. It still exists in the world. If you have the perception stuff on the controller, this makes sense to me.
Also - I don't think unpossessing destroys the controller. So it sticking around after unpossession, also makes sense.
i have to have it on the controller because damage perception sense doesnt work on a pawn for some reason
i just need to get rid of it somehow after i unpossess it
Just destroy it
yeah, makes sense, since it looks like I ended up spawning the AICon, spawning the actor, and then possessing the actor with it, in my case
ah so you dont have auto possess then
Don't have auto possess if you're just going to unpossess right after spawning
but im gonna have multiple characters, im just gonna possess one with the player
i tried this and its still there
how are you getting that player controller reference, where is this code located?
That Get PC is going to be bad once you have more than one player.
like the player possession works fine, its just that the AI controller is still there
its a single player no worries :D
Are you sure the AI Controller is valid
ah yeah, its not
but idk why
because if i dont possess it by the player controller, it runs around with the AI controller
okay im really lost now lol
like this its valid, but it still doesnt get destroyed
even this doesnt work on the pawn
Well it just didnt work with the auto possess, so I did it like you said, turned it off and spawning each controller manually and then possessing it, this seems to work for now, thanks for the tip c:
Whomever told you that was wrong. I've shipped multiple games that swapped controllers just fine. Either call detach controller pending destroy if you want it destroyed or unpossess and disable the AI controller.
oh, that's good to know, thanks! 🙂
Hey guys! Is it somehow possible to use Launch Actor or set velocity of actor who is possessed by AI without stopping brain?
In my current setup I have to call Stop Logic in On Launched event handler, and give attack command in On Landed but I would really like to get rid of this
Without this, launch actor or setting velocity just do nothing
it's not a bad approach, unless you do want AI to do something while in the air, like shooting a gun. In that case instead of stopping the brain you can pause movement request at the pathfollowing component. But I feel it can cause some strange behaviors. Then again, those should be solvable.
@crystal hatch Hey Mieszko, two questions if you don't mind:
- What's up with removing the class export in the AI module? What's the plan? 😅 https://github.com/EpicGames/UnrealEngine/commit/5db685f9
- I heard a rumor that we may be getting namespace support for UHT stuff. Have you heard anything about this?
re 1 - someone made it his life's goal to export only functions rather than everything. That's not just AIModule. This can actually improve compilation time and binaries size
re 2 - that's true, but I don't have an ETA for that
@terse star 👆
Just that it's being worked on is good enough for me! 🥳
It's like my #2 requested feature 😅
On begin play, weird thing is I know it works because it worked when I was testing it on the older version of the level (which was just cubes) but now I've made a bigger version it doesn't work. Here's my nav mesh and there's nothing blocking
Although doing some more visual logging I did just find this
That means that the AI is not on the nav mesh.
What determines if it is or not? I've tried googling and a few posts saying to uncheck can effect navigation but I've unchecked it on all my components and it's not changing
It projects down onto the nav mesh. You can hit f8 while you are playing in editor to see the nav mesh.
Hey, does anyone know how to set a sub behaviour tree's blackboard values from the parent behaviour tree?
Or better yet, share the parent behaviour tree's blackboard values with the sub behaviour tree?
What is the best way to create navmesh for ai when the ground is created upon begin play?
Dynamic navmesh with invokers
I hope Epic will use a linter to not forget exposing functions or I'm pretty sure some people will end up having to wait next version to be released to just call a function because its not exposed 😄
@patent hornet Since your suggestion for resolving AI collisions by having them give you an ability that pushes you back, I actually played FFXVI, they have an interesting system that forces you to sidestep AI.
And just now, I duplicated and rewrote Lyra's interaction tasks, because it does exactly what you suggested - provides an ability (for interaction). See screenshots.
This is my most minimal implementation to get a result for testing, but it actually produced an interesting result - if I really try I can breach the 500cm Strength on the Apply Root Motion Constant Force which makes it feel like there is a collider that instead of being a solid object is more of a suggestion - in real life you can get that close to a person and really invade their personal space if you are feeling stupid too 🤣 It actually feels quite nice. I prefer it.
And I could absolutely couple this with an animation like FFXVI does, where it sidesteps, of course having actual root motion on an animation could feel super disruptive depending on gameplay.
I'm going to make the AI play a "shove" animation 😄 It will look so rude, I can even make them say "move it!" if they're a gruff looking soldier
I used the DetourCrowdController and added a seperation force that took into account other agents and a push force scalar value.. so a human player could "push" through the seperation of another agent.. otherwise they'd be equal in terms of the seperation steering force.
Anyone know a solution? Or am I not using the sub run behaviour tree node incorrectly?
@uneven cloud I fixed it!
Can someone help me? My AI during a chase gets glitched and starts snapping continuously. Also, how can I avoid my AI to walk towards walls when pathing? Thank you
Use the visual logger to see what is making your AI receive multiple different instructions instead of just the one
show your current code
how would you recommend previewing my navmesh if my navmesh only generates around invokers (only way to do it in world partition as of now afaik)
Im new. Can anyone help me call this weapon pickup vector in my ai task for getting the vector? Or what can I plug into the actor location? I just need the ai to go to the pickup. ty!
I don't understand. The glitch is because of the Behaviour tree you think?
Maybe. The snapping effect you described sounds like your AI is receiving multiple instructions on tick or something. Maybe show some code
Okay how can I do that?
Or maybe navmesh?
How can you show code? Screenshots or snapshots (win+shift+s). Would need to see what you’re doing if anyone’s going to be able to assist
Basically the killer get stuck and start shaking
and if you go behind him he'll get unstuck and chase you again
did you look at the tree at runtime to see what happens?
How? don't remember the button
also that decorator on the first selector of the right branch is prly unnecessary. Because if the left side branch fails, the right side branch will execute. same with the next set of decorators
look at your tree, alt+P to start the game and observe the flow of code in the branches
you can also pause the tree at anytime and rewind so you can see what is failing
I'm getting chased by one hour but the fucker doesn't get glitched
aren't you setting the nearest gun's location vector with the service already?
ugh well, you need to replicate the issue to see what's causing it
Lol I will in the future. Do you know why I can't package the game if I disable SteamVR?
I don't use it and I don't want to keep it
but the packaging gets error
not sure, #packaging might
Thx
Yes but I'm not sure how to 'get' that vector for the other task(so that it can 'move to'. Im not sure the setup makes sense but that's how I made it lol
or should I set a reference to the gun?
Not sure why you need a task to get it again, just feed it to the MoveTo node.
You also need to give your tree a fail condition
Right now you have a selector that has nowhere to go but down that branch
So move your branch to the left and put like a wait node or something on the right, so it has somewhere to go if the branch fails
like this?
yeah. Do you need that simple parallel or would a sequence work instead?
I think a sequence will work from what i understand
Does your tree go past your first decorator? I could be wrong, but I think that check will run before your service has had a chance to run and set the values.
I'd also maybe add a Gunlocation1 is set decorator further down, just to avoid it trying to move to 0,0,0, but might not be necessary
the black board is saying failed even though there is a gun in range:(
Try moving either the service up the tree or the decorator down the tree. My guess is your decorator runs the check before the service had a chance to set a value, so it fails instantly
And I would move that whole branch left more, for visibility's sake, because in BTs, the left-to-right order is very important (it determines execution path), so it's important that you can see that distinction at first glance
i.e.:
Ah ok makes sense yeah the reason is cause i have the other stuff on stand by basically
He moved to it!!
last question is what do i set it to so that it prioritizes picking up the gun over attacking the player?
tun a common service which checks what values are true and then prioritize accordingly?
if your gun pickup is on the right of the player attack, the player attack will run first. If you want the gun pickup to occur before that, you need to move the branch to the left of the attack. If that's what you meant
hover over the number at the top right of a tree node to highlight the execution order
Ah ok that does work Thank you so much for the help! Now I just need to get him to pick shouldn't be too difficult lol
the second screenshot is from the blackboard, I set the parent to be main behaviour tree's blackboard
show the inside of your BT_SoldierCombat tree, namely the Details panel
so I'm guessing I'm going to add all the new blackboard keys that I want in the sub blackboard to the parent one, and have it shared?
ok I think I figured it out
for that run behavior tree to not give you a bb not compatible message, it looks like both BTs need to run off the same blackboard. Note that if you change the BB on your 2nd tree to match the first one, the change won't register until you save that 2nd tree
yeah unfortunately I'll have to include all my variables in a single blackboard
also, does anyone know if it's possible to set a filter on a Blackboard Key Selector in blueprint?
i.e have an expose Blackboard Key Select variable, but only allow keys that are object types or int etc
No. It's C++ only.
Hey everyone, I'm using a BT for my ai and using an EQS query to pick spots to wander around the player. My issue is that when the EQS query gives the ai a spot behind the character to wander to, it tries to walk straight through the player. Does anyone have any advice to get the ai to avoid the player while navigating to the point? I have started looking into nav query filters, but I felt there was an easier option
RVO or DetourAI
And make sure the 2 can collide
I tried both of those but it didn't seem to work. I had been messing with the collision, so I may just have to switch those around and try again
Do they just have to block?
right now my project is purely c++. are behavior trees worth using in this scenario? my ai will be relatively simple, as in a generic enemy with a few states
If there is any interest in this solution; I'm going to turn it into a plugin now. Tested and working without desync at >200ms latency. It will be MIT license and free once done. Seems like a pretty basic necessity having AI characters that can collide without desyncing 🙂
The Behavior Tree is just a fancy data asset. You can have all the functionality in C++.
Not enough information to determine which architecture is best.
PushPawn plugin released under MIT License.
Provides a net predicted solution for Pawns to Push each other. Uses GAS to prevent desyncs that often occur when colliding with AI.
https://github.com/Vaei/PushPawn
Not bad for a night's work.
If anyone wants to use it, you absolutely will need to go through that Readme
But its a solid system, both these examples are >200ms latency with p.netshowcorrections 1
Hopefully someone gets some use out of it, its pretty niche I think
Is it bad practice to have one monolithic behavior tree?
I use FSM instead of BT for my game but I mostly do this for my AI. I can't see why it would be bad so long as its not running unnecessary checks or any logic that isn't needed, and so long as it doesn't become messy or difficult to work with
may want to watch that first video Luthage has pinned. It's important to know if the tool you are using is the right one for your use case, i.e. are you fighting the engine, are you fighting the tool's intended purpose, etc.
It entirely depends on what you are doing. If it's really big and difficult to follow, it might be better to break it up into subtrees. If you have different AI types that have minor BT differences, it might also be better to break up into subtrees to share functionality easier.
Thanks
Is there any good docs/tutorials for setting up a simple chase AI with C++?
Watch the AI with Blueprints course on the unreal learning library. That will go over all the AI systems. You can then find the corresponding C++ function by right clicking on any BP mode and going to the C++ definition.
Ah okay, I'll give that a go. thank you
If I want to use a delegate in a BTDecorator the underlying node has to be instanced right?
how to make an AI grab a player when touches it?
What I did was create a collision (in the AI) and in the ActorBeginOverlap event I wanted to do an attach actor to actor, but I don't know if this is the right thing to do
My idea is to do like the AI in Pacify or Devour that when they touch you they take you to a random point on the map
You dont need to use overlap. theres a perception called Touch and you can use for that
Are behavior trees right option when I need performance?
BTs are right option when you need to have a behavior decision tool that you design by prioritization of the behaviors rather than states
Performance is not a concern for BTs
Thanks, i did not know this!
Hello, is there a way I can control where the ai looks while it's walking around?
Is that something I can set up in the behaviour tree or do I do that in the enemy blueprint itself?
AIController's "focus"
and AIController::FaceRotation function (only available in C++)
If you set focus AI will rotate there
oooooh I see, thank you so much!
Do you have to call this every tick?
There is setting focus, which will rotate the entire body or look at which is just the head. Look at is entirely animation driven and there are lots of tutorials. Focus is available on the AI controller and there's a BT service for it.
I have two functions in my Character called Sit() and Stand(). I also have two Behavior Tree Tasks called BTT_Sit and BTT_Stand which set the state of the Character with an Enum.
My animation blueprint then checks that state and selects one of four animations (see picture). This all works well, however...
When I want the character to move, I call BTT_Stand and then the Move To task. The character stands and starts moving, but they move while they are still transitioning from sitting to standing. I imagine I have to delay the Finish Execute node in my BTT_Stand until the character has finished standing. What's a common way to be notified of when the ABP finishes its current node? Or is this entirely a backwards way of approaching this?
I would recommend not using the anim BP for anything the AI needs to wait for. Instead you can use the built-in play animation (single player) or GAS (multiplayer).
What is the best practice when create navlinks attached to spawned actors? I want to achieve the following:
uh... I guess you can't place bp comments inside EQS Querries? 😅
Thanks! I haven't had a chance to try this yet, but I'll try moving the more discrete actions whose finish I am concerned about into my BT Tasks.
Hey guys, I'm working on animal ai, and want different animals to be able to walk up different slope angles, what would be the optimal method to set that up? Generating paths seems so ignore character movement settings, is there a way to have settings for multiple agent types?
One thing to mention: map is very big, so what I really want is a way to do it without placing navmesh modifiers everywhere
Currently playing around with behavior trees, it seems that this type of framework is best used in editor rather than c++. I was thinking of doing the blackboard and behavior tree in the editor, and the tasks in c++. I don’t know if this is a good approach
Hey, can someone tell how I can get context as actor or location in C++ EnvQueryTest?
hello there,
I am working with EQS but need some help.
I actually want to use EQS with player controller character Not with AI.
Anyone could guide me with this to use EQS with Player Controlled character not With AI there are a lot of YouTube videos on EQS with AI but no video on EQS using with player controlled character.
That’s prly because EQS is an AI tool… what are you trying to accomplish, exactly ?
I want to use motion warping with EQS to detect the points to check for sync points.
Yes
I c. Don't know much about motion warping, but I imagine you could attach an AI actor to your player controlled one that runs the EQS and feeds the desired points to your character
Ok try this thing.
Hope workes well
thanks
You can use the EQS with any actor. How you use it depends on BP or C++.
You create a child class of env query context and then override the appropriate function. https://docs.unrealengine.com/4.27/en-US/InteractiveExperiences/ArtificialIntelligence/EQS/EQSNodeReference/EQSNodeReferenceContexts/
I can create context and give it value, I don't understand how to use it in RunTest function.
The movement component settings only determine if the character can move there, not navigation. Navigation is based on the agent settings in the project settings. You can have multiple agent settings, but it costs memory. Having a few is fine, but it can get costly depending on your game.
There is a prepare context function that you either send an array of locations or actors.
What's your favorite thing you've used EQS for Luthage?
Like, "wow, I can't believe this worked"
@ocean wren See the new AI stuff with Unity?
You mean provide actors/locations/array function?
Abilities. My combat branch on the BT is 6 nodes. Then design can add whatever ability they want and the AI just picks them.
I'm too noob with EQS to conceptualize doing that 😅
I mean that there is a helper function to fill an array with the context actor or locations. If you have source (which you really should if using C++) you can look at the built-in tests.
I still just use it to find a potential "investigate" spot. So go to the last seen location, then pick random X spots on where the player could've potentally have gone 😅
There's a lot of boilerplate code you need to write, but it's actually not that difficult. I think I added 3 custom EQS item types for this project.
I use it to find smart objects, abilities, targets and nearly all move to locations.
I still just use the random point in navigable radius - or w/e the function is called
At least for standard wander behavior
I prefer a less random wander. Especially one that they don't turn 180 degrees to go to the next point.
Yeah, I can see how that'd give a more controlled wander actually.
Then probably do a test to see if you need to make any turns. IE - if you end up facing a wall
Yes, it looks like I will have to set the source, it is strange that getting the location of an item in the item iterator is quite simple, but there is simply no information on how to get the location of the context in the same iterator. Well thanks anyway.
You appear to misunderstand. There is a helper function to get the actors or locations FROM THE CONTEXT. It's called prepare context. You don't get it from the iterator.
Prepare, now I get it, thanks for the heads-up.
I haven't ever needed that. I tend to have a fallback query if it can't find a point in front of the NPC, so they recover well.
Why doesn't the Run Behavior subtree abort after failing once? Is this a bug? When using the Sub BT content inside the main tree without Run Behavior, everything works fine.
In my case, when I'm in patrol mode and LastSoundLocation is set, the nested tree aborts and runs successfully for the first time. However, if the nested tree fails (because MoveTo can not get to location) it wont be able to run/abort again until it gets re-evaluated again after patrol finishes.
Also if the abort decorator is not on the top level node, it wont abort at all
currently working on BP but planning to shift to C++ later.
I am not getting any debugger value from EQS
I am running EQS from BP_ThirdPersonPlayerCharacter BeginPlay().
it's generally good practice to assume you did something wrong before you start thinking you've actually encountered an engine bug. In 9/10 cases, it's you.
You probably don't have the right abort settings on that Heard Sound decorator. Also, your subtree Selector only runs down the one branch. It is good practice to have a fallback behaviour, i.e. a wait node on the right, in case the main branch fails.
How are you running it?
I know, but atm it just seems odd to me that a nested tree with the same behavior as a subtree in the main BT would work differently. If all branches fail in a nested tree, it just gets stuck at the root node and it wont abort it again. Whereas it's fine with a normal subtree. But I prob don't fully understand it yet.
I tried both value and result change aborts so I don't think it's the settings.
Having a fallback branch is sort of how I've fixed it. I put a Force Success decorator on my sequence, but that is good to know, ty for helping 🙂
I created EQS blueprint and then run the EQS query from BP_ThiredPersonCharacter on 'L' Key pressed from keyboard in event graph.
You need to send it a querier. You also need to bind to it being finished.
ok
I try.
thanks.
How does the system know which ability to pick? Are they attached to some kind of utility/float calculation?
I've been trying to learn how Supported Agents work for the nav mesh. I am trying to add a "Small" character as a supported agent. However, my character refuses to move and the Visual Logger states:
LogAINavigation (Warning) Unable to find NavigationData instance while calling AAIController::BuildPathfindingQuery
I believe my settings are correct. Attached are my Project Settings > Supported Agents settings, my character's collision settings, and my nav mesh's settings, respectively.
I was assuming that my character will choose to the supported agent that matches its own size. Is this wrong? Am I missing a setting somewhere?
The EQS is used to select the best ability to use given the world state.
Hehe, you make it sound so easy
Your supported agent settings need to be larger than the collision settings. If I remember correctly it just needs to be 1 unit more.
Ah, that makes sense. I'm curious, if you're able to say, if you set up those those tests in the EQS queries, or the designers do?
Thanks! Increasing to 100.0f and 100.0f seems to produce the same error, so it seems like I'm missing something else also?
Sorry ignore that, I'm dumb. I needed to rebuild the paths.
I set up the tests, but a lot of it is data driven. All abilities have AI data associated with them. I have a condition system and there's a test if the ability passes the conditions associated with the ability. So like distance, facing, line of sight, etc.
Very cool, thanks!
I haven't looked at it yet, but I think the new world condition system is very similar to my condition system.
what's that?
It's a new system in 5.2
ooh, it's a new plug-in. Weird, I couldn't find anything on google that references it. I guess there's no docs yet?
I haven't seen any docs yet. I saw a tweet a while back describing it and it sounded like my system. We aren't on 5.2 yet.
Haven't been paying attention, too busy buying guitar stuff, what did they do?
Say hi 👋 to Unity Muse, our AI platform that accelerates the creation of real-time 3D (RT3D) applications and experiences like video games and digital twins.
Starting today, we’re beginning a closed beta for Muse Chat, a critical feature of the Muse platform. With Muse Chat, you can leverage AI-based search across Unity documentation, training...
and this #programmer-hangout message
I feel like I know I'm doing this in a stupid way. Current Target is a BB key that is set before this task is reached, but this was the only way I could extract its value as Actor. So you know, feel free to throw the book at me, I'm ready lol
basically I'm having to get the BB key's value as Object, then plug it into a key inside the task, and then get its value as Actor
because get BB value as Actor is not available directly from get Blackboard
CurrentTargetKey is a blackboard selector, right? Just make that public and select it in the BT.
The entire point of using a blackboard selector is to not have to hard code the key name!
There is no such thing as get BB value as actor. It's get BB value as object and then you cast to an actor.
I mean there is that node but you can only use it on a BB key but yeah I get what you mean
Ty
whenever i use any "AiMove" node the character has it's velocity and accelration set to zero even though it's moving. if i use "addMovementInput" those variables are updated correctly and the currect running animations are playing. what am i doing wrong here?
To use acceleration for paths, it needs to be turned on via the movement component. You need to double check that velocity is 0, because that's untrue or something weird you are doing.
so ticking use acceleration for paths fixed it (didnt know that was a think. but i never had this issue) and as you can see here the velocity is set to zero even though the character is moving
again ticking use acceleration did fix the issue. it might be something dumb i did when i was messing with CMC 😅
thanks a lot tho!
btw is this like a new 5.2 option? i never recall it being a thing in previous versions...
pretty sure it's been there for a while
Personally I think it should be turned on by default. It makes the movement look better.
I don't understand why my test is failing. If I don't turn off reject incompatible items, it just ignores the gameplay tags altogether. I've made sure those targets have at least one of those gameplay tags on begin play
but the EQS is perceiving them as GameplayTags(0). I'm thinking I am supposed to implement the IGameplayTagAssetInterface from cpp for this query to work.
Is it possible for navmesh to work on the lower level as well as the top level? Or would it require something other than a navmesh?
it should work just fine. just scale your volume on the z axis
Somebody can help me about making a simple enermy shooting?
For clarification, there is an actor getter but the setter is object only as the object type can be specified in the BB key.
Hello everyone
I'm trying to create an AI system for the enemy in my game, where the enemy continuously stores the player's location in the 'Player Location' variable and moves towards that location. When the player becomes hidden from the enemy's view, the last known player location is stored in the 'LastKnownPlayerLocation' variable. The enemy moves towards this location if the player is seen again, but otherwise returns to the initial position or 'StartLocation'. I initially implemented this system and it worked fine. However, when I moved a part of the code that involves storing the variables 'Player Location' and 'LastKnownPlayerLocation' into a service within the Behavior Tree, it no longer saves the locations, and the enemy only moves towards the 'StartLocation'
Codes:
ShooterAIController: https://codefile.io/f/B9iTbCHvQ6
*The commented section is for when I wasn't using the service and had written it in the AIController, which was working.
BTService_PlayerLocationIfSeen: https://codefile.io/f/SHw85J0HRX
BTService_PlayerLocation: https://codefile.io/f/RGh6gNxh6n
You might store those values on the PlayerController (or PlayerCharacter whichever suits you), and use an interface to set/get those values wherever needed? You might even have the PlayerController control the 'Player Location' and 'Last known...' variables, and just retrieve them as needed.
Hi everyone! Quick question, can someone try to explain me how the avoidance config works in UE5? I have some AI Enemies with a Detour crowd AI Controller that surround the player, and they do this by walking towards specific points around said player. The thing is that sometimes, if, for example, enemy A is on the way of the location that enemy B has to move to, instead of Enemy B evading enemy A by walking around it, it gets stuck ☹️
I tried to tweak with the values, like changing the amount of adaptive rings so that my enemy had more rings to look for a better path, but the change was still the same. They walk with a slow velocity when surrounding the player, maybe this is the cause?
set breakpoints and find out where your player location fails to come through
I recommend using the visual logger to debug. UE log can get really messy. You want to check if the blackboard keys are valid (255 is an invalid key id).
Also recommend not dereferencing pointers that you haven't checked.
I don't know how exactly, but somehow I managed to revert everything to the time when the system was functioning and reconfigured the services in the behavior tree. Now it's working! :D
I'm grateful to the friends who made an effort to help me <3
Does anyone know of a very advanced Behavior Tree tutorial? All the tutorials i found on youtube are pretty much the same. Sense enemy, pursue, attack.
Im doing a strategy game, and need to see how something very complicated is done?
I recommend starting with the AI with Blueprints one on the unreal learning library. It will go over all of the AI systems (except for the new ones).
oh how did i miss that
This episode we clean up our AI Behavior Tree by creating sub-level behavior trees to hold our logic. Have a few bugs near the end but we work through it! Enjoy!
HUGE thanks to Matthijs de Rijk for giving us these meshes to use in our projects! Please, go...
this one also seems to be good
You are unlikely to find a tutorial on a "very complicated" AI.
yup. but that one in the video looks complicated 🍝 🐺
The actual behavior is simple, but they over complicated it.
it does look like he just goes on and on. i dont understand anything of whats going on there. but i need to watch his earlier videos
but the ai of strategy games is complicated
its not like just a dummy going around looking for enemies
its too many factors
but idk
btw the 3rd pinned video is a very good at showing you what you can do with AI in UE
thanks for all the help
that works very well.
In this 2017 GDC talk, Bobby Anguelov, Mika Vehkala, and Ben Weber outline core principles to get the most out of your behavior trees while avoiding common issues.
Register for GDC: https://ubm.io/2yWXW38
Join the GDC mailing list: http://www.gdconf.com/subscribe
Follow GDC on Twitter: https://twitter.com/Official_GDC
GDC talks cover a rang...
this one?
In this presentation, Epic's Paulo Souza uses Unreal Engine's built-in AI features to build smart enemy behaviors for a game with stealth-like mechanics.
By relying on the Gameplay Framework in Unreal, we're able to quickly create convincing AI using Behavior Trees. Behavior Trees are great for creating complex AI that can be presented in a way...
I believe that one is part of AI with Blueprints.
i went through that one already yesterday
thanks
ok i already have lots of tabs with videos
i think this will be enough for my workout session 🐺
🏋️♂️ 
I'm currently learning AI in Unreal* too, this is what I've been reading in the past day: https://www.amazon.com/AI-Games-Third-Ian-Millington/dp/0367670569
I feel like the Unreal BP course shows you the "how", but you need some other resources to show you the "why"
The book above has a good chapter on choosing the right AI architectures given your game's design reqs
nice i put it on my list
is it theory
like theory of ai ?
or it goes into specific examples
thats a big book
900 pages
It covers the full gamut. Yeah we ain't reading all 900 pages 😛 but I'm keeping it around as a reference to understand how things work. I am only reading the chapter on the design process to start
Like, "how do I choose between BTs, FSMs, utility AI, etc etc"
AI for games is OK. Pretty old though. GDC has an entire AI summit, many of which are free. There are also the Game AI Pro books, which are free online.
Ah interesting 👀 adding some new bookmarks!
im terrible at reading. i read slow. i do very well with videos on 2x speed
for what it's worth I'm a slow reader as well. I do however have a talent for building mental models of how stuff works. Find your talent and build on it!
i have that talent too. im a very visual person/creative type. but i get bored reading.
Yeah and also for building AI models and data-oriented calculation frameworks 😛
how about you doodle while reading? Creating so called "mind maps" is at an very intersection of creating and learning 🙂
oh yeah, that too 😉
but not reading 😄
reading for me is like eating boiled potatoes without salt. but watching videos i just absorb things much better.
if its something short that my brain needs in the moment, i can read and learn it. but if its like, read this book of 1000 pages to just learn everything in general, its hard. so its like just in time learning works very well for me
like eating boiled potatoes without salt
this makes me think you come from one of the slavic nations 😉
I imagine that was why school was hard for some in my "era"... books were the only option to learn the material
Can relate 😅
To clarify, I'm from Poland, so I know perfectly well how discusting unsalted potatos are 🙂
I’m from Romania originally, so close enough
Oh yeah, same diet 😉
Also, YouTube must be tracking my discord usage cause this popped up on my feed a few minutes ago lol https://youtu.be/ZRBXoQTuEgk
I'm thinking more https://www.youtube.com/watch?v=Pf6pekk5CqU
Compilation of Stephen Colbert's "Is Potato" joke.
#stephencolbert #Monologue #Comedy
im not slavic but i do enjoy me a salted potato
but i like it baked rather than boiled
Not from a Slavic nation, but my family is. Grew up on a very similar diet.
Is the PostProcessMove Delegate not called if you're using the UCrowdFollowingComponent?
Also, on the note of crowd following, the docs say All agents will operate on the same navmesh data, Does this mean you can't have different agents (Say for different sized characters) when using it?
TIL that #gameplay-ai is made up of potato diets @uneven cloud @crystal hatch
@crystal hatch does this mean it was accepted/merged?
Or was it just added to your Jira
Thought so 🙂 Thanks
Has anyone some hints/best practices for open world navigation. I need to support a 50km² map with ~1k ai units. I guess Invokers will have a huge performance impact at this amount, so I guess that is not feasible? Should I tile the mavmesh by myself or is the 5.1 world partitioning a reliable feature for navmeshes too?
how do you generally make AI Characters not damage each other?
I'm using the same projectile class between the main character and the ai characters and it mainly only ignores the instigator.
Tag friends?
Hey, how do I test if movement fails on ai? Say it can't reach its target for example
I want to include a mechanic where the ai loses interest of the player if it can't reacht them for a few seconds
Working on a shark AI system for my survival game. EQS not working on a floating pawn. Using multiple box traces atm to determine a valid location to move. Not really ideal. Anyone suggestions would be greatly appreciated.
Maybe run an eqs distance trace to player. If it can not reach the allotted distance in X time it will reset state to random roam or back to patrol point.
The ai character here is not following me, however, the printstring at the end is triggering. This confirms, I think at least, that the playercharacter is being sensed properly. Any ideas?
Surely you don't have 1000 on-screen?
My game is a large open world. I don't place any characters/pawns in the world at all. I built a robust spawner actor (from AActor) which has "Spawn Relevancy", which is just net relevancy, but shorter, and extended to factor all waypoints. If any player is near a spawner or the bot itself or the waypoint then it'll be spawn relevant.
And yeah, I use navigation invokers.
Any idea what the turnaround time might be like on the other ones? They're all other departments I think but hoping you might be familiar with those teams https://github.com/EpicGames/UnrealEngine/pulls/Vaei
anywhere from "a couple of days" all the way to "never"
I could have just wandered down the street and asked Bob 😉 Haha. OK point taken
Was hoping you'd be familiar with them but all good
We split into teams so that I don't need to care what they're doing 😉
Fair enough haha 😄
I totally appreciate that you're on here, it goes a long way IMO
Wish other departments would follow suit 🙂 Dan over in audio is amazing too
Without UDN access it can be pretty hard to get even basic changes and fixes in
Mieszko is GOATed. Sucks we lost MrHibbitts in #cpp though 😭
#cpp energy is way too weird for me
I know it sounds like a joke but I just don't know how else to phrase it
It's not often you get to receive help (for free no less!) from the person to blame thank with the AI systems of a given engine!
its likely you're keep retriggering moveto
and acceleration gets zeroed so your velocity is
i probably shouldnt ask.. but what about #cpp weirds you out?
All the macros 😛
haha
Invokers are incredibly expensive. It's better if you put them on spawners instead of moving actors, but they are still quite expensive. There is world partition navigation support for navigation streaming, but I haven't tried it.
Is this likely to change in a future release? The cost
I wouldn't place my bets.
Unlikely. Navigation generation is just expensive.
Mm that's a shame. I might have to revisit my use. Alternatively I could just place invokers that envelope AI heavy areas such as towns/camps. I already have them tied to my spawners, so I can just remove them from my AI pawns and make them envelope waypoints.
Is the general idea that if they're not causing anything to change on a given frame, then they don't have high cost?
They have a high cost, because they generate navigation. Being on static actors means they don't constantly cause regen, but they do when that area is loaded.
Thanks, that gives me a path forward 🙂
Hello am looking for a comprehensive tutorial for AI with cpp that has EQs and other essential to make AAA AI’s any available?
The team interface. You can get team affiliation for any actor that uses it.
It's only available in C++, so if you are BP only you need to build your own functionality.
Won't find one. Rely on Game AI pro book series and GDC vault. That'll be your best route, other than just sitting down and doing the work.
To get started with AI, there are some pinned resources. And there is a course on the UE learning site...uhhh - Blueprinting for AI or something like that
The AI with Blueprints course on the learning library is still the best first step. Anything in BP is available in C++. If you are making a AAA game, you should be able to read source without problems.
GDC AI Summit and Game AI Pro are other general resources.
Am not a novice am just wanted to Rili Rili Rili expand my knowledge about Ai and I am a c++ fan boy I implement all my codes in cpp no disrespect to the BP guys just my preference
Any links t the summit?
The AI with Blueprints course goes over all the systems. Don't let your ego drive your learning.
Sounds like your a novice if you don't balance C++ with BP and vice versa.
Completely true
Dismissing a useful tool to stick to a more complex one doesn't make you a better dev 😄
Ok 👍 mr professional
To be fair, large games need to really limit BP. But you shouldn't be making that size of a game if you still need tutorials.
Lol u dnt knw me
But it’s understandable
I appreciate ur effort for the link
Ur a hero
Tutorials don't go over best practices for games made by 100+ professional devs. They are made by hobbyists for hobbyists.
There is search functionality and filters.
You test the path before you move. Using the EQS makes it easier to find a location to move to.
I'm not working on a game, so I can't ignore AIs that nobody sees unfortunately.
Then you should be looking at Mass or rolling your own ECS instead.
We already have that, currently we use havok for physics and navmeshes/navigation. But our graphics engine looks a little bit dated, so we are evaluating Unreal. My task is to look at the navigation options unreal has to offer. But so far it doesn't look promising for this scale at all.
This is an option that exists (not making an actual recommendation) https://mercuna.com/
I'm rather curious if its any good myself, esp. since it costs a decent bit (depending on your level of funding)
In behavior trees we only have sequences or selectors
what if i want to run all the nodes below
Havok navigation is significantly better than recast. And they have a UE integration. I can verify that the navigation streaming for world partition does work as that's what we use.
not true, you have sequences AND selectors 😉
What do you mean by "all nodes below"? Do you mean "in parallel"? If so then UE BTs don't have that feature. But you have Services that can all run in (perceived) parallel.
Can't find pricing for that 😄
I think you need to contact MS for the price😜
That generally means its really high 😄
It is not really open price but you need to negotiate with them for your service, lol
So like imagine you have a bunch of tasks you need to run.
The sequence stops running once it finds one node that fails. And the Selector stops running once it finds a node that succeeds.
What if we need to just run them all regardless
I'm sure if I wait long enough Epic will buy it
Epic will buy it if Fortnite needs it.
There should be a decorator forcing result of the underlying BT node. Just force result to success and use sequence.
Probably really expensive. I asked for it and other people dealt with the cost and approved it.
A couple days of Fortnite monies
That assumes Microsoft will sell it.
Oh - M$ owns it? 🪦
Yeah, years ago MS acquired Havok
Make a new nav system and call it "MetaNavigation" and Tim will certainly notice.
Could even get a grant for it most likely.
got it
thanks alot
These days Epic buys stuff for Metaverse thingy instead of Fortnite, otherwise unless its absolutely necessary they workaround things to make it work with Fortnite
Their metaverse is Fortnite
Gameplay/engine code is not directly related with workflow and Tim's obsession
So how does Mercuna compare to Havok
not quite
Well. I can't debate with someone who probably sits in on the meetings about Unreal in 2026 🤣
The whole company does, we have no secrets internally 😉
How so though? Doesnt all content exist in Fortnite? like characters from other universes
and UEFN itself
for now.
So get hired, learn the secrets, quit. Got it.
thats indeed a plot twist 😄
don't forget "spill the guts, get sued for everything" 😉
Oh no no no. Not me good sir. I spill no guts.
It's more so I can chuckle silenty behind my screen on Discord.
also, "get hired" might get tricky 😄
I think part after getting hired is even more exhausting
Engine dev is too stressful 
I never noticed 😄
I actually don't mind engine dev. I'm just more interested in actually making games at the moment.
And you don't make games if you're making engines!
Since after getting insanely burnout from working with Blueprints VM a couple of times, I sometimes open up niagara and chaos modules and stare at the classes to think how epic devs able to keep up with same pace to rush features to next version
unless you're building generic systems for the engine because the game you're working on needs them 🙂
I'm indie dev. I don't have anyone else to do the gameplay programming 😅.
that's your problem right there!
Besides - you've already built these generic systems for me!
you're welcome 😄
“I need Havok.” “Luthage, that’s going to cost us $1M doll…” “I need Havok!” “Ok, ok, we’ll buy it.” 🙃
"Fortnite needs Havok!" *
I think if you're a promising indie studio with arguably enough budget and a team with past experience on AAA companies like Havok tend to agree on revenue share
Thats how Kythera also does
Why do people usually license Havok, are UE's tools not adequate, or do they just want flying AI etc
UE's tools might not be adequate for that specific problem
One of my friends was told most of their programmers was familiar with Havok so instead of building new systems on top of the existing AI they were considering licensing Havok
I notice BOTW used it, but their AI is so simple. Guess they needed something since they don't have UE 😄
Well, a 3rd party engine, it'd make a lot of sense to license Havok
Yep
Their so raved physics engine is also Havok
Yeah, they definitely did a good job with it, because its verrry reliable, their shrine puzzles wouldn't be possible otherwise
yeah, havok is solid.
Its probably default havok btw 😄 I dont think they modified it more than slightly
Havok AI has a lot of features that Recast does not. Like automatic traversal markup and really good collision avoidance. It's also more performant.
Ah yup. That would be a no brainer for many projects
Well, I'd like all that too, but 😄
Haha. It's more like "using Havok will give us these features, that we don't have to build, so it will save us dev time."
That's a great point, buy it and put it in the engine for me
I don't think it works that way lol
😄
It did with live coding, right after I bought a year license
Back when it was Live++
If I license HavokAI Epic will buy it within the month
My superstition is definitely rooted in fact, you should shout me a license
I'd like to keep my job. Also it doesn't work that way.
I know that
Hi how are you? Just a silly question,
Is anyone using State Trees in a moderately successful way?
I'm having a hard time trying to do very basic things and the functioning is extremely erratic. I surely have problems with some concepts, but there is also no documentation or the existing one is superficial.
Is this really production ready?
Is this really production ready?
no, it's not.
5.3 will be already a big improvements, including a first draft of the ST Debugger.
IGenericTeamInterface?
Yes.
@crystal hatch Curious - any particular reason you haven't gotten the "Epic Staff" role?
I don't care for stuff like that. Also it results in funny conversations sometimes 😄
"They don't know that I'm the one who wrote the system" - Mieszko while conversing with someone about a tool in #gameplay-ai or #mass
Actual gif of Mieszko behind the screen
I gotta get my giggles somewhere!
In case you didnt know btw there is a secret epic section in this server
only admins + epic staff see it
Sounds snobby 😄
SmartObjects cant move? 😦
Need quick prefered setup answer. Setup AI perception component on AI controller, should I just place all perception components on the controller or place the Stimuli source on the pawn? Also should the TeamInterface be on the pawn or controller?
More like DumbObjects, am I right
well i think its because of the cache they use?!
and yea in 5.1 they are really dumb (and broken by design)
Smart objects also can't replicate their state either.
i don't need replication, but i can see how this is annoying for those who need it 😄
Perception on the controller. Stimuli source on the pawn. Team interface is already on the AI controller.
guys please.. does anyone know why the " ai move to " or " move to actor " acceptance radius wont work if you are standing on a higher/lower ground then the ai?
they just come up real close to shoot.. picture for refrence to what happens.. they dont shot from there, even tho i AM in the range of acceptance radius.. he will come around all the way up to me and shoot. This problem is not present when we are both on a flat surface.. please help--thanks 🙂
acceptance radius just does math rather than relying on geoemetry i think, can you check visual logger to see what kind of log MoveTo outputs when its finished?
Also bear in mind, that AcceptanceRadius is just a runtime parameter of when to stop moving, it doesn't take part in pathfinding.
Also2: AcceptanceRadius is being checked on the last segment of the path. You'd see the same issue on the flat surface if there was a fence (or something else untraversable) forcing similar holes in the walkable navmesh.
You can fake a "check AcceptanceRadius all the time" by adding a "check distance" decorator on the move to task (to abort move when within given distance from the target)
Okay, ill check when i get to the pc
Hmm i dont understand the second part, hos to i check radius all the time? What node is it?
You need a "distance to BB key" decorators. I don't remember if there is one provided by the engine. If there's not then it's a great opportunity to learn how to create one since it's trivial and can be done with BP if you're not a coder.
That's assuming the "move to" target is in your BB.
There's an is at location decorator that I believe also allows you to set the radius.
Spawning some actors from my gamemode during PreInitializeComponents how do I get nav data to generate for them?
doing this on ABP doesn't work
if (NavigationSystem)
{
NavigationSystem->Build();
}```
Rotate to BB entry gets stuck as if it were missing a Finish Execute node. Google says make sure use controller rotation yaw is unchecked, but that wasn't it. I thought I'd found the issue (abort self causing the EQS service to constantly refresh and change targets), but that I fixed that and still nothing. Thoughts?
More info from Visual logger. Looks like after the BB condition is met, I get a perpetual stream of suspended/resumed branch actions
What are your navigation generation settings?
dynamic
Adding a 1s delay to build after ABP works
You need to wait until the navigation is generated before spawning them. Do not use a delay. There is an event you can bind to.
can't wait actors need to be spawned as early as possible
As early as possible means "after the navigation is ready"
which is apparently sometime after ABP
ABP?
actor begin play
Well actor begin play can happen at literally any time. I take you mean the game mode begin play.
On Navigation Generation Finished
What is the precision set to? If it's too small it might not end correctly
45 currently. I've also just tried 80, same result
oh, 180 seems to work better
https://medal.tv/games/unreal-engine/clips/1gQqtDdenrIM0l/d1337chDUASw?invite=cr-MSxLM1EsMTA1NTU1ODkyLA Hey guys so I decided to go back into my AI testing level because I noticed how unthreatening the enemies actually are. They're made using a simple follow player blueprint, and I'm happy to change that if necessary. You'll notice in the clip below that the AI will essentially only attack me when I'm standing still. I've tried tuning acceptance radius to no avail.
Watch Untitled and millions of other Unreal Engine videos on Medal, the largest Game Clip Platform.
Lots of things wrong here imo
- You should have the attack animation on the enemy be upper-body only so it doesn't slide while it move-attacking
- You should have the attacking and the moving be concurrent instead of out-range -> move closer -> attack -> out-range -> move-closer -> ect
Yeah I'm working on the upper body thing, was just going to fix mechanics before anims
Okay. Easiest solution is to just put the attack logic on your dude
SetTimer TryAttack on 1s timer
if AggroTarget is InRange do Attack()
Yeah so I was setting something like that up, however I didn't really understand howw to use the timer. One of them needed a function name, and the other needed event.
Do I need to put the timer logic inside my attack event?
drag off the event pin and search custom event
You might want to go through a "basics of ue4" tutorial first before diving into something like AI though
Alright, thank you.
think of it as a more malleable Event Tick, in that you can modify the rate at which it fires and whether or not it fires perpetually (looping)
there's more to it than that, but that'll give you some idea
This doesn't get called when I load into a level in-game
BeginPlay
NavigationSystem->OnNavigationGenerationFinishedDelegate.AddUniqueDynamic(this, &AMyGameMode::UpdateNavigation);
never gets called
My cpp knowledge is still very limited, but the screenshot I showed you was on the Game Mode's Begin Play
mine is too
so if it doesn't work, you might be missing a step
our code is identical
GameMode Begin Play -> Bind DoThing() to OnNavigationGenerationFinishedDelegate
🤔 are you certain you're properly referencing the navigation system?
I guess if it was nullptr it'd yell at you, so not sure
It would crash if it was nullptr
this looks promising
nope doesn't work
Rebuilding right after those actors are spawned doesn't work
So looks like the good ole 1s beginplay delay is the winner
NavigationSystem->Build() doesn't trigger the delegate either
what version are you on
most people are
4.25
Toss a cube or something in there during runtime though and Bam there goes the delegate
5.2
That’s odd
Idk about most people that seems pretty outdated. But then again I haven’t checked any polls 😅
Check UNavigationSystemV1, see if it’s anywhere in there
If not, I’m sure one of the greats in here know
Nope. Are parts of the navigation system closed source or something?
Not likely
Looks like it's being called in RecastNavMesh
And visual studio search is just stupid I guess
it's literally highlighting it yet it's still not in the search results
hur dur being stupid was the issue
NavigationSystem::Build() turned out to be sync so it finished before execution even got to the bind the next line
That helps a bit. Still dunno why the initial build when I load in isn't happening though
Wrong function delegate
The one I needed was
NavigationSystem->OnNavigationInitDone.AddUFunction(this, "LoadCustomActors");
whats the difference between a wait node and a cooldown decorator?
they seem to do the same thing. just wait x seconds
It’s in the description. The cooldown returns failed after it waits
i see now
thanks
The wait just means it does nothing and then reevaluates the tree.
The cool down means after the execution is finished, this branch can't be run for at least x seconds. So lower priority branches will run.
They are completely different.
Ah, a much better explanation
got it thanks
is there a way to get the Ai sight config?
btw i just want get. im know that you cannot change the sight config values at runtime with bps