#gameplay-ai
1 messages · Page 50 of 1
ok i will show you
alot of guys said i need something that starts the attack but im using ascent combat freamwork so i dont know what start it
Why aren't you using a BT?
i use behavior tree this is mine
I'm still confused on which part you are stuck on. I don't know the ascent framework to tell you how set it up.
forget that do you know how to implement thing like this
There is a greater chance than zero that Luthage knows how to implement the desired behavior.
The part where only 2 attack at a time? Most games use what is called a token system.
yea but i dont know how to implement it i used chat gpt and gemini and youtube together but still
This kind of thing can be handled with a simple ticket/token system. (As Luthage just mentioned).
Pretty much, AI can only do something if they have a token. So in this case, they want an attack token. You can only have 2 attack tokens in use at a time. So - if they have an attack token, then they would attack, otherwise, move around or something.
Then on death, return the attack token so another AI can claim it.
yea the proplem is how do i implement this
The concept is that a target has X amount of tokens to give out. Before attacking, they request a token from the target. The target either gives one or does not. If they have a token, they can attack. If they do not, they wait.
This can be very very simply implemented as an array in the gamestate/gamemode (if you're trying to stick to doing BP only). Not saying it's the best place to put it. That array has X number of attack tokens. When AI wants an attack token, they ask the gamestate for one. And it removes it from the array. When you give it back to the gamestate, it adds it back to the array. Array can be like, Available Attack Tokens or something like that.
The reason I'm saying GameState is because it is globally accessible, so it's easy to get and give back the token. Again - I want to stress this is a very very very crude way of doing it.
i dont know what start the attack do you remember and thats the part im stuck in
It's better to have it on the target.
ok ill try that
Yeah - that's actually a good point. Because then it self-regulates how many can be on a specific target.
Yes. And it's not throwing random shit on the game state.
The token status is the "state" of the game 😈
(Jokes aside, you're right)
Was just thrown there as a quick, easy to implement thing.
I didn't even think about the actual target part 😭
im confused should i use the game state or the target
Target is the better approach
The important part is understanding the concept of tokens
All you need is 2 ints on the target. The max tokens available and the number of current tokens. A function on the target to request a token and one to release. If Nun tokens is < max tokens, you can give one out and increment the number of tokens.
That is the super duper simple and straight forward approach.
ok i will implement this right away
Then another function to give back a token on death or whenever they stop attacking. Which decrements the num tokens.
ok what should i set the default value
w/e you want the max tokens to be. In this case, sounds like 2
No I'd rather even not use them!
I have a Single Player Game in the Yosemite Valley, so forest rich environment, and Navmesh is needed for some roaming Wildlife and such.
Mainly ABK powered animals.
I'm building Paths now, but previous run was going for over 3 hours.. I don't understand why it takes so long. I wish I could figure out and find out what's slowing the Nav building down..
Once the super simple version is set up, you can expand it to be more complicated if you want. Our token system changes attackers based on distance and strength.
Ours is more complicated, but it still tracks them via ints.
ok i created the functions and than what
Reread what Luthage said and work through it.
She can't write each line of code for you
ok
It takes so long to generate depending on the size of the map and complexity of world geometry. We do it nightly, so it doesn't slow people down.
Ah yeah that's smart! Probably not inside the editor right?
But with the cmd thing?
Does packaging your game also build the paths and such.
I guess I'll bump my question since I think it got flooded over 😛
Packaging doesn't build paths.
Yeah we use a commandlet to build it. Since I work at a studio we have a build machine do it, but you can just run it before you go to bed.
Oh smart! Is it a default commandlet? Do you have any of these building tips or things I should keep in mind when running them? 😇
I don't use State Trees, but in general I don't recommend using delays as they are timers you can't cancel.
is this right
Well that's fine but I'm having the issue that the statetree is activating the next tree before this one is over
You'll want to return true or false depending on if they can get a token. I'd also recommend using the increment node, but the logic is correct.
i didnt understood
Which part?
this part You'll want to return true or false depending on if they can get a token
Convert those red events to functions. And return true if you grant a token successfully or false if you don't.
ok
This kind of communication is beginner tier terminology. You might want to go through a beginner BP course from Epic. Not necessarily the AI one that was referenced earlier. I don't think they teach beginner level topics.
Sorry, can't help with that. Most people around here use BTs instead of ST. You might have better luck asking in #mass
Good idea thank you!
is this right
Does that do what was explained to you?
i dont know
The increment node is better to use instead of setting and adding 1. Makes things a bit cleaner.
ok i did it now how to release a token
ok
And don't let it go into the negatives
ok now what
Now you go back and reread what was explained to you a few times, in different ways, and try to figure out what you need to do to accomplish the end goal. You really need to do some of this on your own in order to cement the understanding.
All for helping, but not paint by numbers.
i red it already but still dont know how to implement this
Spend more than 3 minutes trying to figure it out
This is the very important part in the learning process
It's where you use your problem solving skills
Which really helps with actually learning
And that is the important bit
i have a question am considering to use mass crowd but am not sure if its stable enough and also if its able to do attack commands like zombies does anybody know if its stable to use in a project and if its even posible to use it for say a zombie templet ?
It's not marked as production ready - so there is that
I wouldn't use it yet myself. But some people are.
Hi all. Why doesn't a service continually execute while a child node is executing the "move to" task? Am I thinking about this wrong?
(I want the "move to" task to abort if the service changes a certain value)
A service continually ticks at the interval that is set on it.
hmm ok is there maby a other way to have like a manager that instucks the ai to do tasks. instead of telling every ai to do individual tasks
In my case, the service is set to tick at 0.1. When the child node's "move to" is executing, it stops ticking:
The service is ticking when any of the child nodes are executing, not just the move to.
still : (
People aren't going to walk you through how to do everything for your game step by step.
just to double check. this is how a ST should look like where a states should lead to the other? in this instance it should get patrol point then Move to Patrol Point then wait? (i know i can do all these stuff in one task, im just playing around with this thing for now)
From what I remember of ST from a year and some change ago, yes.
Take that for what its worth
sure! btw what do you think of it? to me it seems like a neat way to organise a boss fight maybe but for "regular" enemies i feel like BTs is the way to go. maybe have the ST act as a "enemy team manager" of sorts. what do you think?
Editor was too buggy for me when I used it. My boss fights are simple. I just cram everything in the class. (Don't bonk me Luthage)
Good ol' simple state machine that is handled via enums
lol fair enough
Trying to use "FindPathToLocationSynchronously" with a Nav Query and having issues.
Want AI to path through the "BP_NavArea_Pawn1", but it still avoids it like the query doesn't exist.
Tried playing with "Travel Cost Override" with no luck...
What am I doing wrong?
The travel cost override is not turned on. See the box to the left? It needs to be checked.
Thanks. Have tried ticking that and reducing the value, but they still path around it.
Also, made the default area very expensive. They still won't go through the area.
Blue sphere is destination and red lines are the path points.
Can you show where you are using the filter?
@uneven cloud Do you hear it as a "token" system or "ticket" system more frequently?
Token
I ask, because I've renamed the one I wrote like 4 times, undecided on what to call it that is familiar 😅
Sure! Doing this at BeginPlay in the Character BP and then MoveTo in the Behavior Tree.
(Patrol point expected is the Path End given in the function.)
It's your code, call it whatever you want. I've never heard anyone call it a ticket system professionally though.
Back to token I go!
If this is the filter they normally use, you can set it as the default filter in the AI controller.
Does the filter not work in both cases? I'm a bit confused as to why you are doing AI work in the character BP.
Thanks, I didn't set it in the controller. Originally had it in a BTTask, but we were having issues, so were doing some quick tests.
Image shows the latest. Looks to go through, but still puts path points at the edge of the Nav Area, which is strange.
Are you able to replicate it in a blank project? Been stumped trying different things.
May just be a function bug. The "MoveToActor" node works as expected.
Hello! When I am using EQS I want the AI to pick a location relative to the player, but prefer the MIDDLE of the available range instead of the minimum or maximum distance. How can I do this? Can I make a custom score curve?
You should be able to create your own curves in C++
I'm having a hard time getting a particular behavior. I want this AI to move towards a particular location while shooting. In this tree I am having them move immediately, then after 0.5 seconds I want them to shoot three times, then wait until both the movement is done and the shooting is done. However, in this setup if they reach the target too late they will repeat the shooting branch a second time. How can I ensure branch #11 only fires once?
If I make the Shooting the purple parallel then the Loop decorator does not work.
Oh! I had an extra loop decorator that was fucking my testing.
How does PlaySound interact with looping sounds? Is there a graceful way to start it and stop it?
Does garbage collection clear out all the old unused AI controllers after the pawn has been destroyed? They seem to be accumulating.
It should do. Unless you are holding references to them.
Also should I bother calling unpossess before destroying a "dead" AI pawn?
I guess that doesn't matter because a new one is possessed but it seems a new AI controller is also created instead of being reused.
Calling clear blackboard value appears to be setting my vector value to have all 3 values be the max float value. I'm curious if there's any logic to that?
what is the way you're supposed to handle arrays in a blackboard? You can't set an array key that I can find. For example, if I wanted to update in a service a list of enemies that are close together, and then pass those in to a task to fire an attack at all enemies in that group? Would I just do this outside the blackboard?
Ubisoft calls it ticket system
I also prefer ticket these days because people confuse tokens with NFTs.. 
Yes. That's the value of FAISystem:: InvalidLocation. There's a bunch of places vectors are checked against that.
You don't need to as the Pawn already does it when it's destroyed.
The solution to my problem turned out to be using multiple MovetoLocation tasks run back to back.
😦
ok than ill delete what all what you have said cuz you didnt tell me what to do next done
Another satisfied customer. Next!
Hello, is there a way to temporary like 5s disable ALL inputs from the AI controller ? so that the pawn doesnt move or rotate or anything ?
My problem is it rotates to the player when stunned 😦
Like I need to mute the AI controller or something
Try using the claim resource node or whatever it was called - if you claim the logic resource it effectively freezes behavior trees, the movement resource I think prevents any moveto's or such from doing anything
damn
works
thax
has anyone ever used the perception stimuli forgotten event? It never fires off for some reason. Is the system in that part broken too or is it just me?
Yeah I've used it
ah now i see, need to turn it on in the project settings
Hey all!
I want to script a behavior tree to have an AI peek out of cover, fire a few shots, and then duck back down.
I currently have this set up as a BT service:
- On Activation the service plays the first section of an anim montage (for peeking)
- This section leads into a looping section of the character standing
- On Deactivation the service plays the last section of the anim montage (for ducking)
It seems like there are a few problems with my implementation:
- It is fighting the animation blueprint (i.e., there is animation state logic living in my BT).
- Sometimes, the service ends and the deactivation is called, but the animation doesn't play the last section of the anim montage (probably because of #1).
A few questions:
- Should I turn this service into two BT tasks:
PeekandUnpeekthat require the peek/unpeek behavior to complete before returning? - Should I be running
Play Montagein this service/these tasks at all? - If no to #2, is the best way to communicate to the ABP that my AI's state has changed using gameplay tags on the character (e.g.,
Character.State.IsPeeking)?
Thanks!
This tree is largely working how I want, but the one problem is that if the target is within range and NOT in line of sight, it frantically does line traces every frame. How can I make that decorator only attempt its check every 0.1 second or so?
I've got it working now, but this pattern I've developed of using a simple parallel "wait + move" to be "just move around for this amount of time before trying anything else" feels wrong
Wait is there seriously no way to dynamically configure an AIPerception component? If I've got two pawns that have exactly the same brain, the same logic, but one has sight range 1000 and the other has sight range 500, how would you do that?
You'll have to use C++ to adjust the sense values. They're not exposed in BP.
Orrrrrr I subclass my controller and don't create an entirely new dev environment to change one stupid thing
For some reason, my enemy randomly stops chasing the player. I think it might be because I'm using AI perception and the event 'On Target Perception Updated', which apparently only fires an event when the player is moving. But how do I fix this with an alternative?
Find out for sure by using Visual Logger but if you need something more reliable for detection there’s a pre-built perceived actors generator in the EQS system
Alright, I'll try that and see how it goes. Thanks!
You don't want to play an animation with a service, if you want logic to wait for the animation to play. You have to use tasks for that.
I don't recommend using the anim bp for anything that isn't stateful. Attacks, reactions or anything that is one off and triggered by something should be done via montages.
If your anim BP is fighting the montages, then you don't have it set up correctly. Montages should override whatever the anim BP is doing.
Why do you have multiple line of sight decorators for the same branch? Also why are you using a simple parallel with a wait and movement? This doesn't make any sense.
Why do you have multiple line of sight decorators for the same branch?
The wait. The enemy sees the player and stops, getting ready to pounce, but the player has that moment to break LOS and avoid the attack. But I also want it to be resilient to the player breaking LOS for just a moment, or lingering on the edge of the range, which is why I'm only checking at the "entrance" to this sequence, and right before the attack, but not continuously checking in between.
As for the wait and move, the basic idea is force the enemy to stay in movement mode and NOT do the attack at certain points, even if that attack move would otherwise be valid.
For example, if the enemy jumps at the player and MISSES, then it's behind the player. It'll still be close, it'll probably still have LOS, so if I don't stop it, it'll immediately jump at the player again but this time from behind, making the attack nearly impossible to avoid. Bad experience. So I force it to roam around for 3 seconds before it can try again.
Think of it as "Wait + Idle Animation", just that I have it walk around instead of idling in place
Are there any guides out there on overriding ANavigationData in C++? Would like to have a concise list of to-dos and interfaces to look into rather than reverse-engineering it myself via code parsing.
Not sure what you're looking for specifically, but this is probably the most "indepth" article I've seen on the topic of customizing the navmesh bits https://maladius.com/posts/manual_detour_navmeshes_1/
I have a few random bits and pieces on it here also, https://zomgmoz.tv/unreal/Navigation-System/, but not sure if it's exactly what you're looking for
Still really helpful; I'm going into this mostly-blind so any clarity is beyond welcome
thanks a million, I'll definitely give these a read
Hello everyone.
I’m currently working on my AIs for my game, and while testing performance I hit a wall… Basically my game is a theme park builder, and I would need to have at least 1000 AI pawns/characters on screen with another 9000 hidden while still executing their logic (state tree).
My issue is that just having a few hundred AIs on screen kills performance, I’m unable to reach beyond 500 without going under 10fps.
Now, I have tested multiple ways to optimize the AIs on screen, I have turned off any overlap, optimized the movement component, collisions and I even have a plugin to handle distanced-based update rate, but it doesn’t help that much.
I also did research based on the profiler results I got, and it seems like the issue comes mainly from the character movement component, unfortunately I haven’t found a good way to replace it.
I also know about MASS, but from my understanding, MASS is still heavily hidden behind C++ and doesn’t work with the nav mesh and I'm unsure it works with my type of AI yet.
So there I am, stuck with this issue, I would really need help with that.
Thanks.
This kind of stuff is gonna be tricky without C++ because you're going to be quite likely to need to optimize it a lot
If you've found that CMC is the main source of performance trouble (which seems likely), I would suggest trying to first replace it with a much simplified movement system
For a game where I would assume the NPC's are primarily going to be walking on paths and not doing anything particularly fancy, you can probably get away with a much simplified movement system where it behaves more like the floating pawn movement component or such
I see, yeah the AI just has goals to reach and animations to play, the movement doesn't need to be super complicated, walking, running... No jumping or anything... I found an Unreal livestream where they talk about alternative Pawn movement but this livestream was of no use since the hosts are just goofing around the whole time
There's probably like 5-10 minutes of useful content hidden somewhere in the two hours of goofing
Unfortunately that's just how the streams are
I'll try to watch it entirely, and I'll do some more research on "floating pawn movement"
If you didn't try it, maybe see if using navwalking instead of regular walking on the CMC would be any better
that effectively just makes it stick to the navmesh instead of trying to simulate the movement more
I think it uses that by default, at least from what I read
My enemies were not colliding with the player(thus not causing damage), unless the player would walk toward them. Unchecking this fixed that. Just in case someone else is having the same issue.
You are going to have a really hard time getting that many NPCs without using C++.
I figured that much
You don't have access to the significance manager or the animation budgeter. You can't profile even your own BP, so if you do a simplified BP movement component you can't profile it.
I can't say it's impossible, but it probably is.
Hello! In my behavior tree, I have the need to start two different tasks and wait until both are considered complete. I tried using Simple Parallel but that only allows a single task in the main slot, and the other branch will loop when I want it to end. Is there a practical way to do this?
What are the 2 different tasks?
Move towards a designated location, and also use an ability a certain number of times in a row.
I found a workaround by repeating the Move task multiple times in the tree but it seemed unclean.
Why wouldn't that just be to move to the location and then a different task to use the ability - with the ability one in a loop?
Update the location in a service while the move to is happening
Or are you trying to move and shoot at the same time?
I'm trying to make an AI enemy that's blind and detects where the player is via hearing. I know how to give the AI hearing, but I don't know how to make the player make noise whenever they walk. How can I get the player to make noise when they walk so that the AI can chase it?
I'm trying to write an EQSQuery to find the "nearest container with an item of Class". The query itself isn't too complicated, I've already added my own filter test to check if each actor has the specified item.
However I'd now like to be able to configure the item we're testing for from the BehaviourTree that is calling RunEQS.
I've had a look at the QueryConfig, it looks like it only supports float/int/bool as configurable parameters. Does anyone know of another way I can pass down a UClass or even a UObject?
My first approach would be to put an anim notify in the animation. Line up the anim notifies to when the feet land on the ground. Then in the accompanying function that gets called - just make the noise event for the perception system
Oh sorry, I forgot to mention as well that it's a first-person game
Make a sound event every like, 0.1 second as long as your moving.
So first check that the movement component has a velocity length > 0. If true, make the noise event. But only do this check every X seconds
Or something like that.
Ok, I'll try that. Thanks!
Also very interested in this, it looks like internally they're actually all just float params, the int and the bool are just converted back and forth
My service doesn't actually tick - is there a way to remove this in the UI?
I'm not all too familiar with AI, but needing to add to my game. Only issue is I can't use navmesh as the entirey of my game is within a 3d swimming environment. Anyone have anything they could point me to for something like that? I've seen one that uses BOIDS for flying animals, but it's not working for me for some reason, so wondering if theres a better way.
if you need actual 3d navigation you'll need to either: build your own, use a marketplace plugin or fake it
I spent a couple hours googling + reading documentation source code and the best I can find is that you might be able to pass a UEnvQueryContext that pulls the value from the Blackboard component of the Querier actor. You'd still have a hardcoded BlackboardKey name, but at least you wouldn't need a seperate EQS query for each individual item you were looking for.
Haven't actually tested it, for now I've given up and gone back to a BehaviourTask.
putting this here since is the 1st thread i found, and found nothing else to help. i really really wish epic could improve this. apparently there are two ways (at least). binding a property to a query param. then setting the query param on the behavior tree. this seems ideal but not all properties allows binding. (looking at you generate aro...
was using EQS outside of a behavior tree, so unfortunately don't really have blackboard keys 😦
Damn. You could maybe wrap your querier in a data object that also contains whatever UClass you're after?
Something like this (the UObject just implementing a couple of ExposeOnSpawn properties for the actual Querier, and whatever Class you're trying to filter by).
You'd still then need a context to pull that TargetClass from the wrapped Querier, and probably need to replace the default Engine querier context (since it's now wrapped by another object).
No idea if it would work, but it might be a path to explore.
interesting, i'll have to look into it a bit more lol
I have level sequence and am spawning one of my enemies, it runs forward and then is supposed to attack the player. BUT when its done jogging, it just runs in place and cant attack me :/ (yes I have nav mesh an tried turning on run physics without controller. and auto posses AI is place in world or spawned)....
Im stuck. nany ideas? thx yall!
Use visual logger to find out for sure
@dense owl ...
Wierd it didnt log it like I expected
See all the red frames? Click on one of them
currently you’re looking at the gameplay debugger thing but you want to observe the PCs
You can also use the vis log box node and plug in your start location to see where it is exactly as opposed to where you want it to be
I pretty have this all in a sequence.
basically it does -spawn particle effect Portal thing. Enemy spawns/isVisible, walks through portal. Then game resumes and he uses the regular AI to come kill the player
Maybe it lifts it off the ground? Not sure
Basically that’s saying your guy is not on the mesh at the end of the anim
Yeah so strange. Trying to place it right on there.
The AI sees my char just fine
Is it stuck bc I have a keyframe in there (the location one)
I technically dont need the location/transform after it stops jogging. Wonder if I could disable that channel or something maybe its locking it into the location I set it to run to
Or it’s going through the landscape or something when it uses those coords. 🤷♂️
Yeah its stuck in the air
snapped to that location keyframe
Need to release it somehow. The AI wants to work it locks in on me but the keyframe has it locked to that vector value
the normal running animation is going now, like its supposed to cuz it sees me
gonna verify quick tho
I mean you could increase the project to mesh distance but prly best to just force it down to the ground
hi, "on smart link reached" doesn't work, it only works when the AI first hears something
someone can help me?
in behavior tree i use this to chase player:
BT has its own MoveTo task, as for the smart link reached that’s failing, show that code
@dense owl
@dense owl it is all
I thought maybe it's because Simle Links has an index in PointLinks, but after deletion it doesn't go to the SmartLink point at all
Is there some way to prevent aborting a specific task in a lower priority subtree? For instance I want a sequence of moving to a position -> using an ability. Higher prio branches can abort while I’m moving but once the ability has started I want to prevent aborting until the ability completes
Does it never reach that breakpoint?
yes
Where is this bind
Begin Play
Then why is there a cast to nav link proxy before it
How are you getting that ref for it, is that cast failing ?
That’s not what I asked
is not Cast Failed
Bind works
but i don't why AI can't reach it
if i use Report Noise
then works
but i don't know why :/
Are you adding this proxy link at runtime or is it placed ?
K. Use Visual Logger to see what’s actually happening when you get to it, maybe it’s not on the mesh properly. Also, some of the answers here might help: https://forums.unrealengine.com/t/event-receive-smart-link-reached-not-firing/385863/9
ok
It doesn't tell me much, I delete SimpleLink
and doesn't work
in VisualLogger I don't see nav link
someone can help? why my AI don't go to Smart link? only when the AI hears something then I receive a signal from On Smart Link Reached
I've a simple question that EQS in 5.3 is still experimental, is it mostly okay to use it in the production? I know it has been experimental for ages. Still wonder why not make it official or at least beta...
They forgot 🙂
In other words, it is safe to use?
I've used it for several projects already shipped. Just very interested in why it is still...experimental
Yes, safe to use
Anyone here familiar with HTNs? I've been reading about it and to my understanding (in simple terms) it's basically a hybrid of BTs and GOAP, right? Where it has a world state, goals and, actions like GOAP but the actions (or methods in HTN's case) can only be done in a set number of ways (aka subtasks like in BT).
Is this a correct simplification? The reason I ask is because I think I accidentally made an HTN system instead of GOAP. It works, but now that I look at it there's only a set number of ways for the AI to accomplish certain goals and it makes a plan in a recursive way
GOAP is quite outdated
and when HTN exists no need to use it anymore
so its good you made HTN instead by accident
Yeah I just found out it's more performant and flexible. But am I correct in my understanding of how it basically works?
How do you make the agent stick to the ground using floating pawn movement?
any example of HTN?
im trying to implement AI system of my own
thinking between GOAP and HTN
Only due to the UI / UX
Functions perfectly
Honestly - just get https://www.unrealengine.com/marketplace/en-US/product/hierarchical-task-network-planning and be done with it. This is an absolute steal for how much it'd take for you yourself to get to this point. Of course, unless you just want to build your own for learning purposes and what not.
That looks very comprehensive
It very much is.
It's one of the most comprehensive plugins I've seen on the marketplace
Hello! Behavior tree question
so this is how I've got an AI's combat phase organized - brain decides which behavior to do, and it passes over to do it, then back to the brain. I've structured this for modularity's sake. The question is I have the attacking handled on a parent service, and that resets every time a subnode is called; is there a way to have this work without re-triggering the service? Or do I need to just consolidate everything and just run all of this on one task with the service node on it?
This looks like you tried to apply state machine concepts to the BT honestly. BT's are better used as priority selectors more or less. So set the highest priority behavior to the far left. Next highest priority after that one, so on and so forth. Then you'd gate those behaviors with conditions.
What does your revolver service do?
I came from doing FSM AI for 2D to this, yeah
and yeah it's organized like that in general, everything moves left to right
the sub tasks handle movement, the service itself handles attacking, because as a generic mob AI I wanted those to operate independently
When I organized this I was under the impression the service would keep running without resetting
It will every time you reenter the node
and it's going to reenter the node every time an existing task is finished?
Regardless of whether or not the next node it finds is below the service?
When an existing task finishes in that branch, it goes back to the root and re-evaluates the tree.
Yep, that was the part I missed. Thank you
Has anyone moved their AI into C++? If so, what parts did you move to C++ and which parts to leave in BP?
- Tasks
- Behavior Tree
- Blackboard
- AI Controller
I'm assuming move everything but the Behavior Tree as that by default is very visual, but interested in what others have done and ultimately the most optimal way for performance.
I've mostly moved AI controller stuff into C++, and if there's any BT task or such that runs a lot
AIC primarily because it just feels more robust to have that type of "core" logic in C++ for me
With regards to perf, you should probably use Unreal Insights to find out if there's something. Otherwise it's kinda hard to say if you'd benefit from moving it to C++ or not
Tasks are probably one of the bigger wins to move to C++, so you can avoid the instancing of BP tasks
Which can cause perf issues
That's what I always figured as well but it actually didn't seem to take that much overall frametime for me when I was testing it in my project
Luthage has seen it cause issues in her AAA game/s.
Yeah it probably depends on how many run and how often, but seems best to profile even that to find out
Super helpful, thanks guys. Yeah I was thinking tasks could be better in C++ if they're heavy or run often. AIC makes sense, at minimum to have a c++ base AIC. If the BTs are in C++, would I need to put my blackboard in C++ so they can reference it?
I don't think you can really build the tree itself in C++ at least it definitely isn't designed for that
The BB is just an asset anyway that's configured from the editor, so it wouldn't make any difference I think
Hello ! Anyone know if that's possible to paint landscape to specify a specific navmesh area?
Ah yeah, sorry I meant the tasks, not BT. But the tasks reference the blackboard, so wouldn't the blackboard need to at least have a base class in C++?
Hello. I have 4 NPC characters that follow my main character in a third person style game.
Using a controller, if I walk into the NPCs they do not move and act like I’m walking into a brick wall.
To try and help with this,when the player collides with them, I make them move out the way a little. This works ok, but it causes pathfinding issues if the NPC gets close to the player while trying to path around him and collides. In case it's important, I have the AI controller set to Detour Crowd.
Is there a way to make the player push the NPCs out of the way so I don’t need to move them on collision?
I'm trying to run an EQS query outside of a behaviour tree but it is returning an empty array
It already is a C++ class, it's an asset. When you create a BB you're just making an instance of the asset and filling in a bunch of values into it, not creating a brand new class of something
Besides you access the BB's via names anyway so it doesn't really make any distinction
You need to bind to the event when the query finishes. It's not instantaneous.
The blackboard and BT are data assets. You don't move them into C++.
I've seen issues with BT nodes in BP in smaller indie games as well.
Depending on your gameplay you can just run all logic in the AI Controller + character without the need for BTs, depends on preference!
BTs are essentially just a visual tool to manage behavior at the end of the day but isn't required to make AI at all so if you prefer coding the logic in C++ and managing state yourself, you absolutely can. I like to do it for FPS bots similar to how they do it in Unreal Tournament
Scripted AI, which is anything not using an AI architecture such as FSMs or BTs, are incredibly difficult to debug, have terrible performance, and doesn't scale well with number of agents/complexity of the world state/agent variants.
I'd be interested to measure my FPS bot logic with an idential BT setup just out of curiosity! There's very little actual logic to be run and I can run it quite infrequently in most cases
Main thing that I prefer about it is not having my logic fragmented across code and various BPs that each run a line or two of code essentially
You call it fragmented, I call it organized.
If I need to boot up the editor to see a line of code then go back to the code to continue along the flow it feels more fragemented than helpful but that's why everyone can work the way they want 🙂
It's like making a separate class for each of your functions instead of... having functions in your class. But that's just my preference
Why would you boot up the editor to see a line of code?
Well you could make a C++ task etc. but then you are ballooning your codebase with lots of single function classes
All of our BT nodes are C++ and I certainly wouldn't say that the codebase has "ballooned" with a lot of single function classes. And it's a AAA game.
And it's a AAA game. which is exactly why it depends 😄
AAA is great to have stuff fragmented so the designers can tweak things
But for smaller games where less people or just one person is doing the AI logic, it can be nice to manage it in C++ directly. All preference / situational at the end of the day
Lyra is basically the epitome of AAA dev with logic for almost everything split up into dozens of sub BPs
I've also worked on games that it was just me doing the AI. If you write your BT nodes well, you really don't need a lot of them.
Lyra is certainly not the epitome of AAA dev.
Alls I'm saying is you can absolutely do everything with BTs and have a great time and also do everything in C++ and it's not necessarily going to be "terrible performance" etc. I've seen it and done it both ways and they are both valid but it does depend on the style of game and type of AI
Have you worked on any FPS style bots that have to do a lot of things constantly to mimick human players? Definitely possible in both BT and C++ but from experience, managing the logic visually in BT was much more cumbersome than just having it in code due to all the chunks of logic being separated out
I'm not talking fortnite style bots where you can almost see the clear cut tasks play out 😄
But even simple ones that just have to move to a location while attacking player and doing some secondary movement things at the same time are quite fun to set up with just code
very expensive and gotta build one myself
This is what I've been doing. I don't have many nodes. Just pretty much always operate off data that is fed into it.
$300 is exceptionally cheap for this kind of thing
(Only commenting on the "very expensive" part!)
Also how do you make navmesh agent out of FloatingPawnMovement? Like it properly sticking it to ground
in my currency its a bit too much
Compare it to hiring a dev for the same amount of time it takes to make such a tool 😄
we are just duo in our case. Anyway what would I do if I have to do it from scratch?
Well, learn how what an HTN even is for starters
alright any links or something to study them?
GameAI Pro is a series of books written by industry vets
Needing a lot of different nodes tells me they aren't data driving anything and likely trying to do some very bad things. Like each different attack is a BT node.
Attack is just a single func which could be a single node or a func called in C++, the BT interface doesn't really matter if you have the logic cleanly running in code
Point being BT is just a nice visual way to manage AI logic but if you prefer to do it in code you absolutely can if it feels clearer to you that way
alright what about this?
Give it gravity
I need Unity-like NavmeshAgent
It is not just a nice visual way to manage AI logic. You can write your AI however you please, but I will argue against the wildly false statements that you make.
I'd argue that writing AI logic in C++ results in "terrible performance" is wildly false also 😄
Depends entirely on what you are doing
I've also had gripes with BT logic when you are dealing with parallel logic
You can argue as much as you'd like, doesn't make it true.
which is much easier to deal with in code: a movement layer, a combat layer, a "secondary" layer for things like slides, strafes or other small actions as well as any other layers you might need instead of the often very static stateful setup that BTs encourage "I'm doing this".. now I'm doing this!
I mean I've 100 AI chars all doing logic with great perf it wildly depends! The main perf cost is CMC component transform update, not AI logic in my case
AI logic is extremely cheap most of the time, infrequent traces to populate data, infrequent queries to decide where to move to next or who to attack next etc. Not sure where the terrible performance is coming from really
Moving to code will likely improve on BT performance on similar logic especially if staggering it over multiple frames for different units
Since BT is still essentially running the same gameplay code at specific times anyway
i am using FLECS(ECS Solution alternative to Mass). So I need to use 2000+ characters. Not sure how Raycast-Gravity gonna help me
unless specific solution out there
I have consulted on a AAA FPS game, but I find the AI incredibly boring. Making it with a BT was ridiculously simple.
Sure! and very valid + encouraged to use BT!
Not saying it's not at all
Just saying you can manage state + call the funcs yourself in code if you feel like it and you aren't going to magically have bad performance, BT is just calling stuff like MoveTo(MoveReq, &PathInfo); behind the scenes anyway
Plus (in my case) making less stateful "I'm moving now, I'm angry now" etc. AI, I found it easier to have multiple layers of logic running in code than with BT which is why I switched over in the first place
The BT is heavily optimized. It being stateful and event driven is also a way to keep the performance very light. "Just calling stuff like move to" is a very naive way of looking at it.
Right well it's not like you can't be stateful in code too! I only query where to move next if my move to completes or fails for example
Not like I'm running it on tick
I just have either event driven logic or when required, very infrequent timers for secondary logic (similar to a service in BT)
Nothing on tick or similar frequency
Again nothing that would suddenly cause terrible performance
I didn't say how to give them gravity. I just said to give them gravity.
If you want them walking on the ground, they need gravity.
Otherwise - navmesh stuff is just XY stuff really
Hey ! I'm trying to create an eqs that search a position on the navmesh but where there is not a specific type of actor around. Anyone can help me ?
If I wanted to have shooting and attacking separated from movement, how would I do that in behavior trees? Like, how would I structure it?
is this the best use, where I have all movement in a task and the shooting logic in the service?
as discussed earlier, dividing it between multiple tasks resets the service every time a new task is chosen
Stuff like the above is why I moved to code for shooting style bot logic, it quickly becomes more cumbersome than it needs to be. In your case though you can probably look for the parallel node if you just need simple movement and shooting happening at the same time
yeeeah, was afraid of that lol
Add in submovements on top of all this like strafing, jumping, dashing, sliding, blocking, aim variation etc. and BTs quickly become annoying to work with imo
With state trees being more general purpose now, is there a good way to integrate state trees with animation blueprints?
What state tree info would you want in your anim bps?
Basically just knowing what state a character is in.
Well since anim bp is driven by char and char is owned by AI controller which houses the BT you can likely query it from the char if needed with getters
yeah, for animation blueprints I just pull states/booleans/etc from the pawn, and set it on the pawn from tasks/whatever
Alright, I'll probably do something like that then.
Come to think of it, my state tree tasks are built to apply a set of movement values and also a GameplayEffect. Would it be wise for me to just read from the GamepalyEffect to determine what state the character is in?
as in?
like how exactly can I place my agent/actor exactly on top of navmesh?
like unity
but seems like they dont as much as they should
I haven't used Unity in years, so I don't know the reference
like often tends to go out of Navmesh if you use floating pawn movement. CMC cant be used for obvious reasons
But all you do is bring out your agent and make sure it has gravity. Which FloatingPawnMovement doesn't by default
not sure if you can do multithreaded raycast
Define "out of navmesh"
like let's say its a bit out of navmesh when following an actor, it tends to straight up moves away from navmesh for a while and then gets stuck
Moves out how though?
Like - outside of the bounds via the XY plane?
Or the Z?
Or what?
how do I put this. Let's say you make plane. Put volume on it. Order your NPC to follow specific character/Actor. Then go out of the plane. It seems it goes all the way out of plane and just floats on air
cant go back to the plane or pathing
Is there an idiomatic way to reserve/use a SmartObjectComponent directly if I already have the actor it is attached to, rather than by running another query?
Do NavLinkProxy objects created via child actor component not work? My manually created one (right) works fine and has the black arrow drawn between the two points, but my link proxy created via child actor component (left) does not have the black arrow / is invisible to pathfinding even though I can see the markers
Nevermind, I think it has something to do with generated dynamic mesh hackery. If I make a normal blueprint and create the nav link in there, it works, but only in the generated dynamic mesh bp does it fail to work
What's the best way to go about the Ai getting stuck besides adjusting the navmesh?
I've been playing around with a lot of different methods like having it transport if its velocity reaches 0 or change route to another location
But curious if there's a better way to like have it reverse and go around the object it's stuck on
For reference, I did increase the capsule component size because it's a bigger Ai
I'm working on a level with a lot of trees and even with the nav agent radius increase, it still gets stuck every now and then
You can launch them back in the direction of the navmesh
Usually does the trick if they get caught in walls or off the navmesh
How would I go about doing that if it was already trying to move towards a specific point?
I'd first focus on getting back on the navmesh and then you can resume
So launching upwards and outwards in the direction of the nearest navmesh will often fix stuck characters
There are likely more graceful solutions like allowing the game to teleport the AI back to the nearest navmesh point or to a safe navmesh area
If that doesn't disrupt gameplay
Is there a node to locate the nearest nav mesh?
There is a func that gets closest point on navmesh which you can then use to determine launch dir
Is there a way to make FloatingPawnMovement behave like a missile, such that it can only move in the direction it's facing and needs to turn to change direction?
Right now it's more like a quadcopter, it can change direction without changing facing at all, and in fact seems to prefer to
Why not use projectile comp?
Can also subclass it and make sure it only moves it actor forward
I needed a way to give it navigation and control it with behavior trees, can you do that with projectile comp?
Pretty sure projectile comp has the INavAgent interface. I think all movement components that you can use out of the box do. Though I have never confirmed.
But you could just do the same thing I said but with FPMC. Subclass and only move in actor forward.
Yeah true, I just wanted to see if the functionality I needed was available out the box anywhere first
Idk if it is to be honest.
It's also not suuuuper hard to fake it, I can just get the movement vector and rotate it that direction lol
Is there a graceful way to shut a behavior tree off, like an inverse of Run Behavior Tree?
believe it's stop brain in the ai controller or something like that
"stop logic" node
inside of the brain component inside of the AIController
brain component only exists when you have an active behavior tree I think. I'm not 100% sure though because I despise Behavior Tree's
sorry for 1 day late reply but where is this settings I can change?
This is my problem
where should I do changes to ensure it sticks to navmesh?
I see that you aren't using the character movement component. If you want to keep it stuck on the ground, you have to actually add in that functionality. How the character movement component works is to first find the floor and then adjust the movement the capsule does to stick to the floor.
hey guys i have a door with a physic costraint that is simulated and move when u go throught work with the player but the Ai dont consider it cause the nave mesh stop at the collision box used with the physic, any sugestion on how to make the ai go throught ?
alright but got a slight problem with that. Because I need to multithread since I'll have so many characters on screen
Most people use nav links for doors.
thx im gonna search that thing ❤️
So for a hearing report it seems like MaxRange is the value you want to mess with, and Loudness is just a multiplier on it? 
I'm not sure I understand the point of loudness 🤔
If it's just a multiplier why wouldn't I just multiply MaxRange myself
but then, the AI perception component also has a specification for hearing range
I would expect the AI to specify only that it can hear, and maybe a multiplier.
And sounds to just specify range
I guess you could also simulate volume loss over distance, but the AI multi would cover that
Max range at which the sound can be heard. Multiplied by Loudness. A value of 0 indicates that there is no range limit, though listeners are still limited by their own hearing range.
🤔
This is oddly unintuitive 
I'm guessing it's for technical optimization reasons
the hearing range must cut down on checks
So I'm playing around with the StateTree plugin, currently I'm using a behavior tree. Here in my NPC controller, I have these blackboard assignments on BeginPlay. What are the nodes to do this for a StateTree instead?
So I don't need to do anything for the NPC themselves? It looks like there's a component for the statetree in their example, so I might have to add that?
I don't know all that you've done or haven't done.
But these docs should be decent enough to get started
Whats my best option for managing a horde of between 100-200 if I want easy access to all of them for flocking but still want them all to be actors?
Make them actors?
I'm not sure what the question really is. 100-200 is entirely doable with actors, that's nothing
Character Movement Component may give you some performance grief but it's still doable
I'm sure it is doable, but I need the CPU headroom elsewhere
Is there any consensus as the value of having a singleton manager for doing things like the mass pathing and flocking?
and just do it RTS style where they are all dummies to the AI manager, or will the performance gain be negligable to an object oriented approach and trusting the engine to multithread them individually with a traditional behavior distance heirarchy? (Still learning Unreal)
The engine won't multithread things for you, actor updates generally need to be performed on the gamethread, but you can certainly perform calculations on another thread but need to sync it to GT
The value of managers and such largely depends on the circumstances and how it's implemented. I would do some tests to find out, you can probably throw together some quick prototypes for pathing pretty quickly to find out what the performance for it is like in the kinds of scenarios you envision
I'm trying to make a character go from the left platform to the right platform using a jump pad. I use AI MoveTo towards the sphere on the right, I was hoping the nav link would make the character go towards the jump pad, which launches the character in the right direction. However the characters gets stuck on the left platform, and stops (On Success is executed)
Increasing tile size to the max value (19467 UU) solves it, is there a workaround for distances that require even higher TileSize than allowed? (except using these PRs)
Maybe connecting small links in the void will work too
How can this even happen in an AI Controller? This object only exists BECAUSE a pawn is spawned that needs to be possessed.
BeginPlay may be called before possession happens. Use OnPossessed to do anything that requires possession to have happened.
Weird! Well, weird that I haven't run into this before, I've been doing it this way a LONG time
That makes perfect sense though
how AI would handle quadtree LOD terrain that update often ?
do AI paths need to be recalculated every time terrain updates ?
I've got an AI pawn that's supposed to be moving just with FloatingPawnMovement and MoveDirectlyTowards. Except despite the movement goal being set to something valid, it literally doesn't move at all it just sits there.
Hm. This USED to work and I've since updated the pawn to have a new parent which may have replaced the based component. The new root component IS set to movable, but is there anything else that needs to happen?
Weird it's working now, I just had to delete some random other collider
Is there a way to set a blackboard key as an array? I've been learning with ChatGPT and it's telling me to do that but I cannot find a way
Not directly. The typical solution is to store a UObject which has an array as a property
Depending on what you're doing, you could also just read the data directly from its source, eg. if it's something on your pawn or somewhere else you can conveniently access
ok tyvm
Is there a way to check whether a pawn has AI running currently? I guess I could call GetBlackboard and juse see if it's valid, but that seems a little gross
There's a function on the brain component for Is Running. Not sure if it's exposed to BP.
Yes, the navigation needs to update when the world changes.
What do I need to do to fix this error?
I have a selector node which a bunch of child nodes, and sometimes all the child nodes fail, but I still want the selector node itself to succeed so that the parent sequence can continue. I can add an empty sequence node as a child to the selector node, but is there a cleaner way?
Force success on the selector
Thanks! But where is this option? I don't see it in the Selector Details panel
oh it's a decorator, thanks!
when an AI character is mid air, how can I make it stop (like stop movement immediately but smoother)? I've tried adding movement input in the direction opposite to current speed but that doesn't seem to work
Isn't there an air braking/friction value on the CMC?
Increasing that seems like it would do the trick as long as you're not adding any inputs
Hey devs! anyone here who could help with EQS?
It's best to just ask your question instead of asking to ask :)
So the thing is in the Behaviour tree the eqs doesn't run!
Ill share the screenshot wait
Hey Guys, I have an issue using the Gameplay Tag Decorator in the Behavior Tree.
I am working with the Gameplay Ability System (GAS).
At the beginning of my Game I am assigning a Gameplay Tag via an infinite Gameplay Effect to my AI Actor. But If I check for it in the Behavior Tree it is always returning false. So its telling me that he is cannot find the gameplay tag on the Actor.
I checked if the gameplay effect is working and it is. So the Tag should be assigned.
Is there a way to debug and see what gameplay tags an actor has? Or do you have an idea why the decorator is not recognizing it?
I checked and printed out all tags that are assigned during the game. The tag I need is actually assigned. So somehow my behavior tree is not recognizing it. Im am using a ability system component which has access to all my tag of the actor. Could it be that the bahavior tree decorator is just searching for the tag at the actual actor and not the ability system component?
good idea thank you, I increase the braking deceleration falling value until the character stops moving laterally and then put it back to the previous value
Hello, how would i go about making my AI be able to hear player microphone?
You could for example generate perception hearing events whenever the player uses their microphone, and use the perception hearing sense to detect the events
hmm okay amma look into that, thanks
It's a bit hard to tell but it looks like either the run eqs node or the move to node after it is failing, which is causing the sequence to fail, which is then triggering the next node from the selector
You can use the Visual Logger to get more information on whether the nodes are failing and if so why
Its showing that the points of interest variable is invalid when using visual debugger
And even when seen in the Behaviour tree
Try to find the execution of the eqs node in the visual logger
it's possible that it's actually returning zero results
Yes that may be possible! but anything that I can try to resolve this issue?
The gameplay tag related nodes use IGameplayTagAssetInterface. If your actor isn't implementing this, they will not work correctly
Fix your query so it returns something, or handle the failing query in the BT somehow (for example wrap the EQS node in a Selector node, and provide some alternative as a second branch)
Ah okay I see, so it seems they are diffrent then the GAS gamplay tags. I will write a new decorator for that than.
If you're using C++ you can implement the interface and have it return the tags from the GAS component
But if BP's only, then you can't and adding a new decorator would be the way to go yeah
@haughty irishttps://github.com/KaosSpectrum/KaosGASUtilities
So I have "Allow Strafe" set to false on this move node, but the pawn does nothing BUT strafe, doesn't even turn at all regardless of what direction it's going. How do I make this work?
These are the settings in the controller
Interesting, I added an arrow to the pawn and set its rotation to the control rotation every tick, and unlike the pawn the arrow DOES face toward movement, though it's very jumpy
Flicking around instead of turning smoothly
Well.. do you have use control rotation turned on?
Dang it, just found that. If i have one beef with Unreal's AI systems its that you're never sure where to look for a given config
Hey guys, is there a way to retrieve nearest player location to use destination? I added service like pics
You need to save the player location to the blackboard.
What's the most sensible way to interrupt and then restart a BT in response to things like stun effects
Idk about sensible but there’s brain component -> stop all logic and then run the behaviour tree again if you’re looking to restart it each time
Think I'm experiencing some kind of bug. When I place my AI in front of a trigger, it will not be able to see anything past it. I am using AI sight perception. Is there a way I can filter collisions on the AI perception component?
I've made the trigger to overlap all collisions but still nothing
The perception uses the visibility channel. Turn that off for your trigger volume
it is already set to that:
Base Brain component doesn't implement it. But the BehaviorTree component does
BehaviorTreeComponent is a child of BrainComponent
got it
ahh gotit
So it’s not GAS related or did you have to change what the acronym stands for because of trademarks? 😀
I came here to ask exactly that, thanks a lot!
This time, I answered a question before it was asked @north vessel
(Ignore that it wasn't under the same conditions!)
But still, I tried both StopLogic and RestartLogic before running the same BT (I kind of want to just "restart it") but it stays stuck at the last branch
the first node is a sequence node, I just want to run the branches under that sequence node
but I guess that might be precisely my problem? (using a sequence node as root?)
Hello everyone!
I'm seeking advice on managing multiple AI characters, all using the same Pawn and AI Controller but with different Sight Sense configurations. Is there a more efficient solution than modifying the AI Controller within the BeginPlay function of the Character class?
Same question for customizing per-pawn some Blackboard values
Modifying it is probably the way to go unless you want to use inheritance to apply the changes
Depending on what and how many you're changing, you could potentially use a data asset as the configuration to make it easy to share and/or create new ones
I did say use Run Behaviour Tree to restart it, but now I’m not 100% sure that will start from the top again
So this CanAttackTarget decorator is throwing errors occasionally because TargetActor is none. I could add a check there and I think I will, but what i don't understand is how it can possibly get into that case in the first place, considering that I'm checking in the parent node whether TargetActor is set and it should abort when that's not true
I ended up just telling to to run an empty tree that just has a wait node rather than telling it to stop logic
The parent node only aborts itself. So presumably you'r getting to the attack node, and then later, the reference is being lost. and it's continually using it or something.
If your actor key somehow ends up being none while you’re in that branch (i.e. you destroyed it) and the tree hasn’t had a chance to abort up yet, I could see that happening
This is my question. My understanding was that execution had to "pass through" parent nodes to children each time
The DetectCurrentTarget service clears the target value if it CANT still sense the target. Name's a little misleading I suppose
So that's what's doing it.
Ah right. You can always hit pause and step through each node to debug
In BTs you can even go backwards
Yeah though that's tough because i also have to be the player and escape this thing lol
which is not easy because it's VERY fast and real mean. All my AIs are mean
make them not fast until they work
Put an isValid check in that service, and run a print off the not valid. When it prints, hit pause and step back through the tree
Are they any obvious gotchas regarding nav link proxies? I have a door class that works in one map but not another? Not work meaning the ai doesn't think to use them.
And if this just happens intermittently you can just leave the isValid check in and bypass it that way
I'm rendering my units paths, and it seems to route through the nav link even though the navmesh is separated. So I think it's working from the routing perspective. but the pawns aren't interacting with it.
Check what visual logger says
@dense owl not really sure how to use this thing. what catgory would it be under? AI NAV? Nav?
Prly under the AI controller. Click on those frames and see if it says anything about the nav proxy.
ehhhh I got it to work by just nudging things around but thats super unsatisfying. I could not discern anything meaningfully different about the not working positioning vs the working positioning
Well it depends on the problem. Both ends of the links need to be on the nav mesh. It can't be too high or low from it, because it projects a certain amount to find the nav mesh.
Whether or not an agent actually uses it depends on a lot of factors as well.
@uneven cloud I mean my ground is mostly flat but is there anyway to at a glance confirm that the links have successfully projected? I assumed it would be ok if the capsule was touching the ground. What is it actually projecting to? Because it doesn't seem to be either the ground or the default green colored rendering of the navmesh
There is an arrow that gets drawn when it's successful, the color is based on the area class.
the green arrow?
that appears to be there regardless for me
ohhh shit, no you're right, there's a second black arrow
Yeah it's a second arrow, the default is a really dark green
Hello! I am building the behavior (tree) for a melee fight and I want my agent to determine its next attack based on some conditions (distance from target, other stuff possibly). The only way I can come up with for this is to have one task evaluate the required conditions and commit this decision to the BB and then have another subsequent task execute such decision.
The problem I have with this approach is that the BT is in charge of managing its state (setting and clearing the BB key for the attack decision).
Is there any better way to go about it?
You could have the rules defined using decorators instead in order to choose the appropriate attack branch which contains the nodes for a specific kind of attack
I have noticed that in some cases it may be simpler to just have the logic for selection + attacking outside of the BT, and you simply have a node that says "attack". I don't know if this is the case for you necessarily, but just putting it out there so you know that's also an entirely fine way to do it :)
hm yes in this case i could have decorators to check "am i far away", "am i mid-range", "am i close".. i like this more indeed but it's a bit less flexible because if i want to decide behavior based on more factors i need to start compositing decorators and have one for each type of behavior
but maybe i don't need that much comlexity in my fight
Yeah it kinda depends. You can certainly stack several decorators for the choice
Hi guys
Could you please tell me how can I check what NavArea is under the actor?
I want to trace it sometimes to change actor's speed
I have some objects that my units can utilize as cover. If they enter the box area, they crouch and gain a benefit.
I'm trying to make it so that they prefer to walk near short cover by using a nav area class with a lower cost
But it seems like the modification is going much wider than the collision area of the cover objects
which causes the units to use it, but prefer walking on the outskirts and not actually benefitting from the cover. Anything I can do here besides just adding another collision boundary for the navmesh?
And if I do go that route, how can I stop it from dynamically recreating the navmesh all the time...
because these objects should be static and I would think that shouldn't affect anything. I think it's because I'm checking off "dynmaic object" on the collider. But I want to it to be a static nav area thing.
This part is caused by agent nav radius, you need to create custom ones with a smaller radius if you want the mesh to be snug against your objects. Whether you should be using nav area class for this logic is a diff story
I think you area describing the behavior of the gap in the navmesh around the barrels; not the region of pink lower cost area relative to the collision box that is generating it. Am I wrong?
No, you are correct. That is the part I was addressing
ok yeah. I'm not too bothered by that. It doesn't seem to have gameplay impacts. I'm trying to get the nav area to fall neatly within the collision boxes.
I'm thinking maybe the navmesh is built using tiles that are too big to do this cleanly? This is an attempt with smaller colliders to genrate just the nav mesh
it's decent but inconsistent
That is actually a good way of doing it. I would not at all define the rules using decorators.
BP or C++?
Are you using a nav modifier component? That takes all of the collision into account and by default it extends it out a bit. You can change how much it extends out. Box extent is the variable name.
@uneven cloud Can I get some feedback on this setup, if you don't mind.
Idea is to only request a token if we have a valid target. Then go into the attack branch if it was successful, otherwise do some other thing and after that completes, it should reevaluate the tree, ending up in the position of trying to request the token again. The service is there to release a token only if they have one. It's not actually ticking.
Just a prototype setup.
C++, I need it to be fast. But BP will be good too
Ive checked source code and found a way to find a closest polygon, but I havent finished the solution yet cause nav code is pretty hard to understand right away xd
Project location should give you the nav location, which you should be able to get the area class from. C++ only.
Well, its easy to get projected location, but I wasnt able to find a way of getting the area without going deep into navigation
Could you please tell some more info if you know smth about it?
That looks fine. I would do something other than wander if they don't have a token.. like taunt...but it's a reasonable starting place.
Yeah - I just threw that in there just to have something. It won't actually be to wander
Thank you!
You should be able to get the area class with the NavNodeRef that is included in the FNavLocation
Alternatively, and probably a better option is to do it from the path following component. By overriding the function SetMoveSegment. You can get the area flag from the path points
I’ll take another look later. I think that is what I was using and it was extending beyond the collision boundaries.
I've been told this is a good place to ask about general state trees, seeing as they're derived from behaviour trees.
I've got a state tree that seemingly won't stay compiled. I have to compile it each time I open the editor, or it won't function. Anyone know what might cause this?
Isn't a state tree a data asset like the behavior tree is?
Ah, I believe you're right.
Hi! Thanks for picking my message back up in this sea! So you would let the behavior tree itself set keys in the BB and then clean them up when not needed anymore? Care to explain why using decorators to define rules is not ideal?
Yo folks! I'm working on a queuing system for customers in a bar using smart objects, and unfortunately after packing the project it doesn't detect the target points, in the editor the whole tree goes through without a problem and they queue normally, do you have any idea why this is happening, or maybe what is better to use for such a system instead of smart objets (working on 5.3)
It's very common to set a BB within a BT. Using a service or task. That's a big part of the reason why you have a BB.
Putting attacks directly in the BT means that it increases the BT size, any changes to attacks needs changes to the BT and it is no longer sharable between different AI types. It also makes it harder to debug.
What debugging have you done?
I agree with all of this but I'm having trouble figuring out how to structure a reusable behavior tree that multiple different enemies can use, when enemies can have any number of abilities that want to be used at different ranges, have different targeting considerations, may or may not prevent moving while they're being used, etc. do you have any examples of projects that you or anyone else have publicly available that you think have a good example of a behavior tree that handles multiple enemies with different abilities and range considerations?
Nothing publicly available as no studio would allow that. I explained it recently if you look back at my past messages.
Look up, from Luthage, about determining to use an ability based on EQS stuff
What I didn't explain, is that any ability that does movement is in the ability itself and not in the BT.
does that include movement to make the ability usable in the first place? Like if I don't want my enemy to use an ability unless its within range of a target, I would need to eventually make the enemy move into range to use that ability even if there are other abilities that they could use at their current location instead? would you encapsulate moving into range as its own action in your priority list somehow?
and yeah, doing this now
No. Each ability has a desired range. If the range is 0, they can use it from anywhere. I have a BT task that finds an ability, then they move into range (if needed) and then execute the ability.
How can I make my service instanced ? Right now I have a service that should update a blackboard key per NPC but it seems to update the blackboard key on all NPCs.
How are you accessing the BB key?
And is the key shared in the BB?
from the blackboard component. NPCs have all the same blackboard asset but I assume that its variable will be separatly updates per NPC
i'm assuming that you use EQS for determining where to move, do you do that within the behavior tree once an ability has been selected, or do you determine that during the ability selection process outside the behavior tree, and let the tree just handle calling the select ability task, then moving, then using the selected ability?
A service doesn't need to be instanced to only set a BB key
Are you using a BB key selector? It doesn't matter if they use the same asset. The BB component doesn't actually change the asset.
yes I am using the selector.
Is the key set to be shared?
is this the instance synced ?
Yes
How are you confirming it's updating it in all of the NPCs?
Have you verified with the visual logger that it's setting the BB for NPCs that are not running the service?
not exactly. That might be a good starting point
I use the EQS after the ability has been selected
Always verify assumptions by debugging.
but in order to go a bit more high level. When its NPC creates the brain component and loads the BB Asset, a change in the blackboard Key does not get synced to other NPCs using the same blackboard right ? In other words the value of each key belongs to each controller and is not shared right (unless specified) ?
Correct
The only thing that instancing a service does is allow that service to save variables within it's own class.
The runtime blackboard is an array on the blackboard component, which each AI controller has their own version of.
I see. So changing a boolean BBKey on one NPC does not mean it will change on another one.
Unless it's set to be synced.
can you pass EQS contexts into a query dynamically?
No. You can pass in query params with blackboard keys
https://github.com/EpicGames/UnrealEngine/pull/10874 - this PR from Riot supposedly implements it though 🙏
Hi All - If I just want a branch of my BT to be idle and still (character doesn't move or do anything) is it ok that I just have a branch that when idle it just instantly finish executes with success? The BT is then constantly firing but I'm unsure if that's the intended result or I should have some kind of wait?
I need a little help trying to figure out how to get something to work. I'm working on a small demo for my capstone project. It features two playable characters. Only one character can be possessed at a time. What I'm trying to do is get the unpossessed character to follow the possessed one. I've done that. The problem is that when they follow, they are not facing the direction they are traveling. I also posted this question in my WIP post where I have examples of what I'm doing.
I have tried looking up solutions and tutorials on my own. Unfortunately, I haven't been able to google fu my way out of this.
Any help is much appreciated.
https://discord.com/channels/187217643009212416/1213910377562247179
you mean like... a Wait node?
orient rotation to movement?
Well, do I need to use a wait node or is it ok to be constantly firing the BT and succeeding when idle?
I'm working with 2d sprites. They can only face one of 4 directions at any given time.
seems a bit counterintuitive to just constantly re-evaluate a tree rather than using a Wait, but who am I to judge?
Here's the current blueprint. It's on the parent class to the two character child classes. I'm aware that I'm probably biting off more than I can chew. However, I'm half way through the class, so it's all in or bust at this point. Thankfully, I'm not making a whole game. Just an alpha demo level.
The two bottom functions are what dictate the behavior of the unpossessed character. I found this based on a tutorial.
Nearest I can figure is I need something to plug into the direction x and direction y instructions on the AI Move To node.
I mean, that's a lot of calls to Follow but I won't say you should use BTs, cause I'll prly have the book thrown at me with velocity 5000 shortly after 😀
anyways, there's a find look at rotation node you can use with the target being your follow target and your start being that pawn that's possessed by AI
that should give you a rotation you can rotate it towards
I'll give that a shot. Thank you!
I've tried a this a few different ways. The closest I got was the unpossessed character spinning while the player character walked circles around it.
I still think it's promising, so I'll keep working on it. Thank you again!
My behavior tree doesn't seem to run properly unless I add a small delay before I call 'Run Behavior Tree' on Begin Play. I have an Enum called PassiveBehavior that has both Idle and Patrol. By default it's Idle. In my BT it works fine with a small delay on Begin Play before I run my BT, but if I don't add the delay it runs the Patrol branch even though it shows PassiveBehavior as Idle. Why is this?
Don't do it on BeginPlay. BeginPlay may run before possession
Use OnPossess
Thanks. Ok, so I need to put 'Run Behavior Tree' in my controller then? I had some variables to setup from my AI Component which I save into the blackboard so wanted to make sure I did them before I called Run BehaviorTree
Yes. Controller should be the one doing that.
Thanks. I think my issue is it's starting the behavior tree before my Movement Component has been intialized so it fails when I use AI Move To initially. Looks like I'll need to call my BT once my Movement Component has been initialized.
If you’re using AI move to, it’s at least temporarily possessed by the AI controller btw
Whats the problem? Finding the direction you're moving in?
Should be just like a 3d actor but clamped in angles of 90 degrees
For now i just package the project and i dont have any errors related to smart objects
Have you tried using logging to track down where it's failing?
I already fixed it, the problem was in the nav path, i just build path and this work
I have one more question, how to release the occupied slots after the action with the first customer, so that the queue will start
hey guys, how can I assign the same cost values as area modifiers do but to a proxy link?
changing the default enabled class on the proxy link to an area does nto seem to have an effect, AIs still try to use it, but they never fire the Reached event though..
it works okay on nav modifier areas btw
did this and on modifiers it works, on proxy it doesnt
well thats stupid, seems like its used the point link area class rather than the default one even though its a smart link
I spent the morning working on the find look at rotation function. The issue I'm having is that the animation is not reflecting the direction the unpossessed character is traveling. Here's what it looks like in action. I'll paste the blueprint below.
I ran into an issue that's causing a headache and can't find any good solutions online. I have an enemy that chases the player using AIMoveTo but they keep getting stuck and confused at doorways (Note I don't have actual doors, just door openings) despite me having nav link proxies. It works just fine when they patrol normally so I'm pretty sure it has to do with the fact that they are constantly calling AIMoveTo while also trying to use the nav link proxy maybe? I tried this bit of code form the only real person I saw talking about this problem and tried folowing their fix which didn't work. I tried binding an event to the navlink proxies that would play whenever a nav link was reached that would use a boolean branch to disable the path that activates AIMoveTo for 1 second before setting the boolean back and resuming the AIMoveTo, but it's not really working. Any ideas on how to fix? I'm planning to move into learning better ways to make AI than just blueprints but this is for a class project I'm working on and I haven't had a chance to learn either Behavior Trees or State Trees.
My navmesh and AI are working fine in PIE but when I playtest using a testing packaged build it says the Nav Mesh Needs To Be Rebuilt and the AI wont even move. What am I doing wrong? and how can I fix it?
What are you nav mesh dimensions?
Varies from level to level but max is probably like 100x100x100
I found a tutorial that mentioned if a nav mesh is too small, it won't work. I'll find the tutorial and link it.
bDrawPolyEdges=False
bDistinctlyDrawTilesBeingBuilt=True
DrawOffset=10.000000
bFixedTilePoolSize=False
TilePoolSize=1024
TileSizeUU=2048.000000
CellSize=64.000000
CellHeight=10.000000
NavMeshResolutionParams[0]=(CellSize=128.000000,CellHeight=10.000000,AgentMaxStepHeight=45.000000)
NavMeshResolutionParams[1]=(CellSize=64.000000,CellHeight=10.000000,AgentMaxStepHeight=45.000000)
NavMeshResolutionParams[2]=(CellSize=20.078432,CellHeight=10.000000,AgentMaxStepHeight=45.000000)
AgentRadius=31.000000
AgentHeight=464.000000
AgentMaxSlope=44.000000
AgentMaxStepHeight=35.000000
MinRegionArea=0.000000
MergeRegionSize=400.000000
MaxSimplificationError=1.300000
MaxSimultaneousTileGenerationJobsCount=1024
TileNumberHardLimit=1048576
DefaultDrawDistance=5000.000000
DefaultMaxSearchNodes=2048.000000
DefaultMaxHierarchicalSearchNodes=2048.000000
RegionPartitioning=Watershed
LayerPartitioning=Watershed
RegionChunkSplits=2
LayerChunkSplits=2
bSortNavigationAreasByCost=True
bIsWorldPartitioned=False
bPerformVoxelFiltering=True
bMarkLowHeightAreas=False
bUseExtraTopCellWhenMarkingAreas=True
bFilterLowSpanSequences=False
bFilterLowSpanFromTileCache=False
bDoFullyAsyncNavDataGathering=False
bUseBetterOffsetsFromCorners=True
bStoreEmptyTileLayers=False
bUseVirtualFilters=True
bUseVirtualGeometryFilteringAndDirtying=False
bAllowNavLinkAsPathEnd=False
TimeSliceFilterLedgeSpansMaxYProcess=13
TimeSliceLongDurationDebug=0.002000
InvokerTilePriorityBumpDistanceThresholdInTileUnits=1
InvokerTilePriorityBumpIncrease=1
bUseVoxelCache=False
TileSetUpdateInterval=1.000000
HeuristicScale=0.999000
VerticalDeviationFromGroundCompensation=0.000000```
Quick tip on getting AI movement to work in 2D games in Unreal Engine.
Why are you constantly calling Move To?
I figured it would keep them chasing the player, unless there's a better way
Move To is a latent node. Meaning you wait for it to end. If you have it move to an actor, it will automatically adjust when the actor moves.
Constantly calling it, means that it will constantly try to repath. Which is not just very expensive perf wise, but make nav links not work.
what would be a good alternative, considering the pawn sensing calls constantly?
also the downside is it's a chase thing so if the player runs a different direction and it isn't updating it won't follow them
performance wise the game is running fine currently
Are you using Pawn Sensing or Perception?
Why are you using the deprecated pawn sensing? What does it matter if it's being updated?
May I ask where you found that?
sorry for not knowing immediately
Because it's long been deprecated, just not with the official deprecation tag
AIPerception supercedes it and should be used
Which ones?
youtube, I'd have to pull them up
I already told you that moving to an actor automatically updates the path when the target actor moves.
Please do. I'm very interested in knowing. Because this is a recurring thing.
gotcha, didn't know that
Honestly I doubt we can do anything about the trash tutorials on YouTube
Hey guys, in today's video I'm going to be showing you how to create an AI which can detect the player through sight and then start chasing the player. The AI will chase the player until they are out of sight completely.
#UE5 #UnrealEngine5 #UE5Tutorial
00:00 - Intro
00...
this is one of them
Oh Matt...
Just gotta bind a macro to auto reply “use AI perception, pawn sensing is deprecated”
Most, if not all, of the tutorials people post here use it. It's a problem with hobbyist tutorials. They learn bad practices and then make their own tutorials using them.
his explanations were pretty bad but the thing he showed worked so I figured that would be fine
Technically get actors of class Actor on Tick also works 😀
I just wanna build my database of teachers to tell people to avoid.
Pin #1: before you begin learning #gameplay-ai , unsubscribe from the following “content creators”
It's literally all of them outside the official courses.
is the perception thing able to be done through blueprints or is it behavior trees?
The perception component is separate
ah
Even me? 🥺 (I have 1 video on UE and it's about the compatible skeletons feature, lol)
😈
That's not AI
I saw someone post a course on Reddit that said it was a "Pro course". Not only was the teacher not actually a pro, but the AI section included using the pawn sensing.
Jeebus
I appreciate the heads up
Blind leading the blind
It took seconds to find the "teacher" on LinkedIn to find out he'd never worked at a studio or shipped a game.
Unfortunately, most people aren't going to look them up.
Well, the algorithm doesn't favor proper learning to be honest. Because it wants short videos. So that's what people make. As well as people not wanting to watch a video for like 40 minutes to actually understand something.
What's worse, is that our designers also use these shit tutorials and break things all the time.
Apparently they "fixed desyncs" by using a node that makes the server wait. Caused a bunch of problems.
Designers and networking. Scary combo.
Unless the designer was also a networking engineer, lol
So, Luthage, Decorators and Services both have OnBecomeRelevant and OnCeaseRelevant (or w/e it is called), why prefer using services over decorators for OnCeaseRelevant? And do decorators execute before services?
I prefer using services, but really only for clarity.
I haven't needed to know which one would fire first, so I've never dug into it.
Is that because services really should be used to operate on data pretty much? Where as decorators act more as "gates" so to speak?
We keep decorators as only conditions, so the tree is easy to understand for the entire team.
Where as services happen while the branch is executing.
Gotcha
The question only came about because I was going to put a service that dealt with doing something with data on a node, but that node was also going to have a decorator that read from said data. Ended up not going through with it because it felt weird - but it got me thinking about it.
So the data had to be valid pretty much (which is what the decorator was going to be checking) and the service was going to be doing things with the data.
As someone also starting out, I would also appreciate this. Although, better yet would be a list of good teachers. 🙂
Unreal is a beast of an engine, the list of good teachers is quite slim pickings.
I'm noticing that. I'm struggling hard with the thing I'm still trying to fix. Didn't help that part of my class wanted me to hook up to github. Doing that damn near broke things on its own. I managed to get back to where I'm stuck though.
I'm not hating the engine by any stretch. Granted, what I'm trying to do with it might be akin to shoving a square peg in a circle hole.
Doesn't help that what I'm trying to do is a 2d top down demo, but all of the tutorials are 2d platformer.
I just need it to hold together until this class is over. Then I can go back and take my time to do the things.
XD
No, it's just me. The class is called Applied Software Practices. Unfortunately I didn't really have time to really research what I wanted to do, so I painted myself into a corner.
Basically, everyone got to pick their own project. This one's on me.
However, I wouldn't mind looking converting this to HD-2D if I redid after the class.
Or going full 3d since I won't be in such a time crunch.
If it's not apparent, I'm a dive into the deep end type of person. Thankfully, I'm only endeavoring to make a crude demo at best.
So why would a nav mesh work in PIE but require to be rebuilt in a packaged test config build? My AI chars won’t move…
Sometimes you need to delete the nav mesh actor(s) and rebuild it.
Worth a shot, thanks
Maybe it got all screwed up since I made changes in the ini config but didn’t go around to each level and let it rebuild…
Just went straight into another test build
yes when i scale up my ai to 450x y z
the wpon does no damage
weapon
but smaller scale it does
is it the sockets?
even if it hits me still no damage so im assuming sockets could be the issue?
did you mean to post in this channel?
Why would you assume sockets would be the problem for a collision issue?
Hit collision
ik little about montages but not sure how that says you actually hit something
That's an animation montage, not collision.
That tells us nothing. It's an anim notify. Not how the collision is set up.
Is this a plugin? Because that's probably one of the most ridiculous ways I've seen collision set up.
and if it's a tutorial, by all means let us know who the creator is so we can build the no-no list lol
I have so many questions. Like why are VFX and SFX being triggered on the server? And do you know that server RPC functions don't work on NPCs? Or why are you making a collision component dynamically? Or why does the character have a component for AI behaviors?
The easiest way to debug collision problems is to use debug drawing. I'd use the visual logger and debug out the collision shape that it makes. Maybe turn off hiding that collision component in game.
Hi. I am working on a goal-oriented planning extension, which I want to integrate into UE5. In my program I represent agent state with an array of ints. This is done due to simplicity and it is suitable for 95% of my situations. However, when it comes to a parameter showing agent's current position, I am pretty stuck. As my agent will use Unreal NavMesh for movement, I wonder if there is any bi-mapping int<->position? I only need agent's position to measure how far an object is from the agent, so a little approximation is allowed. Maybe, I can use the id of the closest NavMesh node or something?
Hi, the "Move to" node in one of my behaviour tree is not working, i was able to narrow down the cause to the fact that i had too many AIControllers spawned in a scene but i cant find a fix for it.
If your using crowd avoidance you can increase the agent limit
it was the solution, thank you
If I have actors A, B, C and I want them to approach an arbitrarily shaped mesh such that they walk towards the nearest edge, how should I do this? I don't need a globally optimal solution or anything but I'd like it to be decent.
-
I've tried move to actor, but they really want to move towards the center of the object, which in this case may require going around it
-
I've tried cast a line from the actor to the mesh and going to that point, but this seems to introduce a fair bit of randomness in terms of where they go...
I'm contemplating ignoring the nav system entirely and just drawing my trace and then applying root motion towards it until a trace suggests they're right against it.
you could try using the bounding sphere I guess and take the closest point on the sphere?
if that doesn't put them close enough you could probably do a linetrace from the closest sphere edge which might give a better result
I have the point. My issue is that telling the actor to get there seems too finicky
Like, when the object is very thin, the ai can't tell if it should go to the left or right side even if I provide a point
maybe I could just peel it back a little bit...
I modified the Agent Radius of the recastNavMesh-Default to let the npc move through doorways, and it worked the first time I tested it but after that I started getting an error saying "NavData RegistrationFailed_AgentNotValid" and the npc won't move anymore. I'm not really sure how to fix it, but I'm digging around. Any ideas?
is it actually possible to make an ai use the navmesh of a different nav bounds volume?
actually, a better question, can you restrict which ai can just walk through a NavArea volume and which cannot?
You can by using a nav query filter, you can specify which one to use on MoveTo nodes and such, and I think there might also be some default filter on ai controller
hmm
this is funny.... my custom navArea blueprint ain't showing up for some reason
doesn't work either
the default nav areas work fine
but the custom one does absolutely nothing
idk why
Hey, devs!! I am trying to rework a problem I asked quite sometime back, and now I am focusing on the pathfinding... so here it goes:
A spiral track for the enemies to move
And I want the enemies to not go out of the path and also the player shouldn't be able to place buildings on the path... I can use splines for the enemies but that doesnt take care of the building placenent... if it was a straight path than I could simply add a navmesh bound and change the collision settings on it... but I cant do it
the image is for the ref
edit: I found this tut to be useful but am not sure if there is any better way to do this:
https://www.youtube.com/watch?v=7CYSoJYpKtU&ab_channel=GamingDev2020
Create custom shaped NavMods, by drawing out a custom brush with the pen tool first and then converting it to a Navigation Modifier Volume. Learn how to do this technique for both Unreal Engine 4 and 5.
Check out how to use NavMods for different Area Classes and Query Filters:
https://youtu.be/vzvOM--Zv0I
Need help optimizing your NavMesh?
htt...
yeah so I'm blocked
I can't use my own custom nav areas anymore
cause it doesn't work
default ones do but mine don't
Using splines I think it should work. You can definitely check if your player is attempting to do anything that overlaps it and prevent it
but the track is broader than the spline... which would mean that if not on the splines than I would be able to place them right next to them... innit?
unless there is a way to broaden it for every segment
But what determines the width of the spline? Probably a mesh reference on the spline itself? Or maybe a variable. Either way you can query that value from your spline actor
And ensure that nothing is built within those bounds
Maybe share your Navarea BP
currently I dont really have anything to represent the spline width since the path is just represented by a different material on the landscape and nothing else... if I get your point correctly... should I add some kind of a mesh or collision bounds on the spline and use that to check collisions against the buildings?
@silent hamlet it has no blueprint setup
Just the cost values
And a color parameter
It doesn't necessarily have to be a mesh. It could also be metadata of each spline point determining how wide the path is at that location.
Forgot to tag you. Reply above is for you ofc 😁☝️
never really dealt with splines so much but I will give it a go
Ah I see you don't have a custom navdata. Looking at your picture indeed it seems something is wrong, just placing the nav modifier volume should prevent generation of navmesh...did you change the default values somehow?
Before a crash, the modifier was working just fine after setting the entrance cost to 1
After that I was tryna see in the navigation system if I could create a new Navdata blueprint
After clicking the + sign, unreal crashed for no reason
After reopening the project, the custom nav area stopped working
And the ai was also moving right through it no matter the value of the cost
Did you try reproducing the same setup in a new level?
And rebuilding navigation data
Is there a system by which I can force an AI to perceive a given actor?
Normally my AIs just use AI Perception like you're supposed to, but in the case when the AI is spawned in response to the player stepping on a laser wire or something, I want to IMMEDIATELY tell the AI to target the player.
Trigger box, on overlap get the controller(s) you want to alert, get BB, set target key
Oh sure all that's easy but the problem is that since the AI can't actually perceive the target, it'll assume the target's invalid and clear it, same as how it would if the player managed to run away
I don't want to override or invalidate the AI Perception system, just like.... give it a hint.
What you mean by invalidate perception? The two systems can co-exist with no issues
That's true but when they disagree one has to win
Normally my BB key is set based on the AI Perception status, so that's the source of truth.
But what you mean disagree? Either perception sees the target first or your trigger. Whoever comes next will just re-set an already set key
There's already a system that you can use that has arbitrary types to describe AI state. Why don't you use that?
My GOAP api was developed away from UE, I niw want to integrate it...
You're going to have a lot of problems with only using ints to describe AI state.
For instance? I guess my scope is pretty small...
But there's also the other side, unsetting a target. Usually if the player breaks line of sight and gets far enough away, they can hide from the AI.
To be forgotten it has to be seen first. At that point the perception system takes over and the trigger does not matter anymore
That's true in theory but not in practice. I've had bad experiences with OnPerceptionUpdated so instead I have a BT Service which periodically checks specifically whether the current BB target is currently percieved, which it wouldn't be
"Bad experiences"?
But then what's the scenario you don't think will be handled? Say your target is now hidden from the perception system. The key is unset. As soon as it becomes visible again it will be re-set.
I mean, it's not a story, it just wasn't triggering when I thought it should
If it isn't triggering when it should trigger then something is misconfigured
Manually checking if something is perceived won't make it perceive something that isn't getting perceived by on perception updated
Note that I'm not saying that periodic manual check is a bad way of doing it - it certainly could be valid depending on how you want it to work :)
- Manually set BB target
- Behavior tree reaches node with target update service
- Target update service checks whether the current target is being perceived
- Since target was NEVER perceived by the AIPerception system, check is false, so BB target is cleared automatically
That's the problem, I can set it manually, but it'll just get cleared instantly
I mean, clearly, but I couldn't figure out what. Eventually I abandoned that and tried something else, which worked
oh wait is on perception update the one which gives you an array of stuff?
that one's a big newbie trap as far as I can tell :P
the one which gives you just one single actor's perception info is much better, maybe that one was on actor perception updated
Have a decorator check if a target actor is set
Independently of what is setting it
Way ahead of you. If there is no target set, it won't even enter the persuit sequence.
That doesn't solve the problem where ConfirmTargetDetection then removes that target when it cant confirm detection
I like how I misspelled "pursuit" there even though it's obviously correct in my own code
Are you checking currently sensed or known? If you know C++, I recommend making your own sense for this. They are really easy to make.
Hmm it's a bit of a weird setup...the decorator is on the same level as the service that's setting the key being evaluated. Ideally you should have that service one level above this. But in any case, when target is out of sight, you unset the key. The ai correctly has no target. It will lock it back when it becomes visible or when it enters your hypothetical trigger. I still don't understand where is the problem!
Or you want that when insider the trigger the target is visible independently of the perception system not being able to see it maybe?
I'm using GetActorsPerception, not sure the internals of that one. I do check if it's known, ignore the stim strength stuff I use that elsewhere it's not a filter
I want to FORCE the AI to detect the target EVEN THOUGH it otherwise cant
You are using currently sensed and not known. I don't believe that is available to BP.
seems like it is in a way?
But you have to pick a specific sense and go through an array
At the end of the day, I still recommend you either make a new sense or send a fake hearing event. Depending if you are using hearing for different functionality
Then I think you need to rework the forget logic. The first thing that comes to mind is to prevent the service from deleting the target key value if the target has been spotted via trigger
Nope! And I can just use Contains on the array
Actually faking an event on a sense I'm not otherwise using is a good idea, I could force a damage event or something. Touch event, etc
That couples things a bit though. But for what you want to achieve you can't just unset the key if not visible anymore
I don't think I need to actually DO damage to have a damage event
It's a better approach, because you can use it for other situations. Let's say you want NPCs to also call for help. If you go with the "rework the forget target" approach, then you also need to rework it for anything else you add.
The problem with the fake sense is that it will be forgotten by the logic you have in place..I think a lot of your problems come from your custom service
It wont be forgotten if the SENSE remembers it
@uneven cloud are you aware of any usecase for the on perception updated function that gives an array? I never quite figured out when that would be beneficial to use over the one which gives you a singular actor's stimulus update
Ah right!
So indeed a custom sense could be good for this!
I don't use either. I use the EQS and the generator that grabs perception targets.
Actually I have some questions on this node. Like, should the Event Location be the location of the actor that CAUSED the damage or TOOK the damage? Also do I need to call this manually in the case where the actor ACTUALLY receives damage or is it smart enough to link to event ReceiveAnyDamage on some deeper level?
Ah I see :)
Sorry for the non answer. I just like the flexibility of the EQS for target selection.
Yeah no worries, it's not really an issue or anything that I'm facing, was just curious because I can't think of any usecase for the func :D
That entirely depends on how you want it to work. The event location will be set as the perception location. If you don't even use it, then it doesn't matter.
And it seems a lot of beginners end up trying to use that function, and inevitably struggle with it because it doesn't seem to always behave quite as predictably as the one which just gives a single stimulus value
Oh it actually HAS a hit location value if you expand lol
You do get all actors that had been updated, so you can use it for target selection. I just don't think it works well for that. Specifically since I use known instead of currently sensed.
I guess it's a "bird in the hand/bush" scenario. Should the AI chase a low-priority target it can currently see, or a high-priority target that is merely remembered?
Using known means they can remember the target for the amount set on the config. So momentary breaks of line of sight doesn't make them drop target.
There's also no reason you have to do target ACQUISITION and target UPKEEP with the same function, I have different services for initial detection and for continual pursuit
I just use the EQS for both. Don't even have to make a service for it.
Luthage's advice to most things 😅
Only for things where it makes sense.
Dumb question, I notice each sense has a "Debug color" how do you like.... see that?
The gameplay debugger. Apostrophe (') while playing the game and use the numpad to turn on the perception category
Hey all, quick question. How would one go about changing the size of the debugging spheres for EQS results? If it's possible at all 🫠
You can only do it by editing engine file, as far as I know.
Thanks for letting me know :)
looking in to state trees, and wondering when evaluators are updated if not run on tick?
@silent hamlet it looks like the custom nav area got bugged out cause of that crash
so I made a new nav area and it all works fine now
I don't think thats sight....
ah wait no, now I see it
I expected a cone shape
but its actually a flat cone in the debugger
anyways, for some reason the sight perception isn't detecting the player
here's the setup
normally it should fire just fine
but it doesn't
oh, right
target also needs an ai perception stimuli
oop, and also forgot Sense by Affiliation
what does it do?
I wish it was possible to manipulate the "Use Acceleration Using Paths" through blueprint....
this forces me to create a custom blueprint that changes the moving speed depending how close it is to the target
its a weird delegate system, at most simple level
BrainComponent and other AIModule classes listen for AImessages
I don't think it's really used all that much anymore either.
is there a way to share EQS results?
its used in a few important parts
but I dont recall where
I still see comments about needing to finish it.
The only one I remember is the BT task move to, but they changed that to be an AI task and waiting on a delegate in the path following component
hi wondering where i would best start on creating ai enemies for a 2dd platformer
There's a pinned message here with a link to the AI with Blueprints course
This is probably a dumb question, but is AI via Behavior Trees and EQS more resource intensive on a packaged product than something like AI Move To? I'm struggling with the latter, and think that EQS will probably solve my problems, but was hoping I could produce something for mobile and don't know if it's ill-advised
