#gameplay-ai
1 messages Β· Page 25 of 1
Well the problem is getting him to detect the foliage tree to go to it and transform it into an actor.
That's what I am working on right now. I'm gonna attempt it with the perception system though.
Yeah I was gonna say if you cant get eqs to work, you could use a pawn sensing component to get the nearby actors and their locations
Yeah EQS failed. It detects all the foliage at once rather than an instance.
You'd need to create your own generator and return locations and not actors.
sounds like a classic example of A* node pool exhaustion. The A* implementation pathfinding is using relies on a pre-allocated pool of nodes to limit the perf cost of pathfinding's worst case scenario - that the path doesn't exist. There are ways to increase the pool size, but it's not a good idea for perf reasons.
Partial paths are the good substitute for super-long paths. I'm guessing that your case of "going in a straight line" results from the path being, well, straight, and the AI optimizing the process by moving directly to the last location.
In general, very long paths are not good for AI - lots of resources used to calculate something that would take minutes to execute, while very often gets interrupted in seconds.
Hi, may I ask how to use GetRandomReachablePointInRadius in C++? It requires a UNavigationSystemV1, but where can I get that from? Is there anyway to like just get the NavMesh it is standing on to find a location?
https://docs.unrealengine.com/4.26/en-US/API/Runtime/NavigationSystem/UNavigationSystemV1/GetRandomReachablePointInRadius/1/
Finds random, reachable point in navigable space restricted to Radius around Origin
something like this:
UNavigationSystemV1* NavSys = FNavigationSystem::GetCurrent<UNavigationSystemV1>(World)
if (NavSys)
{
// getting navigation data (usually navmesh)
ANavigationData* UseNavData = NavData ? NavData : NavSys->GetDefaultNavDataInstance(FNavigationSystem::DontCreate);
if (UseNavData)
{
// performing the query itself
bResult = NavSys->GetRandomReachablePointInRadius(/*...*/);
}
}
Hi everyone. Im looking for a person familiar with Reinforcement Learning and possible experience with MindMaker plugin for UE4/5
https://github.com/krumiaa/MindMaker
I have questions related to server architectures for multiplayer game utilizing RL algorithms for AI and would like to discuss them even if its just theorycrafting at this time. Its a lengthy discussion so i will keep it off this channel, but if anyone has experience with RL in UE4/5 please do dm me!
Thanks!
Hello everyone!
I have an EQS that returns a set of locations suitable for cover positions. I want to ensure that two characters do not use the same EQS result. Currently, I have the following approach:
- A subsystem bakes all the "cover locations" and stores the results in an array.
- The behavior tree sequence includes a service that reserves a location from the subsystem when it becomes relevant (
OnBecomeRelevant) and releases it when it is no longer relevant (OnCeaseRelevant). - When running the EQS, I query the subsystem to obtain all the available positions.
Is this a good approach, or is there a simpler solution?
that's a good approach. I'll add a fallback failure when an AI wants to claim a cover but it's already been claimed (this can happen when multiple AI agents use the query at the same time) - AI will need to rerun the query in that case.
Thanks! Ah indeed, this might happen
By the way, is there kind of concurrency system in Unreal, such as mutex? I don't find anything in the doc
How to get BTTask MoveTo work properly? I want to bots to reach exactly the destination before switch to other tasks. Most of the time, the bots either stuck at MoveTo task or they switch to other tasks before reaching checkpoint. Much appreciate for the help.
there's a lot, depending on what you want to do. For AI there's no concurrency out of the box really - everything is taking place in game thread.
It sounds like you need to rework the priority of tasks in the tree and/or observer aborts. It also might be possible that your acceptance radius is too high so the AI considers the tasks finished before getting to exactly where you want to go
I think a high acceptance radius would only make the AI stop within that range of the goal location, but yeah thereβs something wrong there. Normally, the MoveTo waits for success to complete
Can i get into a call with someone who knows about AI Spawning Coz im useing a blocking volume to spawn my enemies and when i walk through it, the AI breaks when it spawns.
Ho do I get an AI to orient a pawn towards the target location?
You'd think the path component would be what it orients to
Anyone have any clue why my PlayerObject blackboard key being unset is not causing the behavior tree to continue here? Ignore that move to node, it being there is unnecessary
Out of range and in-range, but the blackboard based condition doesn't seem to care
Just tried setting it on the sequence which results in the same behavior
are you just trying to make him lose sight of you and stop following?
Yeah once he gets so far away
More or less trying to understand why the behavior tree isn't detecting the blackboard key changing
does it ever reach the end wait node? it didn't look like it's exiting your task at all in your video
oh
nvm u did that
It only does when it hits the acceptance radius in the task, I'm not sure how to get it to cancel once the player hits a certain distance away
are you using the MoveTo node because you want to be able to change the range?
No I removed the MoveTo node (if you're talking about the one in the BT)
try unticking lock all logic, that might be telling your tree to stop doing anything until the move is complete
the task I meant
Ah
I was mainly using that for the smooth following, if I set it to a location he walks to that location, then the next, etc. Doesn't look like he's actually following the player
turning off the AI lock results the same
I didn't mean use the location
I just meant the BT's move node is prly better to use, unless... you need to change the acceptance radius on a case by case basis, in which case you don't have a way to do that within the BT node
I don't mind trying that
I'd also recommend starting the game, then selecting the debugging object in the task itself, see if the code flows to where you want it
You aren't cancelling the move functionality when the BT node gets aborted.
Like call a stop movement on EventReceiveAbort?
Do AI Controllers use the same MovementInputVector that player's use?
Interesting, I did not know you guys implemented that in your A* search - makes sense
I tried to increase the tile size but for some reason that is still resulting in an invalid path
and for some reason it now even happens with partial paths enabled
like somehow just changing tile size alone breaks the entire navigation, but still no errors in viz log
ok I restarted the engine and it was still broken, but then I restarted it one more time and it worked
Idk what's up with AI and ghost bugs, I always seem to get them
it is very antagonising, also for some reason even after getting down to only like 500 tiles I'm still running into the exact same issues
Well, I should study how threading works in Unreal. Currently, I don't require a specific model, but I was concerned about the possibility of concurrent access issues when accessing a (singleton) service through my Behavior Tree.
I'd say it works the same as multithreading outside Unreal (in the sense that the same constraints and issues apply), Unreal just provides tools such as the task system etc to launch multithreaded code.
There are also limitations to interactions with UObjects, probably everything that changes the state of the game thread cannot be written to directly
Thanks for your answer, I worked with engines where the scripting language (for GPP) is actually multi-threaded. So, for any API function that you wrote in C++, you had to lock a mutex.
In Unreal, if I understand correctly, by default, all the behavior task run synchronously on the main thread. Am I correct?
I would assume that
out of the box behavior trees are single-threaded. You'd need to do some serious work to change that first. Unless you really need MT BT I wouldn't worry about access patterns.
Hello ! π
Do you know if gameplay tag are supported as bbkey value ?
yes they are (or rather tag containers iirc)
So I have to store a Name bbkey right ?
We dont have a gameplaytag bbkey right ? Well gameplay tag store a FName in the end so I guess I could do what I want with that
why would you use a FName if you can have a tag container?
you just put the tag in the container
Is it possible to make an unreal engine environment like an open ai gym environment
I dont see any tag container value as bbkey
Yup
they're gameplay tag containers, even tho it says gameplay tag, but the container is just a wrapper for several tags
Really weird I dont see taht
oh wait
you might need to enable GameplayBehaviorSmartObjects and/or GameplayStateTree plugin
quite possible that one of those adds them as feature
my bad, sorry
Hmmm I see thanks !
Hi, are there any AI Crowd Separation experts here? I am using the crowd following component instead of RVO, but it doesn't seem to work... I tried setting the CrowdFollowingComponent Settings like this CrowdFollowingComponent->SetCrowdSeparation(true, true); CrowdFollowingComponent->SetCrowdSeparationWeight(0.f, true); CrowdFollowingComponent->SetCrowdObstacleAvoidance(true, true);
I just see it is in gameplaybehavior module do we have some doc about the goal of this module ?
that's the smart object one?
i think they added it because smart objects utilize gameplay tags a lot, and therefor it's kinda required for them to be available to AI Behavior Trees
Ok I see IDK if, since they separated it in another module, they would have thought about user usage in the future or not , anyway thanks for the link and the support πe
well, i won't be afraid that smart objects are gone soon... they seem to be a reasonable engine feature to stay
SmartObjects are here to stay. They're already extensively used internally and are one of the core technologies in one of unannounced projects
Yeah yeah I agree with you what I was trying to say is that they created multiple plugin/module for smart object. But, it looks like the feature that interested me is in a separated module called "gameplay behavior" and I was wondering why Epic makes this separation. Probably because they forecast some other usage of this specific module stuff in the future
we split things up for multiple reasons. Modularity enforces better API, for one, overridability, and compile times (when working on that code).
Yep I forgot to mention that part ^^ But since the module name was quite different from "Smart Object" I was wondering if you were forecasting other usage, anyway thanks for your answer π
Dear Unreal Engine Support,
I hope this message finds you well. I am reaching out to seek assistance regarding some issues I am facing with the State Tree and EQS integration in Unreal Engine 5.2. I would greatly appreciate any guidance or solutions you can provide.
My specific problem revolves around utilizing EQS queries within the State Tree system. Here are the details of the issues I'm encountering:
-
EQS Query Integration: I am uncertain about the proper method of incorporating EQS queries within the State Tree. I have created the necessary EQS queries, but I am unsure how to utilize the query results to drive state transitions effectively.
-
Accessing EQS Results: I am encountering difficulties accessing the results obtained from an EQS query within the State Tree system. I am unsure of the appropriate method to retrieve and utilize this data within the State Tree's state nodes.
-
Updating EQS Queries: I would also appreciate guidance on dynamically updating EQS queries within the State Tree. For example, I would like to modify the query parameters or change the test conditions based on certain events or conditions during runtime.
-
Running next states like moving to actor it seems that never move to that state to next state like wait or other action state. The moving state which is a child state from the find actor EQS state never end repeating but if I make sure to add succeed or fail on tick do not send over the actor but do not repeat.
I've just started down the path of learning AI stuff a little more indepth. I have a question specific to BTTask node instancing. I've just learned that you can choose to not instance a task by making a C++ version of it.
I'd like to ask what sort of things you should NOT instance? Where should I be drawing the line? What is safe to remove instancing and what is not in general?
Well, from what I've learned from @uneven cloud's battle experience is that instancing can cause major performance problems. So I'd say do w/e you can without instancing (if you're being perf'd blocked). So far, I haven't had a need to use instancing (though it would make some things easier). Admittingly, I do have a pretty simple game thus far and have no complex enemies. But Luthage could probably give a better response than this π
Instancing means BT node will be NewObject'd each time BT spawned
I'm aware of what it means, that wasn't my question.
Its the answer of the question too though
You don't have to instance anything. I work on AA and AAA games and none of our BT nodes are instanced, because the cost of creating them every time is too large.
There are things you do need to take into consideration. There is node memory to save data. If you want to wait for something to complete, such as waiting for an ability, should be done in an AI task.
Why is instancing the default then? What benefit would you ever get out of instancing a task or decorator?
Its not default, its mandatory for BPs
C++ tasks are not instanced by default iirc
It doesn't seem to be for non BP nodes. What makes it mandatory in BP nodes?
Because when its not instanced, BT only creates "skeleton" objects and all instances of the BT using same skeleton BT nodes, which means you cant mutate data freely
BP cant construct a struct and work with its pointer unlike how you do in C++
and there are latent actions that BP graph needs to track
those requirements enforce instanced option on BP objects
Luthafe ofc knows better but from my experience instanced is a problem if instanced tasks bloat GC and if you frequently spawn BTs
I dont see it as pure evil
hi chatgpt prompt
have an input param on state tree tasks and pass the EQS query to them, and literally just do the work there? if you already did this, can you explain what have you tried and didnt work so far?
Hmm. Food for thought. π I'll have to think on that. Not a fan of writing everything down into C++, but could definitely easily do that for a majority of more generic nodes. Specially decorators.
Anything regarding performance depends on what you are doing and how much you are doing. If you have a lot of NPCs that do complex behaviors, then you are going to run into load time issues of instancing nodes and runtime issues of making them in BP.
Yeah, that was what originally led me to this. π Actor spawn costs being rather high and AI node instancing taking about 75% of that time.
Rn I am happy to have picked state trees for our AI (sorry @midnight scroll must be difficult refactor)
I use those in 5 on my personal stuff. This project is in 4.27 and probably isn't moving to 5.
yeah I know. I hope you solve those issues with BT though, probably moving some logic to C++ etc helps a lot
Hopefully. π You're also in their discord, so progress will probably be posted there.
yeye π
gl!
Hey guys, I am looking for an up-to-date tutorial/resource to learn as much as I can about AI. So far, I have found 2 tutorials that have been looking good to me, which are:
- https://www.youtube.com/playlist?list=PL4G2bSPE_8uklDwraUCMKHRk2ZiW29R6e
- https://www.udemy.com/course/perceptive-ai-in-unreal-engine/
Which one of these do you think is the better one? Are there any better tutorials?
Thanks and looking forward to responses :))
What is a reasonable way to discourage my AI from moving between the player and the camera (3rd person camera)?
AI with Blueprints on the official learning site is going to be better.
By selecting places to move that tests it. Using the EQS makes that easier.
Ah thanks for responding, but while that's fine for destinations, but I was more hoping I could find a way to modify the path cost
Yes.
thank you so much :))
Typically the simplest solution is the best. Modifying the path cost would need to be updated every time the player or camera moves.
Fair enough, thanks for the advice!
sorry to ping you again, but if this were the problem, then theoretically limiting the number of tiles would fix this issue right? Like if I only have around 500 total tiles, it shouldn't hit that node limit
so it makes me think the issue is something else
Hello. Check out this website that turns text prompts into 360 photos: https://skybox.blockadelabs.com I just found out about it today.
This is not that kind of ai channel, more of a #lounge thing
Unless the pre-allocated pool of nodes is not tile dependent?
Oh I thought nodes and tiles were referring to the same thing
The default A* pool size is 2048 "nodes" and each node is a nav poly not a tile. 500 tiles will be a lot more polys (how much more depends of tile size and complexity).
oh ok, so a tile consists of several nav polys, and that's what the A* search is using
My perception component seems to be registering my Spectator Pawn in the On Target Perception Updated event. Is this to be expected? Is there a way I can ignore the spectator pawn from all perceptions? (This only appears when I run Simulate.)
Ah, it seems this is a potential solution:
[/Script/AIModule.AISense_Sight]
bAutoRegisterAllPawnsAsSources=false
yes
I've a general question - if I have a behavior tree which is shared by many different characters, how can I vary numeric values on the tree between characters in a clean way? For a lot of the default nodes the numeric value (such as wait time) is tied to the node/tree rather than to the character. I want to share the behavior, but not these parameters. Can anyone give me some advice?
Use this and set the time as a blackboard value
Ah, thanks, that's a start, but on that note - How do I set default values for blackboard keys?
you can make a task that sets the value to whatever you want
just fire it before the sequence starts.. you can make the task set the value to a custom wait time for example thats gonna be customized depending on the character possessed
Mm, so its not possible to set them before runtime?
If youre not yet running the behavior tree, then what would you need the values to be set for? Make a task that starts when the behavior tree starts which will set the blackboard keys to your desired custom values
you can use decorators too
you can store the default values in your save file or your preferred blueprint, and then just "load" them from there into the blackboard keys with a task or a decorator when the behavior tree starts
Ah, well, its more about keeping things clean/ DRY, I'd prefer not to have to make another task that has to pull configuration out of some other asset to pass to the blackboard. If that's the way to do it, then that's alright, was just interested in alternatives. Thanks for the explanation π
Im not very good with AI yet so maybe there is different way, someone else should say if there is :D But this is definitely how I would do it. Imo this actually IS cleaner because you have a more practical way of controlling the defaults and custom values, if you store them in one other place all together
I have a simple question of my own too, maybe you or someone else can help :D How can I make my own custom move task wait to be finished before moving on to the next task in sequence, just like the default "move to" does?
Aha, well, I am probably more of novice than you are, and I'm more comfortable in CPP than BP but If you return EBTNodeResult::InProgress; from the initial execute call I think it will wait until you call FinishLatentTask with success or failure
Ah im doing BP only though :D
i think im gonna have to do it through some bools and decorators and stuff unfortunately
Mm, what does your blueprint look like?
I'm pretty sure you can do this, the AI-execute event says it will remain active until finish execute is called
im using that, the problem is that my custom move to task is not doing just one move. It sets a series of these "aimoveto" nodes, even 10 one after each other (moving on a grid), and I just need it to wait until its done with all of them. Otherwise it just fires after only the first move is done
Well, just call finish execute only once the last move is complete then? Its just a function
im also not running the "aimoveto" straight from the AI task, im running it from the character BP, because im using the same function for player controller too
the AI task is only calling this function inside the character BP
im gonna have to do it through bool checks and decorators i think, ill try at least
In UE 5.2 I cannot seem to set the Object type blackboard key as the target in a Move To task, I only see SelfActor and my Vector-type keys. I am convinced that was possible before, to direct an actor towards another actor. Does this have additional requirements in configuration now? Has something changed?
I think its because the default "moveto" task only accepts vectors, not actors. You could just make a task before to convert your actor location into a vector blackboard key and then feed that into the "move to" node
at least thats what im doing
Weird. I was convinced it accepted Object keys before. It's even mentioned in the description and what I've seen people in the tutorials doing.
Well at least I'm glad to know I'm not the only one that has to somehow circumvent this
it might have done, Im not sure actually. maybe its intended, maybe its a bug, idk. But I know that my method works so thats what im using :D
you could also make a custom "moveto" task, and use the "ai move to" node and plug in your object there, since this one has a "target actor" input
Yeah that's probably what I'm about to do.
custom moveto task is probably better anyway since you can customize it later if needed
Also it minimizes the Blackboard clutter. I'm already concerned as-is with all the control booleans that I'll probably end up placing there.
I have figured out my issue. I checked the key filters in the engine and indeed the node does accept actor references but ONLY actor references. In order to properly utilize the node to Move to actor you have to set the base class of the Object key to Actor. π
I would not recommend putting setting a BB value in a task unless it needs to be changed at runtime. You can set the BB values during the AI Controller possess function.
Ah, thanks, and is that the right way to go about this sort of thing? Should I just store the default on a dataasset I can select on the character BP?
This is really not a good way of doing things and will likely cause a significant amount of bugs, but you can use an event dispatcher that the BT Task listens for.
Yes. This is incredibly common.
The object needs to be an actor. You have to set that in the blackboard.
This is incorrect. It accepts vectors or actors.
lol - I thought you were saying that the way this image does it is not a good way and would lead to bugs (#gameplay-ai message)
And I'm sittin' here like...why? Then I see that you're probably talkin' about the task reaching into the character BP and doing the moveto in there
This is really bad advice. The default move to does a lot of things to make it bug free. Creating your own just because is not only usually unnecessary, but an easy way to introduce bugs.
They are also doing a string of move tos. How does it abort?!
I didn't look at the full thing, figured they were just showing a quick concept and not a full blown solution
So I was givin' it a pass at the time.
But yeah - that image still has work it needs to do π
Maybe you know Luthage - but why do we have 2 versions of the execute stuff in BP? Execute and Execute AI. Wouldn't BTs like always be on AI?
I know it supposed to select the correct one to use, but it was something I wondered in my younger years and just never found an answer
The execute AI is newer and the older version has not been deprecated.
Good enough for me.
I'm running a behaviour tree in CPP using: RunBehaviorTree(AICharacter->BehaviorTreeAsset); and it seems to work okay, except checking the tree in the UI during play gives me a message saying its unable to find matching actors. Is there some way to resolve this?
o.o thatβs good to know
Knowing Luthage, they'd probably say to write a service that runs an EQS query to find a location to move to and then put that service on the MoveTo
Weird tho, I seem to remember them setting a blackboard key inside the task in that first pinned video, mind you it is a bit older
Nothing stopping you from doing it
Actually, those values are dynamically changed at runtime, so that makes sense now.
Only if the location needs to be updated while moving π€ͺ
does anyone know of any AI tools that can convert highly dense images to 3d assets?
For example, even if it was just the building in this image.
https://ak-d.tripcdn.com/images/1004180000013m0snDDEB_Z_640_10000_R5.jpg_.webp?proc=autoorient
(Cross-posted in #generative-ai )
Prly best to leave it in that channel, weβre more into UEβs AI system here
What if UE's AI systems had some ML models available?
I mean its got an ONNX plugin right?
There's a lot of potential for extending UE with useful tools right now.. I'm building out my own toolset for voice based authoring of behaviour and content (well, voice and motion, but still). Its actually quite fun how quickly stuff like language models can be integrated
Meh
hear me out
L4D2 Game Director AI
but as a pretrained model
it would call functions on BPVM based on arbitrary values that can be described with gameplay tags or FNames
it would run on a separate thread and would be so easy to train & run
I mean SC2 had support for ML AI right?
They have trained bots, which is less interesting to me, but they also had non-scripted AI and it was at grandmaster level (which means better than most people including myself by a huge margin)
Is there a console command to visualize navmesh during a standalone or packaged game?
Is there a way to stop blackboard key selectors from picking a default value when the BT is opened?
Not sure. You can kind of see the navmesh a little using the AI debugger, least in standalone
silly question I'm sure, but wouldn't "All matching" return an array of perceived actors? And if so, how would you use that given that a blackboard key cannot be of type array? I thought maybe it didn't matter and I could somehow get the BB key inside a task, get its value there and assign it to an array, but I don't see a way to do that. I found something on the forums from 2018 about making a custom bp and placing it into the world, but I'm not sure if that's what I'm looking for. I'm trying to use the perceived actors generator to give my units a bit of self-awareness so they don't bunch up with each other. Tried playing with agent radius, but that did not seem to work much. I'm currently using GridPathAI and CCD, but it's not enough; the AI is smart enough to make them move up and down and around each other a little bit, but they still look like cockroaches climbing on each other. Idk if there's a better way to do this. I did have a hacky solution in place where if I give a move order, the units look for a navigable point in the goal's radius, to kind of spread them out, but idk how sustainable that will be in the long run.
I believe it means you could make a custom actor with a variable such as Targets (e.g., an array of Actors) and then store your custom actor as an Object on the BB?
π€ not sure how I would store it on the BB but Iβll try to look into that
You just have a key of type Object. You can then specify the class that key holds which can be your custom actor. Then store it just like you would a float or a bool.
Easy to train and run.. is a challenge indeed π Part of the problem is that people don't have much conception of AI in general. Look at how many have issues getting a simple behaviour tree to work? I suspect it'd end up with all sorts of issues with users mainly because they won't take the time to understand the limitations.
That said, if the system works and has good UX, I think it would be important to show people the alternative to hand coding things
I saw an interview with Tim Sweeney the other day, basically crapping on the large language models and generative AI. I think its fair to say that Epic are not going to be part of the AI revolution π
Unless and Until someone drags them kicking and screaming π
Why are you using the EQS to do that? It would make sense to use the EQS to find a location and use a distance test with a CONTEXT for the other NPCs. If all you want is the perceived actors with no tests or sorting, then using the EQS makes absolutely no sense.
Speaking of people having issues with simple behaviour trees. I'm trying to get my AI to move and shoot at the same time while facing a target. This (almost) achieves what I'm looking for, but it feels very hackish with the infinite loop. Is there a better way of achieving simultaneous strafe and shoot behaviour? (The parent tree can abort, so I can exit out of this behaviour).
Idk, I figured Iβm checking the surrounding environment and using the built-in generator to get perceived actors would be a solution, especially if I do want build on that by adding tests (which I was planning on doing π)
I suppose running sphere overlaps or whatnot might be simpler tho
I think the idea is that you're looking for a location not an actor, so your generator should generate possible locations and then you should used the perceived actors within a context inside of a distance test to score/filter good or bad locations. As opposed to trying work backwards from generating perceived actors.
Does it make it act weird or are you just wincing at the infinite loop? π
It works decently (aside from some ALS headaches with rotation). I just feel creeped out by the infinite loop!
Could maybe make it a conditional loop, but as long as you already have a way to abort up and thereβs no way it can get stuckβ¦ π€·ββοΈ
BTs are a generic tool and lack of knowledge and bad UX implementation is main problems of it in UE
but what game director is something very game specific
probably you dont even need a transformer for it
and model would be so small that you could run it on PS4 under 0.5ms or something
it would be basically something just relates array of floats as inputs with TMap<FName, FuncPtr> output, shouldnt be really that hard π
and training would be just playing the game
</armchairAIthoughts>
Its my first attempt with ai in ue5 and i made one of my paper 2.5d game but its going well whats wrong with my roam ai, the npc roams now but it will only roam to the edge of the navmesh and freeze
Iβm so confused why my ai feels clunky instead of smooth like real published games. Whatβs the secret sauce.
Decision making is a tricky thing, game directors have as much to do with things like movement coordination and the like... I'm working on an improvisation system for UE that's based on language models as methods of transforming input description into behaviour specifications.
Why are you only sending the x coordinate?
because thats the only axis i want the npc to walk on
It is very hacky. What is your AI supposed to do when it reaches the location?
Is that a valid location though?
?
what do you mean
You are telling it to go to a specific location. Is that a valid one?
I just learned if you name these things exactly the same as a Blackboard Key, it will auto-fill the reference instead of just defaulting to SelfActor π
I guess the idea is it would choose another location to "reposition" towards and it would then move to the new location while attacking. But I'm thinking maybe repositioning and ranged attack should be separate branches entirely. That's how they were initially, but then I couldn't get my AI to fire while it repositioned and thus, the hacky infinite loop.
I randomly saw this while searching through Discord. Any updates @ocean wren ?
The problem with your infinite loop is that it's not going to do anything when it gets to the location. It'll just keep trying to move there again until it's broken out of.
Yeah, that makes sense. Thanks!
Is there a reason why my EQS query would return the points in the wall as valid even though I filter on if they are reachable? (see the 1.49 scoring point)
Select the wall mesh and change the navigation area class to null, maybe that will fix it
Hi, I really need help with my nav mesh. For some reason, it seems to be somewhat inconsistent and does not want to be accurate enough to let me through the door for some reason? It did let me through once or twice before, but after restarting Unreal it stopped working again. Any help would be much appreciated!
these are my recast navmesh settings
update: there was a screwed up candle in the scene that caused the issue
can someone help me about this?
well they aren't that useful most of the time
@lilac cedar help with what?
the fact that keeps pathing to the same spot and is glitching out?
Is there a way to make a character movement not rotate in place till it faces its target with Ai move to? I would like it if the character to walk in a large U arc to turn around. Any ideas how to do that?
You can make it rotate slower as it moves but itβll still path directly to the target. If you want it to take the scenic route, thatβs going to take some doing
@dense owl any ideas of a good way of doing that or have any good recourses on the scenic route? i already got the slow turning in place down.
Not rly, sry, there are more intelligent people here that might be able to give you some clues tho
I've recently spent some time working on this, and it indeed is not so easy, I'm not really sure its doable with blueprint but in cpp you can get something to work by overriding some stuff on the path-following component
There's a function there-in called OnPathUpdated which is run before your AI will start following a given path. You can access the generated path at that point and add some extra points to it to generate a loop/turning circle based on the angle between your original path's direction and the actor's current direction
Just make sure you check the extra points are actually pathable so your AI doesn't go out of bounds
@still crypt thanks for the response, seems a bit complicated my CPP knowledge is limited. I am more on the art side. I will do further research and keep that in mind.
Ah, sure thing. if you come back to it feel free to reach out, and indeed its possible someone else here knows a better way. best of luck
looks like AI being issues a movement command every frame (or so). I'd say it's alternating between two (or more) locations. If you use BT you should post an image. And as always: look at vislog - this kind of scenario should be obvious looking at the vlog's contents.
how do i get my ai characters to formate around a downed ally enemy.. i have an eqs shape i like to use but it is not working. What am i doing wrong?
Was the array of your actors generated properly?
Are you sure it's the EQS that's at fault here? Have you checked vislog for eqs debugging info?
yes i have checked all of the debug and it isnt even giving the ai a moveto task
even though its in the bp
Never done this outside of a BT tho so it makes sense why it could be faulty
Why not trying to do it in BT?
I just wonder.
Is this Random right? Seems you could add same actor reference into the array.
May I ask why even though I created UAIPerceptionComponent in AIController subclass, it doesn't show up in the Blueprint?
you should do it in constructor
Thanks
Hi, I would like to ask, in behaviour tree, how can I do concurrent tasks?
What I'm trying to achieve is that the enemy will chase the player, but if it loses sight of the player, it will go to the last seen position of the player and search the area.
Right now I have 2 nodes, one to move the enemy, one to update the last known location. But because MoveTo doesn't end until the target is lost, the sequence is aborted and the last known location does not get updated.
i'd suggest you make a BT service that checks AI perception (or just get first player and check if it's in LoS), stores perceived target and it's last seen location in BB keys. Then make a selector and put your service on it. To the left you could put a BT sequence with a decorator [target is not null], and on the right [last seen location is not null] and put your logic for pursuing player or looking for him in both subbranches
Could someone explain to me why the stop movement function doesn't seem to work when the pawn is near its target location?
Is there a MoveTo function that allows for a movable base?
My Location needs to be relative to a moving base actor
I've removed the fluff from the Blueprint for easier reading but this will work when the player isn't close to the pawn when the delay ends just fine, but if they are too close the enemy continues to move towards the player after the delay
I ended up resolving this by forcing the async task to end
for whatever reason actually reaching the destination nullifies the stop movement function from working
You need to wait for the results and not immediately try to get them.
Maybe that node should be an async action π€
I've never ran an EQS through that node but I would've assumed the return value is the result
Your acceptance radius is 1. If you want the MoveTo to complete when theyβre near the pawn and not right at it, increase the acceptance radius
yeah the issue was I wanted to cancel the move to not complete it
Oh? How come
I'm doing a tracking attack that I wanted to stop tracking the player after a while
so it uses the move to actor to move to the player then stops and then does a move to a set location instead
Ok well reaching the destination means the movement is done, so stop movement would obviously not work because thereβs nothing to stop. Really, you should prly be using BT and EQS for this stuff, but if you say you fixed it in some weird wayβ¦ Iβll just wait for Luthage to throw the book π at you π
I agree that movement shouldnt stop because theres nothing to stop but seemingly it would restart itself for no reason
What is the difference between the Pathfinding, and Pathfinding(batch) EQS tests? The docs just say the same thing for both of them...
I remember there being a checkbox somewhere to show invalid nav links, but I can't find it. Anyone know where it is?
Pathfinding batch is cheaper. The pathfinding test does a path test for each location. If you ask for a single result, it will stop at the first one that is successful. The batch one does them all the same time.
It's in the debug options in the nav mesh actor.
That node was made before gameplay tasks. There is an AI task for run EQS, but it doesn't return anything useful to BP.
Thanks!
With my limited knowledge I would say box collision in front of it, and strafe on component begin overlap
well, Im trying to use a bt and the perception component
the problem is its detecting the character as well, but I only want it to dodge when it sees a projectile
Scripted AI is fine for basic behavior. BTs are harder to start out with, but make it easier to not fall into issues later. EQS for locations can just make more realistic movement if done right. I've said several times that there is no RIGHT way to do anything. There are bad ways and better ways depending on the team and project.
Thatβs fair, I just meant BT and EQS make a simple patrol movement easier to implement, or at least it seemed that way to me
i.e. why not stand on the shoulders of @ MieszkoZ ? π
The player should tell the AI it's firing a projectile, then the AI decides if it should dodge (you really don't want it to do it every time) and then calculate the projectile location in the future.
You can do that with the perception system and the prediction sense, but it's easier to do it yourself. They should not be using the sight sense for the projectiles.
I always just use the EQS task in the BT.
Does anyone know of any decent resources on Melee stacking/ Kung fu Circle type approaches and implementing them? I've had a look through the game-AI pro stuff and while there're some useful bits they tend to assume a level of knowledge above what I currently have π
There are 2 different parts to that. 1. You need to make a reservation system for attacking. So they reserve an attack slot instead of all attacking at once. 2. Then you have the circling part where they fan out in a circle. I prefer the EQS for this. You can add a context for getting all the other AIs selected locations to do a distance check.
Right, thank you, that much I sort of understand, and have taken a stab at it, but I've been caught up/out on how to handle player movement in that situation, and how to join the circle initially - as in, transition from a 'chase' behaviour to a combat one, and then making sure not to get left behind when the player moves through the arena without just reverting back to chasing
Why are they chasing? They should just move into the circle, which should be generated around the player and updated with a service.
Well, by chase I mean moving into combat range from some initial position - potentially reasonably far away from the player. I had tried having them move directly into a slot on the circle, but as the player moves they tend to reassess which slot they want to move to too often and the movement becomes pretty jerky and unnatural when the player moves. Since the query regenerates the slots there's no real memory of which one they had initially chosen, and indeed no guarantee that slot would even be available on subsequent runs of the service...
So complex collision and nav mesh don't really play nice together huh. Am I just supposed to keep adjusting max simplification error and add some blocking volumes for tricky spots?
The way that you make that cleaner is to prioritize locations that are in their heading direction by using a dot product test.
Ah, that is an excellent suggestion, thank you!
You're welcome! Another recommendation is to use another dot product test so they don't go past the player to a location on the other side.
Ah yes, that's a good point too. That dot product test really made a huge difference π
Hey, are behaviour trees easy to pick up and understand for a programmer focusing on C++ instead of BP?
that helps a lot! so thinking about it , should i make a boolean for whenever a projectile is fired, and give that to the enemy?
also, if I do that, I think i have to configure the dodging time for every projectile manually
depending on how long it takes to get to the enemy
What do you mean by a boolean?
You can calculate when it'll get to the NPC using it's velocity. You don't actually need to manually configure anything.
i need to achieve next:
minion goes to waypoint1, after this forget about this task, and goes to waypoint2, then forget completed task and goes to waypoint3
and, every second check is enemy in range, if so - attack him, then goes to waypoint, he's heading before
how to make it with sequences and selectors?
Where can I find documentation on all the events in a BTTask?
When I create a BTTask BP it's just a blank canvas. How do I know what built in events/functions are available?
Base class for blueprint based task nodes.
Is there a good way to simulate an ai on an npc while the portion of the level they exist on isn't being streamed currently?
Is there a way for multiple AI to share some blackboard values?
Like if I want to do a squad of enemies that should work together. Once a single enemy sees the player, the others should too etc.
also read this if you havenβt https://docs.unrealengine.com/5.2/en-US/behavior-tree-in-unreal-engine---quick-start-guide/
I would suggest you created a "pick next waypoint" task, that puts the info into a given BB key, and then you'll just need a high priority (leftmost) behavior "attack" with a BB condition "has enemy" and then the other branch being a sequence of "move to BB" (the waypoint) and "pick next waypoint".
anyone have this jittery behavior when using Move_To task in behavior trees?
https://gyazo.com/831476693a51d2bc03b6f654a4c80c58
Kinda looks like the same issue we saw here yesterday, see MieszkoZβs reply here #gameplay-ai message
Except yours doesnβt happen on every single tick. But Iβd imagine the same advice applies
When AI is moving along a partial path to a location, how do you find if it's reached the end of that partial path?
from the path following's code point of view it's just a regular movement, so it will just finish the movement and tigger all the relevant notifies.
So then just listen to one of those notifies and ask it if it was a partial path?
yeah, but depending on which specific method you pick you might not have access to the path anymore. If that happens you can just check if the goal location has been reached.
Thanks
May I ask for Environment Query context, what is EnvQueryContext_Item? Like I get EnvQueryContext_Querier since it's pretty self explanatory, but what does EnvQueryContext_Item refer to? What's Item?
The points generated by the generator pass
Ooh, so there can be multiple items?
So something like this will check distance and dot product which each generated item in a loop?
yes. Cool, isn't it? π
Nice thanks!
@uneven cloud Further up you mentioned scripted behavior versus behavior trees. What if you need both (i.e., allow designers to take control of the AI to specify paths to follow or objects to use, but allow for the AI to take control when the player has been detected)? I've been trying out pausing the brain component and then letting the designers issue commands in BP, but I'm wondering if it's better to build the scripted behavior into the behavior tree? For example, setting the ScriptedPath variable in the Blackboard would go down the scripted path follow branch. Or maybe there are other alternatives?
Please help π
I have this simple AI to 'identify next checkpoint in map then move to target'
If i were to remove the purple floor, or if it gets no collision (right now it's set to invisible wall) the AI won't execute and just loop between 1 and 2, if the purple wall has colision it does run normally
the AI is in the brown spheres, character movement is already set to Flying
And i could just work with that as ahidden wall with invisible wall physics but i'd rather not having there something i'm not using
I am lured with Ai I have to admit.. π https://youtu.be/lYcrRXhpdgo
Ai Powered, Personal Assistant Using #unrealengine5 #convai #metahumans
Yeah, Paul is editing them now.. two books are in the editorial stage, I'm sure there will be more if he keeps at it
It depends on your definition of useful.. I mean you can't deny they're being applied in plenty of industries.. its mostly that there's new potential for a wide range of applications and it seems a bit short sighted to ignore it.
I mean hell, blueprint copilot might actually cut down on the same old questions we get in here every day π
MoveTo copilot π
EQS copilot π
How are you setting the no collision part, what preset are you using ?
that'd be this
π€ is there a query only collision in those presets ?
Oh ok
Idk, Iβm sure someone here knows whatβs going on, but in the interim I would say try using the AI debugger and the vis log - as MieszkoZ always says π, to see why the move task is failing
Yeah i treid with the AI debugger but i'd show me that the current task running is either "nextgoal" or "rotate to face bb entry" and they loop at such speed they look like a fan spining
You can pause
True
Like open your BT, use alt+P to start, then pause and use the rewind or w/e to see the arrows going up and down the tree
May try that
But that will prly only show that it is failing which you already know, so def try the vis log, to see what it says itβs doing
It entirely depends on what is actually needed, instead of what designers want. Designers always want to hand script things, but it always takes a long time to support and it never ends up with good behavior.
You want to look for ways to give them systemic behavior instead of forcing everything. A dynamic subtree is a lot better than a scripted follow branch.
"It entirely depends on what is actually needed, instead of what designers want." is going on my grave. Thank you, that's helpful and I didn't consider having dynamic subtrees. I guess I could make a subtree for UsePath and UseSmartObject and then allow those to be added to the behaviour tree at runtime.
Is there a way for AI to simulate what it is meant to be doing if it is in a portion of the level that isn't being streamed currently?
If my enemy AI loses perception of the player, I want to have a timer count down to 0 before the enemy "loses" the player. I am currently adding a float to the blackboard called and using a service to decrease it. Is this the right way to do it?
Feels pretty long winded to adjust blackboard values in services
Or am I meant to do this another way?
Furthermore, in services, there's 2 ways to get/set a blackboard value. The Blue nodes feels more "correct" but at the same time I can't give it a key.
not out of the box
Has anyone encountered an issue updating to 4.27.2 source build where Nav Modifier Volumes just simply stop working?
I built 4.27.2 from source and they just simply dont work.
Blank project.
Hey, does anybody know how to make the AI go around walls instead of trying to go through?
I'm using the Behaviour Tree Move To node
Which AI class are you using
Do you have CCD on?
Continuous collision detection
huh
Interesting
I fixed it by rebuilding the navmesh
The editor shows the correct navmesh but it seems it doesn't actually updates until you rebuild it
Thatβs good to know
Need a little more to go on there, chief
all empty, everything is correct in the BB/BT assets and the controller is properly assigned
not sure what the issue could be
Check your BT flow during PIE
where are you setting these?
Hey do you know if there are some data validation possible with BTNode ? I tried with the classical IsDataValid but when saving BT nothing is running. Behavior tree asset dont call this function on their btnode at save I guess ?
ive realised something odd about the perception system. is 'entered sight radius' from sight stimuli based on the actor location (aka a point in space, not a volume) ?
if so is there a way to change this?i have two issues with this...
- i have interactable items which can be perceived, however if they rest on the ground (z height = 0) then it intersects with the floor and the perception system cant see it. in the above screenshot i solved this by making them z=1, however would prefer to avoid if possible
- i also wish to have large actors which can be perceived, and if its calculated based on actor location you would have to get closer to them to see them than compared to a small object, which is a bit counterintuitive.
any help or thoughts on this appreciated, perhaps i am even mistaken but its how it appears to me
I have multiple AI agents taking part in a real-time combat with the player and I am trying to implement an alghorythm to position them properly. I wanted each AI Agent to calculate their desired position based on individual preferences (e.g. ranged units seeking vantage points, and melees moving in to engage the player). I already implemented CrowdFollowingComponent o avoid collisions between actors, however, I struggle with figuring out how to prevent actors from targeting the same space when they calculate their desired positions. The only thing that came to my mind was procedurally adding NavModifierVolume after a spot gets taken by one of the agents but from what I understand it would require regenerating the navmesh each time so it sounds quite performance expensive.
Are there any other tricks that could help with generating unique target positions for navmesh agents?
Instanced foliage actors are not being affected by nav mesh bounds volume, any idea how can I fix that?
I believe someone here had a similar issue and the recommended solution was using dot product tests
I've taken a peek at the channel history and I belive I've found the conversations that you referred to. While the issue discussed is not exactly what I struggled with, both the EQS and the other mentioned resources seem like they could be helpful. I'll study them, thank you.
Hey guys, I used smart object from BTtask and Im getting thrown an this ensure every time I change map
Oh, sorry, I thought you were already using EQS. Ik theirs was a different situation, for some reason I was thinking you want to check if their vectors are pointing in the same direction. But if you just want to check the goal locations, you should be able to do that more easily
Heyo,
I'm doing a 2D multiplayer game with up to 60 characters, each character being a BOT if there isnt enough players to fill the spots, so potentially 60 BOTs. With 30 BOTs, the game runs smoothly, but the CPU performances tank significantly with 40-60 BOTs, it seems that the MoveTo function is causing it (performances are fine when BOTs arent moving).
Any idea on how to tackle it? Each BOT needs to have its own behavior and they can't be disabled.
I tried using a Pawn + FloatingPawnMovement instead of characterPawn + characterMovement but that didnt improve the performances :/
it seems that the MoveTo function is causing it
It's not the AI-sideMoveTo, it's the character movement which means you'll probably have the same issue with 60 human players.
Thigs I'd suggest are:
- forcing all the characters to use
MOVE_NavWalking(don't remember how that's done, maybe someone else can jump in) - disabling character movement component ticking and implementing batched ticking - this will require implementing this mechanic, unless you find a plugin that does that (there should be one, and if there isn't someone should make one π )
thanks! Good to know that it's not the MoveTo itself. Player characters move with WASD, so I guess the NavWalking wouldnt work, but maybe a good thing for the BOTs. Regarding your second point, I checked and the movement component has a tick interval variable, and increasing it indeed helps a lot with the performances π (though the movement doesnt look as smooth, but maybe i can find a compromise), I will look into the batched ticking
forcing all the characters to use MOVE_NavWalking (don't remember how that's done, maybe someone else can jump in)
Can just change the movement mode in the CMC, on the BP itself
disabling character movement component ticking and implementing batched ticking - this will require implementing this mechanic, unless you find a plugin that does that (there should be one, and if there isn't someone should make one π )
The simple way to do this is to create a world subsystem in C++, then on begin play, register the CMC to that world subsystem. Then that world subsystem, on its own tick, just loops through all the registered movement components and calls tick
Ill look into it, thank you π
or just adjust the tick rate in them?
that's an interesting way of describing an awesome, work-in-progress tool you get to use for free π
Unless we make more than $1 million π
yeah, wouldn't that be terrible π
Oh the horror
STs are still very much WIP and under active development. The internal use-cases are what's driving them and those are mostly bug-free. Most of perceived bugs come from users coming up with use cases we haven't anticipated or just came across yet. It's worth reporting those.
A lot of work went into STs in 5.2, but if you want more fixes or features I suggest using main repo.
Main reason I dropped ST and went back to the good ol' BT is because the editor would, seemingly randomly, decide to no longer allow you to bind to an output.
Most of the bugginess I experienced was around the editor, not the system itself.
editors are hard! π
As I always say, better you than me!
It's based on the actor location. At least for the distance checks. The distance is meant to limit the amount of raycasts needed for sight. If you want to change how it works, you'd need to make your own sight sense.
Why are you using perception for interactable objects?
You need to balance how complicated things like perception are based on performance, dev time and what the player would actually notice. The idea is to create fun player experiences, mostly with smoke and mirrors, not creating intelligent AIs.
Use the EQS system, generate positions, then filter ones that are close to a recent positions in a list so it basically avoids new positions that are close to ones already selected (change the context so that it filters from the generated points)
ok thanks, that is frusterating that actors with roots at floor height therefore cannot be seen.
i am using perception stimuli on interactable objects as an experiment, the game im making has the goal of emergent interactions between AIs and i find some interesting possibilities in using the perception system beyond pawns. I am familiar with the smoke and mirrors required for game dev.
i think ill try and make a sight sense that casts to actors location but if it overlaps with bounds/volumes of the stimuli actor it counts as seen π€
You can override the location that it looks at.
Perception system is more important for things like appearing fair during combat. For interactables, it's easier and cheaper to use the EQS.
ok thanks, ill also look further into EQS
Anyone here ever had problems with AI pawns not moving when loading a new level? The AI sees the character but I think the nav mesh is bugging out, any ideas?
Rebuild the navmesh, see if that fixes it
May be a dumb question but do i rebuild the mesh through blueprint or the editor?
In editor. Try build -> build paths. Otherwise, if it only breaks at runtime you can try setting runtime generation to dynamic in engine -nav mesh within project settings
Setting runtime gen to dynamic worked, thanks a ton Neo
on the tick function afaik
in 5.1 it didn't work for me if I set task as anything but running in the enter state function
didn't test in 5.2
and in tick function works ok
I use C++ tasks and conditions
Anyone know how I can make some really good shooter AI?
Movement wise
Like Dodging, In air movement, Jumping up stuff, etc
Does anyone know what causes AI to stutter like this when using a dedicated server? I've got a map that uses world compositor and I'm using navigation invokers.
It works fine in the editor, it only stutters like this when compiling the game and connecting to a dedicated server.
Good is a really subjective term. How it should be done depends entirely on what you are trying to do.
It could be a number of things. Add some logging to debug it.
What in particular should I log?
The path could be invalidated, because of the invoker causing a rebuild. It could be a replication issue with the movement. Could be performance issues.
I have a print string hooked up to the On Fail pin on the AI Move To node and it isn't failing. How can I check if the path is being invalidated?
I've also tested it on a version of the map where I deleted all the objects so perofrmance issues are pretty much ruled out.
You can't rule out perf issues without profiling.
There are events on the path following component, but I'm not sure what is available to BP.
Debugging is a matter of making guesses where it could be failing (movement component or pathing in your case) and verifying by logging what is happening.
So when you run this itβs basically on the client, rather than the server?
When I run it as 'Play as Client' using the play button in the editor it works fine. When I compile the game and run a dedicate server to which I connect with a client, it stutters.
Right but play on client is still on your machine, where as connecting to a dedicated server implies lag
I tried to switch maps to a regular map which does not use world compositor and it worked fine on the dedicated server. Then I deleted all the objects from the map that uses world compositor and it still lagged.
But I also created a brand new map that uses world compositor using height maps from the old map and it didn't lag. π€
I thought world composition was replaced by world partition
I'm using 4.27.2. At some point you have to stop swicthing versions and breaking more things. Plus UE5 had terrible performance.
Ah
I get 15 FPS less than I do in UE4 just by switching.
I'll spend a bunch of time moving to UE5 only to find out that World Partition has it's own set of bugs. πΈ
Yeah, not suggesting you switch right now. Not sure about this issue, but I might suggest asking in #multiplayer , if this only happens in networked conditions
I'll try. I saw people posting about this on the forums but there are no answers. π€·ββοΈ
if i chose LowerPriority for Branch 2 condition here, does it mean Branch 2 will be interrupted anytime, when Branch 1 meets his condition to run?
That just decides which branches to abort. Lower priority means anything right of current branch
If you had a branch to the right of it, you would see it turn blue
i dont get it
so, if i set lower priority for this branch, it means, if there is another branch from the right side of this branch, they shall have the lower priority?
if b2 is set to lower priority, it means, if i add a Branch 3, this B3 shall have lower priority?
Yes, the execution order is left to right, so anything on the right is lower priority
And anything on the left is higher
Thereβs a visual indicator when you do this. If you have a B3, you will see it turn blue when the abort lower is set on B2
so, in my case, i need to set lower priority at B1, like this, right?
if you want the stuff on the right to be aborted when B1 fires, yes
thank you, mate, u make it a little clear for me
bcz this "Observer aborts - Lower priority" is realy confusing
who is this Observer anyway?
why lower priority has not this branch, which i set to, but next, its looks messy
@dense owlbtw, this code runs much more correctly, thank u again
np, just think left to right execution order (highest priority is the branch that gets to run first). If you hover over the circled numbers in the top right of each node, you will see them get highlighted. The way it is structured makes it easy to move things around the BT, to change the priority of a branch
real quick question, if a task aborts, do I need to add these 2 nodes to get it to properly abort or is it not needed
thank you, but these numbers and left-to-right priority is the only thing, which was easy to understand here π
observer is still in misty
observer is the current execution kinda
something looking at the current execution of the entire behavior tree
so like, when it says observer aborts, that means that when the evaluated condition that is being observed becomes a different value, the entire behavior tree will abort
and lower priority means anything that is executing with a lower priority will get aborted
I think, I don't use lower priority that often so
as far as I understand it, the observer is the "eyes" that the decorator is using to check/observe if the specified result or value has changed. When it has observed/has been notified of the change, it will do what it was told, such as abort the branches you instructed it to abort.
yeah
tho I'm sure when MieszkoZ or Luthage get on, they will be able to provide you with a far better explanation π
my man MieszkoZ
the man, the legend
ooh what'd you fix?
oh I didn't fix anything lol
I just exposed a delegate that was previously only avalible in C++ to BP
very simple but also imo that delegate was essential so
It was AIPerception OnTargetForgetten
nice
some part of the delegate was also private too so it was hard to even get it to fire in cpp
if you just had the binary version of the engine
solid PR
Today I found FBehaviorTreePropertyMemory
I guess it was a product of prototyping about making BP nodes non instanced
I think it'd be possible to copy the BP properties data from that memory block if FBehaviorTreePropertyMemory could be serialized to a BTTask, I wonder why its not utilized
maybe its because that copy operation is almost expensive as spawning the object
gotta ask Mieszko if I can ever see him around π
he's often on during EU daytime I think, I've seen him when I stay up late π
I'm on EU timezone too, but I love the night life π
I often see Mieszko around afternoon on EU timezone
How do folks activate GAS abilities that require data from the Behavior Tree? I have a BTTask that calls Send Gameplay Event to Actor and passes in data through the Payload using Make GameplayEventData , but I'm curious if there is a way that's less... abstracted? It's quite tough to follow calls that are made using gameplay events.
Using GameplayEventData is the correct way to go.
Thanks!
We did start with BP-implemented BT nodes not being instanced, but it confused the hell out of non-programmers (aka "most of BP users"). To be honest I'm not sure if that code is still operational. I don't believe we use that approach internally at all.
Ah, I see. I brainstormed a little meanwhile and couldn't find a non hacky or cheap way to utilize it with abstracting it from event graph either, so I can see why it's not being used. If there could be a way to disallow event graphs and lock users to function graphs it could be way easier but then we couldn't run latent nodes π
I was thinking about using something like UFunction->GetOuterUClassUnchecked()->GetPersistentUberGraphFrame because its practically same as FBehaviorTreePropertyMemory, its a FStructProperty that contains the memory info of the event graph and we could instance it instead of the UObject itself but then if users run latent nodes or timers then there is no way to make this work
hey everyone, i have a question which has me totally stumped. im guessing the solution must be some kind of very obvious oversight on my part. any help appreciated.
problem:
i have created a custom behaviour tree service, but it seems to not be setting keys. ive debugged my service and inside the service it does indeed set the values to what i would expect. but outside in the behaviour tree itself the keys are not updating. i then ripped out all my bp and just made my service hard-code set a blackboard value (picture one), and it still appears to not be working. (picture two)..
so what am i doing wrong π€―
I'd start by looking at vislog. Among many things it also tracks BB changes for AI (stored at the beginning of frame, and more precisely, stored along with the first log data stored a given frame). Check if the value is being set there, and if so, what's the value, which key, etc. Also make sure there are no errors/warnings in there.
thanks. ill do this now π
@crystal hatch i dont really know what to make of this honestly. this is what the tick looks like. i wonder if its somethign about suspending and resuming branch actions....
what's the BB key value in this log entry and the very next?
i cannot see any BB keys in the vislog? thats the full window
well, that itself is curious. How about gameplay debugger, do you get aby BB info there?
nothing ? is it possible i just havent added a blackboard somehow? its been a while since i did BT stuff....
I just added a BT component to the AI Controller. the BT has the BB assigned inside of it ?
You added the BT component? Yourself, manually? I mean, not automatically by running RunBehaviorTree? That might be the problem then π
are you debugging the instance of the controller you set the values on? π
i added a BT component to the AI Controller. I wanted to go this route rather than having a RunBehaviourTree node as i wanted to have child classes that were data driven. but i suppose i could make the BT in the node an exposed variable π€
@patent hornet it is certainly running ! im seeing the instance running live and also breakpoints are triggered. but maybe its in some weird state....
oh i also wanted it to be a component as i wanted to have a reference to it in future
and RunBehaviourTree doesnt return a referecnce
BT component is not expected to be added via BP editor. I'm actually surprised it works at all.
oh weird. ok π€ͺ.
but you don't need one, you can just access the default brain/BT component from the controller instance
After calling RunBT you can get the BrainComponent from the AI controller and cast it to BT component
cool! and thats how i get a reference?
well, a pointer, to be precise π
IT WOOOOOOOOOOORKS π₯³
@crystal hatch @patent hornet tysm ππππ theres like no way i think i wouldve realised this was the issue lol
I'm not surprised it works now, I was surprised it didn't π
usually when you start doing stuff engine does on its own but by hand and in your own way it finds a way to bite you in the arse
unless you know exactly what you're doing to start with
and preferably do it in C++ both for richer API and better debuggability π
aint that the truth
as a rule, if you feel like what you're doing is more complicated then it should be, it is
yea im learning c++ but deffers more comfortable with bp when possible π οΈ
As #gameplay-ai is emerging in our daily routines more and more I wanted to spread the word for Convai an incredible tool for Games and also the real life scenario businesses.. the tool that NVIDIA recently announced a partneship βπΌπ«ΆπΌ Here is a sample and a step by step tutorial.
Think of a near future π once we merge everything in a pot With Artificial Intelligence #generativeai and #conversationalAi
[voice]
bEnabled=true
Add this two line of commands in your game engine ini file.. Can copy paste from here for shortcut.
Welcome to an exciting new era of video game development! I am thrilled to share with you the incredible tool released by Convai.com, enabling creators to bring their virtual worlds to life like never before. We'll delve in...
hello. any idea why enemies from duplicated BPs won't move? they are exacly the same as base BP, but are stucking in "move to" node. if I make enemy BP from scratch with the same settings, everything works fine
Visual Logger shows that movement failed due to block
Are you duplicating the entire bp, rather than spawning instances of it?
I am duplicating in folder to faster make new enemy. That way I don't need to set up many variables
That is bad
If you want to reuse the same variables make children of that blueprint class and let inheritance take care of it for you, assuming you need to have slight differences between each of them, but a common functionality
Otherwise, if itβs supposed to be the exact same enemy, just spawn instances of the same blueprint class
I am inheriting from chain of cpp classes and setting only some variables specific for each AI. anyway I am not asking of proper way how to do this, but why duplicated BPs in content browser have issues with "move to", when exacly the same BP (children of the same class) which were made as new are working
Can you post a screenshot of the BP logic with the Move To node and the exact error message Visual Logger gives when movement fails? There are many reasons why this might not be working, but duplicating a Blueprint in and of itself shouldnβt be one of them.
Hello, a question, does anyone know why the reference to the AI controller from the BTS fails when I invoke it from an administration panel that I did?
The Spawn button calls a Spawn AIFrom class
I suggest you put a breakpoint where you set the value. My guess is that Enemy AI Ref is empty.
this suggest that duplicated BP class is missing something. The details depend on what exactly the copied class contains, how much custom stuff is there, and the exact way of duplicating the class (done via editor or just copying the file via system tools - the latter is strongly discouraged).
@crystal hatch parent class is in cpp which contains structure "EnemySettings". in BPs are only settings, 0 BP coding. I was duplicating via ctrl+d or moving BP in content browser to another (new) folder and then choosing option "copy here". I was doing that so to not miss any setting, like "Max Acceleration", "Rotation Rate", Mesh Location and Rotation, etc.
It's impossible to say why stuff doesn't work with this information. If VisLog contains no clues then only C++ debugging can tell.
I tried to catch something via breakpointing all functions in UBTTask_MoveTo, but with no luck. do you have any tips where I can search in cpp?
I'd start by checking what vislog indicates as the reason for failed movement. Maybe it's not movement that's failing at all (goal location outside of navmesh, or not even set, for example). Like I said, there's a lot more information I'd need to be able to tell.
ok, thank you. I will dig into that
hello slackerz. im back with another fundamental BT question.
i wish to basically replicate an Else If logic in my BT, but i have discovered that a node can only have a single input. i was wondering how you would go about achieving the logic i have sketched in this drawing ?
Put the decorator on the collect trash node. If that fails it will use the next node because it is a Selector.
i see. i guess the issue i am running into is when the tree starts, there will be a BB value (say, target)
we check if 'trash is visible'
if this is true, we collect trash.
if its not, we survey, which is a more indepth search, which would also set the BB value target
but if we were then to go to the root of the tree once more, the 'trash is visible' test would once again fail, overwriting the target value, and it would just loop
is this a situation where i would use a decorator that can abort lower priority ?
is this perhaps a better way of achieving the same result? π€
Yes, it's empty, but I don't understand why, normally it would have to say "Demon" which is the name of the child of the EnemyParent, but when I call it the value of the Enemy AI ref is not set, why can this be?
Now you need to determine why the code setting these values is not being called or fails.
Hey guys. I have some questions. My AI was spawn in a mulitplayer games. They use ai perception to detect enemy. The player team use 0 , and enemy use 1. The problem is AI enemy attack treat other AI as enemy in a few seconds after they spawn . I did change the team attitude towards team -1 as neutual. Anyone know why this happen?
Dragging the daemon directly from the content browser to the map works, calling it from the Spawn AIFrom class node doesn't work, I really don't know what is causing this
The only thing I can think of is that the On Possess event is not executed correctly, this event is where the reference to the Enemy Ai Ref is stored, which is then called from the BTS (which is what fails)
But I don't know why the On Posses event would not be called
I have a little hint, when I put the demons directly on the map they are called
demon1
demon2
demon3
And these work fine.
But the ones that I call with the panel are called
Demon_C_1
Demon_C_2
But I don't know why this difference
set your pawn's AutoPossessAI to PlacedInWorldOrSpawned
Done, but i still having the error
make sure AIControllerClass is set
I'd debug UAIBlueprintHelperLibrary::SpawnAIFromClass in this case
Could you tell me a way to look for this to document it?
I don't understand what you mean.
I don't know how to debug what you say, I ask you if you could tell me some way to find documentation of this in google or unreal
that's a C++ function. If you don't do C++ then you won't be able to do it.
does vislog or regular log say anything when you spawn stuff. What does gameplay debugger show when you pick one of the defunct AIs?
With the vislog I have an error in the initial execution, then everything is fine
Why the team id will be unsigned char for a moment?
looking at vislog I'm guessing the possession is happening "too late", meaning you run BT before the pawn is possessed. Do you manually call RunBT or use the SpawnAIFromClas's BT param for that?
I called the param del SpawnAiFromClass
I must admit I find it hard to wrap my head around your type naming. What's Enemy_Parent? Is that a pawn or controller class? I suggest naming things in a way that allow people to instantly identify the super class a given type extends.
I mean, your AI controller has a Enemy AI Ref pointing at its own pawn? That's confusing.
Sorry, I'm still not used to calling archives for their best practices, let me summarize a bit how this works
I have 4 key files
The Enemy_Parent is the one that executes the AI actions, the daemon is a children of this file
I have the BehaviorTree that takes care of the typical BehaviorTree hahaha
I have the controller that does some initial setup of the attack ranges and also configures the Sensors.
And the Behavior Tree Service is the one that is in charge of changing the states of the Behaviors through the variables that change in the IA Controller
what's the parent class of Enemy_Parent? Is it a Pawn or Controller (I'm assuming it's a pawn - correct?)?
it's a Pawn
Pawn for what blueprint?
your Enemy_Parent's base class is Pawn
anyway, something is not what you expect it to be when dynamically spawning AI. I suggest you go through all calls and ensure every parameter (especially Pawn and Controller classes) are what you expect them to be.
Excuse me, but what do you mean by expect them to be?
when you want to spawn character of type X you need to make sure that's what the parameters to spawn function say. Also, make sure the AIController parameters is what you intend it to be.
your log suggests the types match, but there's something off, and I'm unable to tell without debugging it. And this would be best debugged in native code. You can put breakpoints everywhere (spawning, possessing, etc) and make sure things happen in order you expect them to, or find out what's the difference between working and not-working cases.
Oki, thanks you, i will try
notice a difference,
When the enemy is dragged to the world (this enemy does work) first the On Posses is executed and then the Begin Play, when I spawn it, it works the other way around, I will record a video to make it easier to understand
ohh
i put a delay
and it works!
I did ask you if you run BT yourself or rely on SpawnAIFromClass . The video shows you do it manually. The issue here is that you run it on BeginPlay while you should trigger BT on Possess - there's no point in running BT without a pawn, and only Possess you have one. That's your bug.
Yes, I was able to solve it thanks to adding a delay of 0.2
I did it because I had read what you said about the BT being generated first and then the Possess in the pawn
Regarding the manual or with the SpawnAI, I misunderstood the question, sorry
Thanks a lot!
don't add a delay. Just change where you run the BT - run it on Possess.
And delete the BeginPlay?
yeah, I don't think you need it.
wasn't easy, but I'm glad we figured it out π
Do all decorators in a node have to set notify observer to interrupt in order for that node to interrupt lower priority nodes?
From what i've tested it seems to work this way, but it seems strange and unintuitive so idk if i'm missing something
No, but all the existing conditions must pass for the new behavior to be picked and the old one aborted.
Well in my case all conditions should have passed, but it did not abort the old node until I set all decorators to abort. I thought it would be enough to have only one decorator set to abort
it should, but that one needs to be the one that triggers the whole process. Having said that, what I describe is how it "should work" - even after 10 years of constant use UE4/5 BTs contain edge-case bugs.
Have you verified this scenario with vislog, that it indeed behaves as you described?
Ok after debugging a bit it seems it was not quite as I described. I think I misundersood how aborting works. I guess it makes more sense now.
So I had two decorators - InSight (which did abort) and IsInvestigating (which did not). If InSight was true but IsInvestigating was false, when IsInvestigating became true WHILE in sight, the node did not abort because InSight value did not change for it to abort. So thats why everything worked after changing IsInvestigating to abort.
Basically I didn't realise the blackboard value had to change for it abort. I thought just the decorator condition had to pass.
And i've been working for few hours already so my brain was kinda fried xd
This is probably a dumb question, but why do I need to use UBTTask_BlackboardBase::InitializeFromAsset(UBehaviorTree& Asset) in my BTTasks when resolving BB keys? Is there an issue with using the GetValueAs<Type> functions?
Is it a good idea to make a service that overrides OnCeaseRelevant in order to reset values when that node is aborted?
as long as you don't touch BB keys anyone could be watching you should be good.
BB key selectors are tied to a specific BB layout.
Ah, thanks for responding, but I am not quite sure I understand what you mean? I've not had issues using the get-value-as functions either
hey all. ive noticed that my BT Service doesnt set BB's until the second time it fires from Root. is there a specific event that would set the BB's before the logic passes down into the children below?
Is it perceiving the actor on the first pass?
yes. altho ive noticed debugging there actually appears to be a latent delay caused by this for each loop node?
Only on the first time tho... which would explain why this happens but i dont understand exactly the reason it would do that.
bizarrely completed is firing before the loop. this is not what i expected..
Might be easier to use the EQS built-in generator to get perceived actors btw
Prly means it has perceived 0 elements on the first pass
Should be able to check the contents of the array with a breakpoint.
tru.... thats probably whats happening
ok so its just a matter of the perception not being ready on frame 0 ig. which makes sense i suppose. i thought it might be an event thing, good to know.
thank u @dense owl
and yes, it was an array of 0 on first pass
also theres an EQS for perception system?
Well thereβs EQS and when you make a query and use a composite, thereβs a built-in perceived actors generator you can use. Saved me hours of work
oh nice, thanks i didnt know that. i was wondering if there was any way to combine the two π
Get value as is for BP, because it can't do template functions. If you want to use the template function with the constant look up (recommended) you have to resolve the key.
Ah alright, thanks for the explanation, though, why is it recommended specifically? A cleanliness thing, or is it more performant?
It's a constant look up instead of iterating through the blackboard array. It's not a significant perf difference, but it can add up.
Ah, alright, that makes sense. Thanks again π
I got a character with a nav mesh modifier. but when i do a move to, since the nav mesh sets the nav to null it cannot walk
how do i make it ignore it's own nav modifier?
You should not be using a nav modifier on a moving character.
how do i make other AI not consider a character as walking space then?
they keep trying to walk through each other
Tho thatβs gonna start cutting holes in your navmesh so idk that thatβs good. Thereβs agent radius and CCD properties you can play with
And diff AI classes
Built in solutions are RVO and detour.
thanks, i will give that a look
How do I make an ai that walks on walls/ceiling like a spider?
that's not something straightforward to do
there was a plugin on github though
might give some insights
It seems so...
Really confusing situation.
So I'm trying to add arrows to some project and when an arrow hits a pawn, it should stick to it and stay on.
So as a first approach I used attach actor to actor, and it all works fine, except once the arrow gets attached, the pawn (who's been shot) starts going bananas, twisting and turning, etc, while trying to use AIMoveTo.
Once I pickup the arrow from them, they go back to normal.
It looks like some physics issue or something I guess, though I really have no idea where to even start on this.
You need to call ignore actor while moving on your pawn.
so for some reason, when I debug ai, by pressing ', I can't toggle any mode by pressing the numpad
Like the modes donβt turn green at the top?
yes
they don't activate
i've tried with numlock on and off
but no luck
Have you tried restarting the engine, and also are you sure itβs selecting the right AI?
I have multiple in my game so I usually have to use PIE and select the correct actor from the outliner
yes, multiple times
well they're all the same, so yes
so it turns out RVO avoidance doesn't replicate well to clients in multiplayer with lots of NPC lmao
Will try!
Doesn't make any sense. There shouldn't be any RVO replication that happens. All AI logic is processed on the server.
RVO is movement component not AI.
Let me clarify (I'm aware RVO is the MC) - the AI movement logic is all processed on the server, so when the AI is trying to move, it happens on the server, with the avoidance there as well, and that sends to clients. So I'd expect the avoidance to have already happened on the server.
Yeah at first it seemed to be working well. But when I had 15 AI agents running around, the clients (only clients not the server player) would spring around and react as if they were on ice, and bump into invisible capsules, etc.
Disabling RVO fixed this. I think the server and client location of the NPC is being adjusted, but then the player's reaction to the rvo "capsule" is no longer valid, so the client player ruber bands into position, etc.
Maybe it was an error on my part to have RVO also enabled on the player character, not just AI characters?
hey guys i was working on a ai for a project, and was making the ai chase the player and attack and it worked. But out of nowhere it stopped working and i dont know why, any help?
Looks like your TargetActor is not being Set. Or rather, it is not being given a valid reference to set Could be a few things, did you use the AI debugger at runtime?
is it a terrible idea to use multiple behavior trees (not nested, just multiple trees), and switch them out by blueprints with event dispatchers?
No
How should I make advenced AIs with lot of advenced mechanics (like game bosses)?
With behaviours trees?
Depends on what you actually mean by advanced.
A lot of complex combos
Abilities to dodge player attack etc.
Something like souls like bosses
I create common enemies just by enum states etc. Everything made by code
I've never used behaviour trees and I wanna know when to use them
behavior trees aren't always the best way to set up some form of ai, but they are a very powerful one, and worth learning for anything that is going to be complex. in a lot of cases they are going to be a good way to model the logic you want them the boss to follow
So in most cases I should use trees?
i would think so
You want to have a solid combat system with good attack selection and reactions. BTs are not well suited for attack selection.
So I should do everything myself in code?
I think behavior tree is good for selecting the attack to use. For implementing the actual attack you might want to use something like the game play ability system
BTs are a great way to organize the logic that is a separation between the action (what the AI does) and the transition (why the AI does a thing).
Bosses are typically more scripted behavior. BTs are fine with it, especially if you already use them for other AI and have nodes that you can use.
No it's not. It creates complex trees of decisions without a lot of reuse.
Why are BTs bad for attacks selection?
It creates a complex tree of decisions that is difficult to maintain and debug.
It depends on your goal. If the boss going to follow a set of scripted actions regardless of external conditions, then don't bother with BT. If you want them to follow through a series of conditionals, that is exactly what a BT is for. Their purpose is visually representing those conditions. Non reusable BT is irrelevant. Have a different BT for each boss.
It's only difficult to maintain if you try and make one BT be applicable for multiple bosses/enemies
hello, i'm arriving at a stage in my game where the core components are finished (for now) and I would like to tackle the subject of ai (game is an fps shooter with a lot of mechanics). I've already got a little bit of experience with BTs but because it's a fresh start I wonder if it would be more future proof and also a more solid options to choose the new State tree system. would anyone have an advice on what I should choose (c++ is not a problem for me and I've read that EQS works with state trees when written in c++). thank you
please @ me
@sage patrol My understanding is that state machines are an older concept in computer science than behavior trees. Epic decided to implement behavior trees first but people requested state machines so they were implemented later. I wouldn't say either one is going to go away or replace the other. You just choose which concept you like better and work with it.
alright. i'm gonna test State Trees a litle bit and then i'll decide
A BT is not a decision tree. Their purpose is not to "visually represent the conditions."
BTs aren't going anywhere. State Trees are still being worked on. Which you should use entirely depends on the behavior that you want and how confident you are using a system that is still being worked on.
apparently we have radically different interpretations of what they are then. given that you've offered nothing other than basically saying "you're wrong" it doesn't sound worth discussing
Behaviour trees aren't always evaluated from the root, so they are not a one-to-one mapping of visually representing the conditions. See: https://gamedev.stackexchange.com/questions/51693/difference-between-decision-trees-behavior-trees-for-game-ai
What I'm curious about are people's heuristics for when something should be encoded as a behaviour tree versus a state machine? It seems there is a threshold where one works better than the other, but I can't put that threshold into words.
The main difference is that a state machine has the transitions within the state, where the BT decouples the transitions from the actions. With a FSM, anytime you add a state, you must edit any state that transitions to the new state. The more states you have, the more complicated this gets. You also have issues with NPC variants with different transition conditions.
There really is no hard threshold. It's understanding the pros and cons of each and making a decision based on the needs of your specific project.
Hi. I have seen this discussion about FSM and BTs. I was reading about other options, like HFSM, GOAP, utility AI. There's one called LTL although that's for self-driving cars. Some I don't like, the others are not fitting for my game. I tried the State Tree, but it's buggy.
Now I'm making a slightly different system that's like HFSM but with changes to make it easier to manage. It has no connection between most states, so there's no need to modify one if a new state is needed and there are other... "improvements". Since this is the first time I'm making an AI for a game maybe I'm on the wrong path entirely. Is it a wrong idea to make a custom AI? What do the more experienced people here think about this?
Make a simple version of it and prototype it. You really won't know if it works for you unless you try it.
So it's not an inherently bad idea? I've made a prototype but only tried it with very simple behavior. I'll keep testing.
how would one instruct the AI to play higher prirority execution?
Abort back up the tree
Just to add to the discussion on BTs, I'd say that you should view it as a very macroscopic representation of AI behaviour, with each node abstracting some modular complexity. For example, when the AI enters a combat state, it triggers a sequence that starts with calling a "make combat decision" node, which is a series of c++ function that analyses the environment and spits out a combat decision enum. The next node is a selector node that has several branches of behaviour depending on which decision was made. It's generally a good idea to divide branches using discrete variables such as ints or enums rather than a range of bools.
With that said, the only way you can really know if it's fit for purpose is to get stuck in. As a developer, you'll have to make many uninformed best guess decisions that will often not work out, but every time it doesn't, you'll learn why and improve.
Add the node in the BT to the left of the lower priority node and have a condition that becomes true and aborts the lower priority because of that change
Nothing wrong with writing your own system, just don't claim it beats everything and is amazing unless you've got thousands of people using it and preferring it π
I guess the main thing, is to actually understand whatever system you're using π
Seen a lot of people get it very weirdly wrong with BT's time and again
I guess partly because they've not migrated from FSM's like so many of us did.. BT's make a lot of sense once you've used complex FSM's and found their limitations
And in a similar way, Utility makes sense when you hit the limits of BT's too π
While playing around with Smart Objects, I noticed that AI agents will move to the original location of a Smart Object even after it moves. After a little digging I found this line in the Smart Objects Overview documentation: βEach Slot includes the location and rotation relative to the parent anchor (baked from editor placement), as well as several overridable properties.β Am I understanding correctly then that Smart Objects canβt move?
it sounds to me that the part that can't be changed is the relative tranform between the smart object and its parent. you can just move its parent and the smart object will follow
I'm using navigation invokers with dynamic nav mesh. In this image there are two pawns with navigation invokers. If I tell one to run to the other, they won't move, because the nav mesh makes it unreachable. What is the intended way to handle this scenario, or is it simply to have a radius that is high enough to cover all possible use-cases for the pawn's behaviour?
Yeah, it is how the navigation invoker works. Usually it makes the player the invoker and AI would reach the player with the navigation mesh generated around it.
I have the invoker on AI as well as the player, since they still need to patrol
I guess some games just set a radius as far as the player can reasonably see, but I have a more complex spawning system that optimizes them to not even exist in the first place if the player doesn't need them to
Massive open world and all that
Not really sure what you are trying to do, but if just for patrolling, you may let the AI pick the random point inside the navmesh, right?
No no don't worry, I was just wondering if there was something that I wasn't aware of, since you've confirmed that I understand it my question is solved ^^
I watched this video recently. They dealt with generating a nav mesh in a massive open world very nicely, I thought: https://www.youtube.com/watch?v=yqZE5O8VPAU
In this 2021 GDC AI Summit session, programmer Eric Johnson explores the unique AI challenges faced during the development of Kojima Productions' debut title, Death Stranding.
Join the GDC mailing list: http://www.gdconf.com/subscribe
Follow GDC on Twitter: https://twitter.com/Official_GDC
GDC talks cover a range of developmental topics incl...
since trying to make an AI travel over very long distances usually breaks things
I'll have a look. My AI won't really travel long distances though π
ah ok. well, either way if you're trying to move your navmesh around or generate it at runtime, make sure this is set to dynamic. You might already know this, but just in case:
Yup, its dynamic with nav invokers
So much better than the old ways
I replaced the blackboard/bt system with logicdriver state machine and I actually somewhat enjoy AI now
heh, I'll have to delve into that at some point
LogicDriver is expensive but its extremely well made π
Is it a plugin or you made it yourself? Looks good
sounds like a paid plugin
Marketplace plugin
Is it a FSM?
I use it to drive my GAS based combo system too. Going to rebuild my dialogue system on it to replace my custom node graph that I made. But AI is it's best use-case I think
Yeah, better than any of the other ones, there is free version too
The dev clearly built it by repurposing anim graph, but its very well done, very clean
How is it comparing to state tree from UE5?
Well, because I have this already, I've got 0 use for state tree. But I was talking actively with someone making something using state tree and it seemed incredibly limited by comparison, but for very simple purposes that require an FSM, I'm sure state tree is fine
Yeah, Epic uses state tree for mass AI not really complicated combat AI
Sometimes all you need is a pencil and paper, and sometimes you need a fully featured wacom cintiq. State tree is the pencil, logic driver is the cintiq π€£ Silly comparison, but that's what it seems like for me
Well, one benefit with state tree is if you want to make a marketplace plugin that needs an FSM, because of course you can't make it depend on someone else's product
allow partial paths and the pawns will be able to eventually reach each other (in the presented case anyway, in real world geometry might make it impossible).
Those are the bits you do see, but you don't see the internal use - ST is being used for all sorts of complicated scenarios, like multi-agent interactions. We even had ST-driven combat in the Matrix Demo at one point, but got cut due to dev time constraints. Similar to SmartObjects actually :/
Glad to hear you have more cases for using ST. I'd like to know what's the internal opinion for AI work pipeline? I mean the recommended cases for AI using ST or BT?
Is it safe to use the State Tree? There's a bug in it that causes crashes. I have a workaround but I don't know if it actually solves the issue or I cause a side effect that hides the bug.
Right now ST is being used for all the new stuff, so SmartObject logic, interactions (both player and AI), and a number of non-AI uses (like Animation). BTs are still being used for AI agent logic but that's mostly due to it being a well known tool with a lot of game-specific nodes already implemented.
Depends on your definition of "safe" π If you want to rely on ST I'd suggest running with latest code (i.e. not launcher provider) - Mikko is constantly working on STs and the improvements and fixed are constantly streaming in.
I assume this means compiling the engine? I haven't tried that yet, but it's good to know. I will wait for newer releases then.
Although it's a plugin not the engine... nevermind.
note that releases drag months after actual development.
it being a plugin doesn't help that much - some work allowing ST changes is being done in other modules (like StructUtils), so you essentially need the full engine
Thanks. I'd like to see more showing cases for ST in the future. And probably providing a solid document as well π
I already started working on a custom AI with its own editor, so it's not essential for me right now. But the idea of the State Tree looks interesting.
I believe in 5.4 Lyra will have some ST uses, but don't quote me on that.
So are STs meant to replace BTs altogether in the long run then?
there's no plan to discontinue support of BTs. There's is, however, no feature work done on our BTs either.
Fair enough
are they already pushing commits to 5.4 branches??
sorry I had no idea how far ahead they are developing it's nuts
nah, not like that. The work is taking place in Main and every now and then a release stream branches from that to get stabilized and polished. AFAIK 5.3 haven't branched yet (although will soonish IIRC).
oh that is interesting
very curious to see ST in lyra because I've been toying with the bots and man I wanna try something else lmao.
Pity STs are not getting as much community love as Mass does - otherwise we'd have an awesome community-created sample project for STs as well (nudge nudge π ).
mass like mass entity system?
yeah, Mass (capital M π )
Great! Thanks for the tip
I've only played around with Mass State Trees but it's not suprising there isn't much love there yet since there isn't much there yet to be honest. Even the most basic things can't be accomplished yet out of the box. π€
You mean using MassStateTrees or just regular StateTrees?
Mass
Yeah, no suprise there. MassST was added only as a thin layer between ST and Mass, just for the purposes of the Matrix Demo. No work has been done on that since, the work is focused on developing core ST tech - Mass integration and use cases will come next.
I can't remember the limitations but the free version of logic driver may be sufficient if you want a non behavior tree implementation
I've tried MassStateTree on the current released version and it even didn't transfer to the next state right now. So I just gave up Mass to wait for the next release probably 5.3?
How much is it?
Hmm don't recall and I see NZD also with our 15% GST π
I'm out of the loop, is there any work being done to integrate LLMs into AI in terms of dialoging or even driving actions dynamically?
I started with free version to see how well made it is, then when I wanted pro features I bought it
99% of marketplace plugins are poorly made but this one isn't
IIRC, replica is doing something like that with Unreal
It is very expensive as I'm checking the price nowπ€£
I do remember that much. I'd pay 3x that now that I know how good it is. I build a lot of my systems on top of it so it's easily worth it for me. I recommend the free version until you decide it's worth it for you
The way I built by combo system is very unorthodox so I was surprised it had the functionality. Instead of the state machine driving it, gas needs to drive it, state machine updates based on gas instead but the gas ability looks at the links on the graph to ensure it's a legal combo the client initiated and also to see what's next in chain, etc
It let me make custom nodes that take a gas ability too
Screenshot here
The dev really thought of everything and the code is clean
Not surprised that they actually having a team to support it nor like you know, individual plugin maker and just have no supporting. Some plugins you have to figure out how to use it even, no document at all.
The dev is incredibly helpful actually, good documentation too
There's a discord, but not sure if I'm allowed to link invite here
Don't worry. It is easy to find out on their official site.
BTW, the combo system you mentioned is your player combo or enemy?
Well, in this game which is kind of like a very combat focused BOTW, a lot of enemies have same abilities as players, so fighting enemies is similar to fighting players. Of course, there are simpler non-human monsters. So this one is for the player, but also humanoid enemies
This also helps a lot with combat design/testing because I don't need other players to fight me π
Well, if for combos, I probably will just use combo graph plugin. (Maybe we are out of the topic for this channel, lol
There is no available plugin that can do anything remotely close to what mine does. It ticks between frames so even at 5fps you have extremely accurate hit detection all through the arc of the swing and at the extents. And it has net prediction with server authority.
Hmm yeah bit off-topic now
Anyway, good to know it and may consider it while on sale.
I'll do anything to avoid behaviour trees, I find it tedious and messy π
BTs are not that badπ
that's usually what I think about any system before I actually understand how it works π
Ha ha, I'm so insulted ;P
I don't think you're too far off, but I don't want to understand it better than I already do, I was very put off π
Know your audience
I have another question about BTs. I have a combat tree where the only thing the AI can do, upon entering the tree, is look for a combat target, calculate its distance, and if it's > 500, enter the attack ranged behaviour. However, this initially fails which means, as far as I understand, the services Set Combat Target and Set Combat Target Distance are not run again because their single child node fails. I verified this by checking the Blackboard values these services should be populating and they are not set. Am I thinking about this the wrong way? Is it necessary to have a "default" child that will run when all other children fail?
Ah this seems to be what I'm looking for... maybe?
Did that do anything for you?
Yeah now every time the branch is entered it seems to start the service's tick which is what I want
note that this is a terrible BT structure. If the conditions fail nothing will get executed and the whole process will start again the very next frame wasting perf. This is why I always suggest having a "never fail" fallback behavior, like "wait 5 seconds" and have higher-level actual behaviors "abort lower" when conditions are met.
I sometimes added dummy wait nodes for most of these cases...
Same, seems to be good practice
Thanks, I was curious about this and this makes sense! Would you recommend also against using Call Tick on Search Start?
If you have a service producing come data that a condition on the same node or any of its children consumes, then you do need Call Tick on Search Start for things to works as expected.
Hi, is there a way to trigger 'finish execute' only when the AI reached its destination ? (I can't use the default 'MoveTo' node in the behavior tree, because I need to dynamically change the querry filter)
There's a node called "AI Move To" which is a task has the completed call back from the out pin.
π
aah nice, unfortunately this node doesnt have the option to change the filter class π¦
I'd look at the nodes in C++ and compare them, maybe you can add it yourself. I've done stuff like this before! (Two nodes in screenshot as an example). I didn't modify engine for this, I made plugins
I'll give it a try, ty π
If you need a dedicated example thats easier to read than engine, my repos that have those nodes are public https://github.com/Vaei/PlayMontageBlend/
thanks a lot!
Someone else might have an answer for you that is already done for you if you wait tho π
Hello, I'm just unsure if I should go for the regular Behaviour Tree + Blackboard AI setup if my AI is simply going to be moving between certain point periodically, checking a few conditions each stop, then going back to the base
Up to you, you can just use blueprints if you want, but it might be worth using BTs in case you want to build additional functionality on it later
true
I am trying to have my AI rotate towards the player when they approach but am running into a problem when I fixed settings for smooth movement for the AI. I was hoping it would be simple to use the Rotate to face BB entry task in my Behavior Tree, but since I change the use Controller Rotation Yaw setting this no longer works. Is there another simple way to rotate the AI? Do I need to figure out how to do partial roatations per frame towards the point?
How do i make ai shoot autofire weapon without tick? im trying to use ser timer and delegates on cpp and dont finishing the aitask for example. im having a hard time figuring this out.
Have you looked into using a timeline? I know you are using cpp but there should be an equivalent
yeah I am looking into it to solve my problem and I am facing this agony
don't be afraid of the #blueprint π
@gritty glen I will make this, since I need to include one that uses partial paths anyway, I'll make one that also includes class filter and make it public repo.
Turns out, in this specific case, it isn't as simple as the other nodes I made.
This UAIAsyncTaskBlueprintProxy which is responsible for the AIMoveTo node registers itself with UAISystem, however UAIAsyncTaskBlueprintProxy is only exported MinimalAPI so its impossible to derive and I can't bind to the events because those aren't exported either. I also can't call Super on the engine's function that creates it, because before it completes, it is already making the move request to AIController.
I don't know why the UAISystem wants to track these nodes, but I see literally nothing in the engine source that ever accesses this TArray<TObjectPtr<UAIAsyncTaskBlueprintProxy>> AllProxyObjects; cache and it is not exposed to blueprint.
I will submit a pull request exporting this class' functions properly in hopes that I can clean this up in the future. This is the result working properly, but only because I changed the engine source to export what I needed. You can see it still functions as expected.
I have created a temporary version that isn't tracked by the UAISystem and as expected - it works just the same. But I suspect in a future release Epic may make use of their cache so the PR will be important for that. I'll do the PR and setup the repo and send you a link @gritty glen
State Trees are really damn good.
AI MoveTo node with extra options.
https://github.com/Vaei/AIMoveTo
Here is the PR that I want Epic to support so I can make the UAISystem track the node properly. I don't think it uses the cache at all yet, but very possible it will in future version which will kill this node unless they accept the PR π
https://github.com/EpicGames/UnrealEngine/pull/10528
This is my second PR in a short time, are they accepting PR again? They stopped around the release of UE5 (understandably)
For which branch you made the PR? I guess usually ue5-main has more frequent pr mergings.
Yeah I made on ue5-main
I found a very serious engine crash with very simple fix that I submitted few days ago, so that will be a better test to see if they're accepting π
Maybe they fixed it already? Who knows.
Seems the timeframe is about 1.5-2 months based on other PRs. But still many outside that timeframe with no reviewer assigned. So depends heavily on simplicity. I think mine are very simple so they will probably take 2 months.
@night hazel worth pinning?
this PR is so new we don't even have it converted to a jira ticket yet π I'll bring it in once the ticket is there (I've already taken a look, it's good).
Re overall process, PRs are kinda on hold, but it also depends on target team. AI team is pretty responsive with PRs (although there are some that fell into the backlog and I need to bring them back at some point).
It doesn't matter really.
That's good news! Thanks π
And yeah I only just submitted the PR, I was musing over the delays to see if I can figure out a timeframe, certainly not being critical π
Some teams accept PRs very rarely, while others are very enthusiastic about them (like the AI team π ). So I strongly suggest PRing AI code π
This was a simple use case that is right up my alley, I think for 99% of things you don't want me touching AI code ;D I'll keep it in mind though, always good to know if I do the work there's a good chance it'll be used
That makes sense. I think it really depends on the working style of the team leaders. I would consider more actively about PRs with AI later. Sometimes it feels invisible walls between the engine team and the users. You know what I meanπ
I think if you do super simple PRs that are easy to understand at a glance it helps a lot
I'm sure they get tons of PRs where they have to spend real time figuring out what it actually achieves (and even more to figure out what it's gonna break)
yeah, the simpler the change the higher the change it will get pulled in
That's why we need good coding style to make others understand your codes betterπ
deltaTime deltatime DeltaTime deltaSeconds DeltaSeconds
I could use some advice on handling the nav mesh for bots that can climb. See video for example; in this one I've disabled pathfinding so it "works" for preview. It is no problem to have a set height that every single AI in my game can climb up (275cm), my world has considerable verticality so it just makes sense. Which means I don't need multiple nav meshes. I also specifically don't want to use nav links that require placing by hand, needs to remain procedural. What would be the correct way to implement this?
In the screenshot I have set AgentMaxStepHeight to 275 and it does work but there seems to be some errors (see last video) and I wonder if they're caused by the navmesh, it doesn't fill above my cube properly?
DeltaTime and DeltaSeconds are the only valid ones in Unreal π
I would suggest nav links, but you can generate them procedurally. Make them one-way and mark with a "climbing navarea" and you have enough to work with.
Could you expand on the best way to do that procedurally? Is that something like walking the nav mesh edges and generating the links?
I actually just started looking into it and was googling the same question π
Occurs to me you didn't get an @ @crystal hatch
I'm thinking PCG might do a good job for this kind of thing but I haven't even really started with it yet, I'll definitely use it elsewhere, but maybe there is something better suited
You could add a component to the navmesh that, whenever the navmesh regenerates (there is an event for that), regenerates the navlinks. You can query the navmesh for βdebug dataβ which includes the edges as a list of vectors, so that each consecutive pair of vectors is an edge. The edges are directed so that if you normalize and rotate them 90deg around Z (donβt remember if itβs clockwise or counterclockwise), you get the normal pointing away from the wall. For each edge you could try generating a navlink(s) by doing a bunch line traces etc to detect obstacles.
Games like Assasins Creed markup the environment with climbable tags on ledges etc.. Then I assume they do some kind of tracing to identify nearby marked up climbable objects. There's an example of some of this in the ALS locomotion system, which is free on the marketplace.
hey guys im having a issue where i kill my ai, but the controller keeps on doing the BT tasks and i dunno how to resolve that
There's a checkbox, I think on the character to attach the controller to the character.. maybe that associated it with the death state of the character? been a while π
might be on the controller BP too though..
The way to tell, is that your controller should be as a child of the character in the scene outliner
didnt work, i tried creating a new blackboard key so it check if the ai is dead then created a function in the controller, but it didnt work :/
Is the controller attached to your character in the outliner when you run in PIE?
look for that checkbox, it should be an obvious one when you find it.. "attach to..." or something like that.. I forget the name
the basic idea is that because they're seperate actors, you need to attach the controller to the character, otherwise it thinks you're going to reuse the controller I guess
Its either on the character or the controller blueprint
probably the controller
alright gonna try that
red?
ooh you're right
what does that mean?
Oh yeah, totally safe and secure π hahaha
That is great!
Now I wonder if it made the cut off to make it in the next engine version
it will make it to 5.3
Any elaboration on generating them procedurally? It sounded like you had something specific in mind, but perhaps you were just suggesting that I figure out a way to do that? (Sorry to bother you when you're probably at work π )
Definitely appreciate having someone from Epic that is in reach. AI community is lucky π Now to find me an Epic dev on the animation team...
Is anybody using https://github.com/KellanM/OpenAI-Api-Unreal and has linked the plugin with the OpenAI GPT4 API?
I cant choose the GPT4 Module (error missing module) and if I choose 3.5 Turbo Setting, it tells me "Messages" is a needed property.
Yeah, Mieszko is awesome
Is there a way to update just a specific area of the navmesh? I have a bridge that is disconnected initially, but over the course of gameplay, it gets reconnected. I'd like to just add in the navmesh generation for this location only instead of trying to do the entire navmesh.
You can make a NavArea that has NavArea_Null class assigned, it will remove nav mesh wherever you place it.
π€
If you place it on your bridge it will remove nav from the bridge, then you can just scale/move/remove the nav area as the bridge builds
Will the navmesh auto link up once it is in position?
This page is good for a brief overview of the available tools for navmesh https://www.vikram.codes/blog/ai/02-nav-modifiers-links
Or do I still ned the nav link?
It should auto link up
Should be easy enough to make a quick map to test it on first ^^
I'm familiar enough with nav links
That shows more than just nav links don't be confused by title π
It threw me off too at first
Not sure it covers anything I didn't already know π
I do appreciate it!
I'm still pretty new to this stuff myself π
I just haven't been in my current situation yet.
@harsh storm this should be what you want, right? Unless I misunderstood, you should be able to just put one of those over the bridge to remove the navmesh, then resize/move/remove it when the bridge constructs.
In that video I'm using it to remove the navmesh where the navlink he's trying to use is, he has bAllowPartialPaths so he tries to get there without the nav link until it becomes accessible
If I'm not being helpful I'll shutup π
hello! so im stuck, i have a cloaking bp setup and when i use it i want the ai not see me when i use cloak. How can I achieve this. I'm using Pawn sensing and not im using ai perception
I've actually tried this before. The only problem is if you have a bunch of AI pawns, they would lining up around the navlink actor and waiting for the one in front of him to finish. It is obviously possible to put lots of navlinks around the object but it is not very convenient for a big level have lots of platforms like that. Any better idea to solve it?
Sorta - but the bridge would end up being flush with the ground.
I have nav link for climbing up a ledge, and when it wants to go back down it goes to the same one. Of course I can mark it one-way to stop this happening, but I still want them to be able to fall/jump back down a ledge. Thanks to bUsePartialPaths he will run to the ledge but of course he just gets stuck there. I definitely don't want to make nav links for where they can jump down because that's literally everywhere, is there a solution for this out of the box?
At this rate it looks like I need to build something that procedurally spawns nav links all through my level anyway
Maybe some sort of line trace to generate the nav link where heβs looking, or at his feet, which is conditional upon him being up on a ledge for performanceβs sake?
Easier said than done ofc π
The game has no concept of a ledge, it simply sweeps geometry to see if what you're about to walk into could constitute one and if so climbs up it, so there isn't anything like being up on a ledge to factor in.
Only way I can see it working is to calculate the path the bot wants to take, then conditionally spawning nav links anywhere that it obtains a partial path, check if that is somewhere the character can fall down, until eventually the nav links form something walkable. That sounds a bit expensive. I was hoping the engine had something to support this, I imagine it would be common but maybe not?
It really would be so much easier if I could just set the step height to 275 (the max climbable ledge height), but I get erroneous nav meshes doing that
Might be, Iβm sure some of the legends in here prly have some tricks of the trade
The simplest approach to procedural navlink generation is to have extra data with your static meshes or actors, that declares/configures possible links and then at runtime you try all of them and the system should ignore the invalid ones. This approach is how navlinks work in Fortnite.
That makes sense. I can work with that. Might be a little less chaotic doing it that way too
Pooling or ECS. Depends on a lot of things. If you use ACharacter you have no chance of pulling that off. If you have extremely minimal actors but are spawning projectiles then that's writing to memory every time which will destroy your performance which is where pooling/ecs comes in
you'll need Mass (and a lot of work) for that π
(Mass is ECS)
yeah, 1000 regular characters is impossible with the current state of Unreal.
it has never been possible in the past either π
Lol
UE4/5 has ACharacter + UCharacterMovementComponent which has client-side prediction out of the box. It is how you create experiences where players cannot cheat but still feel like they have 0ms latency. The downside is that its computationally expensive. Unless you're trying to make an RTS then for most games it is worth it's weight in gold (and its heavy with CMC being over 10,000 lines π€£ )
Fun indeed
By not using the character classes, start with APawn and implement only the logic you require for your game
I have seen someone do a HISM based approach for an RTS game but that isn't in my skillset
20 is easily doable. ~100 is achievable.
You can still get 20 characters unless your game is poorly optimized
well, 100 is achievable with Fortnite tier servers π
You don't need 100 very smart NPCs, lol
"achievable" means you need to know what you're doing and optimize for that π
Unreal can, you can't. Not being rude, just the truth
Itβs not the car, itβs the driverβ¦
why won't you use Unity then? π
Lyrabots always kicked my ass, I don't think they are dumb...
My troll senses are tingling
Well this is no longer an #gameplay-ai topic at least
Thank you for joining us and gl with Unity
You put 100 AI in a small map, that's the obvious result, dude,
lyra boths gather list of opposing team
target closest one
then ipon seeing ANY ENEMY
pull the trigger lmao
while trying to aim at their target
You know what, unreal has a lot of stuff done poorly, AI isn't one of them
