#gameplay-ai
1 messages · Page 170 of 1
well if you halfta label code hateful, then those are not code lines in the first place
could be some scratch pad fart
its python, its ui, of course its hateful
goccha
Yeah, this tracking looks pretty good: https://www.linkedin.com/posts/simonfrijters_meta-avatars-vr-ugcPost-6927879465096126464-6Y1b?utm_source=linkedin_share&utm_medium=member_desktop_web
yeah
Shouldnt Elon buy Linkedln now
so here's a new question.
my coder is concerned about the number of AI running around in a multiplayer open world game and suggests multiple cutbacks to make it feasible
ok
exactly how many AI does it take in a players vicinity to start clogging a server
could you elaborate or define your question a bit more?
precisely
?_?
could you stop being dumb
there's no need for that man.
lul
gunna answer my question or be smug 'cowboy'
it's a perfectly simple and straightforward question.
you get stuck up on an online date or something? that why you're acting like an asshat
lul
I simply asked how many AI in the scene would start to show signs of things breaking down.
if you can't be assed to answer, then don't.
take your shitty attitude somewhere else.
yes, please, bring them here.
who?
Aha, wow. all you did was ping some random guy with the user 'admin' and you call me dumb. <@&213101288538374145>
@main heart If you can't answer the question in a productive way, you don't need to reply. Read #rules 1
@wheat arch normal traditional AI, does cost quite a bit. I had to do serious optimization to get 200 AI to be working, etc. If you want a lot of AI, then i would look into MassAI (new in UE5). But without optimization you are looking at a pretty low number.
Scooby I dont know if you are following the chat history
@wheat arch has failed to answer the logistics
and it be better if you check that
and you failed to answer/reply in a professional manner.
who are you
an admin.
well learn to read history first
and stop crowding
One admin at a time
dont gangup on me
lul
too long
cut them
:triangular_flag_on_post: the_cowboy#3713 received strike 1. As a result, they were muted for 10 minutes.
I don't mean to be inappropriate about this but, me and my coworker are thoroughly enjoying this
thank you very much for an answer to this and I appreciate your help 🙂
If you have a bad day, go outside, enjoy the weather, listen to some birds, and come back reenergized and with a positive attitude.
massAI is purely for UE5 as well, isn't it
somewhat raises the question of how ark managed to get such droves of AI in the world map. was that simplified AI or some smoke and mirrors?
Odds are only ai by a player is running, and in that case there isn't a tremendous amount in most cases.
well they seem to have basic behaviour sure, run around randomly stop to play a grazing animation now and then, attack anything that comes too close or run if you're not a hostile AI
if I'm to assume that alone was a huge feat and if I wanted to replicate anything even remotely close to that (and I don't, but it gives me an idea of what I can and can't ask of my programmer) what kind of things are there to consider, what hurdles are there
honestly the whole purpose of my asking all of this is to get a correct scope and understanding in which I can plan ahead with
I'm saying there aren't as many ai running as you'd think. Most are turned off or simulated if a player isn't by them. And the tamed ones have very limited and controlled ai, most likely still subject to player view. The biggest trick is only touching what immediately impacts a player. I'm not an expert in Ark's implementation, but I feel like you might be giving them more credit than is actually applicable. Also the way they lag out massively is probably deeply tied in.
most likely in something like ark you cheat
nobody sees the AI? it doesn't exist
the AI is far? it doesn't actually do anything complicated because you can't see it with that much detail
Honestly even up close Ark has some of the most basic ai I've ever seen.
But it's dinos chase you, doesn't need much.
Yeah
And they do lag out massively... so I'm not sure they'd be my go to example even with that. At least on consoles.
I just went to take a look at Ark. Very less AI dinosaur. Like only 1 or 2 in an area. No issues. Unless you want more than what Ark has? Even double is still fine.
Yeah maybe 4 tops until player bases get big. But then you see massive lag and companion ai has very little going at any time. Hence dead when attacked.
Sit boy takes up 0 brain.
Since I've been meaning to optimise AI in my project recently, are there any specific ways to do that? Where the AI kind of disables itself based on distance?
what about keeping track of where they are
for example, a skeleton with a bunch of gear that you've already damaged and you want to come back to finish him and get what he has
I honestly feel like animal behavior kit from Coqui games is pretty good about walking through optimizing ai how and why. But he runs a sphere with an actor catch, then looks for player tag, disable if not there. Check every so often otherwise.
There may be better ways, seems like there are almost infinite tricks in this game.
so let's refine my question a bit and close the gap
But remember. The more you add, the more your server cost increases
how many active AI can you get before it just goes splat
Depends on the cost of each ai
And the system
And the position of the moon ;)
Sorry that's a joke.
could you give me a rundown of how you calculate an AI's cost? is it based on how much logic they have, what tasks they do, the patrol route
what consists of an AI's cost
I also really really appreciate all the help here guys educating me
thank you ❤️
Exactly the heart of the problem. Everything you do and show has a cost.
Biggest threat is rendering and movement component cost
If you dont render and move them all at once you can manage it by behavior LODding etc
And the cost is based on the cost of what you're working with, bad logic, bog it down in no time with BP loops
One bad ai could lag a system solo tbh.
Just remember, any type of high count of anything and optimization work for that requires dedicated engineer(s) because you have to end up optimizing low level code if you want to go further
What Kaos did is crazy stuff to run 200 AI at once
It also took a lot of time and tons of R&D
I don't even want to imagine, but any links to anything on that?
Yeah you'd have to be so optimal at such a level, we get lucky as hardware keeps growing though :).
But since he does multiplayer, i think he should consider how much he can pay first.
If you are rich and can run a heavy beefy server then only thought of making large amount. No point trying to make a lot when you cannot pay.. if this make sense
I think with this it's practice at small scale unless you're getting paid to play with the big boys.
About Kaos's work?
Yeah, always love finding out tricks especially towards those kind of levels.
I honestly feel like animal behavior kit from Coqui games is pretty good about walking through optimizing ai
I've found a series of youtube videos of the same name. These what you're talking about? or something else
He only explains visible stuff there though 😄
Real stuff is on CMC optimizations he made
He has a pack on the marketplace, but yes his tutorials cover it.
Yeah that too, he's got quite a bit back end.
But if you're looking to start, that's a good place to start imo. Don't need everything in a day.
One question leads to another.
On PS4 you can only have 50 as listen server, while they are running and being rendering
My guess would be as such:
- Do logic LODs - use simpler logic the further out the player is
- Different tick rates - reduce tick rates the further out they are
- Animation sharing plugin - help reduce some animation cost (which frees up time on the gamethread)
- Have less scene components on the AI - the more there are, the more costly it is to move something
Then, if you're using navmesh, there is a lighter mode of walking around that you can use that might help as well; navmesh walking.
MassAI seems to be able to make 1k of pawns move without any visible frame rate drop but it also relies on what Durxxigar summarized -- besides being DOD/ECS
Also it's pretty experimental
At least, these would be the things that I do to get 200+ AI running around on a server.
Haven't played with it, but Unreal keeps pushing the edge, pretty impressive no lies.
that seems like a decent amount
I'm definitely going to have to try and figure out how to truly fit everything together..
You said you have a programmer and you are collecting info for them right?
nahhh I'm doing my own checks
Oh sorry then, not sure where that came from 😅
I mean, I just gave you a solid check list to investigate to push things.
I have a coder but as a good habit to have I double check for what they say can and cannot be done
Well, then first of all do your design plan properly, know the limits of the engine and your budget, then keep profiling of target hardware
too many times I've dealt with people lying about what's possible because it's hard and they don't want to do it, or they don't know how to, or they just don't think it's worth pushing the boundries if there is too much likelihood that it will fall down later on
not that he's anything like that though!
I just like to do my own checks.
I wouldnt aim for 200 AI for my first game
I'm just the environmental artist guy and storyboarder.
oh no way in hell am I gunna get 200 AI
Singleplayer is fine with any amount he wants to aim.
Multiplayer is different beast
Singleplayer is not fine with any amount though, both is limited to how much pawn you want to render at once
but I was hoping for something along the lines of like 1 player gets a max of 5 follower AI, 2 pets, 1 mount, and 1 mount per follower
but here's the hard part
open world. so.
I agree there are limits. It is just that multiplayer has so much more limits
One way or another everything is up to engineering team
I wouldnt even try to accomplish high count AIs or open world with non professional programmers
mmmmm...
how far can I stretch the limits with a good server setup
let's say it's a medium to top end machine for a rack slot
Dunno 🤷♂️ Up to how much budget and skilled team you have?
Do they have previous experience with shipped games, or any type of familiary to back end architecture of open world games?
it's only one guy for all blueprints
and he has an impressive background in AI and made all the pawn logic for a moba with all the bells and whistles
but not a lot in the ways of open world I don't think
brb, at work currently and I've got time for a smoke break. gotta love graveyard. keep typing though this is good to know
Well you can't stretch the limits with blueprint only, why do you want/expect something big from a micro team
It's not like I'm saying you can't accomplish anything or so, but you gotta understand both high count of AI and open world systems require high skilled engineers
Not coders, programmers, "engineer" is something different
Ehhh, coder/programmer/engineer is pretty interchangeable terms :P
But there is that nuance there which I assume is what you're suggesting, you need more rigorous systems design for something big and complex which means you need a decent bit of experience
I understand what you guys are saying, I do
I just need the basics though. it's a post apocalyptic medieval world so I can certainly make the AI count low but I need combat to be fun and engaging, I was just really hopeful I could get maybe 5 ai followers per player (at least in singleplayer or something) and then go from there. which I probably can to be honest
BUUUUT it will take time.
hey. do you guys think they really spent 1.5mil on ark back in the days of release? that's what they claimed I'm pretty sure.
Perhaps. Games are expensive to make. Shovel knight was $1 million-ish.
Yes.
1 million
Why are you surprised?
because it's so low budget, the mechanics aren't that special looking
from an art perspective which I come from, it doesn't make sense
coding wise it doesn't seem all that impressive
so I'm just like
whaaaaaaaaa?
This is just what the devs said.
"Shovel Knight's budget was $3 million, although its actual cost is a little hazy as Yacht Club Games members ended up giving up their own salaries to fund the project."
that's just
How many people were involved in that project?
With 10 people you could pretty easily hit 1 mil in a year already
I've spent about 15-17k as it stands now on my project and we're probably a quarter of the way through, at least for the demo stages and getting things properly fleshed out
Yeah, games are expensive as hell to make. Which is why it's such a longshot for small hobbyist teams banking on revshare to actually succeed.
How much are you each being paid per hour?
and we're full 3d open world with retro styled graphics similar to what valheim is doing but not as cartoony and a bit more detail
everyone is getting 15 an hour, I don't give myself any of the money because I'm the primary funder
but we don't even work that much, everyone is part time
we do 8 hours each
5 days a week?
just 8 hours a week however you wanna accumulate it
15 an hour is not a developer's salary in most western countries
sometimes 16 if I don't have a lot of bills and costs from real life expenses
8-16hours a week
certainly not for a professional established company, no
Looks like Yacht Club Games is based in Los Angeles
so for a living wage for a developer you're rapidly closing in to 10k a month
I sometimes agree on 15 per hour but if it is only a BP only project and if I'm not totally responsible of what I'm working on
I believe in more of a pay by effort standpoint. if you're going to spend all week making sprites and simple things the pay should reflect. that's why it's just a part time casual gig
and everyone in the team agrees and is pretty content
but when things hit off and big money is made (not if, but when)
then bonuses come into play
This is pretty offtopic for the channel
the mods are watching this channel now after that earlier show I guess 
np feel free to continue in #career-chat or #lounge
First time a mod visited #gameplay-ai since months though 😂
might be my fault, there was this guy who was acting like a prick for no real reason and they shewed him off
anyways back to AI I suppose
who's got the time on their hands to run me through the basic understandings of an AI LOD
actually better yet
It's the same as graphical LOD
The further away the AI, switch it out for more simple AI
let's get a rough cost calculator going so I can wrap my head around things
here's what I want follower AI to do!
commands:
-harvest; go chop some trees or mine some rocks, gather some herbs or food, hunt things down. how is not important just the command itself, then once said resource is in inventory they return to base and drop it in the correct storage.
-guard; self explanitory, throw in some patrol nodes if it's over a decent sized area
-follow + follow types and logic tweaking (don't chase enemies and stay by me, chase on sight, chase distance ect ect ect)
-formations! this is, as I've been told, going to be hard but still doable.
to name a few off the top of my head.
oh, automated crafting/refining at stations and workbenches. that too.
how expensive would 5 of these little bastards running around in your base be, just on their own
and then how expensive/doable would it be to have about 25 of them (5 human players in area) fighting in a battle
or rather, 5 human players in an alliance.
It's all completely relative. Which is why it's hard to give such a straight answer.
if it's a battle they're just going to be doing one thing; attacking
if it's an alliance base they'll be doing the full extent
okay. how about some probing.
let's say
The cost comes mostly from how much processing something takes
Do it the most simple way you can - then measure. Rinse & repeat.
For example chopping trees can be very cheap if it just stands there and a number goes up
they can only do one task at a time, and the tasks are hard set with 4 basic steps. get tool, locate resource, gather resource, return resource, repeat (skip step 1 if tool is fine)
but it can be more expensive if he walks around and chops with an axe and does a bunch of animations and stuff
Nothing you're saying sounds awfully complicated in general though
it'd be one animation for chopping, 1-3 animations depending on distance (walk run jog blended), and keeping up with their stamina and inventory size
this is good :x
Seriously this question is going to go around in circles for hours. Glass beaver is building an RTS with 1,000,000 units. He's spent literal thousands of personal hours developing highly specialized code to enable this. On the other end, the basic CMC with a little extra functionality will grind your game to a halt in 50-100 instances. It's always about how much work you're willing to do and what compromises you're willing to make along the way
Indeed
My general suggestion is to try to keep things simple and not build overly complicated systems
You can build a simple system that does the job, and if you find out it doesn't quite work, it's easier to modify if needed
Of course this doesn't mean you shouldn't make accomodations for future features where you know they're likely
fair call
I shall think hard
and have a long sit down with coffee and potentially booze with my coder
More acting upon, less thinking
and we'll try to hash out a method
I am scared, therefore I think.
this project is quite literally what I want to be remembered for. huge stress placed on myself by myself
analysis paralysis is the term you're looking for lol
it rhymes!
You don't really need a rough cost calculator. The programmer you are working with can show you the profile info he's getting from the engine. The average ms cost per frame for various AI systems can be broken down there. If your design/vision requires a certain number of AI, then that's the pin you put in and start finding optimizations (or, more likely, compromises) to hit your budget on target hardware.
Or conversely, if there's behaviours that are are the real key to your design/vision, then you pin that, and find optiimzations/compromises elsewhere (like reducing the number of AI, or finding ways to cheat and do simplified things for AI that aren't visible).
can someone help me with this. i feel like im doing it wrong. im trying to store an actor in this variable which can be seen and is in a certain range
what's the problem?
so i want my frindly ai to shoot enemy ai but with this its only 80% accurate . some times the AI sets the focus/shoots enemies through walls and sometimes doesnt shoot enemy ai when its right next to it
Hard to say based on that, you'd need to debug it to find out what's going wrong
for example try printing which values it's using
yea thats what ive been trying to do for a couple of days but thought i could ask here too
wat ive noticed is taht sometimes it wont set the blackboard key to true for seeing enemy
even if its right next to it
try using on update target perception or whatever it was called and not the one you're using
is there a way i can constantly check if there is an enemy in sight or wil the ai execute only work once it updates
the one you're using gives you a list of all updated things, the other one just gives you individual stimulus data per actor which you can then look at
that is my main code
the one above i just used to get all actors and store the focused one in a variable that is the closest
cuz sometimes the ai focuses through walls and sometimes it doesnt so idk wat its doing
You should be able to do it all in the other one
Basically save the current target to a variable, then when you get new perception updates, compare the distance then to determine whether that one should be used instead
so like everytime the ai sees a new target it udpates ?
wat if it sees 2 targets at the same time
Then it gets two updates
ahh
ok so i remove the perception node whichgives array right
i do all of it in this one
target updated
yep, that would probably be simpler
@misty wharf i tried doing it off just that one node but now the ai just stands still sometimes becuase it doesnt go into the CanSeeEnemy blackboard value
ive noticed if there multiple enemies the ai doesnt start shooting until there is an update
in seenenemies
Drafting a Behavior Tree with an AI Controller, pretending Event Tick is Root
The idea is that my NPCs should...
- Flee if critically wounded and NOT in a party (So enemies will flee for their lives but the player's allies will fight to the bitter end.)
- Follow the commands of the player if they are in a party. A "Command" is essentially a target actor & location, that is attacked if it is an enemy, followed & guarded if it is an ally, and used if it is an interactive object (like a teleporter.)
- Run Idle Behavior if the NPC does not have a party and has no higher priority tasks, Follow Leader if the NPC does have a party.
Is this conceptually sound?
I'm drafting this way because I still don't grasp how to use Decorator & Service nodes beyond updating Blackboard values. (But Composite Nodes and Tasks are understood at least.)
@wintry flint Yeah more or less. The decorators are the part that does the boolean checks. The services set values on the blackboard as needed. At a glance it doesn't look like you would need any services.
Kewl
I am trying to get my ai controlled units to use GAS abilities now. I need a way to flag to the BT Task that a given ability has ended. I'm planning to create a generic "Use Ability" Task that implements an interface that receives a callback on End Ability.
Curious if there's any thoughts on best practices here
Seems reasonable. You could probably hook into the OnABilityEnded delegate on the ability system for it
#gameplay-ability-system may have some more ideas
OOooh, Decorator, Service, and Task Nodes can get Input Actions
I don't think I'd do anything with this but it's real interesting to know about
That seems like a terrible idea lol
@misty wharf Only thing I can't figure out is how to pass a reference to the Task to the Ability... Seems like you don't get a chance to pass data calling ActivateAbility?
Oh lmao
TSubclassOf<UGameplayAbility> ?
I have no idea if I would ever do anything with it, but that sounds like a great time for cursed blueprint experiments :D
Exactly lol
Maybe for some messed up 2nd person game.
Press W to set the AI's attacking state to True.
@misty wharf I don't follow? I'm saying how can I tell the ability which task to call back to when it's done
Ahh
I wouldn't do it that way
I would do it from the task side, so that your task does TryActivateAbility, and then listens to the ability component's OnAbilityEnded if it seems the ability did activate
@wintry flint nah you would still want to use inputs on the player controller to set vars on the blackboard of the ai controller of the unit. Imagine an RTS
the ability itself doesn't need to know that it's being activated from a BT in that case
Ah ok that makes sense.
That would be the proper way to do it. 😂
@misty wharf should a c++ implemented task inherit from UBTTask_BlueprintBase
If you have no reason to do so I wouldn't
@misty wharf UBTTaskNode then? Will that be useable in the BT editor? I presume it will not be extensible in BP?
just UBTTask if you're not using the blackboard, if you use the blackboard using UBTTask_BlackboardBase would probably make sense
I see. I believe this task will not need anything but the actor and the ability, so I'll try the former
@misty wharf Are you sure that's a real thing? Looks like TaskNode might be the root of it all.
class UBTTask_BlackboardBase : public UBTTaskNode
Oh yeah you're right
Anyone recognized an issue related with BTNodes properties get corrupted?
For example bool, enum and float values I exposed to editor has values in BT graph but debugger displays a different value
And this does not get fixed until I remove and add another new node
It's not even get fixed 
🤔
C++ or BP based nodes?
If it's C++ tbh it sounds like a bug in how you've implemented them because I've not seen this
or some other very strange issue I guess
🤔
BT'izing that graph from earlier
For that IsParty member variable that keeps coming up, I'm not exactly sure where to set that.
My first impulse is to place it on a Root Level Decorator but I'm not sure what to make of the warning it gives
For the first time they are BP nodes 😂
You have a lot of conditions there.. what behaviour is expected for the case where the conditions are not set? make sure you define exactly what you want to happen in both cases somewhere and make sure that your expected path for both condition true and condition false make sense
Because its always the edge cases where SOME conditions are true, but ONE isn't that kicks you in the ass 🙂
Ohhhhh
When I built this I assumed that all of the conditions must be true or else it will fail, abort itself, and move onto the next node
"All conditions must be true" might be worth making a custom decorator.
Actually, I should probably think about condensing all of these into a single condition when possible
"bFleeThresholdReached = True", "bHasParty = False", and "CurrentOpponent Is Set" could probably be condensed to a "Can Flee" condition.
It depends on how you want to handle it, it can certainly be simpler to have a smaller amount of conditions in the BT if you don't need the specific details there
There is also a composite decorator which allows you to use a simplified node editor to create conditions like X or Y or Z or other variations of such
Is there a way that navigation also consider other ai pawns in its findPath ?
How can I make this property appear in a task?
Left is my c++ task with a single attribute I want visible on the bottom; as is done with the example on the right with it's behavior tree arg.
Sorry, "GetStaticDescription" I think is the right one. It's one of them, anyway 🙂
@opal crest It was the latter edit. Thanks
Is there any way to jump out of the selector execution flow?
Something like with finish with succeed but it needs to end parent's parent too
Without decorators 🥲
sounds like a goto
I don't think you can just exit with result which would immediately exit parent too, unless the parent is also a selector and you succeeded or something like that
is it possible if my ai follows me and attacks me at the same time? i set up a layered blend by bone thing and BT to attack and its attacking but i noticed when it gets close enough to attack it stops and then slaps and then starts walking again
A composite decorator seems right for what I want, I was essentially trying to put together AND statements preceding each set of tasks
you can use simple parallel node in bt to move and attack at the same time
i can feel the pain..
🫂
Its not always bad to have multiple conditions, but what you should be thinking about is how the conditions themselves split the behaviour, if you have a condition "isInCombat" for instance, then you need to figure out what dictates "incombat" being true vs false. Usually for each side of that boolean, you might have a number of subquestions, like "incombat and has ammo" and "incombat but out of ammo".. then those branch around the ammo condition
The point is to recognize that having boolean conditions is essentially a tree splitting
and you should try and figure out both sides of the tree, or some catch all fallback
Otherwise, what you'll get is unexpected behaviour because the specific conditions are almost true but not fully there
its also kind of why I've gone off boolean logic based approaches, because they feel far too brittle to edge cases
and my brain doesn't have the logic to handle all of the possibilities
I kind of prefer "in the ballpark" logic 🙂
I find it important to mentally figure out what the priority order is.. like if I'm in combat and I'm running low on ammo, what really is my priority? if I've only got one enemy and I'm likely to kill em before running out, then does the low ammo really get priority?
boolean doesn't really express that well
So it's not really a fail condition like I was assuming it to be
Well, remember that BT's are essentially conditional priority selectors
i.e. its important to plan your priorities and your conditions that split your choices (at least the important ones)
It can be a lot easier to architect if you figure the high level priority order at least
stuff like having different priority set while in combat is decent.. so a split for incombat or not is a clear one
The question then becomes one of rearming.. does that have higher priority than firing
and is it still "incombat" to be rearming
For my NPCs, Flee is the highest priority behavior if allowed. Self preservation takes precedent.
But in most situations it is expected to be suppressed by the following conditions:
- Its HP is above the flee threshold (an enemy should flee at 50% or less HP)
- It is not part of a party (I don't want the player's NPC teammates punking out on them)
- The NPC actually has a target (There's no point in fleeing if its target up and dies, changes teams, etc)
That 50% flee point will get predictable fast btw
Yeah, it will, though this is just for prototyping purposes
In the "real" product I would have more going on to determine when to flee. An NPC should be able to look a character up and down and correctly assess the target's power level relative to its own.
sounds like utility 🙂
Yeah 😄
I've got a self imposed deadline of June 7th so for now I'm taking the most simplistic, straightforward representation possible.
I started the whole project March 7th, I've worked sequentially through the main menu, character creation, party recruitment, and damage application.
AI is the last big part of this equation, the deepest requirement is to have NPC teammates that can move to the target in the player's crosshairs upon right-clicking, and either attack (if an enemy is the targeted actor), defend (if an ally is the targeted actor), and use (if an interactive object is the targeted actor)
Nice 🙂 I did that for a personal project once.. felt very natural to me
ended up adding a marker on the ground if you aimed at that too
kind of tempted to start it back up to copy the Full Spectrum Warrior thing
The attitude I was coming from was that RPGs are good at being Digital Barbie right?
So according to my incredibly self-serving logic, the Digital Barbie will be 400% better with 4 avatars to customize! 😂
Hmm, not sure its multiplicative 🙂 but can't hurt to try
We did a study once using Neverwinter Nights 2, turns out players of RPG's choose characters based on percieved utility.. so chose armoured whatever for tankiness, or leather looking things for backstabby etc.
Naw but seriously, it's taking the idea of a hero-builder RPG and having it operate around the player customizing 4 blank slate avatars, instead of just 1. And the player can swap control of each avatar at will (via D-Pad or RTFG)
It was a beast of a task to get the hero swapping done lol.
Especially cuz I had an issue where my AI controllers would just freeze after swapping in certain ways
So like Rainbow Six swapping?
Actually, I think FSW had swapping.. but you have two squads of four to swap between too, so 8 in total
How does Rainbow 6 do it?
It was pointed out to me that what I'm doing closely resembled Evolva or Marvel Ultimate Alliance
R6 has four squad mates and you can swap them, can't remember if thats only on death, but I dont think so.. might be thinking of Swat 4 though 🙂
tab swapping
We did it in worms too 🙂 arf!
For me it's RTFG/D-pad to swap between heroes 0 - 3
The AI teammates will follow the player controller, so you can essentially pick who is the leader at present
thinking about it, loads of games have done swapping.. I think its a really cool mechanic
My heritage is RPGs and MMORPGs - my goal is to make the altoholics promised land.
does diminish each individual, but emphasises the squad
The allied AI is gonna be the heart of that lol
whats that bioware rpg called?
the one with the stop time control thingy? I didn't know it even had it until watching a youtube stream.. I'd literally played the game for weeks 🙂
Uhhhhhhhh
Beats me lol.
I explicitly went for real time action where you have over the shoulders camera and only 1 avatar in your possession at any moment (but the other 3 can be directed.)
The AI controlled teammates are expected to be good-but-not-perfect at "playing the game" so to speak, so that the player doesn't have to micro them too much but can be directed like that if so needed or desired.
With the fleeing stuff, that's the heart of a self preservation system
Where enemies will try and retreat if they sense their power level is beneath their opponent(s)
Be careful, retreating looks bad in combat 🙂
Part of this is coming from my ARK modding adventures, I had wild dinos flee at 25% HP - the effect was convincing because dinos had a damage material that would gradually become more visible overtime
Might feel wrong for teammates to run and leave you 🙂
You could see why the dino was fleeing, you just scuffed it up in a fight
Teammates are expected to never flee
oh right
Fleeing is meant to be suppressed if they're part of a party
The expection is to make "winning" (or at least surviving) easier than "killing"
turn off rigid collisions and use a seperating force.. thats my advice.. moving a squad around is hard enough as it is
oh and steal some stuff from ellie of Last of Us, some good teammate stuff in there
I know Ellie was setup to never break the player's stealth.
FFXV also had pretty robust teammates, they were pretty competent on their own and would reliably pick you up if you were downed.
When I modded Oblivion making custom pet creatures I made a point to give them a cloaking spell if the player was crouching and neither it nor the player were in combat. So that way the player would know the pet would never break their cover.
For this prototype all the NPC teammates do is move to the player's position with an acceptable offset (value set to around 300 or so.)
But it definitely looks ugly, in a more finalized setup they should prefer to keep a bit of distance between each other and move towards a specific offset from the player. I expect EQS to be mandatory here.
Yeah, EQS would be a good idea.. keep the friendlies in eyeline and slightly in front of the player, preferably towards the enemy so you can see them at the side of your view
After June 7th I'll be wrapping up my investment into script/code though. Drawing and modeling are my trained skills, anything to do with BP script and AI is entirely self-taught.
I'm doing what I need to get a working prototype and demonstrate I'm a cut above "Ideas Guy" but that's not expected to be a forever role.
ah, the fabled "ideas guy" 🙂
Nobody likes em, and being able to draw/model doesn't necessarily put me above that 😄
I don't expect to have a software engineer's range of knowledge but I should at least be able to have the bones of something so I can point at the screen and say "Look! He shoots gun and makes fireballs! Controls nice too!"
(And looks great doing it)
hahaha.. that's probably above 80% of indie projects 🙂
I should probably share what I've been doing in #lounge or somethin'
Wait
#work-in-progress
Ya
Yarp
Swooping back to AI (still uploading the progress video!)
The big thing I need allied AI to do is be able to process what kind of actor they're dealing with
And also interrupt their following behavior to immediately follow a command
I did successfully send a signal from the player controller to the AI Controller but I noticed that AI would only try and process the command after finishing their follow task
Yeah, unless you set it as higher priority and set it to abort lower
That said the way I did it back then was to run a new behavior tree entirely, rather than using the same BT like I'm trying now
@ocean wren I really think you should write a book
I'm already writing two! 🙂
YESS
@visual swift lol you think big servers have here enabled?
Tell me more lol
well, writing IN two, but yeah, likely to be writing a book properly soon
If you say so :D
Information about BTs are very rare and many people end up learning best practice by experience or mentorship rather than researching
A book dedicated for BTs would be blessing
Pretty sure there's been a few books on BT's in general. I've read a few at least
But not UE specific
It just gets complex with the scale
Then at some point you're having that "WTF" moment
And another experience
I guess
I'm not sure people would get much out of a book on it.. because the kind of people who have trouble with it haven't got time to read a book 🙂
My book will be about the ML/RL stuff really.. because that's a bit more unclear/unknown
there is a youtube video about behavior trees
which had some kind of gardening related title
yeah, I've made a few 🙂
that one had some good ideas on more complex BT management
gardening related?
For me, the biggest hurdle was grasping that the code that actually does stuff lives in tasks, decorators, and services.
https://www.youtube.com/watch?v=Qq_xX1JCreI here it is
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...
I saw that one recently 😄
For me it's ambigious rules of BTTasks in general and controlling the execution flow
Ah right 🙂
The pinned video was also watched
Ambiguous?
Execution flow is controlled via decorators more or less, they can do all kinds of arbitrary things
There's been some good ones from GDC, wonder how many have watched them before coming in here and asking for everyone to debug their blueprints 🙂
Like it doesnt tell you C++ BTTasks are not instanced by default etc.
Hmm, in UBTTaskNode?
Probably yeah
Don't remember, maybe I missed
when you know the variable you set to make them instanced just find where it's created and you can usually find the default value
It's not confusing anymore since I went all over them a year ago but when I was a starter it was a tiring experience for a while
lol yeah
also instancing is a lie
they get instanced a bit even when it's not on
:P
if you look at some of the builtins they treat them as instanced sometimes with stuff like binding delegates
but they aren't instanced so it's a bit weird
I usually end up getting confused we can't abort the currently running parent tree etc.
I definitely discovered that backwards. Like "this function is not const, but pretty please pretend it is" made me go on a whole code safari.
Sometimes it forces you to use FSM instead at some specific parts
All functions being const in C++ and being mutable BP event in BP side is also weird 😄
Why I can't just cache values 
How cursed would it be to have all the allied AI logic inside one godforsaken task? 👀
The number of things telling me to make my variables private, but expose them with UPROPERTY(Meta...) tags is ahhhhhghg.
Summoning Lorash.. 3.. 2.. 1..
she doesn't frequent this channel lol
Yeah 😄
In all seriousness, while I'm being resolute for now and seeking to do things properly, with my personal deadline coming in about a month I am definitely keeping in mind what my ugly options are.
Missing my deadline = I am now Zuko and must regain my honor.
You can get away with doing a alot in a task, it just makes it things more rigid.
You mean you're not making your variables private? 😲
Only If they deserve to be private 🙂 I default to protected, unless there's a good argument otherwise, particularly if they are UPROPERTY's. And especially if they are going to get BlueprintReadWrite, I start considering putting them in the public section, since that's effectively what they become.
Does making your variables private or public have any special effect? I have never bothered with this but now i am curious. I think in BP has private option if not mistaken.
Its a bit of a holdover from OOP stuff, where you aren't supposed to make your variables public unless you specifically want them to be accessible (so that you can only provide the minimum interface)
which is a very good idea
kind of
OOP has kind of lost some of its shine really.. because people become overly fixated on some of the principles and don't think if they're actually a good fit for the problem
perhaps, but encapsulation is something that applies outside of OOP as well :)
For example in Haskell you can declare a data type within a module and only expose certain parts of it to the users of the module
So it is best that only all none accessible (by players) variables all go private?
Yeah, I don't have a problem with having private/public values etc.. I just worry that people are still teaching OOP like its a goddam cult 🙂
When in fact, for some things, it is positively detrimental
it's not so much about player accessible, it's more based on how the objects should be used by whoever is programming the game
@ocean wren What do you think of an utility editor like this?
I see. Thanks
Looks good.. that slate?
Anyone know of a reason that ai perception would simply lose track of the player?
I have a student who followed the behavior tree quick-start guide. All works as expected except while "chasing" the ai will all the sudden switch to patrol state.
Code looks identical, and during debug I discovered the event to make them stop following the player in never fired either. So it's almost like the black board key pointing to the player is invalidating on it's own
It's from other another engine. I'm using for a reference to what I'm doing
It has nothing to do with behavior trees and everything to do with how the sight stimulus is handled
So you need to look at how that gets handled and what is updating the blackboard with the invalid values
Assuming the sight sense is the only one affecting it, then most likely it either senses something else which causes it to lose track of the player, or something ends up blocking on the line of sight trace channel
No, it's identical to the set up in the "bt quick start guide".
The ai controller is the only thing handling sight perception. And the timer for losing line of sight is pushed way up to 16 seconds.
I can be surrounded by ai characters and they will (in unison) stop running at me and resume patrol for a second before the ones who can still see me chase again
The event to clear the player as the chase target is never fired, so idk how they are leaving the chase task and going to patrol
If it's identical to the guide then the guide is wrong
I haven't looked at it so I can't say, but there is no automatic lose sight mechanism that would do something like this except in the scenarios I mentioned
I've used the guide dozens of times for various students. Never had this issue before.
I'm just gonna have him reinstall the engine, cuz by all accounts it shouldn't be doing that
I suspect it's the case of it's not quite exactly the same
It would be a valuable lesson in debugging most likely lol
question: I have a AI that follows multiple vectors close together but the problem is that the AI stops for a brief second at each vector, how can I fix this to where he runs smooth with out stooping
Well if it's still broken next time I see him we'll have to try debugging further
Custom movement code. Its stopping due to reaching point. You could try and check the distanve manually and update target location before the aiMoveTo acceptance radius is reached
Hi! i have this grid made of tiles on a 2D matrix (X,Y)
Do you know of an efficient way to know if Any of the tiles is connected to the rest?
I'm trying to define spawn spots randomly, but i don't want them to spawn if there are in a location like the one pointed in the screenshot
I tought about using the NavMesh to check if the place is "reachable" but i'm not sure how to do that
Sounds like an expensive check 😅
You can use a better algorithm for creating the random map
One that doesnt allow islands to exist
I'm doing celular automata to just let them die / appear with a certain criteria
the "is partial" doesn't ended up working as intended, so i may need to do what you said and just don't allow islands : (
You could flood fill from one of the tiles and then find tiles not visited by the flood fill and then fill them too. Then you will know which islands are reachable (contiguous tilesets)
I think islands were undesireable in the first place
Anyone had success with using StateTrees instead of BTs? The official examples are AI and... a weather system, not sure if it's focused on being competent at AI, or rather a general purpose pre/post effect-driven state machine, sorta thing
hi, about my nav mesh config....what I'm missing? I want my pawns be able to cross the dark wall. I have create two Object Channels: Zombie and Breakable (block everything by default). The pawns' object channel is Zombie, and they are ignoring breakable objects. The dark wall's object channel is Breakable and is ignoring Zombie objects. Nontheless, something is missing about the nav mesh: for the nav mesh pawns can't cross Breakable actors. Thanks for any help! (L)
and yes, every component with collisions inside each actor is setting the same way
pawns
brekable wall:
a workaround:
Who knows how to get the hostile perception system working and would like to make some money
Just need Custom AI Controller with the proper C++ code I can just parent to
ue5
settings of the team id to bp
navmesh dont update at runtime
you can change that in project settings tho
Hi , does anyone know how to do a spherical navmesh? I cant find info anywhere
Or a different system to replace the nav mesh
If you want to use a different system to replace it, just don't use the navigation movement functionality and do something else
Hmm trying to write a custom task in c++ to handle using GAS abilities. Trying to use the built in move to task as a reference but I don't follow it entirely.
It seems that ExecuteTask of a BTNode needs to return a EBTNodeResult to indicate the state of the task for the BT. But for anything that isn't instantaneous this should return EBTNodeResult::InProgress.
It looks like BTTask_MoveTo kicks off a AITask_MoveTo which is an async thing. But I don't understand how it ultimately tells the BT that the movement was a success or a failure.
For example. BTTask_RunBehavior has the following code
EBTNodeResult::Type UBTTask_RunBehavior::ExecuteTask(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory)
{
UE_CVLOG(BehaviorAsset == nullptr, OwnerComp.GetAIOwner(), LogBehaviorTree, Error, TEXT("\'%s\' is missing BehaviorAsset!"), *GetNodeName());
const bool bPushed = BehaviorAsset != nullptr && OwnerComp.PushInstance(*BehaviorAsset);
if (bPushed && OwnerComp.InstanceStack.Num() > 0)
{
FBehaviorTreeInstance& MyInstance = OwnerComp.InstanceStack[OwnerComp.InstanceStack.Num() - 1];
MyInstance.DeactivationNotify.BindUObject(this, &UBTTask_RunBehavior::OnSubtreeDeactivated);
// unbinding is not required, MyInstance will be destroyed after firing that delegate (usually by UBehaviorTreeComponent::ProcessPendingExecution)
return EBTNodeResult::InProgress;
}
return EBTNodeResult::Failed;
}
void UBTTask_RunBehavior::OnSubtreeDeactivated(UBehaviorTreeComponent& OwnerComp, EBTNodeResult::Type NodeResult)
{
const int32 MyInstanceIdx = OwnerComp.FindInstanceContainingNode(this);
uint8* NodeMemory = OwnerComp.GetNodeMemory(this, MyInstanceIdx);
UE_VLOG(OwnerComp.GetOwner(), LogBehaviorTree, Verbose, TEXT("OnSubtreeDeactivated: %s (result: %s)"),
*UBehaviorTreeTypes::DescribeNodeHelper(this), *UBehaviorTreeTypes::DescribeNodeResult(NodeResult));
OnTaskFinished(OwnerComp, NodeMemory, NodeResult);
}
It looks like ExecuteTask is binding the end of its subtree to trigger OnSubtreeDeactivated, which in turn runs OnTaskFinished. But OnTaskFinished doesn't have any implementation here or in the base class, so I don't see where it would be passing the node result?
Can i rebuild navmesh after placing wall? on them map because im trying to make prototype survival game
What i should to do?
You can enable runtime navmesh generation in project settings
This will allow it to rebuild every time you move/place something which can affect navigation
can i rebuild navmesh from c++ because i dont want to make them dynamic because is consuming so much fps in that case
ans walls will be do not moveable
Probably
I'd imagine it's in the navigation system code somewhere
It has a delegate which triggers when the navmesh is rebuilt, you could see where that gets broadcast from, it would probably help you find what you can call to trigger the rebuild manually
@misty wharf That thing you found with executing a specific part of BT, was that C++ only?
Huh?
I believe it was last week where you were looking on how to jump to a specific execution of the BT, and you found something
RequestExecution - that's it.
Ah, yep that's the one
That would appear to be how the execution for specific nodes is done, I didn't really spend much time looking at it any more than that though
is there any design document for how the radiant ai works in gamebryo? i was gonna have that sort of system for the npcs in my colony builder.
ugh, I feel like I'm spamming the channels at this point with increasingly shallower questions.
How can I make a c++ bt task return success in a behavior tree. I suppose is all I really need to comprehend.
Why not read the code and look at where the existing ones return? It is pretty obvious if you look at some of the existing ones.
@ocean wren I've been trying and I cannot follow the logic. It's obvious when the result is instantaneous in Execute_Task. It seems obvious if you're checking for some end condition in tick and can call FinishLatentTask. But I want to end the task in response to an event, and I'm lost.
So you know how to end the tick version right? so all you'd need to do, is hook a delegate and change a value and then check that value in the tick?
@ocean wren I'm hoping to do this on a non instanced task. Checking a condition in tick also feels... ugly?
I have a delegate capturing the event. I just can't figure out how to call FinishLatentTask and supply it with the behaviortree component that it requires.
Its gonna tick anyway 🙂
It's going to tick but it won't have member variables to check
Well, ok, if you want to do it otherwise, then have the value on the owner and simply have the task check the owner?
or have the event change the BB and have the BT task check the BB value, as is right and proper 🙂
That definitely feels wrong though. No other tasks work like that. There has to be a way to trigger the end of the task in response to some event.
Well, the BB value change will cause the task to change anyway
guess it depends what you're task is doing
I just want to run a gameplay ability and return success when it completes or failure if it cancels
Like... the Move To node does not depend on altering your blackboard to confirm the move is over
I just don't understand how this isn't a basic concept
But it's not a GAS problem. The GAS is tangential. I have a task. I have a delegate I'm responding to.
//FOnGameplayAbilityEnded delegate
void UBTTask_Use_GAS_Ability::OnAbilityEnded(UGameplayAbility* Ability) {
// tell task to return Succeeded
this->FinishLatentTask(OwnerComp, EBTNodeResult::Succeeded); // This won't work because OwnerComp isn't defined
}
Maybe I could bind the delegate to the Behavior Tree as a way to force succeed the node but that also feels very bad
Yeah, that looks like a bad idea.. unless you have one of those tasks per agent
Is it a bad idea to make my AI Tasks instanced? Could I just cache a reference to the behavior tree?
Well, the design of the BT system was intended to have a single BT being applied for multiple agents, with the per-agent stuff in the BB
Why don't you bind the ability on your AIController and simply set a BB value when the event fires?
I could. It still feels dumb to do that. No other tasks do that... and my mental model from blueprints is that you should be able to call Finish Execute
meh. fuck it all. doing it in blueprints.
Anyone know how to assign "friendly, neutral, hostile" using the ai perception component in BP?
You cannot
That part is controlled using IGenericTeamAgentInterface
which is not blueprint implementable
I'm starting to grasp why I was advised to avoid using booleans if possible. Or at least be cautious about it.
Setting it to false is still setting it.
Yeah, on blackboards/Behavior Tree's
Right
Graph work incoming
If you're using the blackboard decorator it actually has something that will help with this
It has an option to trigger when the value is set, or when the value changes
the set one will trigger it every time the value is set regardless of whether it's the same value as before
Also I feel like I'm committing a sin by casting directly to my character class
lol
I mean the other option is using an interface, but it probably doesn't make much of a difference
But anyway, the idea is to have an NPC flee it if's below the flee threshold.
And is not part of the player's party, so that way teammates don't punk out on you. But I have a separate decorator covering that.
It occurred to me that in the Behavior Tree the "Is Set" value would be satisfied for both true or false
But it sounds like "On Value Changed" is what I want
Yep
"Is Set" is basically "Is true"
and not set is value == false
they just decided calling it set and not set or unset is more designer friendly lingo I guess
but I've seen plenty of beginners get confused about what "is set" actually means, so I don't know if it's actually any better lingo :P
Behavior Trees feels like a parallel planet for better or worse.
Now that I'm starting to get into the gory details, it would be nice to have a built in Blueprint equivalent of Selectors & Sequences, right now there's no obvious equivalent.
The flow of data from Blackboards --> Decorator/Service Nodes --> Behavior Trees --> Tasks is a lot to take in when you consider the 7 or 8 classes actually involved with the operation.
I just use a lot of decorators which read values directly off my pawns lol
Don't like dealing with the blackboard when there's so many random values involved with it sometimes, and the bb is so hard to organize and you'd end up with a whole bunch of random bb variables which basically exist for one branch of the BT and for no other purpose
Approaching it in the way guys like Matthew Wadstein suggeset, I'm noticing that I'm basically having to duplicate blackboard values in my decorators
Oh?
There's the Blackboard Value, and then the Key Name in the Decorators I have
Well, that's not a literal duplication
But it does come off redundant
I'm not sure if I'm following :)
I built a god BB...only to learn later on in the project that you can inherit BB's 😭
inheriting BB's seems pretty iffy too tho
if you ever want to run Sub-BT's
and it still makes organization hard :P
If I want to access the Flee Health Percentage float that's in my Blackboard, it seems to be that I need to make a Name variable in a Decorator or Service that matches the Blackboard variable's name.
Is this actually necessary?
don't get me wrong I like BT's they work well but they have their small issues here and there lol
I haven't tested it with sub-bt's; but I don't think it'd make organization difficult personally. To me, I think the way things are set up is really nice personally.
@wintry flint use Blackboard Key Selector
make it instance editable
this will allow you to just plop the node into your BT, and it'll show a selector you can use to choose the BB value you want to use for it
Yeah, what zomg said; BB key selector is what you want.
Well you can't even change the order of the BB vals which is a bit of a pain if you have a lot of them :D
If you're talking about that, then sure. But meh. I don't have much of an issue with it.
hehe
Oooh, Break BlackboardKeySelector
in my current project I have a BB value called RandomInt which is only used by some of my BT's lol
@wintry flint you can also directly get a value from the blackboard using the key without having to break it
Wat
Yeah in my other project I have a lot of AI state like what objects the pawn has in their inventory, what objects they want, what their current task is (they have a list of tasks), etc., trying to stick this stuff into the BB is kind of a pain lol
in my shooter project it's less of a problem because most things the AI is concerned with is: do I see the player and can I shoot at the player
and a few other small things :P
I could see how it could balloon up like that, sure. But I'd probably end up looking for a way to reduce it; at least with the way I approach writing my AI.
Yeah.. I just have a lot of decorators which can access the data directly off the pawn which makes it much easier to work with
Yup - that works too. Bend it to your will!
Released ugly code is always better than beautiful non-released code
Hmmmm'
Is the selector being named after the blackboard or the value you're looking for?
The name of the blackboard key you set up
I still haven't really used Gameplay Tags all that much either 😅
Gameplay tags are nice
I kinda prefer enums because they have that type safety, but there are various situations where enums are annoying to work with because of lack of polymorphism and what have you... so instead you just use gameplay tags :P
Yeah, I get it.
I have a bunch of tags for all my animation states like walking, running, shooting, etc. which is used by my animation state machine related logic, then I have tags for attack types which is used both to decide which attack an npc is going to use and also choosing the appropriate animation from its animation list... etc.
So - you're using it as a statemachine for your pawn?
Yeah it's just used to represent the animation that needs to be selected similar to how you might use an enum
I do have some states like OnFire and Dead as tags as well which works nicely with GAS
I typically have a few bools that I change via events and the ABP is listening for those. Simple and works. Thus far, most of my pawns don't have all that many actual states. Montages work well enough.
Yeah ABP would probably reduce the need for animation related logic like that but since I'm using sprites it needs a custom system :)
Ah - poor 2D; womp womp
If only 2D got like 0.5% of the funds from Fortnite.
All of a sudden, UE would become a much stronger competitor to the other 2D engines 🤣
lol
It'd be like a rounding error to them.
yeah paper2d is nice even for a doom-style thing I'm doing, but it has a few things in there which are a bit meh
I noticed it ends up rebuilding render geometry a lot when sprites update, because it has things like support for different collision boxes and stuff based on sprite, but as a result those can become a bit of a performance bottleneck if you have sufficiently many sprites animating at the same time
How do I create a StateTree class?
I feel like I'm missing something very obvious.
one doesn't simply "create" a StateTree class, instead one has to will it to exist, offer the gods of AI a living sacrifice and chant the litany of the navmesh in order to invoke its presence.
it's under AI
not a blueprint
it's a unique type of asset
a fancy data asset probably
Wat
I don't even see the State Tree when I hover over Artifical Intelligence
All I see under AI is BT's, Blackboards, and EQS
Ok there's my problem, I wasn't looking for a plugin
[Incoherent cretin noises]
The last time I ever did anything with plugins was like, 2 years ago lol
pfft, you're not unreal-ing hard enough then
I plug things in ever other day
ever-y
New fluid sim for instance.. well worth a plugin
Had a meeting with a company yesterday, led me to some pretty wild ideas. For instance this weekend going to have to check out the Caesium plugin.
Hi there, can you help me? In Which component should I change collision (mesh or capsule)? and what set presets collision to shoot this AI?
scuze me chaps - setting a blackboard Object var as an actor, google turns up many questions but few answers, which makes me suspect i Shouldn't be doing it, but then how can i reference an actor?
i've got a key of type object with base class actor, but setting it from my gamemode with either an actor or a subclass just sets it to None
never mind, named the key wrong, it works.
horay
Hooray! And yep, somewhere in the top 10 rules for working with blackboards is "check that you're using the key you think you are using".
isn't that ALL of the top 10 rules?
Haha. True though.
I've got an AI-controlled NPC and somehow something is overriding its movement settings. I've tried to make it fly instead of walk, and actually set the walking speed to 0, but when I play the level it's walking around like normal. So I think the movement settings I'm editing are somehow being replaced at runtime?
Any theories on how this could be happening?
Like, this is not a character who should be able to walk.
Also edited this. Still it walks.
If I had an Elevator or ladder or something like that how would I make my AI account for that? So instead of him getting stuck he just goes to the elevator or ladder or something and goes up/down that
I believe Navigation has a NavLinkProxy thing for that kind of stuff?
This is from the Topdown default project for UE5.
Those two cylinders are the start/end points of a proxy link that lets you jump off the platform and not just navigate down the ramp.
Could be janked into a ladder connection, not sure about elevators though.
And on an unrelated note: what's a reasonable maximum to have on AI controllers?
I'm wanting to make a game, closest existing example is probably Total War or something... I'm not sure what options I have for having squads of units move around dynamically other than attaching an AI to it.
But doing that for every squad and then every soldier in said squads so they can properly fight could quickly become, well way too much.
It's hard to set a hard limit, it's going to depend on a lot of things, but If you are smart about it, AI controllers are less likely to be your limitation, then, say, CharacterMovementComponent.
The MassAI plugin for UE5 shows off simple AI running efficiently at a huge scale, for example.
[Cries tears of moron]
Doing the Behavior Tree Quick start guide. My NPC successfully follows me when I enter its perception range but doesn't play any animations while sliding at me.
Patrol also fails to find a valid location.
For TotalWar, it sounds like they have a battle AI that controls Units (which likely do have some simple AI associated to carry out commands), and soldiers are out of its scope. https://www.totalwar.com/blog/total-war-ai/
@wintry flint That sounds like a a lot of movement commands being cancelled quickly. Is your BT flickering like crazy? It could be a decorator that's aborting on every update.
As a matter of fact yes
The "Find Random Patrol" task immediately fails
Graph work incoming
I see. I'll look into the MassAI plugin. Would Pawn Movement be better than Character at all? The squads themselves aren't going to be visible so as long as they are moving the same speed as the slowest member and following a viable path it shouldn't need all the extra walk/swim/fly fluff?
I have looked into how Total War handles it. Best I can figure is the individual soldier has a combat AI to control them fighting and retaining formation while the "player" (AI player in this case) has an AI controlling more strategic decisions.
Obviously the latter player-AI is going to be far more advanced, but have a helluva lot less of them in play at once.
So I guess its more a question, how much overhead does simply having an AI bring?
Not much. It's a component that gets ticked. Just being there is cheap.
Right. And from what I can tell the AI is necessary for even the simple MoveTo nodes to work. So I guess it shouldn't be too much of a concern to add it to each squad? Maybe even each soldier?
@wintry flint Your only finish execute "false" is after your cast. My best guess is that your cast is failing?
Gonna test that with a print string
Yes, each soldier. You may start reaching a limit at some point, where things slow down, but at that point using stat commands to show you what's taking up all the time will point out what is (unexpectedly) expensive.
Right, I'll go ahead with it and just keep an eye on performance. Looking at videos on the MassAI stuff too.
The cast doesn't appear to be failing, the print string is not being triggered.
Yeah, I haven't made the time to learn that yet, but it's hard to argue with the performance it's getting.
@wintry flint Ahh. Then do you have errors in the message log?
That's the only other thing that should fail a task.
The thing I've noticed with debugging is that an invalid location is always returned for Get Random Point In Navigable Radius
This is despite having a nav mesh created and with paths built
Can you check if "Patrol location" has been set on on your BTT_FindRandomPatrol task?
That's what it reads like is happening
Make sure it's exposed (the eye icon) and that you've set it on the task in the BT.
I would expect this to mention "Patrol Location" if it's setting the output there.
Every last person in this channel has done it 🙂
She moves.
Now I just gotta figure out why she's not animating
She just sliiiiiiiiiides from place to place lol
But I think that's an Anim BP issue rather than an AI issue
Yeah, I'd try to see if the character 'works' with a basic 3rd person character setup before debugging the AI side.
This is from the default 3rd person template
The demo video for the Behavior Tree Quick Start guide is from UE4 using the Mannequin asset.
Very strange, generally that works (just grabbing a third person setup and attaching an AI controller).
Oh, found it
AI Character needs to have Use Acceleration For Paths set to true in Character Movement Component
Does anyone else run into issues with Stop Logic not actually stopping the BT from processing?
I lock resources of brain component instead
heyo
can someone show me how to move to a player in ue4/5?
this is what ive got so far?
pls @ me
Anyone know how the perception system (sight) actually works?
It seems like once you enter the cone, the perception doesnt update often
Until you leave the cone again
Nice guide, also can be shared at #mass and even be pinned
mine doesnt even percept XD
so, the ai doesnt do anything, when i debug, its not percepting at all
Ah 3rd Screenshot is about perception
A thing I never worked in UE
Sorry
Rest of the active people knows better than me, try keep updating your post if you cant get any answers soon
ok, thank you!
Does your actor have a stimuli source? Did you check the flags in the sight sense to detect friendlies, neutral, and enemies?
Hey guys
I need an advice,
I am working o a project, I add the AI BP TO FOLLOW an object, but is not working anyone knows why..??
When I cast it to the main character it works and follow that character, but it does not follow an object
You might wanna show some code
Is there any way to interact with a Blackboard without using literal names? Surely there must be some struct somewhere that knows the names of its fields
You could probably pull the values off the blackboard asset in C++
but I don't really know what goal that would achieve since you wouldn't know what they are called
I mean, using literal names and generic functions is objectively worse than using defined functions, so the goal is to avoid that?
I don't think the blackboard keys are available as named values
I think it's literally a TArray<FBlackboardEntry> where each entry contains a FName field
A method I've seen used is to create your own FName fields where you can input the key name and refer to the names using the fields which is I guess a bit better than duplicating the string
Hmm. Next question, what's the right way to get a reference to the Blackboard in a BTTask? This is coming back with None
Get Owners Blackboard
Is there a consequence for a Behavior Tree component failing? I'm basically using "fail" as a break statement in a sequence (on like a boolean task which checks whether it should proceed). But then i remembered if you do that with throw statements in like JVM languages it's actually secretly ruining your performance. Is this like that?
a behavior tree component failing would most likely crash your entire AI - however it sounds like you are talking about a behavior tree node failing, which is entirely expected and handled
it's an expected behavior to the point that you have sequence and selector which have different handling of failing nodes
so that you can set your tree to work as you want
(assuming you fail in expected ways, being returning failed from the node in some fashion)
Howdy, i've a quick programming querstion that relates to ai decision making. In fire emblem, a turn based topdown tactics game, to prevent savescumming they make it so that enemy movements and if attacks land are prederermined, so you can't just load the game and do the same thing and have something dif happen. (if Jack swings an Iron Sword on turn 15 with a 45% chance to hit and misses, it will ALWAYS miss no matter how many times you play it). Xcom does the same thing, will rng locked at the start and hits predermined.
I get that this is tied to keeping a stable seed and if nothing changes about how the seed is refernced between two requests, it won't change, but i don't think i really fully understand HOW that, in practice, means that these shots/movements are predermined. Would anyone be able to broadly explain that?
it feels like i kinda understand what to do, but not quite why it works.
you would use a random number from the previous generator to seed the new one. So for instance, you roll for success on attack 1, and then you get one more random number and save it as a new seed for the next attack. When you roll for attack 2, you seed a new pRNG with the saved random number from the previous attack
this is how you would accomplish that specific goal, but note that this differs depending on your use case. For instance in Minecraft, the seed to determine the contents of a specific chunk is based on the world seed and the coordinates of the chunk
Okay, and so if you were to have a system where the player can rewind their turns to play old turns over again to try dif stuff, you'd just make sure that the various RNG rolls have the seeds they had when it was that turn the last time? So you just store the old seeds and slot them back in if you need them, and once the player moves forward you start using new seeds and storing those?
I can def see howthis is highly based on implimentation, but knowing abuot seeding new RNG with old ones is good, i know how to use RNGs but haven't really mucked with seed-based decision making much before. so that's very appreciated.
Okay, and so if you were to have a system where the player can rewind their turns to play old turns over again to try dif stuff, you'd just make sure that the various RNG rolls have the seeds they had when it was that turn the last time? So you just store the old seeds and slot them back in if you need them, and once the player moves forward you start using new seeds and storing those?
yeah, you could save the seeds that determined those turns, maybe in an array/list that you could traverse
the main principle is: seed X in, random numbers Y1, Y2, Y3, etc out every time
the fun part is determining how to pick the seed based on your use case
worth noting though, that if you can save the seeds that determine the result of a move, you could save the result of the move, but that might not be as doable if you want to let people branch their decisions-- ie say you have a routine A for move A, that generates 2 random numbers which mean different things for routine B for move B, which generate 3 other random numbers that mean different things
saving the seed lets you branch from it, as if the player had hit X instead of Y at that moment
Okay, excellent. I'll have to test some of that out, can't say i 100% get it but i'm def got some direction now. Much appreciated!
Maybe we should pin an "how to debug moveto" document in this channel?
stuff like "did you check the output logs for any failure messages"
and "do you have the name right in the blackboard key"
and "are you too far off the ground" and "have you seen if there is any information presented in the visual debugger"
and "are you in fact using Unity and not Unreal and are in the wrong discord server"
hi, I have 1 ai. I spawn the Ai behind my character. The Game is in multiplayer. I want the Ki of the first character team to fight the second character team. I am using a get closest actor function. The problem now is that all the Characters are from the same Blueprint. How can I make that the get closest actor function only see the Ais of the Enemy team?
You appear to be setting your objective location to "Where the actor is right now". Try using the "
GetRandomLocationInNavigableRadius" node to choose a different location, and see if your BT works then.
Okay. There's nothing particularly about the MoveTo node that should fail if a simple AIMoveTo node works in the same situation. If you add a breakpoint in your BT, you can see what the value of Objective is in the blackboard. That might give some clues.
Today's fun experiment: Figure out which config bool on the Navigation System and Recast Navmesh does the exact opposite to what it says
For example: "Initial Building Locked" comment says it does not influence editor-time generation. It does, and it prevents Force Rebuild On Load from working
how do you cast to a behavior tree task?
cast what?
and why? I've never needed to talk to a behavior tree task, they should run on their own and be cancelled by the owning BT observer set
Okay asking here. I've got a pawn that's mostly moving via physics, if given a destination it flies there in a straight line. Inputting a debug destination works fine. HOWEVER, when I run a behavior tree on this pawn, the physics motion slows to a crawl and starts stuttering, even though the pawn's tick rate is still good.
The thing is, the AI step that seems to cause this issue is literally just this. It's nothing, just calling "Set" on a variable. But without this, physics on the pawn runs smoothly.
If I simply edit the above to remove the Set call, suddenly the pawn moves smoothly. Why does this set call interrupt physics motion?
Wait it's not even that call! I added a LONG wait call on this AI function so this only gets called ever 15 seconds but STILL the physics doesn't work smoothly. Why?! It isn't even getting called more than once!! This makes no sense!
The PRESENCE of that Set breaks physics movement.
Ok RAD I've proved that this isn't an AI issue, now I can just go to #blueprint with this 😄
General Question about the best approach to a problem of mine.
im doing TF game that have horde and waves of AI that going to the base, they can break walls and other obj that they have in their way.
But I want them to break it Only if their path is blocked by them(those obj) and they cant reach the player/base. if they have a clear path so they will ignore those obj and move along
any tips?
Maybe try making it so that obstacles have a nav area with a higher movement cost
This should make them prefer to go around them, but if no other path is available then they would take the more expensive path
interesting ! thanks, I didnt know that there is a way to modify pathfinding cost
ill look into it, Thank you very much
Good day, I'm looking to get into StateTrees but I can't seem to find any resources about it. (The official "documentation" is sparse, at best). Does anyone have a sample-project one could look into or does one of the unreal-demo include good examples about it? They haven't used it in Lyra :/
CitySamples has statetrees I believe
Thank you so much! I'll look into that!
The official documentation actually covers pretty much everything you need to be honest. The only issue that I was having back when I was fiddling with it was data communication didn't seem to be working as advertised. So, getting data from one task to another task just flat out didn't work the way the docs said it was supposed to.
So I've got an AI pawn that isn't moving, and this is for sure why. But I don't understand what it means by goal projection, where do I disable that?
Oh weird, it's a hidden variable on MoveDirectlyToward. You'd think the "you're not using navigation" system wouldn't let you even turn that on
For pathfinding, is it possible to get all points in a path? Also is it possible to make a path using this sort of data?
I have a squad and I want each character to replicate the origin's pathfinding but with an offset for formations.
You can in C++, not sure about BP
Right. I don't mind diving into C++ since I'll be doing that after prototyping.
Think the call is FindPathAsync? something like that.. returns a vector of path points if I recall.. been a while
Its a good starting point at least, thanks. I'll look into it.
Well, its turing complete so you COULD, but.. no 🙂
but no what?
its not possible?
Well, I mean its possible that Bigfoot exists.. but highly unlikely
I'd suggest that if you want to do ML, then you think about running the ML remotely and using BP to pass data to it
There are plugins of course.. but ML on one machine is a bit of a bad idea for any non-trivial models
ill need the ML to pass data to BP as well in order for the AI to make tangible decisions ingame, is this possible? BP gathering data from files in a folder/outside the engine?
Whats a trivial model or non trivial
I believe so, but again its usually a bad idea because you might not have access to the files
well, trivial would be something like a model that classifies letters
shouldnt be a problem if the ML program is inside the game folder id think
the typical "hello world" ml model you know
oh like a chatbot?
no, chatbots are going to be a lot bigger (assuming it isn't crap)
im guessing youd need to be running the ML program while the game is running at the same time
the seperate program i mean
yeah, so what I usually do, is I use a REST api running my model, call it via an UE call and then just use JSON to pass the data between them
That way, I can run the ML model on another machine or in the cloud
or on my cluster
Something like FastAPI can get you started quickly if you're used to Python ML models
its basically a HTTP request/response
yeah, in ML terms, they're usually called "endpoints"
but they're just ML models hosted via a REST web api
yeah i dont really know anything about ML im just getting started
I was thinking of a typeable chatbot but that might be too complicated. I was thinking instead that the AI can choose from a large range of pre defined behaviours/choices based on data from its enviroment, itself, and the player. but maybe that doesnt require ML
im guessing ML is for more dynamic things like a typeable chatbot, image processing or physical movement/navigation stuff
hi I'm just starting with EQS -- can someone explain what happens if if add more than one generator to the Root of the EQS Query Graph?
does the system run the nodes L->R and choose the output with the highest score?
or something else...
show us an image of your setup
But yes, there's a left to right evaluation.. if you have two EQS query stacks and it doesn't return anything in the leftmost, then it'll fall back to the right
So the root basically calls whatever is under it left to right until it sees a return
ahhh of course
What you'd typically do is have a set of complex EQS settings on the left.. and a more lax one on the right
gotcha, makes sense thanks
Quite a few people didn't know it did that fallback.. I don't think its documented anywhere, or at least isn't clearly
yeah I searched for quite awhile but couldn't find an explanation -- all the tutorials only show one branch off the root
but I need this fallback behaviour so Im glad it exists 😄
QQ, is it intended that Rotate To Face BB entry only affects yaw and not pitch? (second image is me liveprinting the control rotation)
(I do know for a fact that the destination target is not on the same plane as the actor)
Can I give the BT action cost ? I want the AI only to do the action he needs to only if its his only way. (I tried to give that object navmodifer its not work well they are still trying to destroy it even tho thier path is open )
How do you do interrupts in a behavior tree? Say if my AI is moving to a certain location but halfway along the route it detects a player
Higher priority (left most) can interrupt lower priority
Hello, it is possible to add prediction to AI, to move more smoothly?
https://youtu.be/RG3_IHL0Wwc in my case it's very laggy 😦
hi guys i m facing a problem with the ai move to (not workinng) , i ve found multiple solution online and it didnt help the ai move to doesnt work
nav mesh placed? aimoveto calls on server? nav mesh is dynamic (in project settings)?
Nav mesh placed
What is the aimveto ?
ai move to 🙂
I'll check first in the project setting
I didn't find where to see if nav mesh is dynamic
I set it dyn and it still doesn't work
I tried to call it on event tick and the editor crush everytime
You aren't calling moveto multiple times are you?
I want a mob that patrols along a set of locations (array), but BB doesn't support arrays. I was thinking of implementing this https://forums.unrealengine.com/t/can-blackboards-have-an-array/306261 and I made a new UObject that holds TArray<FVector> Array inside. The problem is, how can I use the BT to iterate over this array?
Hi is it possible to have an ai blackboard store information in an array. I.e location of food, say storing vector information so that it can retrieve said food at a later date.
MoveTo task only supports Actor and Vector BB values
Seems like a basic AI feature. Patrolling between points. I think I’m missing how to do it more easily since I’m new to using UE
its in a Behavior tree task named BTT_Attack Right now i am casting to a Blueprint to get the mesh and play the animation montage is there any way to play montage without casting, please help
i dont want to cast to a blueprint each time a enemy attacks
https://docs.unrealengine.com/5.0/en-US/behavior-tree-in-unreal-engine---quick-start-guide/ use this guide it explains how to use Behavior tree
Create an actor, add an array to the actor.. stick the actor reference in the blackboard. Then use that actor in your pathing. The actor is basically just an empty container for your array.
thanks!
Why are you so concerned about casting?
Cuz it's costly and it is performance heavy task
So i don't want to call that every time enemy attacks
Have you profiled it?
Not yet
so how do you know its costly?
Well, its not free, but the real answer is "it depends"
if you only have a few enemies, then no
if you have a million, then yes
Ohh nice thanks for ur help
I'd not worry about it until it becomes a problem
Ok I will remember that
if you're using blueprints, you are already accepting the performance hit
Honestly i like to code but BP takes less time to prototype and get results
Yeah, fair enough doing things with BP, but don't expect maximum performance is all. Its really not a problem until its running too slowly
Then its usually something other than what you expect anyway
what is the main difference between a serive and a decorator
and what is the difference between aborting when result change or aboriting when value change
Decorators can alter the flow of the tree, services can't... I think otherwise they are functionally similar
The intention is that services would update values and do other other simultaneous tasks while the tree runs but you can use them for whatever you find useful
Abort when result changes: Only aborts if the result changes, eg. true becomes false, abort when value changes: aborts every time the value changes, even if it changes to the same value, eg. true to true
@stable falcon you can make it less costly by casting to character instead of AI_Zombie, but it shouldn't make much difference. You would be able to use that same task for other characters then
If AI_Zombie is a Character then it makes no difference which one you cast to in terms of performance, just the total number of casts (and it's unlikely to have a big impact on it anyway)
Also - there is a fairly high likelihood that your AI_Zombie is already loaded in memory anyway. So, w/e.
Hey are they any good tutorial about complex boss ai?
I want to try to make something like Death Door bosses, but can't find any good tutorials or courses
Community tutorials for AI is generally much scarcer than tutorials for Blueprints, I think for what you're doing the simplest, most easily tested version of Death Door-esque bossfights would be to make 2 attacks, and get the boss to conditionally switch between them
Like, say, have 1 attack for when the target is at distance or up close. Or if you want to super saiyan at low HP lol
I mean yeah, I also though about it, but wanted to find what other people did, and some experts you know
since I have no much experience working on ai, this would be helpful
(so I don't have to reinvent the wheel, just smart-copy)
Hello guys
i have a simple Question
can i use ai move to on a pawn ?
cuz it didnt work but when i tried it in a new project with a character it did work
if you have a movement component yes
i guess it doesnt
thank you so much you savedme a lot of time that was my problem for two weeks
i tried to move it without mov compo
Is there a way to pass a variable AcceptableRadius value when using the MoveTo task node inside of a behavior tree? In this case, if I had several unit types with their own attack range properties and I wanted to use the move to node such that they approach another actor just until they are within range
I have an ai zombie with physical animations and ragdoll blend with animations that can killed, fall down and has the option to get up from death/ragdoll from a certain time. My character roams in a relative large indoor level, how do i optimize my ai when the character is far and it will getup again when the character is near? Thanks
I think you'll probably get what you want if you create your own version of the default MoveTo task (should be a simple task, just call AIMoveTo). Then you can expose the variable to the behaviour tree.
Also good afternoon. I'm trying to get my AI to path further from walls when they're just patrolling (rather than in combat). I've got an idea two potential approaches but no idea which one is sensible (or if they will work).
-
Change the character's Nav Agent Radius to be much larger than normal when the AI is in the patrolling state - I cannot see any blueprint access to the nav agent radius value though so I'm wondering if this is not meant to be done. Maybe this only works before runtime due to the issues it could cause?
-
Two nav meshes. The normal one for combat (so the AI can navigate very closely to walls) and the other using a much larger minimum agent radius. I can imagine there are potential issues where the AI is off the second navmesh but on the first that sound quite clunky to work around though.
iirc it uses the nav agent radius to choose which navmesh to use
but I'd just give them a try and see which works, they don't seem too complicated to try out
lack of BP access to something means nothing about its intended usage, it just means they didn't add BP access to it lol
Going to try option two first methinks
I hope UE5 exposes this functionality on blueprints
https://www.youtube.com/watch?v=czuhb6lSEn4&t=529s
Project Files: https://www.patreon.com/posts/62180923 .
This is the 23rd episode of the unreal engine advanced locomotion series. But still, you can apply this method to change the point of the character seen by AI sight perception system. By default, AI sight of enemies can see the middle of the character. Because of that, when the player is b...