#gameplay-ai
1 messages ยท Page 168 of 1
Hi people i will need someone with some experience on MassAI or similar EQS to help me on a project, its a small project but there is some budget so if there is someone that can help and finish the system for the project i will pay him
MassAi documentation doesnt have any user guide ๐
Save your money: https://github.com/Megafunk/MassSample
Also job posts generally should be in #freelance-jobs
@ocean wren Wondering your thoughts about one thing.. I made DOOM's token system, but not sure how I should implement it to Behavior Trees. Should "token claiming" and "token releasing" processses be a BTTasks? Or decorators?
I'm thinking about a component attached to AIController and BTTasks or BTDecorators will communicate with it like how gameplaytag checking works in decorators, but not sure since execution flow doesnt fit with token system in BTs
Maybe token stealing logic could be in a service too ๐ค
Not heard about doom's token system, got a reference? I assume its some kind of smart object kind of thing?
I used a claim/release thing for cover positions, I'd keep them external to the BT though to be honest.. have booleans for activating the different behaviour (or a single enum value)
having them external and "in the world" allows you to visualize them outside of the AI etc.. just find it a bit easier to understand. I don't think there's an ideal for this kind of thing though.
I guess token claiming could be bttasks in terms of performing the action.. but in my case I needed the claim to happen at the same time as the pathing, so I had a pathfinding task that looked up the path to a cover point and reserved it at the same time.. so that others wouldn't try to path to the same point. My EQS filtered out reserved points
The release was a bit different. Because you could temporarily move to a higher priority but still intend on completing the pathing move to cover
so I had a timeout for the release as well as a distance check that would release a reservation if you got too far away due to other behaviour
It's also known as ticket system, I'm pretty sure you are familiar with it. They are kinda work like smart objects I guess but not exactly same from what I know
It's basically an UObject owned by a subsystem, kept in an array. And components (UTokenClaimerComponent) try to take it based on utility system, like how they are close to target, how much health they have etc
And the one which has a valid pointer to token object can run that behavior
But what you explained also looks like a token system, its just not bound to a subsystem/pool, its just like smart objects
fwiw usually claiming/releasing, setting states like crouching, are useful to be in services for one specific reason
or decorator I guess
you can easily reset back out of that state or release the claimed resource if the tree becomes inactive
If you have a sequence of tasks like claim -> do task -> release, and do task is aborted, now your resource is never released
but if you use a service or decorator [claim resource] do task, now if do task aborts it can always be released correctly
I think
Services should try to claim/steal tokens
Decorators should check validity of tokens and activate behaviors (allow sequences to run etc)
And tasks should be only for releasing tokens
Well yeah but keep in mind tasks don't always execute
so if you claim resources in some branch of your BT and it aborts, the task that releases it might never run
that's why having a decorator on top of the branch which uses the resource that will release it on exit is useful
of course it's not for every situation, maybe you have a reason to allow them to keep claimed resources
but it's something to keep in mind
If BTs shooting a delegate, component can clear the resource too I guess, but yeah you have a point
I gotta consider that situation
I had this situation in my BT's when it was instructing NPC's to crouch :)
Then they would never uncrouch in some situations because it would abort the branch that had a task to make them uncrouch
Easy enough to solve by having a decorator on the sequence containing the crouch stuff that uncrouches automatically when the sequence exits
(of course one could argue if crouching is too specific for BT tasks and it should be handled differently, but that's a separate issue)
Hey there, I am having a problem with AIs
I made a simple zombie AI that can chase the player when it sees it and eventually attack the player when it reaches it
It can also hear sounds and if it hears one it will go to its location
The Sight sense has priority
Now, normally this works amazingly, the AI can hear properly, see the player, chase them, everything works, or at least it did until I modified one map
In the map I modified the AI has just became stupid, when it hears a sound, it will attempt to reach its location but its pathfinding is broken and will bump and slide on walls, moreover, when it sees the player, it will rarely chase them and even when it does and manages to reach them, it will rarely attack
Moreover, when hearing a sound, I said that the AI will try to reach its location
When it does, it will stay there and execute all the code attached to hearing and will completely ignore the sight sense until the hearing code has been fully executed
I have no idea why this is happening, it worked one second ago and works perfectly on other maps
I hate when something just starts not working out of the blue
It might be a clue the fact that, for now, the map is built entirely of brushes and there are still no meshes
Nvm I fixed it
It was all caused by the Nav Mesh for some reason, I had to delete it and add it again
Who knows why it didn't work when I did it the first time though
I've created a level with doors that open, I have placed my character at one corner of the map, and ai spawn point at the far end, opened doors and the AI doesnt start chasing the player. I have increased the pawn sensing sight radius to massive amounts and set the peripheral vision angle to 180 as well as 360, nothing makes them target the player. they also seem unable to move through the doorway even though the character can simply walk right through. (the door is simply a subtractive box with a door frame and door mesh) anyone have any ideas on how to resolve this?
Anyone have any experience with "Behavior Trees"? I am just starting to learn about implementing ai, however I can't even get started with getting the AI controller working. I made a custom AI controller class, hooked up to my main enemy BP, within the controller class, I have it set to run my behavior tree off a begin play, and a print string to make sure its running the AI class, however I am not getting my print string, so I have no idea what i'm missing to be able to run the behavior tree from the AI class
Make sure you have the correct auto possess by ai setting on the pawn
if it isn't set right then it won't actually spawn the ai controller for it
which sounds like it might be the issue there since the print should definitely be showing up
I found out how to make the ai's see through objects like a rock I had put outside as well as doors through editing of the collision setting of visibility, but my walls are actually just the floor from the default level copied and resized. there is no collision setting in these. is that what makes the difference and I actually need to make new walls? god I hope not because thats alot at this point now that I have all my doors in place lol. but if thats what is needed to make it work, looks like im stuck doing it lol
I have mine set to placed in world, also set it off the begin play to make sure, but still not getting any prints ๐ฆ
and you've placed this pawn in the level?
yea
when you play check in the world outliner whether any kind of ai controller is being spawned
iirc they should show up in the list
and the pawn just is there and does nothing I take it?
correct, it has some regular BP code on itself that shows when its been hit, but nothing AI related runs
That's odd, have you tried changing the auto possess by ai to spawned and placed in world?
yeah, I tried that option as well
any warnings or errors in the log?
oh wait! im getting a print string now that I changed to spawned and placed!
๐ค
I must've changed something in between last time when I tried that option
so you're not using spawn actor to create this?
no, I have it dragged straight into the map, no code to spawn it
oh wait...
maybe I am spawning it hahaha XD
its odd to me that I set the AI controller off the begin play and it still didnt connect the AI controller though
You're just setting the ai controller class, it's just the class that it spawns assuming the other settings are correct
if the other settings are wrong it doesn't matter what you set into it because it won't use it
gotcha! not sure why it won't force set it using a node, but hey i'm glad you were here to mention the auto possess options, even though I swear I checked that earlier.
This is actually the first help i've gotten from discord for unreal, so I appreciate the help! ๐
np
you can manually spawn the ai controller and possess the pawn with it as well
that would be the way to "force" it, or use the "spawn ai" node which also spawns a controller always
oh ok, so if I just used spawn AI From Class that would be the way to go if I wasn't using the auto possess
Yep
sweet!
Riight, yeah, this is part of resource locking. They do the same kind of thing in the gameplay ability system if I recall? might be worth trying to use that? We usually use resource locking for things like animation so you can do weird things like 360 no scope while doing a roll ๐
You can have stuff like resource locking the arm control so you can IK it to a door handle
So yeah, common AI technique. Plenty of ways of doing it. Its basically a critical section in distributed systems terminology if I recall correctly
You just need some mechanism for transactional request+reserve, update, release as you posted
usually you want it to be transactional so that if you can't reserve, you can roll back and fail over to another attempt
why is it when I set actor hidden in game the ai can still see the player
how can I make it so that the ai can't perceive the player when hiding in the dark
hidden is only a rendering related feature
you can set a flag on the player to indicate when it shouldn't be seen, and check for it in the perception logic, or you can unregister it from perception
well how do I setup for the player to detect whether he's under light (visible) or not ?
Depends on how you want it to work I guess. You could use sphere colliders on lights, or sample the color of the pixel under the layer to determine if it's dark enough, etc.
I want it as a dynamic system, not detecting light source via tracing or sphere collision
so is there a guide for sampling the color of the pixel thing ?
No idea :)
You could probably use a scene capture for it but it might not be as straightforward
I'm building an RTS game and I want to implement a reverse move command like the example video here from Command & Conquer RA3 (where you press the reverse key, which toggles reverse on, then you right click to send the move command and the unit turns away from it and move backwards.)
I have everything up to moves backwards working, I click the reverse key, right click to send command, the unit turns around to face away from it, but once it's done turning away, it rights itself to face the location as shown in the example video from my project.
Is there a correct way to make a character class type AI move backwards? I can't reverse the walk speed, it won't go negative. And turning off 'Orient Rotation to Movement' makes it so when the unit has to path around an obstacle it doesn't turn it just strafes around it, which isn't really realistic. Any help would be appreciated as this is very out of my depth.
Attached:
- Example of desired behavior from another game
- What I currently have working in my project.
- Image of the code that currently; rotates the unit to the face away from the location, but once it's done rotating it rotates back to face the direction it's moving. This code also doesn't account for if the unit has to path around another object.
Is there an AI/movement controller way to turn a pawn to face a location? Or is the way to do it to just change the actor rotation directly?
You can use SetFocus on a Location or Actor to continuously face something, even while they move, and there's a BT Task for turning to face a location. CMC needs some specific setup for these to work the way you expect (and you might need some additional animations to look 'right')
Make your own movement component
This route worked great thanks!
We used the AI controller to get the unit to face the reverse of its forward vector, and update the facing direction based on the next focal point
Awesome!
Is there a right way to use "Enable World Origin Rebasing" in world composition with dynamic navmesh? When I use it, right now everything gets moved properly, but the navmesh still generates based on 0,0,0 world origin, so it doesn't generate in the right place (and so theres no navmesh around the player character)
on 4.25 if that matters
Has anyone managed to get foliage to work with navigation in UE5? The nav mesh completely ignores all my foliage regardless of the settings used
I dont think foliage does anything to interact with navigation unless you add colliders, even then.. not sure
Anything related with foliages, landscape etc is ultimately cursed
Epic strictly not exports them to extend 
One man's curse, other man's blessing
I have an enemy AI which can hear and see the player. I use (picture) this node setup. How can i make it so the ai actually recognize which sense was triggered? Currently for hearing and seeing the player it triggers the same nodes, but i want a different behavior for hearing and seeing
in c++ you have an array of stimulus that correspond to the various senses the perception component has. i dont know how it works in blueprint
Ah, thank you. I found the node for it. Thats is the one, probably the thing you mean in c++
yeah, thats it
cleanest way is probably to create your child class of aiperceptioncomponent and add events for each sense using this node
Is there a way to change the view of BTs to be more like the right side of this slide?
Or a way to collapse branches?
My AI is barely beginning to get complicated and it's already feeling unmanageable
I'm not aware of any way to collapse branches, but you can use other BT as branches. There is (or used to be) overhead in calling a second BT from the first BT, but that would kind of be similar to collapsing nodes in BP.
So basically like this..
I could also put that conditional inside the BT_Patrol behavior
I wonder what the overhead is like
Correct
I'm not sure.
Are there any tutorials out there that show getting to more complex behaviors rather than just the basics of like Patrol + Chase?
Where the BT starts getting more intricate
I've got mine set up with basically Patrol, Chase, Search & Investigate. I guess maybe the next step is more subtlety to the behaviors in those states. Adding pauses, looking around, barks, etc..
Seems like all the tutorials kind of bring you to the point I'm currently at
Not sure but it's basically just combining more stuff I guess
You'll probably want to dot around some waits with randomness to avoid all of them reacting at the same time etc.
Off the top of my head, I don't recall any 'tutorials', but I used to watch Ian's Inside Unreal videos and get some of the projects off the marketplace to see how other people were doing it.
Do you know a good one on the marketplace to look at?
A more complex sample project would definitely be a good thing for me to see
The one that comes to mind is Dynamic Combat System by Grzegorz Szewczyk. I'm not sure if that is as complex as you are looking for, but it has an Ai Template in BT that was interesting for me to see: It had some ideas that helped me out when I was first figuring out how to make enemies feel better. It ended up being misleadingly simple, which is good and also underlines the idea that the player's human brain fills in a lot of the blanks when seeing the enemies do things.
Little Disclaimer: I am not endorsing the approach that DCS uses simply saying that it was useful for me. I ended up making my own utility Ai solution that doesn't use BT at all because it does better for my needs.
There are videos and information on the DCS marketplace page that show what it contains so you can be more educated about it before you make any purchase decision.
You could derive from the BT editor and add a few extra functions to the editor. People have done that for things like making different types of node link rendering etc. Its actually a pretty nice framework (using slate and FGraphNode) for extending. I wrote a few different editors using it. Honestly though, you'd be better off looking at StateTree as a starting point I think
That said, I always though BT's were better in a top down format, because the lines are easier to create.. making a BT editor from a simple treeview control is pretty trivial.. you could even do that using the BT code but a different view of the graph data.
top down format as in.. left-right for root->branch and top-down for priority
The right hand side of the GDC image.. it was the way that Damian Isla showed Halo's BT's that got everyone interested in BT's in the first place ๐
Has MoveToActor always taken the Capsule Component radius of both characters into account? Or did I mess with some setting im not aware of? Also why isn't it exact? For example if the radius is 50, the distance it will stop will be 51. But if the radius is 200, the distance it will stop is 198.
Dunno, have a look at the code?
It's had an option for those I think
Distance is probably not exact due to acceleration, braking, and such
yeah but even if thats being the case it should never be over the acceptance radius
because shouldnt it check, if im not under to acceptance radius, keep moving?
or at least if I recall the MoveTo
I found if I turn off the default bStopOnOverlap = true, it does always stop after getting inside the acceptance radius
but still a little confused bc even if the capsules collide directly at edges of the circles it still shouldn't be greater than the combined total
depenetration?
It's possible that moving objects will move inside other objects during collision
so it recalculates to stop that from happening?
that sounds reasonable to me
the difference in value isnt that big for anything under a 50 radius with bStopOnOverlapTurned on, so it does seem usable
I tried it with a 100 radius though with bStopOnOverlap and it kept stopping at 208 and 8 isn't a small dif (both characters have the same radius)
wait you can make foliage work in ue4 at least with navigation, is this what you mean?
ill screenshot my settings if thats what you need to happen
but its ue4 not ue5 not sure if its different
actually as far as i can tell this is all i did
There was a marketplace plugin for that, then somehow they removed it
For the BT editor? I remember the one with the node wiring changes.. but didn't see a BT editor one. I mean its just replacing a few classes (FDrawingPolicy and another one) with different ones.
I mean you can do part of it in the editor settings for the BT editor
For BT editor
Replaces top-down layout to left -> right
Hey! Is it possible to have parts of a map have Dynamic Nav Mesh whilst other parts are Static? I just need one section to be generated at runtime whilst the other parts will remain the same. Thanks!
Maybe if you write a custom system to handle it like that
It's not going to regenerate it unless you do something which causes that to happen, like moving an actor which has can affect navigation set, so if you make sure you don't do that then you can avoid it
There's a hacky way to do this where you can use Nav Modifiers and then change the Nav search filter on your AI to see the modifiers as obstacles or passable.
That way you've still got a static nav mesh, but you can do something like have a door that closes & opens
Is anyone using the new State Tree tech in UE5? I'm curious if anyone has any strong opinions there.
Not using it yet because I'm still on UE4. I've looked into it though and my general feeling is that it might be aiming to solve the wrong problems...
That opinion is based on this talk--
https://www.youtube.com/watch?v=Qq_xX1JCreI&t=1167s
It seems like StateTrees improve the readability and add some more BehaviorTree like stuff to a Statemachine, but then still have a huge amount of interconnectedness
which is from the talk what makes maintaining BTs difficult
Havent used new State Tree Tech yet - curious as well. I really dig https://www.unrealengine.com/marketplace/en-US/product/logic-driver-state-machine-blueprint-editor?sessionInvalidated=true
There's a free version of that with all you really need ^
I've been using Logic Driver Lite to manage my state decisions, with a BT to actually run the behaviors.
(Again modeled after that talk)
My biggest concern w/ State Trees is that it appears to have very little reusability. I liked that with BTs we could nest some boilerplate tree logic inside of other trees.
That's exactly what I was thinking...
A hybrid approach would be best.
My gut is that StateTrees are a good research/experimental project but not ready for prime time because of usability things like that
btw - not sure if you have looked into the mass stuff, but this was really useful: https://github.com/Megafunk/MassSample
I was kind of hoping I could do that with State Tree + Behavior Tree but they seem to be at odds with each other because of how they're architected.
So you'd recommend Logic Driver + BT?
Logic Driver Lite + BT for early dev and prototyping... For production you'll need to swap out Logic Driver for a more performant implementation.
But it's still really good to figure out your architecture, and a more performant state machine is easy to cook up
I really like Logic Driver... not sure if it would be good for large numbers due to blueprint
OK so prototype the state flow in Logic Driver / BP then harden the transitions in C++?
Yeah exactly.
Yeah it definitely wouldn't. It's blueprint and it's polling. That's two sins. For handling large numbers of AI, the state transitions should be event based and all logic should be in C++.
If you only have a few AI Logic Driver is fine - its basically the cost of an AnimBP without the pose calculations
yep
OK we might be able to get away with it then since I can't imagine us exceeding 10 enemies on screen at most.
But I can also cross that bridge when I profile
Thanks everyone
if you have a lot of entities - definitely go ECS and possibly Mass Entity
I didn't know that UE had an ECS implementation coming in
otherwise Logic Driver FTW
yeah - that github link above is a great breakdown
its a chunked archetype... kinda like Flecs
(Flecs and Entt are two other ones sometimes used with UE)
but MassEntity has been really good so far - been digging in for a few days
What's the difference between the paid and free (lite) version of the plugin?
The free version has everything you need for this. There's a comparison page linked to from the marketplace
Here it is -- https://logicdriver.com/pricing
Create finite state machines in Unreal to manage your game systems, AI, dialogue, and more with an FSM Blueprint Editor
The biggest difference seems to be supporting parallel states which I don't really think is useful for AI. That's more for handling quest logic
Got it. Yes all I need is the ability to swap out Behavior Trees at each state which this seems to support
My AI right now looks like this --
And in the state machine I have a small amount of glue code to set a blackboard entry with the current state --
wow that's literally identical to what I wanted lol
๐คฃ
Same states
Basic stealth ai
I was realizing, the original MGS didn't even have this many states.
I don't think there's a search state in MGS
Did you work on the original MGS?
no no, just looking at it for reference
Ahh OK. Had me excited there lol
This is still early days for my AI setup. So I don't know what roadblocks I'll run into yet. So far so good though
I'm assuming the answer to this is yes, but just in case: all of the blackboard values get retained when the BT gets swapped out, right?
I don't swap out the BT, I've just got a master one which calls into nested BTs
and the blackboard is accessible from the nested ones
Yeah. It sort of decouples the actions/tasks from the AI's state. If the BT wants to finish running a state before actually listening to the state machine it can ๐
It's brilliant
The talk goes into details about this, definitely worth a watch. HFSM takes the place of a "planner / decision making" while the BT "executes the plan, and can make micro decisions to do so"
It's funny. I actually know the guy doing that talk. I know he kind of hates Unreal Engine lol
Maybe it's because there isn't hybrid support for this out of the box.
I wish he had a longer talk on this but I haven't been able to find anything
I'll ask him
I wish this info wasn't hidden in a bunch of 1 hour long random talk videos
That one's actually three talks in one, and the first and last talks aren't very good imo
but the middle one is gold. Really glad I sat through the first one to find it ๐
They were developed for use with the mass AI to cut down the overhead for when using the mass ECS system
BTW, we used to use the "walk and chew gum" analogy for why you'd want parallelism in AI. Basically you want to be able to have multiple factors at play at the same time. UE implementation is totally broken in that regard, but most other BT implementations have parallel execution more to the fore (including my own ones in the past)
should be called "kick ass and chew gum" analogy 
Whats the talk btw??
In this 2017 GDC talk, Bobby Anguelov, Mika Vehkala, and Ben Weber outline core principles to get the most out of your behavior trees while avoiding common issues.
Register for GDC: https://ubm.io/2yWXW38
Join the GDC mailing list: http://www.gdconf.com/subscribe
Follow GDC on Twitter: https://twitter.com/Official_GDC
GDC talks cover a rang...
timestamp included
I swear - if one would mostly hang out in this channel and they were a complete noob, they'd think UE's BT's are just utterly useless with the way people talk about 'em.
Not BT's just the current implementation is harder than it should be to use
UE's BT's
I didn't say BT's in general.
And honestly, the lack of good documentation is a factor
i.e. beginner documentation
examples etc
TBH I am a complete UE AI noob, and I've been trying to figure out how to make them useful. Initially I was really hyped for it, but the more I dig the more I see the warts.
They seem really good for simple things
I don't think a few half arsed livestreams are good documentation for the record although I appreciate those too.
I do reasonably complex things with BT's in my other project in terms of task selection and such
I've not really had issues with it, it works very well for sequential things
but if your system is not really sequential in nature, then it might not
I do quite complex stuff with BT's but I supplement them with a variety of systems, the BT does the high level conditional logic
I think having "systems of systems" is my goto ๐
i.e. utility for target/threat selections for instance
Yeah - I haven't really had any issues with BT's personally. And it has really helped lay out AI imo.
It does seem like using multiple approaches is a strong way to build this all out rather than trying to do it all in one
systems of systems
I could see the value in having a simple FSM implementation for most of the newer people to just get something working.. so hopefully statetree will get some documentation
But then it seems focussed on the Mass based ECS.. so likely just another problem area ๐
I did a panel about 8 or so years ago at one of the aiGameDev.com conferences in Paris and we had a survey of people using BT's for games.. and EVERYONE had different processes. Some trees had like 100's of nodes. Others had like 4 ๐
That said - I am quite interested in that HTN plugin ๐
This is what I've been finding, and what's been making it harder to get into this.
So we went around the room, about 400ish ai guys.. and the concensus seemed to be that there wasn't a consensus ๐
There's no "one preferred way"
It seems more like... build until you hit a wall and then change your approach
Well, you can play it a bit smart and read about the different options before starting
Yeah for sure, but most of the examples don't go deep enough to really see the problems with one approach vs another
and you can build a simple AI using any of these approaches
There's a definite difference between where you choose to start
broad brush, you can look at state-driven stuff, FSM/HFSM etc. You can look at "reactive planners" like BT's you can look at proper planners like GOAP/HTN and you can look at Utility.. those are the big three everyone should know. I'd add fuzzy systems and ML into that mix personally too.
What's Utility vs Fuzzy? I thought those were the same
Brett Lamming did a great presentation at GDC about his "Marpo" architecture.. which was a multi-layered action selection thing. Kind of like a pre-emptive flat structured behaviour-tree-like thing ๐
Utility is essentially using maths to score options
Yep. Give each option a scoring function and run the highest priority
Fuzzy is similar, but there's an older body of research for "Fuzzy Logic" that's worth reading about
Fuzzy deals with signal processing kinds of things. Usually used in process architectures where you don't want hard limits on things, but "fuzzy" thresholds
makes it a bit less prone to hard edge cases
Does fuzzy basically add a confidence threshold and some randomness?
That could make sense
it deals with thresholds yeah.. look it up on wikipedia, its easier to understand if you see a fuzzy signal ๐
I've seen it used a lot in manufactoring process controllers
manufacturing even
These days, you'd probably use utility, but fuzzy is sort of a historical version of that in a way
just more curvy rather than sawtoothy ๐
fuzzy came from electrical signal processing I guess.. when to take a logic gate high when a signal is present kind of thing
in many ways, ML is kind of along those lines.. number goes up/down ๐
ML is a whole 'nother kind of insanity ๐คฃ
I wonder if I could get away with claiming that ML is fuzzy logic with a for loop ๐
toss that grenate at NIPS ๐
grenade ๐
difference might be ML has multiple outputs
not always.. you can do binary classifiers in ML
and also it's fuzzy logic of undefined nodes
which means its still fuzzy logic, but you've got no insight into what the logic is
I didn't say that.. I'd get lynched
It's amazing how simple ML really is at its core.
ML = "inscrutible markhov decision processors" ๐
yeah, it really is.. just a whole bunch of floats going up and down ๐
and GAN training is just training a huge critic alongside your productive agent
"no that's not right, try again" until it can't tell the difference
most of the techniques in ML I'm interested in are related to student/teacher actor/critic and gan things..
RL is kind of similar.. have a try.. and then evaluate the results in a loop
Check out evolutionary algorithms with ML though for some interesting viewpoints. The basic premise that "there isn't a fitness function" is kind of fun ๐
hence the literature on quality/diversity
QD has my seal of approval
It's been strange coming from learning about ML and AI art stuff earlier this year to now Behavior Trees and HFSMs. Kind of going backwards in terms of complexity.
Lehman and Stanley I believe... their stuff on YouTube for evolutionary agents is fascinating
Yeah, most of us went the other way, from FSM/BT to ML ๐
I dabble in both
Haha yea. Technically I learned FSM and Utility first, but didn't really put it into practice. My practical experience goes the wrong direction
I guess I got into the computer vision aspect too much
What's the preferred way to diversify behavior between different types of AI agents? Like if I have a zombie vs a skeleton. Do you add conditionals inside a master BT, or does each monster type have completely custom BTs?
(Ironic to ask "preferred" after we just discussed that the only consensus is that there is no consensus) ๐
I go based on what their behaviors are. If a zombie and skeleton will behave the same way, I'll just use the same BT.
^yeah same
I think it's good to not get too stuck on trying to make them reusable/shared though
One problem I had with EQS queries was I tended to treat them as reusable/shared like components or functions
But it almost never worked very well and it ended up with having a bunch of EQS queries which were confusing as to what they actually did
so now I just treat them as task-specific things instead usually for specific AI type only
I also tend to have generalized tasks that just take different input. So building a whole new BT is a relatively quick thing for me.
Yeah, abstracting things into tasks is a good idea
One thing I noticed some people did, was to encode optional behaviour into the BT itself by having the BT encode things in BB values that enacted some creation of sub behaviours... so basically make optional bits and have the option choices in BB keys
so for instance, you might have an Actor ref in the BB, you could for instance spawn that actor to do some logic
or run a particular query with it
so the BT itself was relatively static, but the execution wasn't
Not my personal preference to be honest.. I'd get too confused
Real question is if you have just a selector calling state nodes like this, why do you even using BTs, you can just use FSM and have a blackboard component
I tend to go with layered systems
Yeah, that's been my concern with that kind of approach
FSM break down as you add more states.. because of the exponential nature of the transitions
Yeah, the reason to use a FSM and a BT is because a lot of complexity on how to actually execute that state gets hidden into the BT
The whole reason I switched from HFSM to BT's was because I was tired of writing transition selection logic
By having the BT handle the lower level stuff, the FSM stays simpler as well
FSM's are great for things like vending machines ๐
and elevators/lifts
and zombies maybe ๐
although I'd draw a line at parkour zombies and FSM ๐
Eh, reasonable, though judging by screenshots that tree sequences could be done by calling other state machine instances in the graph, that way you can control transitions more
Not saying bad, but I wouldnt allow something like that on my own project just to be consistent with flow
I was looking at some AI jobs today
Playground games need a Lead AI guy on Fable
which was tempting
So it could get cancelled again?
Playground are UK based
Think offworld are US
Streamline studios are hiring too.. but I'm not really interested in porting/services companies really
Just thinking about a new gig is all
My goal is to not be writing transition logic, and to just let the BT gracefully handle aborting currently running behaviors. Inside those different states it does get a little more complicated too with some micro decisions. Like this is my hunting behavior --
so the BT switches between chasing the player vs running to the last point seen, without needing more states defined
and then the "state wants exit" is a generic message sent to the state machine to handle so this particular behavior needs no knowledge of any other state.
It doesn't care what happens next.
Not sure if this is a good way to do it, but this is what I've got set up for now ๐
That's what I did a year ago and had issues after BT got complex, most important thing is handling SM <-> BT communication properly
BTs can get out of hand very easily when you do states
Jumping between sequences etc. is getting confused
So thats the reason you implement FSM into BT anyway, to not do states in BT
So BT shouldnt intervene in any type of state logic
Unless you have a small graph like you shown
๐จ๐ฆ
Though, I dont think even some AAAs can afford your salary ๐
damn straight ๐
Wouldn't really work for a US company, because the holidays are trash ๐
Wait - we get holidays?
barely
Everyday is holiday if you are working for yourself
benefits of not getting huge amount of salary /s
35 days + public holidays
I'd love to know more. What types of things were you trying to do that got tricky? Any examples you could show?
This is the part where I've really not been able to find any info, the deeper level learnings
This is most important thing that you just be careful of
"Jumping between sequences by altering the root selector"
By setting BB keys
Especially setting those BB keys in FSMs
Its very difficult to debug, track, and maintain
after a while at least
try to stick what I said, dont do any states in BT
Keep it in FSM
dont let that bttask running FSM affect BT execution flow either
Maybe you can have a BB key output that determines if FSM returned fail, succeed, or abort but dont jump between nodes
Hm. I think I understand. I'll need to give some more thought to how I'd refactor this if I wanted to keep the state info out. There would still need to be some communication from FSM to BT but it would be more like just setting the hunt target, and then the BT responding to that by chasing I think
yeah, I see far too much state machine thinking in BT's and it irks me
I mean all the tutorials showing how to switch between chasing the player and doing a patrol are basically just implicit state machines, based on if HuntTarget is set
BT's are about reacting to priorities, not about state
yeah, but if you start adding states into the BT, you are thinking wrong.. you end up being dissapointed that the "states" aren't clear enough, because they're not explicit
Yeah, I know what you mean. I'm trying to get over that mental hurdle
but the point is to not think of states.. think of active priorities
i.e. "should I be doing something more important right now?"
with conditions being the things that decide which priority wins
Back when UE4 first came out. there was a tutorial on youtube where they had like a 4 state statemachine as the tutorial and it literally destroyed loads of people's attempts at AI becuase it was fundamantally using the wrong mindset from the get-go
annoyed the crap out of me ๐
BT to FSM is alrigth and ultimately healthy
But FSM to BT is dangerous
I'm looking at using gameplay abilities for applying some slowdown effects from stuff to my player... I wonder if I'm going to regret this like I did the last time I through it might be a good idea lol
Probably.. good luck!
I just migrated to GAS
Probably
rip.
Yeah I have several situations where something slows you down - eg. when using a melee attack, it should prevent you from sprinting at max speed, and when certain enemy types crowd you it should also slow you down, so figure it might actually be something the ability system might handle in a nice way
since the slowdowns also have some stuff like how long it lasts after the enemy type no longer touches you
But I'm not quite sure how you'd even represent player speed as an attribute set because the speed is governed by CMC...
It's easy, you have a callback when attribute changed
On that callback you modify those values based on new attribute value
That makes sense
I figured maybe I could also subclass the CMC to have it read the max speed from the attributeset instead of its own values
Yeah I was just trying to launch Lyra but it just crashed right away lol
Driver error?
Not sure, it did give me a warning that my nvidia driver has issues, but the stack trace from it said something about megascans
Will probably update and try again since it might be useful to look at it since my project is also an fps to see how they manage it there
What GPU do you have?
1080ti
yeah, 1080ti doesn't work with nanite anymore
so... if its got nanite meshes, that might be an issue
It should.
huh? :|
My 1060 still works with Nanite
nawp.. they disabled it weirdly
lookit the docs
Ah yes, UE5 production ready...
pisses me off, becuase it DID work in the beta
:P
loaded up the city example and no goddam city ๐
didn't crash at least, but a big red notification that it wouldn't work
it works even on my friend's ancient 970 lol
Are you sure its actually USING nanite? did you look at the nanite view?
Where does it say in the docs that it disabled it for 1080ti?
r.Nanite.RequireDX12=0
r.Nanite.RequireAtomic64Support=False
two things you could try
That's from this tweet -- https://twitter.com/PCzacD/status/1515019184564015106?t=ITYh_vaQv76AqY8Uhib6ng&s=19
@glassbottommeg Does "r.Nanite.RequireDX12=0" and/or "r.Nanite.RequireAtomic64Support=False" those are temporary work arounds that will be removed in 5.1
That wording seems to be related to atomic64 showing up as unsupported and so far I haven't seen a modern GPU not have some work around.
You can put those into ConsoleVariables.ini
Yeah - I'm not seeing it either
lemmie find it
Video cards must be NVIDIA RTX-2000 series and higher, or AMD RX-6000 series and higher
If my 1060 does, I'd imagine the 1080ti does.
Yeah, but there's something weird about how they're setting things up
And that requirement you mentioned is specifically for hardware raytracing.
Lumen doesn't actually need an rtx card either pretty sure
it's just likely to run like ass
:D
Works at 80fps on my machine
Well, ok.. try running the lumen/nanite samples.. it won't work ๐
I....have?
with a 1080ti
no idea why a 1060 would work and a 1080ti wouldn't
but as I said, can you check its actually using lumen/nanite? because I can run the scene fine in DX11, just not with nanite enabled
I'm at work right now - so it'd be quite a few hours before I even could.
Ah, that twitter thread suggests its a bug
I suspect its doing some wonky detection of windows versions and I'm using the edu version so the version numbering is.. weird ๐
updated to 5.0.1 and it no longer crashes on startup ยฏ_(ใ)_/ยฏ
yeah, who knows..
trying the console vars now
sure wish they'd fix the launcher to cache icons and shit.. I've got so many projects that its slowed to like 2fps ๐
Hey guys, I've got a question. I have this Behaviour tree (BT) and Blackboard (BB) that contains some basic actions. If I want to have different type of enemies and I'd like them to do what the BT and BB indicates but with few differences, should I just duplicate the files or is there another more effective way in doing this?
It depends, but if the general behavior is the same, it might make sense to abstract your actions into custom tasks
so that for example you have BTT_DoCoolTask, which simply calls a function DoCoolTask() in the pawn that's being controlled
this way you can just implement a different DoCoolTask on each of your enemy types
OR, you can have a data driven BT, where you store some integer values in your BB that switch versions of the BT tasks based on what entity they are
Hmm, might have to install UE5 on Friday on my ML machine
just wondering if 48gb of ram will improve performance ๐
on the GPU that is
incidentally guys, check out "lightweight instances" when you get a chance.. its a new UE5 thing
basically, it does some weird engine stuff to treat static mesh instances like blueprints, so you can interact with them and they'll become BP versions of same.. then they can be released back to static meshes
Yeah heard about it
Might be useful in my video rental store game where I have tons of video cassette boxes
Although the biggest cost in them right now might be the fact they all have a unique material because they have unique box art :P
Hmm, isnt this whatt Mass stuff is about?
Giant index texture!
lol
but then they'd all be different meshes
It would have to be truly quite large because you might have like 200 different ones and the resolution needs to be sufficient to allow readable text :P
Yeah I've got my foliage set up with colliders (they successfully blocked navigation in UE4 and when I run tests on a blank UE4 project with default assets, it works) but still no luck in UE5. My AI are all getting stuck around trees now because they just try to walk through them instead of around them, since the trees are no longer seen as obstacles ๐ฆ
no, this is some runtime switcheroo thingy.. basically it switches out mesh instances for BP's at interaction time.. so hit a thing with a physics object and it properly interacts even though its just been a static mesh instance previously
they have a HISM object collection store the instances.. at runtime they check for interactions and instantiate the proper object (or pre-cache and just switch it, dunno)
apparently its quite baked in now.. so you can get the "actor" reference and run queries on it, even thought it wasn't an actor until you asked ๐
That's cool. I worked on a system like this for making pickable fruit in all the trees in a forest. Fruit would be instance meshes until the player reaches up to grab one, and then we'd swap the instance with an actor
That's very nice, though since static meshes are also actors, I wonder whats the benefit
Just behavior lodding?
Behavior lodding and instanced rendering
also kept the physics scene less complex since they wouldn't have collision until the swap
We ended up ditching the system though and only having a couple fruit trees
We didn't have time to prove it out performance-wise and it ended up not being needed for the game design.
I meant instances not SM's, so basically an instances of a HISM
the behavior tree, other than the layout to keep track of the execution order, it essentially is using events but is it TICKING through everything basically, or is it a more efficient form of tick, like not every frame but perhaps every 10th frame or something performant?
the BT ticks in order to run the tick functions on the nodes
you can configure how often nodes tick, and if they don't do anything on tick, then of course they won't cost that much to have
@ocean wren btw I didn't regret trying to use GAS for this yet, infact I think the solution with it is fairly elegant :P
probably since all the complicated stuff is handled by GAS lol
Do not temp me to learn GAS, lol.
I'm having too much fun putting too many things in components as it is.
(Ignore the character doing the A-Pose)
The AI strafes when shouldn't. Do you happen to know why this happens?
Second picture is the behaviour tree.
I tried turning on/off these settings but they don't change anything.
Isn't that because of the Set Focus?
If you want them to not look at the player, you'd need to clear focus
I think
The problem with clearing the focus is that the enemy will lose the sight of the player.
I'm not sure if I'm doing things correctly here, tho 
You might need a more complicated animation setup in that case which would allow the agent to keep looking at the player while the body/legs aren't facing the player
Yeah, this is it ^^ It works fine in UE4, but I've tried so many different settings + setups in UE5 and the nav mesh just doesn't take any foliage into account when it's being generated
Which one is the AI?
The black dummy with the sword.
Well I don't see undefined behavior. First the focus is set then strafe point and finally move to followed by usual attacking scheme. Or I am not getting something?
are you looking for smooth lerping?
then you need to let go of set focus instruction (if it is there in the node) because I see no use of it for deciding strafe point
well unless the crowd of players is present
Even if it ticks forever, it's overly optimized so it wont cause any issues unless you really try to
It also has time slicing
Not sure I understand, lose sight of the player? the player is an object in your blackboard isnt it? then the focus value has nothing to do with that. Just set focus back to the BB value when you complete your move.
Anymore for anymore?!
Thanks for the heads up..
is there a way to make OnMoveCompleted() to trigger when the pawn is in some range?
Is that a path following component function/delegate?
yes, it's a callback. Btw it has a an arg where it accepts a radius
You should be able to pass a struct before requesting move to
That struct has that argument as a float variable
But you can not trigger that delegate manually
pathfollowingcomp does that
You can just cancel the movement by checking conditions on your own
Are there Tutorials out there for this one but for ue4? This is made in unity. https://weaverdev.io/blog/bonehead-procedural-animation
The principles are the same regardless of unity or ue
Hi all, in my game I have realtime nav. I have bridges and other objects that can mean a player could trigger an enemy, then run off and lower or raise bridges, so the path to the player for the AI is not always valid. Using the decorator "DoesPathExist" works for when the AI first starts chasing the player, but I need something that will keep checking at a regular interval. I could run a repeating function from a timer... As I understand it, this is what Services are for. I can't work out how to call DoesPathExist from within a service, is this possible? Is there a better way you would suggest of approaching this problem? Thanks.
I think i've solved my issue. I'm running a function on a timer that checks the path is valid - although atm it always says the path is valid when it isn't... but i'm sure i'll solve that eventually :0
I am trying to get navmeshes working with custom LoadLevelInstance (LevelStreamingDynamic) but running into a lot of trouble. Note that this is not a large geographical world, but rather using them for building a procedurally generated dungeons. I have tried static streaming, and after not getting that to work even tried dynamic streaming (with a big boundry in my persistant room). Still not working. Further I am getting warnings in my code which mention the agent already has navmesh implemented (note that these levels do not have a navbounds or anything, thats all in P-Level). Revelent screenshot, if anyone can guess what I am doing wrong or point me in a direction.
Note that in that screenshot, there are 2 levels which are repeated using LoadLevelInstance, each internally aligned z forward back at zero. But what would be both valid navmeshes appear stacked on the first room.
Interestingly, if I leave the volume but delete the recastnavmesh, the errors go away, but its still just isolated to the first room.
its almost like the mesh generation is not taking into account the position which is specified in Load Level Instance
Hey so I am trying to get my character to just simply walk around however the node "get random reachable point in radius" is only printing the characters location not printing a new location any advice?
New location on next iteration (presumable in Behavior Tree)?
Check out tutorials for control rig
Can anyone tell me if there's a good reason why there isn't a Blackboard Task that allows you to set the value of a BB variable?
I'm thinking of making a new task that depending upon a set of bools, i can tick which variables i want to set in this one task. Then i can just set a var when I want to in the tree.
In my current example: The player gets close to an enemy, the enemy chases. I jump off a cliff edge. The enemy stops. Plays a "frustrated" animation at not being able to reach the player (like the "Sandpeople" in Star Wars shaking their stick in the air in annoyance).
So after they've done that in the Behaviour Tree I want to just set a BB variable to show they've done that so the same tree/branch won't be accessed again at the moment.
Would anyone advise me to do this differently?
How am I suppose to dot tests in EQS? I'm looking for a way to find a position that out of sight from multiple pawns, but probably this test wouldn't come useful in that case?
I think you mean a behaviour tree task? there aren't any blackboard tasks.. and yeah, I've used BT tasks to set BB values. Works ok.
Hi zoombapup, yep a Behaviour Tree task - i'm just not sure why there isn't one in the drop down list as standard
You can chain tests one after another.. just don't filter the outputs of them, but score them
that suggests to me they don't expect you to use it that way
Probably because it'd depend on the BB values and those are user-decisions?
Hmm, can you elaborate "chain testing"? and if I dont filter, wouldnt that mean it could produce results that are not out of sight of pawns?
Its just scoring in the end
Other tests could add more score
It seems such an obvious thing to want to do... so you'd expect a default task to exist for this purpose. But as there isn't it suggests Epic#s AI people don't think it should be done that way.
Thanks for the advice. I think i'll make a single task that has all my BB variables in and then i can tick whichever bool I want to change. Perhaps with a lot more usage of their Behaviour Tree system I'll work out why they discourage it later.
(and will probably then have to re-make my entire Behaviour Tree or something :))
Well, if your score were 1 if your pawn can see it and 0 if it cant, then anything > 0 can be seen from a pawn right?
So scores somehow becomes filters in this context?
So just add each score and threshold filter it
They basically act like a utility value ๐
What I didn't understand is if Line A should be the target pawn(s), what line B should be? Or am I misunderstanding how that tests works ๐ค
Because EQS points (items?) can not be passed as context
So I can not test if pawn(s) facing any points
You can do a line trace for all points from the point position to the pawn right?
So generate your points, run a scoring function to add visibility value for one pawn
do the same for other pawns etc
add a filter that takes away any point with score > threshold
and then return one of those
Hmm. Though it would only work for obstacles. For example it wouldnt return the colored positions
(sorry I suck at drawing and whiteboard
)
But, iterating locations and filtering them manually is a good idea
Never thought about it
It's just sometimes providing data for it is difficult
there's actually a really nice presentation by Matthew Jack on the design of EQS for CryEngine which is what this one is based on.. might be able to learn some ideas from that
Well, I think its made more difficult because the UX is kind of sucky
i.e. some of the language seems.. almost inverted from what you'd expect
this is one system that could be massively improved with a usability pass, but hey.. Epic ๐

Just to verify if I understand correctly, I can not make EQS detect multiple pawn(s) facing locations and I just can generate items with it and I have to loop locations and check the dot by myself, right?
Dot test only check if two contexts facing each other
So you would generate your starting candidate positions
you'd dot product them with your enemies view and score accordingly
for each enemy you care about
then you'd filter and score from your player
the dot test would be from the point to the enemy
i.e. if the enemy forward vector dotted with the points position is within some threshold angle
I guess you'd maybe have to create your own score function if you want to do multiple enemies
I did a bunch of custom scoring functions and query contexts and the like
But the basic idea is to layer the tests
Hmm, I dont have the info of where is the enemy yet
Enemy will be there after test is done
If any eligible position found
So I guess I have to do these outside of the EQS?
Eh? you don't know where your enemies are?
I mean you cant avoid them if you don't know where they are ๐
Oh, sorry context of the sentence confused me
The pawns are players, enemy will spawn where they dont see
Yeah was my bad, I wasnt clear enough
So enemy pawn will spawn in a location where player pawns don't see, so I'm trying to provide a location to enemy
right, so do a filter from your players viewpoint first on your potential points
Can I provide that "potential points" info to EQS as data?
Well, you'd use a generator for that
A custom generator right?
you can write your own generator yeah
Ah, alright, was mainly wondering that
but usually I'd use one of the built in ones.. circle, square, donut etc
Oops wait a second I'm confused again ๐
The main thing is to remember you can provide custom query contexts on each test
Real problem I'm having is I'm unable to do a test if players are facing to generated points (i.e. potential points in your terms)
It will be a square generator
right, so do that as a custom scoring function, with a query context that provides all of the players transforms and takes the input of the generator and scores them depending on line of sight or angle
It helps if you review the code and understand the flow of points. I kind of wish the EQS actually allowed you to return a point list instead of a single point
Because having a system that can return a set can just return a set of 1 item for the other use case.. but sometimes I want ALL of the options
Hmm, though what EQS is doing just doing some math to generate a formation and projects those FVectors to navigation, if you need to have all the options whats the point of using EQS? ๐ค
You could generate that formation (circle, square etc) by yourself then project like EQS and do your own tests manually
I just like the flow of the interface.. it seemed logical it should allow multiple points as a return
I might want to use multiple EQS queries together for something is all
So you also want to have invalid locations along with valid ones passed the tests?
I thought we could do this? ๐ค
Oh, maybe they fixed it.. but look at the "run mode" single random item
Hmm, that will probably return an array with single element
I want to return everything ๐
I have an issue, I spawn the AI as an actor and it causes hitching on the players end, how do avoid this?
nah the player walks through a trigger, I spawn the AI and it hitches, my playtester has obs running but its still very stuttering while having a beefy system.
Check visual logger
It should provide info about move to task
Otherwise you have collision issues in level
what do you mean by collision issue? too much complex?
I saw in unity for example they lod the collision of meshes.
Check visual logger first
It could be that you're spawning the AI into the floor, so its having to test again looking for a safer spot
I'd check the logs
How do you go about switching to a different task in a behaviour tree when a boolean is true?
Blackboard Decorator can be used to switch based on a blackboard value so if you store your bool there that'd do the trick
Cheers I'll have a look into that
Not sure if this is exactly what you are asking, but: Using a context that returns all of the player pawns, you could just do a filter that only returns points that all pass (or fail) a line trace. The "Multiple Context Filter Op" setting does some heavy lifting here.
It shows that it is executed in the behaiviour tree but its doesnt work
Hello Guys .
Can u Please tell me why this is not working
I have have a Shooting Task that work
but the Focus is not working
Anf Thank You
d*
Hmm, didnt know that. Even though its solving the issue I have, it'll be helpful. Appreciated
Shouldn't it be finish execute ai?
No, Just Finish execute .
atm my enemies attacks just work in Behaviortree like BTT_Attack -> wait. I want the enemy's attack speed to also affect that wait time. How can I achieve this?
You should stop @ing random people and be patient
Wait for someone to answer
And take it to animation if its an animation problem
Not sure why you have that first selector, might want to remove it. Also the first blackboard condition is failing.
Might want to also finish execute (failure) when the cast fails or the isvalid isn't valid.
I was following a tutorial
Might want to take the course I linked in the other channel then. It will save you time and headaches.
im not even watching them tbh
why
yikes
here's the link one more time: https://learn.unrealengine.com/course/3318392?r=False&ts=637862598157587846
cant say im surprised
that course will help you
this is quiet for Saturday morning
Does the engines default AI work good for RTS4X games?
Or is there a plugin or something recommended
@bitter cosmos what do you mean default ai?
Like the one built into the engine that kinda just runs full out. (Not a dev myself but im funding everything)
Fog of war is going to be part of it so the ai needs to be able to search potentially large maps for the player then send a fleet after them
its just matter of setting up the blackboard correctly for it to work
Are there any recommended assets to help it work better?
that's a question i cant help you with, sorry
Dang
Default AI works for general situations, for instance patrolling or driving on a reasonable enough map.
If the game is beyond certain threshold complication, then you need to write relevant logics accessible in AIController class.
yeah
sigh
or you can learn
well UE caters BluePrints especially for this reason
But im a good manager, problem solver, and lore writer
gg
And ue doesn't like my computer
Im stuck to a laptop with a crappy MX gpu and older cpu
lul, dont ever think about ue5 then
well ut3 has some ai contexts if you wanna make use, but I digress
And sadly im stuck with revshare. Funding everything with leftovers from my disability benefits
Did get one game made
what is revshare
Uh its when payment is from % of games income vs cash up front
The moment when you realize Run EQS query is not synchronous 
It's gotta do timeslicing somehow
I thought it was optional
Though I dont get how Run EQS decorator works in that case
Or was it a service? ๐ค
Yeah it was a service
You should be able to use UEnvQueryManager::RunInstantQuery(const FEnvQueryRequest& QueryRequest, EEnvQueryRunMode::Type RunMode) to execute an EQS query instantly from C++. You would need to make a custom BT task if you want to do that from a Behavior Tree, since the default one only uses UEnvQueryManager::RunQuery , which does time-slicing.
EQS queries can get really expensive though (think multiple milliseconds if you're doing line traces and/or pathfinding to items), so disabling time-slicing is really risky.
Ah, great. Thank you
i do run EQS sync for certain things
but these are normally cheap queries only (no tracing, etc)
does anyone know how I can switch animations for my AI
from my anim bp when its chasing the player
every tutorial I find none of them use anim bp
they all have 1 animation for roaming and chasing
set some kind of variable which you look at
chasing = true, switch animation based on it
How can I handle lots of collisions? I have a lot of simple ai's that chase the player but my performance takes a big hit when using collision even if they're set to ignore each other
How many are we speaking of?
I have like 10-20+ running around and it doesn't seem to have that much of an impact
So I'm making a bullet hell game and have been testing with 200 enemies on a plane
All they do is move towards the player and from testing it seems like the only thing affecting performance is the collisions
Just using floating pawn movement
But when I disable collisions performance increases dramatically
Yea its quite a few haha but worst case Ill just tone down the numbers
By disabling collision you mean setting them to NoCollision or?
Yea I've just got two sphere colliders on each enemy, one is the hitbox and the other is to allow the enemies to overlap slightly but not all the way
And just setting them to no collision instead of query only gets cuts the performance hit almost entirely even though they're set to ignore eachother
Yeah it probably still has to do collision checks when moving which I'd guess is the cost there ๐ค
Yea I've just checked and once they're all stationary the frame time jumps right down
Is there a more performant way of doing collisions other than sphere collisions?
You could try tweaking the physics settings or something, but not really sure tbh. You might have better luck asking on the physics related channels since this does kinda relate to that (probably?)
Do they use CMC
He did say it was floating pawn movement so I would hope not :)
Ah, sorry missed that
Collisions shouldn't be the performance issue even with 400 spheres. Are you sure you've not messed up the colliders and made them penetrate each other on the same actor? Make sure you set each one of the two colliders to ignore the other
Good point I always forget they do that because ????
default setting
usually you would want to go into your physics actor and make sure it doesn't have constant fighting
Ahhh I've just checked and I've got one blocking the other even though they overlap, I'll make another collision channel and then check the performance
I'll also check the physics settings as well and see if there's anything I can do there
Thanks for the help
You can go into the physics body editor and just set them to ignore each other
Oh like just for the one specific collision volume?
Well, I'm assuming you have the sphere colliders on your actor?
Yea just two spheres on the actor bp
thinking about it, you're probably not using a physics asset are you?
I just have a static mesh as a stand in for the enemy but I've disabled physics and collision for it
Hmm, you might have to tell the collision spheres to ignore each other in your actor then
I was just thinking of like the typical character and vehicle physics assets
Oh right okay
essentially, you want your spheres to ignore each other, otherwise they'll constantly overlap and whatnot
Am I right in thinking that I only need to set it on one? So just one being ignored cancel out the other?
Saves setting up another channel that way lol
Yeah, I wouldn't make another channel
Okay thanks, although if that's how it works I've actually already got it set up that way so I'll have a look into it a bit more and see what else I can adjust
Add some debug info for collisions and overlaps.. check whats actually happening
I would just turn off the other one for starters to see if it has any effect :D
Easiest way to find out whether it's colliding with itself
yeah, fair point
Yea if I turn off one I gain about 3ms on frame time
But just by having one on I still have about 11ms just on the move component
Yea everything's moveable
No errors or warnings in the output log as far as I can tell
Try the profiler?
I checked in the profiler and it's roughly 50/50 split. Roughly half the time is spent on "DispatchBlockingHit" and "UpdateOverlaps" and the other half is on "MoveComponent" and "FindFloor"
Oh I made a mistake and was reading the wrong log hahah
Its mostly on "GeomSweepMultiple" "DispatchBlockingHit" and "MovementComponent ResolvePenetration"
You definitely messed up your collision
Yea maybe I'll just start over and see if I can find where I've gone wrong haha
Thanks for the help
Do the standard unreal EQS unfliter results? I have this trace test that is set to filter only that basically always fails and filters all results (as a test). However, it only seems to work when I delete the other distance check that I have. When I don't delete that distance check, none of the items get filtered. When I do delete it, the items get filtered as they should.
If one test filters something out it's out
hey guys idk where to put this question so i figure here(let me know if i need to move it),have anyone here been using HTN Planner plugin?im tryingg to use that method for a specific AI behaviour
i saw it is still experiemental
is it production ready?
Not quite sure what that has to do with AI :)
So i'm setting up a basic ai for a shooter game, i want skeletal mesh collision instead of the collision capsule, so i can determine damage dealt by where it was hit (bone or other collision asset)
when the ai controller possesses the character, it disables collision on the skeletal mesh
???
any idea how to fix this?
nevermind, i just set the capsule to ignore camera so i can damage the mesh.
weird issue though? i don't remember having this problem in ue4
I don't think possessing should affect collision so it'd have to be some kind of logic somewhere
yeah
parameters may have been offset
Does anyone know what the behavior of MoveToActor() is if it is called while still moving to the target on the same actor? Does it just ignore the call?
ok nevermind I looked at the source code and the answer is no
Well I have had the privilege to call MoveToActor() each tick with same target location.
So you make up your mind about that
What happened?
I just went with what you did
I mean looking at the source code, basically it just removes and readds the target, which theoretically shouldn't do anything because MoveToActor is already updating the location on a tick anyway I think
yeah. So it is contextual. Function is indeed called but ignored, in the sense, that target is same so behavior is same.
Nope, the built-in HTNPlanner from Epic is long abandoned and not really usable for anything as far as I know.
what is HTNPlanner
I was replying to the person from earlier in the day.
I know, just wanted to enlarge my UE dictionary.
HTN Planners are heirarchical task network planners.. its a form of planning used in games. A bit like the GOAP thing, but a bit more recent. There's a few talks about using HTN for I think it was the Transformers games over on YouTube (from GDC).
And yeah, I suspect the HTN planner is abandonware. It was just a personal project Mieszko did.
Let Mieszko be summoned in inside unreal! Too much to showcase now
or maybe it ibe too trivial for his majesty
hi! I have a sliding door blueprint and an AI that follows me around. the AI won't pass through the door when it's open. What could cause this? Thank you!
Enable navigation visualizaiton and check if navmesh is active at there
it's not. I set runtime generation to dynamic, the navmesh is active after that but the AI just spins in place
Check visual logger
if the door starts closed and I open it while playing there is no path. If the door is open by default there is a path for the AI
thank you for the info
i was scouring around marketplace earlier and i saw something similiar
Hello, i am really trying hard to work with the AI system in UE5 but I can't show the AI debugger ...
i am using a US keyboard, i've reset the shortcuts and pressing apostrophe open the command line
showdebug AI doesn't show the AI debugger window either
Are you possessing the player pawn?
UE5 btw
I would hope they haven't randomly just changed this in there lol
It doesn't seem to show it anymore if there isn't any AI features loaded.
so that's probably why
I have a BP deriving from pawn, associated with an AI controller, which have a run behaviour tree with a blackboard
I activated one sense (sight) on the pawn (even though I have another one on the controller ...)
That does sound like plenty of AI features. I ran a quick test, in my First person, zero AI project, the debugger did not show. In my RTS project, it worked as usual.
and just by pressing ` in UE, while possessing the player pawn and not the AI one right ^
OH
might be that
btw is it better to have the perception on the controller or the pawn ?
I don't know for sure. The Unreal Learning stuff has it on the pawn, generally. I think the idea is that you can re-use a single controller on diferent pawns, which might have different sense capabilities.
But either seems to work just fine in practice.
ok
Just another question, sorry for that
AI Controller seems to already have a perception component
but it doesn't show up on the BP
it's a bit strange. We should be able to use it right ?
or is it because it's a TObjectPtr, then doesn't show up and gets filled with any AI perception from the pawn maybe ...
THANK YOU
If the perception is on the pawn, do you still put the perception changed event handling in the AIController, or in the Pawn?
The examples I was looking at had the perception component in the AIController but it does make more sense to me to have it in the Pawn
the event goes to where ever the component is
iirc you can subscribe to the event from elsewhere too if you want to, but you need to use nodes to do so
Ok so it doesn't work anymore
i don't know why ๐ฆ
i've been on it almost the whole afternoon
it's supposed to be so easy to set it up and for some reason it's not. really frustrating
could you tell me what's wrong ??
Pawn:
And I have a navmesh, even though I don't want one (because flying pawn)
Come on. I feel so stupid rn. I even created a new third player project and it doesn't work either
the AI is active though, pretty sure of it. I see the behaviour tree running
Alright, tried every combination, changed the key board layout twice, nothing happens
Yeah, that's in 100% not normal. A fresh third person project shows the AI debugger for me.
Process. 1) Play, 2) click on window (so I can start running around) 3) Hit '
So I was trying to make a nav link that's only navigable by specific kinds of things by giving it a certain area class
This area class is then excluded in the nav filter used by the movers that aren't supposed to use it.... but they still insist on trying to go through it?
Oh wait nevermind, I had left the simple link enabled :P
It kept trying to go through it and not the smart one, duh.
Thanks man
I'll try another keyboard at least
If that's the reasons the fellow will end up in the wall
Make sure something didn't change your nationality in windows.. strangely enough I had that happen once. It just selected a different nation somehow.
Does anyone know, why my AI doesn't step over this part. Whenever he tries to navigate out, he gets stuck here
anyone know of a way to have my AI stop immediately upon finish path finding? they have a tendency to ease to their final position
I figured it would be a better place to ask about this here, so moving my message to this channel:
Before I submit this as a bug, because it's a bit annoying, why wouldn't they allow us to reuse a Blackboard node in the composite decorator graph?
Or is there any reason for preventing us from connecting them to multiple other pins?
Why would you want jerks?!
not so much jerks
but it's a pixel art game
and enemies are like just kinda slowly skidding to a stop
which means the art keeps updating since they still have velocity
so I want to ramp the braking factor a bit but I've set every "friction" and "braking" parameter to max on their charactermovement component but they still kinda skid
obviously this looks weird
Bind a function to pathfollowingcomp's delegate
And call stopmovementimmediately
Not sure which one, but one of the delegates are being fired after pathfinding finished
Or try to set braking deceleration to 0 in movement comp
I'm using behavior trees fwiw
behavior trees are awesome, I believe Alex and Miezko have graceful videos about setting them up!
My biggest nag about them is saving
Why can't I just do BT->GetCurrentNodeIndex
Save it
Then load the game and say BT->SetCurrentNodeIndex
and have it work?
considering all the nodes are numbered you would think this would work
They're great in general but this is a persistent annoyance I have with them because they make dealing with saving more complicated lol
I looked at it a bit now and it might be possible actually.
You can call RequestExecution to request a specific node to be executed by the tree, and this mechanism is what it uses to start the tree when you start logic
Assuming the function will allow you to specify an arbitrary node in the tree, it might be possible to save the active node index and then use that to look up the node instance on load and request the execution of it
But need to do some other stuff now so will need to test it out later
Does the UE implementation keep the stack of parents in some data structure when you push a new node for execution? because you'd need to serialize that too
It seems to keep the active node
So you would need to be able to find the node instance in the same point in the tree before you request execution
yeah, you can have the deceleration set to 1 or a million, doesn't change the behavior in the slightest. I need the lerp on the MoveTo AI node to be more aggressive, but there's no documentation on it like anywhere
@austere kindle Just keep tweking CMC settings or do what I said about path following delegates
You cant lerp on MoveTo AI
It basically sends acceleration/velocity data to CMC
You can get path points and lerp towards each index though
Not sure if it would work
CharacterMovementComponent
Its same for any movement component inherits from UNavMovementComponent, which is basically every other movement component like Floating Pawn Movement etc
Does anyone know of a really good, up-to-date tutorial for AI? All the pins are either old or not as helpful as what I am looking for. That or I will just literally pay someone to teach me lol
The problem is that "for AI" can mean a million different things
Are you looking for BT stuff? perception system? The new AI stuff in UE5? Specific types of AI logic patterns? etc. etc.
BT stuff for UE5. I've been reading through the documentation from the Unreal site, but even following that, it isn't working so not sure what I am doing wrong.
The older BT stuff should still be quite relevant for UE5 as well since the BT bits should work pretty much the same way as they did before :)
But if you have some specific issue you can always ask here
Last pin (the first one appearing) is very helpful imo
Good for starting
Alright thanks. I guess I just need to keep reading up on it. As someone who has never used Unreal before this project (despite going to school for game design), there is just so much to learn and retain lol
Not because its difficult or confusing, it's just you will get many "wtf" moments when reading the source code
lol
tbh it hasn't been that confusing to me except for a few of the bits like what the heck am I supposed to do with AI tasks
The most recent pinned video is probably the best source out there imo. Hits literally everything you need.
And is nice and compact.
I've absolutely been loving the AI tools in UE, even if they haven't changed/improved all that much since like 2015 or w/e. lol.
Don't get me wrong, the BT and whatnot make people like me who don't really know how to code, able to actually do it, but man making them like smart is the hard part
A lot of it is just smoke and mirrors lol
You try to make an actually smart AI and it's not fun at all
and then you make it just do some dumb pattern over and over and it's much better
Of course depends on type of game
Ok let me pitch new UE feature for AI
embrace yourselves, here it comes ....
psychic AI!
something like https://youtu.be/KivaDuXOL9Q?t=3097, where the said entity predicts the appearance of another entity
although now when I rewind it, it seems plausible prediction ๐
more like gauging behavior, but name stays ๐
I am curious. What kind of improvement does AI module needs?
Or what do most of you expect the UE's Ai to be? I am unsure what is lacking for now.
mainly usability stuff, the UE bt implementation doesn't actually support a lot of the things you'd normally use a BT for (because of its lack of parallel's that work properly)
But there's a lot of small things. Like the smart links and the like are kind of half assed, the navmesh doesn't easily support streamed levels and doorways and the like
Then there's the overhead of the whole setup being quite heavy for lots of AI's

