#gameplay-ai
1 messages Β· Page 176 of 1
Haha, well you are kinda a slate wizard, other than being an AI wizard 
slate is ok.. edgraph is fine π
Composing UI's into Models, views and controllers isn't a problem, it's more that Epic's own code doesn't seem to have a very good separation between layers. But yeah, good fun in here, just taking a lot of time to sort out what parts of this are important and what parts are just what the original authors ended up doing.
Yeah, it does take a while to grok the overall architecture
The basic planner was much easier to write, but that's owing to the AIPro paper being pretty good, and how much of the Editor code is new to me.
And I also haven't tackled partial plans, replanning or parallels yet, and that's where the really interesting decisions come in.
I'm getting my class next semester to create a node graph for PCG
not that they know it yet π arf!
Ai not compiling with task orders
images:
Any Idea?
Have you set the blackboard in the tree? Have you given FindRandomLocation a selector? What happens in the BT when you run the game, does the function return failure?
Your function succeeds, but the MoveTo fails
Indeed, no idea why tho
But the value of NewLocation is invalid. Did you set it in the blackboard node of your custom function?
If i will plug in a print string to the value it puts out
it wil print bunch of random location it picks
will*
Can you select the FindRandomLocation task node and send a print screen?
there ya go
The Vector blackboard selector in the Task BP should be marked as editable, then you can use that as an input in the details panel of the task node here
No worries, glad I could help
does anyone know if its possible to add an animation to an ai which plays when it reaches a curtain path point
Hello, i am currently trying to figure out why the AI is aborting the code for looking around and running away even though the enemy's health is being set to 5.
here is the code for NPC controller to set the health of the AI. as well as the NPC code to see if it is time to run away or not
What is it youre trying to do?
You're tree looks wonky to me
But in order to understand it, we need to know what the intention is
this is an old version of it they just follow a specific patrol path. The player kills him and then the enemy runs away. it is working in this old version of the project and I have not done anything to the BT or NPC controller to break it so I have no clue as to why it will not work
the left has the most recent version of the code and the right is the old one
The sentence "the player kills him and they run away" doesn't make any sense. Kills who? who runs away?
i figured out why it is standing still
that was set to less than or equal to also the cast is failing on level streaming meaning that it is not properly getting the NPC pawn.
Just wanted to let you know that your answer to another user earlier today just helped me solve an issue I've been working on all day. Thank you!
Making an RTS, best to use that AI perception, a sphere trace in a BT service, or an overlap sphere on the unit?
To be honest, none of those.. for an RTS I'd create a new system with it in mind
with small amounts of units you could get away with simple sphere + line trace checks
I imagine
What do you mean by that? It sounds to me that if a tests takes to long, further items will be discarded to be tested by that test.
For my EQS I only have one filter test and while previewing it with the EQS test actor everything is fine, but when testing it in game, the Visual Logger shows me that not all items have been tested by the filter test.
LogEQS: Warning: Query EQS_CoverPoints_SingleResult is over generation time warning. 0.010051 second (limit is 0.010000 second)
Performance does count I would say. It needs to be below 0.01 seconds.
not discarded
it saves them and evaluates them on the next tick
i.e. time slicing
so it never takes more than 0.01ms per test for a frame
ahh okay, now I got it. But does that mean the Visual Logger shows the wrong result? So that it just shows the result after one frame and not after it finished?
Hmm, no idea about that, but if I had to have a guess I would say it does as you say. Just displays the result of ended operation without checking if its timesliced or not
But then again, I do my own visual logging in UEnvQueryTest::RunTest and it matches the one from the VLogEQS. I'll investigate that further..
Sadly this area is one of the most cryptic areas in the engine
People rarely bother to work with it
With EQS? Really?
Generally AI module is abandoned and forgotten 
Not EQS itself directly but the C++ implementation of it etc.
Very few people able to help
I logged a count on how often the UEnvQueryTest::RunTest gets executed.
- AICharacter executing the EQS Query within a Behaviour tree. TestCount = 9
- EQSTestingPawn TestCount = 86
For a total of 86 items.
for (FEnvQueryInstance::ItemIterator It(this, QueryInstance); It; ++It)
inside the RunTest method only loops 9 times then for the AI π« π₯²
I think that's the same problem
Do you have other tests besides this one? And are you sure your generator is returning more than 9 items?
I have multiple tests yes, but my custom C++ test is the only filter test.
The query instance has 86 items yes
How did you verify it has 86 items?
Ah
And this is from when it runs in the BT and not when it runs in the testing pawn?
yes
And how did you determine it only checks 9 of them?
the log that you can barely see in the screenshot
^
Correction: "I logged a count on how often the loop runs in the UEnvQueryTest::RunTest function"
yes
What is your test code actually doing within the loop?
It's checking if the AICharacter has line of sight with the target when leaning out of cover.
Yeah I meant more in terms of showing the exact code just to make sure it's not doing anything funky in there that would terminate it early lol
ahh okay
void UEnvQueryTest_EvaluateCoverPoints::RunTest(FEnvQueryInstance& QueryInstance) const
{
ShowDebugContext.BindData(QueryInstance.Owner.Get(), QueryInstance.QueryID);
bShowDebug = ShowDebugContext.GetValue();
PlayerCharacter = UGameplayStatics::GetPlayerCharacter(GetWorld(), 0);
#if USE_EQS_DEBUGGER
if (bShowDebug)
{
FlushPersistentDebugLines(QueryInstance.World);
}
#endif
TestCount = 0;
for (FEnvQueryInstance::ItemIterator It(this, QueryInstance); It; ++It)
{
TestCount++;
COVER_LOG(Display, TEXT("%s TestCount: %i"), *CUR_LINE_CLASS_FUNC, TestCount);
TargetEnemy = Cast<ACharacter>(GetFirstActorFromQueryContext(QueryInstance, TargetEnemies));
if (TargetEnemy || GetFirstLocationFromQueryContext(QueryInstance, TargetLocations, TargetEnemyLocation))
{
const FVector CoverPoint = GetItemLocation(QueryInstance, It.GetIndex());
bool bValidCoverPoint = EvaluateCoverPoint(CoverPoint, QueryInstance);
It.SetScore(TestPurpose, FilterType, bValidCoverPoint ? 1.0f : 0.0f, 0.5f, 1.0f);
}
}
}
hm π€
I mean unless COVER_LOG conditionally break's sometimes there's nothing there yeah
Out of curiosity have you tried just commenting the rest of this out and doing nothing but calling It.SetScore and seeing if it then would run it the expected amount of times?
nop, I will do that.
Also, does the BT task running this actually finish and not get aborted?
It does not get aborted and the AI walks to the cover point.
Okay, yeah now that I think of it that might not cause the test to abort anyway unless manually aborted
when I do that I loops through all 86 items
I just commented out the bool bValidCoverPoint = EvaluateCoverPoint(CoverPoint, QueryInstance); part and it still loops through all of them. I have a look at the function.
okay wtf. I uncommented it out and tested it again and now it runs through all?! Seems like a bug to me
edit: myB, it was not the same code..
... for querying Mode = Single best Item the tests will stop after one item is valid.
AI BT has it set to Single Best item.
EQS Testing pawn set to All matching.
So silly x) Thanks for the help zomg!
Ooh that's interesting
Did you only have this particular test in your query?
I would imagine even with single best item it would have to score all of them but I guess if you only have one test set to filter then whatever comes out of it as valid counts as the best since there's no scoring
I have this test (filter) and a distance (score) test for the EQS query
Hmm I wonder if it does other optimizations on it such as only filtering the ones with the highest score
because if you have scored items it seems it would have to filter at least the ones that scored the highest
Wouldn't the EQS query do the scoring tests at last after items have been filtered?
Hard to say, it could be done in either order
But if it filtered first, it would have to filter all of them
iirc the query system does optimize for test cost, so if your filter test is more expensive, it may run cheaper tests first
I mean it would make sense to not do tests that only score on items that have been filtered out for performance
only if the scoring test was more expensive than the filtering test :)
but I guess it can't really guarantee which order is cheaper to execute
for example if you score first you do run all N, but then only filter highest_scores(N)
but if you filter first, you filter all N, but only score passed_filter(N)
true
hey folks
how should name the task in cpp ?
i mean what is standard for this
in bp is BTTask_NameOfTask
you can check the class names for engine tasks ^^
Yeah that's the naming pattern for BT tasks in C++ as well
I have my Blackboard Based Condition Notify Observer set to On Value Change, so after the AI's point of Interest has been updated he should investigate the new Point Of Interest. When he finishes the task or aborts it, he should clear the point of interest value. I have a Service for clearing keys on leaving nodes.
My problem is that my service clears the updated PointOfInterest value and not the PointOfInterest value before.
Does someone got an idea on another way to accomplish that?
I have a service that listens to Noise events and updates the PointOfInterest key. I thought about Invalidating the PointOfInterest key first and wait for one tick after I update, so the Behaviour tree can update before I update the PointOfInterestKey with the new Location, but working with Delays in services / nodes seems to be unreliable, because the execution flow could leave the service / node while the delay is happening.
I know a little bit about this, since I ran into this when writing my own custom EQS tests.
The way this iterator works is that every time it loops, EQS is checking if you have used too much time. If it has, the iterator ends and EQS remembers where you were in the ItemIterator loop.
On the next update, it will call your test function again, but this time when you get to the iterator, it'll resume where you left off.
There's some assumptions built into the system about how long any one loop of any item iterator will take, which is why you get that warning.
But it looks like you didn't run into that case π It just finished when it was happy.
hey folks is there anyway to rotate the sight in perception component with bone ?
or attache to bone
i found a way
set sight vision to 360 degree
and attach a overlap mesh to bone
if ai see something and be in overlap mesh
done
i need help with my AI plz, my behavior tree never goes past the ROOT node
i added a breakpoint and it never reaches it
wtf am i doing wrong? or is UE5 just broken?
it worked before i added this sequence
but now its just idle on the root node
it works when i move my service into the upper selector
but it makes no fkin sense
is it the condition i have set?
or is it the service i created?
it all looks ok to me, no idea why this would cause the behavior tree to never leave the root node
i guess i just found yet another bug in UE5?
but wtf do i do now? i cant continue my work...
but where?
after the selector
then connect it all again but to the sequence
that could fix it
but it is a sequence
no
on the root
where it says selector
drag off the selector and add a sequence
then connect it all to that
nope same result
stuck in root node
could it be that i have to use a task instead of the service?
it (mostly) runs fine when i disconnect this node
maybe i just cant run a service without having any tasks behind it
yeah seems like that was the issue, i added 1 second wait and now it works
kinda fucked up but thats how unreal works i guess
i wonder how many unreal devs gave up on this issue lol
for some weird reason ai closest to the player on start moves but not the ones far from it in standalone mode.
I am trying to make openworld ai that is spawned in proximity. This works fine in viewport mode.
are you using nav invokers by chance?
though that shouldnt be different in PIE (assuming this issue only occurs in standalone)
I checked navmesh debug parts of it got invalidated without me realizing.
Ok so how do i hide ai spawning in such a way that the player does not see them pop in and out in open word map?
you play with their materials, or your spawn a particle effect to mask it, or you play a montage of them spawning
Hello friends, please help me. I created AI, now they just move to one point, one after another, one by one. How can I make my AI move like a grid or a sphere without making a funnel? I will be glad if you help me.Below is the reference of what I want to achieve!
I mean how do I make it look like they were always there. Our game is an urban city setup
Blend them in with materials
blend them out with materials
like a lot of open world games
gta did this?
a lot of games do, look at far cry 6
things blend in as you get near them including characters(npc)
Does anybody has an Idea why my AI keeps breaking?
I uploaded an Video showing the problem.
https://www.youtube.com/watch?v=P4IWrk5PjYU
You can find all the things I did in the Description.
What did I do?:
- Added Nav Mesh (1000x1000x5)
- Added nav Mesh Invoker to AI so that it would expand and Update its Nav Area at runtime
- Added a "Move to" Node in Behaviour Tree
- Target Location is getting set with Point which is in a reachable radius (1000 units)
Extras:
- TargetLocation is only set Once while Runtime (At least it doesnt ...
looks like your capsule collision is set to a dynamic obstacle
agents should not be an obstacle
otherwise they block their own paths
in any case always consult visual logger
Changed it but still same result. After that I looked with the AI Debug menu for some clues what could be going wrong. And this (marked Green) is the only thing that stands out by changing every single Frame (changing Values)
hello everyone, it has bugged me for quite a while. When I switch levels or play from other level for some reason in my main playable (or any) map navigation mesh gets "unbuilt" then I need to move it a bit so it refreshes and starts building, this happens quite randomly but mostly when I switch levels
any idea to fix this? or have blueprint inside level to force refresh it or find reason why it gets unbuilt?
What should an AI do in a stealth game if it sees something (player peeks out from behind a corner for a moment), and is walking towards it, but then hears something at a different location (player throws a noisemaker or something)?
I guess the typical thing in movies is that the new stimulus would override the older, and they'd go check out the noise instead
That depends on the game. It might be more fun to be able to control the ai by making a noise that distracts them.
You could also do something like assigning priority or weight to the different things. Maybe an ordinary noise isnβt that distracting, but if you use a power to throw it, it is.
Yeah. I was thinking about adding some priority / fuzzy logic system for deciding which stimulus is more important but I'm not sure if that's really necessary.
Like something that would say "a sound happened over here" and then it would lose interest to the AI over time, but if the AI has already investigated other more interesting sources and that one is still interesting it would go check that too
but I think that might be getting too smart
AI only remembering one thing and being able to interrupt the investigation with another stimulus does sound like more fun for the player
Hello everyone, I have created a pawn with a FloatingPawnMovement component, it works when I play it locally, but I dont get it running with my AI controller. I have created an AI controller and do a SetFocus on BeginPlay to Player 0 but it doesnt rotates to the player. It does work when I create the pawn as Character.
Is FloatingPawnMovement the wront way for a floating AI? Or do I have to set up something for make it rotate?
So i noticed that if you have a follower character that uses the Behavior tree AI and you make an option to possess your follower and then switch back the behavior tree shuts off and cannot be turned back on. I think this might be an errorr in the engine or an option that is not available for behavior trees.
You have to repossess it with the AI controller to reactivate the BT
I have tried that and the BT just seems to not be activated
Hey guys, has anyone taken a look at the new NNI plugin? https://docs.unrealengine.com/5.0/en-US/unreal-engine-5-0-release-notes/#neuralnetworkinference
I just accidently learned about it last night. Much of the documentation is by reading the source code, wondering if others are using it. It allows you to run ONNX models to run inference natively in unreal

For those that are interested there's some Microsoft startup sample projects and videos here
Model Zoo: https://github.com/onnx/models/tree/main/vision/style_transfer/fast_neural_style
Repo: https://github.com/microsoft/OnnxRuntime-UnrealEngine
PyTorch Example: https://github.com/pytorch/examples/tree/main/fast_neural_style#models
Check out the other Microsoft Build AI Repos: https://aka.ms/BuildAzureAI
#onnx #onnxruntime #unrealengin...
I really wouldn't try doing ML while running the engine on the same machine.. unless you're model is small
which is not the direction of travel these days π
This is just doing for doing inference it seems, not for training specifically
My guess is for shipping it with games
I haven't done any testing on the cost of running with and without the models though but onnx runtime is suppose to be optimized for this as far as I understand
Yeah, its just the slicing on the GPU that'd concern me
Hi all, i am setting max agent step height in nav movement capabilities for a floating pawn so it can fly up instead of navigating to stairs or whatever, and changing the value doesn't appear to do anything at all.
If i change the max step height in the project settings to something very high then it works as expected, but then setting a lower step height on agents that aren't meant to fly doesn't appear to do anything either
this leads me to believe setting the agent movement capabilities on the pawn doesn't work in general. any ideas on this?
why is it pawn and not character?
dammit, trying to decide if I need to book a hotel for tomorrow or not
I hate having to make decisions when I'm trying to relax π
where are you travelling?
how to enable / disable an AI stimuli source?
i made this but it doesnt seem to work
strangely my AI sees me even if i remove the stimuli source
ok apparently the game registers sight for all pawns by default which is kinda retarded
i had to add some lines in DefaultGame.ini
[/Script/AIModule.AISense_Sight]
bAutoRegisterAllPawnsAsSources=false
however the toggle of the component still doesnt work
vroom vroom looks like this works
next problem
AI sees me with stilmuli sources removed
Going to Bolton, about 2.5 hours away by car
ehh, if you are going to end up returning to home at night and coming back at morning i would definitely book a hotel π
Drive safe 
Yeah, but there's no good setup really.. either I get a hotel for tomorrow, overnight there and then drive back in the night, or I drive first thing tuesday and return in the night
guys ive added a collision box
can someone help me make it so when it touches the player it plays an animation
please
This episode we fix a few bugs discovered since the last episode before adding the damage sensing config to our AI. So when we punch the AI, he notices us and gives chase.
Support me on Patreon and get access to videos early, join our developer community on Discord, get exclusive behind the scenes videos on my projects and much more over at htt...
also, this guy is a fkin degenerate
dont watch his tutorials if you dont want to search for bugs because stuff doesnt work and he only fixes it in next episode...
he literally makes mistakes in every video, this should be removed from youtube...
like he adds hearing and breaks the vision in the process, and i was looking for 2 hours for what i did wrong...
guess what? he again links a wrong pin in this part...
dont need anything character adds (except, possibly, working step height π )
Oh my days I thought that was just meπ
Thatβs why I come in here cuz the things I follow most of the time do not work
try making a capsule instead of a box for ur shit
also, did u try just adding the touch event and playing an anim montage?
My ai already has a capsule around it, I can use that?
afair characters have a capsule assigned by default
Wdum.
Ye my mesh already has that
then why add a box? just adjust the capsule to fit ur model
Btw when I use a box collision it breaks the ai movement
I didnβt know you could use a capsule for overlap π
why not? any shape should do
i learned this on my first day lol
So the capsule shouldnβt block the movement like the box does?
Cuz like the box has to have certain collision blocking and some reason is prevents the ai from moving
CHARACTER ASSETS USED;
https://gamejolt.com/games/TutorialFolder/464704
FREE LEARNING ASSETS;
https://opengameart.org/
starting off the RPG series, the first thing we need to do is decide which engine we're going to use, I'll be using #unrealengine5 but #unrealengine4 will work perfectly well for everything we do (and if anyone is using #ue...
here is a shitty tutorial series that should answer alot of ur questions
why would u even use an old version?
Iβm using 4
just upgrade to ue5
what?
Yeπ
It should not matter either way
Idk where I heard that from
who told u that lol
The internet ππππππ
Nothing much changed in character for ue5 and ue4.
You should read the hardware specs before upgrading. ue5 is hungry
Ye I have a good specs on my pc and especially laptop lol
stop insulting ue5
LOL
πππ
Upgrade π
I will π
u can literally right click ur project file and upgrade it
It wonβt break any coding?
Iβm following this tutorial atm for the jumpscares
#ue4 #beginner #blueprint #overlap #collision
IF YOU LIKED THIS CHECK OUT OUR BEGINNER TUTORIAL SERIES FOR MORE BASICS
https://www.youtube.com/playlist?list=PLyu-W38DvZhqByAoeva1jewB5s78zQHIy
** WANT MORE ADVANCED STUFF? CHECK OUT OUR CUSTOM C++ NODES**
https://www.youtube.com/playlist?list=PLyu-W38DvZhqOdaCkB4hGWYQzuKH2gALZ
** WANT A FULLY ...
Idk if itβs any goodπ
overlap is covered in that ue5 tutorial too
they use it for interaction system
and probably other shit
just stop using ue4 its shite
btw i see u already have a capsule on ur thing so u dont need that shitty box
it literally says collision cylinder lol
Um. We donβt talk about that
π
Does anyone know what sweep while nav walking does?
In one of my tests the AI would stop moving if it's on when facing a slope
In another test the AI behaves exactly the same whether it's on or off :P
Actually I see it know, the AI will try to sweep and if it's blocking it will not move
I've been wondering, does the simulated proxies will always accept the server's capsule position or will it sweep itself
both
they will sweep to detect floor/recast themselves and they will always accept server's position
use Visual Log to debug the AI, its in developer tools and is reasonably well documented
very useful tool
thank you, I think I kinda know that they do both
because if the server is nav walking
the client will twitch a lot because it's still using the normal walking
we've had that problem, had to swap walking mode manually on clients
yes, RTS controls with predicted movement, we have to have it
@wooden echo you online?
yes
how can i get this to work? print strings work so the coding does work but idk how to get the animation to play
well u have to set up the montage properly
wdum
wait
i got it kind of working
but the animation is so big
LOL
how can i make the animation smaller?
I heard about a way to use Reinforcement Learning to blend animations for NPCs a while back, but now I can't find anything about that idea. Does anyone have a link to anything related?
hmm
one sec
I couldn't find but zoombapup once shared something very similar related with Arc Raiders
I found this one: https://www.youtube.com/watch?v=Q5RAE73zCKQ
Does anyone know if Epic is working on anything like this? I'd hate to get 6 months into a project and then realize that Epic is releasing a much better solution in UE5.whatever.
In this 2020 GDC Virtual Talk, Unity's Jeffrey Shih explains how deep reinforcement and imitation learning can be used for scaling playtesting and NPC creation in games.
Join the GDC mailing list: http://www.gdconf.com/subscribe
Follow GDC on Twitter: https://twitter.com/Official_GDC
GDC talks cover a range of developmental topics including ...
They showed some of it in an epic dev stream a few months ago, animation warping based on some ML if I recall
If we've learnt anything from Epic, its that they don't give a shit about AI π
Well, Mieszko and Mikko might, but the rest? fagedaboutit!
Plus, if you're going to do RL, my recommendation is to do it outside of UE and use a REST endpoint (like FastAPI endpoint being called by the FRequest/Response code in UE
The guys who did Ark Raiders used a kubernetes cluster to train their model for the robot spider thingy then brough it into UE
Again, my advice is to check out kubernetes (k3s is a good starting point) and in particular kserve
Awesome, thanks for all the info!
So you do your ML in the cloud via an API, call the API via the built in HTTP code in UE and you're rockin
unless your models are teeny tiny, then you can run them locally ok
That said, there's tons of ways to skin this particular cat.. like embedding a pytorch C++ library and running torch jit'd models using that
if you're after RL, part of the thing you want, is to run your training loop quickly, so loading up UE to train is a huge nono π
TLDR, you can collect the code run by a model into a script, then execute that script in either the python or C++ runtimes
essentially its sort of a compiled version
normally, you'd create the model using python, then jit it, then load the jit'd version in the C++ lib
essentially the jit compiler looks at the execution code path and stores a sort of compiled version
I see, cool
A lot of places they do this for inference to speed it up
run it in C++ etc
if you're interested in this stuff, you can look for the keyword MLOps on google/youtube and you'll find endless volumes of info π
Yeah, after the model is done, and you're using it in-game, I imagine running it in C++ would be the way to go.
Well, when you're using a model in production, saving a few percent performance over say ten million inferences can be quite valuable
so hosting C++ versions of optimized models is not a bad idea
Yeah it looks like some of these navigation models run several times a second. In the video I linked he showed one method that just produced the next frame of animation.
In Blackboard, what is the point of the Base Class under object key-type?
I can set it to a specific type of object but it doesn't seem like that forces the key type to be that specific class.
Like if I set it to base class of "pawn" I still have to cast to pawn when reading that key.
but you wont be able to set it as something isnt derived from pawn
Wait really?
you'll be able to call set value as object but it'll be nullptr afaik
It limits set key to that base class but doesn't change the read key?
A k2node would be nice for this tbh
Okay I suppose that's better than nothing, at least I can be sure when I'm doing tasks that it will definitely be that type.
Even if the idea of casting to something I already know is that seems a bit redundant.
The casting is a bit of a technical limitation thing with how these work
A custom K2 node would potentially be able to get the type info from the metadata and do the cast for you, but regardless it will always require a cast on some level somewhere
Fair.
Okay last question for the night.
What decorator/service do I need to use to back out of an execution chain if a blackboard value changes?
I want to immediately cancel a move order if a new vector is supplied.
blackboard decorator can be used to watch for when the value differs from the previous one maybe
yeah at least for the aborting
Nope. Key Query being "not set" stops it working at all.
And "is set" doesn't seem to do anything.
At least not aborting it.
for vectors that doesn't make any sense
vectors are always "set", they can't be null or false which is what that's testing for
Not a vector. Commands are an object that I make children of for specific types of commands.
The "move command" has a vector in it. I read that value if the command is found to be of type MoveCommand.
First part of the tasks is a cast to see if Command is of the appropriate type (so MoveCommand, AttackCommand, CastSpellCommand, etc)
If not, it fails, and since its on a selector it moves to the next task.
Probably a better way of doing this tbh, but this is how I'm doing it until I'm told of a better solution.
wait a minute
Okay yeah I messed up somewhere.
So I was clearing the current command in the command stack but not in the blackboard itself. So the pawn/controller was aware it had no command but this wasn't being reflected to the blackboard.
That's why the decorator wasn't working properly.
btw vector blackboard keys can indeed be unset
Can they? That doesn't make a lot of sense π€
and Is [Not] Set checks work fine on them
How do you unset it
Clear Value
Interesting, I wonder if the bb keys actually store them as pointers then π€
Β―_(γ)_/Β―
I just assumed it was a regular FVector value
i wonder if you can unset booleans
nope, just makes it false
on a side note i had fun labelling this all nice yesterday
does anyone know if EQS results are sorted if your query has a score?
I just did a test, the answer is yes
I believed this is what you may have been referring to https://docs.unrealengine.com/5.0/en-US/using-the-machine-learning-deformer-in-unreal-engine/
I missed this fun conversation!
What's your current training setup looking like @ocean wren ?
I'm building towards a kubernetes framework
But God damn is networking such a pain in the ass lol
I haven't checked out fastAPI. A few weeks ago I was testing out some NLP chat-bot like models because I wanted an dialogue and I'm too lazy for it
I ended up using websockets since I found a plugin for it on the unreal side of things
I had the model running inferences on python and sending info back and forth through the websockets. That setup was pretty painless for the most part
kubernetes* ?
I'm sure you have your reasons but the thought of throwing ML in to avoid writing dialog (due to laziness) is funny :-D
i wish Blackboard decorator could take a key for the value to check (not just the "key" to check, if that makes any sense) ie for range checks
How would I make ai teleport to a location instead of walking?
should be able to set up a custom task and have the logic run as event execute ai--->teleport---->finish execute
How should I initialize an Object for a Shared Blackboard object key with the given Base Class?
Thought about creating a static function that instantiate the key with the given base class of that object key, but it's not accessible since it's private.
Do I really need to let every AI check if the key is initialized and if not, initialize it?
The coding βteleportβ exists?
Or can I make it so the speed it moves to is legit 0.01 seconds so it looks like it tp there
Somehow I get the feeling that just does set actor location lol
Oh thanks @wispy flame
Anyone know how I could make it so my ai path patrol resets when blocked by something (like my door in the office)
Like I close the door on them and they reset there process or start a new one
were u drunk? lol
just reset ur path index when moveto fails?
I mean
When it fails
Whatβs the code name to reset the path index
Or do I just put βai move toβ coming off βif failedβ
Haha yeah it was pure programmer's laziness and I was curious to see how I could get it to work. I was inspired by videos online of people using NLP models to generate unique dialogue
Can someone give me a rundown on how AI stimuli work? Was suggested that I use it for allowing a Pawn to sense only specific other pawns but I have no idea how to use it.
Are you trying to add sight or hearing to your AI?
Regardless, if you are using sight and would only like certain parties to be seen, you can set the affilitation/group that you'd like to detect
If you're looking for specific actions that will trigger the ai senses, you might look into this
Just trying to get the squad to see other squads without also seeing all the characters that are part of said squad.
I know I can Cast or use Does Implement Interface on a "See Pawn" event but it seems bad when a squad can trigger it 26 times and only one is relevant.
Plus characters can trigger their own squad's senses.
The best way to reduce this is by setting the affiliations of your squads vs enemy squad, you can do that in c++
something like this maybe: https://www.youtube.com/watch?v=WoPxEbrhlTo
My Apps: https://sites.google.com/view/bradapplist/home
Tools: Unreal Engine Version 4.23.0
Assets: Third Person C++ Project
Recording: ShareX
Editing: Microsoft Photos
Background Music:
I Don't See the Branches, I See the Leaves by Chris Zabriskie is licensed under a Creative Commons Attribution license (https://creativecommons.org/licenses...
Alright, I'll give the video a watch.
i have quite a few questions. Is each member of a squad running their own AIController? or how does your setup look like
Each member has an AI, both so they can stay in formation and so they can do combat properly when squads engage.
Outside of combat they pretty much exist just to follow the Squad's location.
Always part of the same squad.
Wait, can you set other pawn/characters as components?
Can anyone explain why AIPerception is on the AIController rather than the Character?
I know I could put it on the Character but I'm wondering why most of the tutorials seem to put it on the controller. Can't make sense of that though
Pawns might change while controllers indicates to who you are
But arguably your perception is tied to the pawn (your ears/eyes)
Controller is the identity of the player/AI, they are the proxy/extension of them
they can posses other pawns while keeping the memory etc.
who did they saw before etc.
many AI related things will end up being constructed in AIController
also since BT/BB is AIController oriented its easier to access to AIPerception there
I guess the argument here is that AIPerception actually has some state/historical information in it too. It's not just raw sensing.
um.. I'm not sure about that, never used UE's implementation.. but even if its not have history information, it can have
Yeah, the "it's easier to access" argument seems like a bad way to make a tech decision but seemed the most obvious reason people would opt for it.
Well that's kinda what i was gonna get at. I'm not sure if you can directly set pawn as components. But if your units are essentially operating as a single entity (squad) but their visual representation is that of several members. You could probably do some optimization there. Maybe have a single aicontroller per squad, and renders out the rest of the members as (take your pick of how you want to render) MASS or particle systems. There's a few ways to go about animating characters with light compute time to make them look real
why would you want it to be in character class?
what would be the benefit?
Good way to tackle it, reverse the question π
The character makes more sense to me because the character is physically represented in the scene, and different monsters (visually different) might have different sense ranges. That is easily paired together on the character side
Part of my issue I think is that the AIController / Character is a meaningless split for me right now because my AI shouldn't be swapping pawns. So instead all the enemy behavior and visual response stuff is just getting split across two files instead of one
and my instinct is to have the AIController be more general purpose, to run the logic, while the character itself has unique specifiers to the behavior and sensing
So I wouldn't need a new AIController for every enemy type
hmm, fair.. but possession is still a thing, AI character could get destroyed, unpossesed etc. and this can even happen with a communication of BT & AIPerception. In that case when you want to keep everything in AIController without resetting any values, having them seperated from character makes sense.. But to abstract it further, main decision of creating those components in AIController is relying on the logic "controller possess pawns and it's the proxy of the player/ai itself"
But I'm getting the feeling that AIController per enemy type is more the "Unreal way"
I would feed/fetch the data from character to AIC
Yes
Over the time I started to think if you obey how UE works its less likely to have unpredicted issues on the long run, but it depends ofc
The real issue here is that the characters are part of the squad but when they get into combat they break off into "individual" control of sorts. I don't think visual smoke-and-mirrors here would help because they do still need some functionality of their own.
I'll see about using them as components though. Might work.
Right, if they actually end up breaking up then that's a different thing
Is World Partition currently supported by the navmesh either static or dynamic?
If so, what are the recommended settings?
I mean. Break up when squad gets into combat. Soon as squad leaves combat, they reform.
Its sort of like Total War's units where the individual characters do have some AI to them, just most of the time its not doing anything.
You don't need to break Unreal's patterns to put more logic on some sort of AI manager. Just have the manager throw simple BTs at them
I recommend watching this: https://www.youtube.com/watch?v=5ZXfDFb4dzc
This stream will cover my preferred solution to game AI decision making.
Timestamps:
00:00 - Stream Start
01:05 - Intro
03:45 - Past Experiences
12:36 - Problem Definition
20:49 - Approach Overview
31:42 - Goal Generation
40:57 - Behavior Selection
59:47 - Dynamic Behavior Modification
Your characters can reference a data asset with a lookup table of Name -> Behavior Tree, and an AI manager according to some internal logic can choose which ones to give to who, by name. Trying to rip out pieces of the gameplay framework is pointless - it's not about the class structure but what you do with them
The only thing you'll achieve is weird bugs 3 years later when half your team hates you
Probably a good thing I'm not part of a team then.
You can still hate yourself π
You say that like I don't already for doing this project
Work as if you were part of a team. work as if your future self has no recollection of your current self. It will help you build good habits
Anyways not what I was asking for. I just want to know how I can have the squad sense only other squads and not the attached characters.
Which, unfortunately, means the squad also detects its own characters.
I don't think it matters, have it sense characters and then build a knowledge layer on top of perception where you reason about squads
Think of sensing as purely physical and then "digest" world knowledge from it
When you see a person you don't see their family, etc.
So what do you mean by build a knowledge layer? Querying the sensed thing to see what it is?
Because right now I have casting and does implement interfaces to see if its a squad or not. But my point was it was sensing every character in the squad too, which seemed unnecessary.
Just some code that keeps knowledge in a more "processed", design-driven way. Basically your situation is: you have an interesting design idea and you're trying to bend the technical framework for it. Instead of doing that, use the technical framework as it is and build design patterns on top of it
And again, its sensing its own characters.
Have characters send their perceptions to the squad manager or whatever. The squad manager can then go over that list and figure out what it wants, e.g. "I see squads A, Q and X"
Characters can have "squad components" which keep info about their squad.
If your characters end up sensing too many things, that's a technical problem to be addressed separately, unless you're doing 1000 characters at a time the perception system will handle it
It's an optimisation issue, don't worry about it when designing
The characters have reference to their squad and the squad has reference to all its characters.
What is the downside of using regular blueprint instead of behavior trees for Ai?
But what's the point in having every single character sensing if they're all going to be in formation and sensing the same things anyways? Seems redundant, no?
the short answer is: because it's the simplest thing for you to do technically while you're trying to figure it all out
They'll still be sensing the other characters (both in their squad and the enemy's) when all that needs to be sensed is the squad itself.
You can figure that out once you've made the game and don't want to change everything π
Should clarify, the squad is an actor itself, it acts as an anchor for the characters to form around and follow.
Think in small systems which layer on top of each other, not a single overarching technical design
Its not an abstract manager with no physical presence.
I am an abstract manager with no physical presence
Just think about what I said, sleep on it, see if you can make it work. It can feel clever to do something weird with the engine but most of the time the simple and stupid solution works best, because it's easier to change later, and it will not cause you unexpected issues.
For example if you want squads to perceive each other then you will be limited by the squad manager's visibility queries and will have to care about their location.
A squad should be an abstract manager with no physical presence. If you want a point in space to form around, it should be literally a vector property somewhere, or a selected squad member that acts as the pointman
Most of all stop worrying about your agents perceiving too much
Are the event calls really that cheap?
If perception starts being your bottleneck then you'll likely struggle to have that many characters anyway
Also, doing it in blueprint will add an order of magnitude to execution time
True true.
Once a task starts taking time you will either struggle to model it or you'll have to reinvent the wheel
What do people do about actions that are shared amongst players and ai?
For instance in a fighting game, you want ai to Kick, which would be a Task, I guess.
But when the player Kicks, it would be part of the character event graph.
Is it common if the Kick Task just calls logic from the controlled character's event graph?
That's kinda reverse of how you should do it
You create your kick logic within your character as an event or function
then you can call that from your player controller, or you can call it from a behavior tree or where ever you need to trigger it from
To repeat why I logged in today:
Are there any established workflows with Navmesh + World Partitioning, at the moment I have a static navmesh in a large partitioned level and when I tick the "world is partitioned" box on it it actually breaks, and works fine with it off π π π
Oh yes, that's what I meant, but I worded it poorly. Or rather I threw out 2 hypotheticals at once.
But happy to learn that's the right track.
yep
i haven't gotten to play with world partitioning yet so not sure what's happening there
Oh nice, this is the same guy that talked about combining BTs and HFSMs in that AI Arborist talk! Thanks for posting
Yeah he says he's learned a few things since then and simplified them
Yeah I'm watching through it now. It's great to see how his thinking has evolved.
Honestly he's the only person talking about BTs that actually made sense to me π
Which is why I've been trying to mimic that HFSM/BT approach
But I've already been running into a lot of the issues he's talking about here
i think.. that link can be pinned
add this one too: https://www.youtube.com/watch?v=G5A0-_4dFLg
This stream will cover all the basics needed to build an agent-based game AI framework.
Timestamps:
00:00 Introduction
11:00 Agent Model
14:56 Actuation
16:38 Actuation: Action System
18:41 Actuati...
it's what he recorded first
I would really love to dispel the notion in the UE community that you should build your entire AI with one behavior tree
It's really not designed for it even in the technical sense, like blackboards of subtrees requiring to be base classes of the owning scope, meaning you can't treat it like a call stack
and your BB balloons into 50 keys
Easier said than done, when there seem to be no good tutorials showing a different way. π¦
Yeah, apparently every 4 years a new technical writer comes along and does the same 3 basics streams and the whole thing doesn't go anywhere.
You have to remember that the purpose of UE guides is to showcase the features of the engine, not the right way of building things
π€£
And then 50% or more of GDC talks are borderline recruitment material
They never tell you that the game director was insane and everyone hated it and they had 200 bugs in the system in the last 6 months

Rewatch all the talks about God of War 2017, paying attention to how they let it slip between the lines how they really hated the camera too
Basically GDC talks are nice content but you have to apply some critical thinking to them, think of what they're not telling you.
i just took a look at one of the gdc talks like you said, "Reinventing God of War" for those that are interested and yeah the way they're describing their E3 showcase sounds like a nightmare lol
My favourite is when the combat designer says "Cory [the director] puts the camera horizontally to get the most cinematic view, and everyone else who knows what they're doing tilts it down a bit for some depth perception"
hahaha, yeah im watching Cory talk about his 2 months of rehearsing
GDC talks are exactly like every other industry talk then -> The one reasonably charismatic/ambitious person on a team putting a positive spin on disaster π
That quote about the camera is an incredibly good detail to use in the evergreen discussions about why video games aren't more like movies.
Not sure if its more relevant here or Blueprints, but is there a way to give an AI player a playerstate?
Not an AI controlling say a character but one meant to play the game like a human would?
It's that crap that caused engine to become 10GBs fatter?
i didn't check size. but there are quite a few third party modules in there
Oh, sorry, it's Engine/Plugins/Experimental/PythonFoundationPackages actually.
i wonder if the intended use of that is for editor-scripting
i think is saw that they added tensorflow and other ML packages to that pythonfoundation thing
a playerstate does not control anything
good afternoon
Assistance in implementation
I have a fly that moves using BT (moves to a random location)
How can I make it so that when moving it moves up and down
exclusively with the help of drawings
My squad setup was this.. I have a SquadActor that is a coordinating actor for a squad. It has squad members as a reference array to a set of Actors with SquadMemberComponent's on them
The squad member components coordinate between the squad and the AI for each squad member.. via a FMessageEndpoint
SquadActors run some simple AI that allocates threats to squad members, makes sure that if a squad member sees something, it propagates to the squad (think of it as squad comms)
SquadActor will also allocate roles and coordinate "commands" which are things the player tells the squad to do, usually movement or cover type stuff
So for instance if you give a squad a command to move, the squadactor will coordinate bounding and the like
The reality is that BT's aren't architected the same. We had a panel about BT's back when Alex C was running aiGameDev confs and basically everyone had different BT architectures, some with tons of simple nodes, some with a few complex ones.. all BT's but quite different.
Oh for sure, I'm talking about the UE implementation specifically.
But generally they're not very scalable design wise (it's just a massive if-else statement) unless you try very hard to instill a structure but at that point you're better off making a hard break so that the system is the structure, so to speak
I miss Alex C doing game stuff
Remember reading some contest entries for that CTF game and feeling all three of my brain cells explode
three? that many? π
I think the main issue for the UE implementation is the lack of proper parallels
without those, things get a bit harder to create
Right, time for some kip.. ttyl all
i made my first AI without a behaviour tree-
can i ask whats the difference between EQS and influence maps?
Influence maps? Is that a new UE5 feature because never heard of that π€
Its not actually im not sure how to explain it cause i just started looking into it
that is a great question!
when i started learning about influence maps i also noticed that they had the same functionality 
This is the third major time ive ran into this situation where i cant tell if its the same thing with different names
Looking at it I don't think so
EQS is for querying info about the environment based on some set of rules
Influence map seems like a more specific solution similar to a djikstra map
So just looking up at some definitions, it seems that influence maps are generally tied to a more direct concept of relationship and influence between an object and the player. But EQS seems more abstract than that
You could definitely use EQS to build up an influence map, but i probably wouldn't call it an influence map itself
It seems you could use EQS to query your influence map moreso than create one
Eg. "give me points within radius with at least this much influence"
Since you have direct access to the scores given by the EQS, and you have the discretized query points, that'd essentially be an influence map though
Yeah, an influence map is basically cached geometric data that you use to make decisions with. EQS does have influence-map like properties, it's just that you usually compute it only when you need to make a decision.
So we would just use EQS to create/update our influence map then right
It'd be hard to have a tasty snail leave behind "delicious" influence values as it moves the EQS way.
Yeah, I can see that. Run an EQS when an object would change its influence, then store the results in an octree, or sparse 3d array.
yeah that could work, i saw a nice lecture on influence map usage in games. I wish i could remember the name to share it here, let me check
Ahhh it was videos from Dave Mark lol
This is a combination of video examples of what my modular scalable influence map (Imap) system can provide. Please note that many of the positional behaviors here are intentionally created to demonstrate in a short time what the Imap system can do. More realistic movement and positioning behaviors can easily be accomplished.
The important thin...
All I do in this channel is grow my never ending gamedev youtube playlist. Thank you!
haha
Here's the Game AI Pro article that goes with the video: http://www.gameaipro.com/GameAIPro2/GameAIPro2_Chapter30_Modular_Tactical_Influence_Maps.pdf
Yeah ive been looking at that website thats where i got a bit confused cause they both seamed to be used for spatial reasoning i think its called
I actually didn't know you could get free chapters from the website, that's pretty awesome
All the three books are free there at least for time being
should probably wget the whole thing just in case :P
haha yeah im seeing that
have you guys seen that GDC talk where i think they have different speakers talk about tips and tricks for making cool AI
and one of them suggested to build an AI using assumptions that robots do
so the the tldr; here is. In the real world we have partial observability, so if you build your AI using that assumption, you can get some neat emerging behaviors
I don't remember what algorithm he used, i think it was SLAM or something
to create a local map of what the AI has seen while he explores the world
like he would start out blind, not knowing anything
It sounds familiar but i cant remeber the name im just all over thr place with studying AI
I found it!
In this 2015 GDC lecture, DigiPen's Steve Rabin, Insomniac Games' Jonathan Adamczewski, Lockheed Martin's Kevin Dill, Maxis' Rez Graham, and Digital Extremes' Dan Brewer share a plethora of AI development techniques that skip past the complicated programming and get right into the basic psychology that will trick players into thinking they're in...
Took me so long haha
It's around 13 minutes in
It's fun 
influence maps are cool but if there's too many influences it becomes really hard for designers to shape behaviour through it
I've just found that they want simple rules
Nobody likes to have to take their idea, then translate it into numbers that a system takes as input so that it comes out on the other end how they want it
the God of War and Spiderman talks from the same year both had the same lesson: don't overcomplicate it, use no-go zones and hand-designed shapes
and think in terms of where do you absolutely not want your AI to go as opposed to trying to find the best position, it will give you more stability and be easier to understand
Oh definitely, the right tool for the right job. I'm thankfully in a lucky position where I'm encouraged to try out different methods so get to be a little experimental with approaches
hey any idea why would a task in a behavior tree wouldn't change even when the blackboard key is switched?
do you have a decorator that aborts when the value changes?
oh I should enable the abort self thing. let me try
Interesting. Could be related to research which Mikko recently mentioned on this twitter.
https://github.com/EpicGames/UnrealEngine/commit/0a72cbc6abdae41315e9f498e390a28afb9a0f0b
Influence maps are used to store shared information in the world, so EQS might read that information and possibly change it, but the idea of the influence map is to actually represent information in the world as a shared resource for multiple purposes
Best demo of them, is Arkane's talk about Dishonored 2 from GDC which is on Youtube
I don't see much point in using EQS for influence maps. The map should have all the info you need while EQS is built to query actors and locations while gathering info about them
Anything you make in EQS for an inf map will either be non-reusable or redundant
Well it could be useful for situations where you want to filter or score your results based on influence
F.ex. if you wanted to select some point from a set but you want it to prefer points with higher friendly influence
Which would be easily achievable via a custom EQS test which queries the influence map
I don't think you should ever update the influence map using EQS because EQS just queries things. You certainly could use the results from an EQS query to determine what to update but that's separate from EQS itself
does anyone know what kind of AI Half Life 2 uses? is it GOAP, state machines or Behavior Trees?
Anyone know if Get Random Point Navigable radius is broken in ue5? been having problems all day and after recreating my setup in ue4 it works perfect, then when ported to ue5 it just stops working.
here is my very simple setup and behavior tree
yes the character is using the correct ai controller
yes the ai controller is firing off to start the behavior tree
the behavior tree activates and gets all the way to the print string and here is what it looks like
it looks like it will be random for a few ticks and then just send the same location every tick
sorry if this is the wrong place or if I should ask on the forums but I've been at this for hours
Its a hierarchical finite state machine, pretty sure there's a GDC presentation out there about it
Pretty sure it was Mike Booth? or Mark Booth? something beginning with M π
Mabe Newell 
I was at Valve's offices once for a job interview.. didn't meet Gabe though
was it 3pm when you were at Valve's office?
Should I play animations in Behavior Tree tasks or in the AI controller?
uhh.. bttasks for sure?
why would you play animations in ai controller
for uninterruptable animations
-> run anim on bttask
-> disable logic, bind on anim finished delegate
-> when delegate fired end the task and enable bt logic again
I could be wrong, see the answer above ^
All I really want to do is switch from idle to wave when spotted
I'm just trying stuff out, not really wanting to make a game
if it is not making game, just go with whatever you are comfortable with and fastest route
Yeah but then if i want to make a game, like down the road, not out of this project I might add, I might copy the way I do it this time and it may be the wrong way
I was there for a couple of days, their interviews are pretty full-on π
any tips on optimizing npc ai? I am trying to have as many pedestrains as possible for an open world game. I have already doing optimizations on the skeletal mesh tick (visibility based and update rate.)
was trying to joke that Valve never like that number 3. My bad. I see, too many want to work there
every other method follows that same method other than doing engine side optimizations
agressive mesh lodding, behavior lodding, significance manager etc
was exactly doing that
Kind of the bottleneck I'm at in my learning project is that I don't know how to get passable/decent AI going. Where do I start if I just want to be able to make a few basic BTs for a variety of enemy types, Γ la Doom or Destiny
significance manager is not working properly for me sadly. I did manage to register my actors but I could not get the significance values to be updated properly. Npcs are stuck in far state and all
eqs for good positioning would be a major one
that's probably a good idea. I have one melee guy that works okay, but as soon as I put in more than one they just run all over each other
from what I have understood avoidance has limits and good positioning will be needed. You could do an eqs to check if the anybody is standing there. Move to it checking if anybody blocked it or the player moved too far away from the point so it recalculates.
Another common technique is to have a resource associated with a melee target which is a location relative to the target the AI should attack from. An AI will claim that resource and this avoids bunching.
I notice that it's kind of hard to find an intermediate tutorial for some of this stuff
like, I already have a BT, but I'm also not looking for Epic Games documentation on how to make a realistic stealth game
I'll look into EQS, though. thanks
check pinned messages
stealth is a nightmare
Laura/Lorash posted great one
this is actually the one that prompted me to say I'm not making a stealth game
wait they are the same person?
yeah.. like how hannah montana is miley cyrus
it's probably a good tutorial, but I'm just not interested in making something with advanced noise detection or anything
its pretty basic
its fundamental
One system at a time is a good way to go. Otherwise you get buried. Eventually you may get curious enough to try this stuff.
would anyone know why my the RangedAttack isn't working? I'm running into this issue where the enemy can spot my player, I look at the behavior tree, it executes properly (1, shoot, 2, shoot, 3, shoot) but there is no projectile spawning and I have no idea why, here is the code I have for the task
EBTNodeResult::Type USBTTask_RangedAttack::ExecuteTask(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory)
{
AAIController* MyController = OwnerComp.GetAIOwner();
if (ensure(MyController))
{
if (ACharacter* MyPawn = Cast<ACharacter>(MyController->GetPawn()))
{
FVector MuzzleLocation = MyPawn->GetMesh()->GetSocketLocation(TEXT("Muzzle_01"));
AActor* TargetActor = Cast<AActor>(OwnerComp.GetBlackboardComponent()->GetValueAsObject("TargetActor"));
if (TargetActor == nullptr)
{
return EBTNodeResult::Failed;
}
FVector Direction = TargetActor->GetActorLocation() - MuzzleLocation;
FRotator MuzzleRotation = Direction.Rotation();
FActorSpawnParameters Params;
Params.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn;
AActor* NewProj = GetWorld()->SpawnActor<AActor>(ProjectileClass, MuzzleLocation, MuzzleRotation, Params);
return NewProj ? EBTNodeResult::Succeeded : EBTNodeResult::Failed;
}
return EBTNodeResult::Failed;
}
return EBTNodeResult::Failed;
}```
it was working originally but I added an EQS testing pawn so i'm not sure if the query context is confusing it with another pawn
but regardless of whether I delete the testing pawn it doesn't make any difference, thought that might've been a cause
when I swap around the "Wait" and "RangedAttack" nodes it shoots once but then doesn't shoot anymore, honestly confused, it's executing properly but not shooting anything
So you've visually verified it hits the ranged attach node correct
Have you tried adding breakpoints to see if it's actually getting to the spawn section of your task
yes I have, I realized it's only ever shooting when it sees the player upon spawning with the Pawn sensing component (which I can confirm at the very least that works) when it should shoot as soon as it arrives at its location and when it's within view
this was working before but I have no idea why, I haven't changed anything on the behavior tree this is making me wanna pull my hair out I hate AI but I gotta learn it π¦
I'm doing this for a course and I can testify that the behavior tree on the professor's version of the project is in fact working and is in the exact same setup I have it here I'm just so pissed off hsaufhusaihufsialhufsalihfsajlfsahulfsahyiolaefguiaeghialefghiaeflgyaeuif;egfyiaeui;fqevghia;wefhgfizd;geaf;awygfhi[eafyg
the AI sees the pawn, it rotates, and just keeps spamming the "Wait" node when it should shoot 3 times, then move to the nearest EQS point or whatever
if it can't find me, it waits 5 seconds, then moves onto the next point until it does have me within its vision cone, then shoots me
but instead what happens is it just stops when it sees me, doesn't move at all, doesn't shoot at all
for the rest of the lifetime of the program
unless it doesn't see me or it's outside the attack range
So when your BT executes it's not getting to the left branch where it does the wait shoot wait shoot?
it's very not correct, I know I have the EQS and Behavior Tree in the correct order, rewatched the professor's videos like 5 times and I can ensure that the code I wrote is also correct and working accordingly, there's probably just one tiny thing I might've changed that is driving me bonkers lol
nope, the left branch should only ever execute if the AI character is within the attack range and it can see me
I'll try posting a gif to visualize what's happening if that'll make it easier
Yeah it might, I may be misreading. All your tasks are getting activated when they're supposed to but the range one isn't actually shooting projectiles
nope
Have you tried verifying through the world outliner to make sure that they are really not speaking
Okay then I'm misunderstanding
Lol
you can see in the second gif, the AI is not shooting me
I think the only time it's ever shooting me is when it spawns and I'm within it's vision upon spawning
not sure why though
Okay and where is this key updated
I'm pretty sure it's only local to the scope of the BT, where would it typically be set? I looked within the QueryContext and EQS but it doesn't seem to do anything
I should know but I'm struggling, I'm pretty sure it's setting it in the actual BT itself
i think this is it?
I should know where it's being set but I honestly don't know
I feel so stupid lol
this was working for me before but I have no idea, been stuck for like 2 hours
Okay so that's where you check it, click on checkattackrange
what do you mean by this
Within Attack Range?
On the green rectangle, in your BT
my bad
this runs when WithinAttackRange is true
(i think idk)
it should
it ticks and checks to see if CheckAttackRange is true
but what determines WithinAttackRange honestly idk
it seems like a local variable explicitly defined in the BT
I know I can expose tasks to BT but idk if I can expose variables
Yeah but it has to be getting updated somewhere otherwise how would it ever change to true
Or false
gonna look back through the prof's video
What's the name of your eqs class
where would a variable like this typically be exposed
pretty sure this would be it?
I don't think I have an EQS class, I'm pretty sure I only have a query context class
Yeah I was referring to this one, where in your BT are you using this query
never mind, it's Query_FindNearbyLocation
I want to see blackboard variable you assign these results to
this should be obvious to me, idk how I'm actually this dumb lmao
I can't find anywhere where WithinAttackRange is being set
Okay I had to scroll up to your original images, I see where you call this
But it's still a mystery to me where, or if you are even updating withinattackrange
I should be, this was working before
Can you show your code/nodes for the CheckAttackRange service (green node)?
this is where it's being set, my bad
void USBTService_CheckAttackRange::TickNode(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory, float DeltaSeconds)
{
Super::TickNode(OwnerComp, NodeMemory, DeltaSeconds);
//Check distance between AI Pawn and Target Actor
UBlackboardComponent* BlackboardComponent = OwnerComp.GetBlackboardComponent();
if (ensure(BlackboardComponent))
{
if (AActor* TargetActor = Cast<AActor>(BlackboardComponent->GetValueAsObject(TEXT("TargetActor"))))
{
AAIController* MyController = OwnerComp.GetAIOwner();
if (ensure(MyController))
{
APawn* AIPawn = MyController->GetPawn();
if (ensure(AIPawn))
{
float DistanceTo = FVector::Distance(TargetActor->GetActorLocation(), AIPawn->GetActorLocation());
bool bWithinRange = DistanceTo < 2000;
bool bHasLOS = false;
if(bWithinRange)
{
bHasLOS = MyController->LineOfSightTo(TargetActor);
}
BlackboardComponent->SetValueAsBool(AttackRangeKey.SelectedKeyName, (bWithinRange && bHasLOS));
}
}
}
}
}```
maybe TargetActor isn't being set properly
TIL there's a built in lineofsight
Are they both true?
should be
Put your cursor on top of them to check
yup
it did set bHasLOS to true
thanks guys, helps me understand my code better at least, haven't continued this course in a month so I'm just refreshing myself
Okay so for the sake of making this easier to debug try just printing both within range and bhasLOS
will do
My intuition tells me that maybe bHasLos may be returning false under certain conditions bevause it queries from your player to maybe the feet of the enemy?
Or maybe your targerActor isn't who you think it should be
Oh and try printing out the distanceTo value and removing the extra AI from the level. That should help with debugging
Agreed. If you notice in your first gif (the blackboard view in the bottom right), the withinRange bool is never updated to true. You definitely want to get a sense of what's happening when your service runs when your enemy ai is moving.
will do, I have a bunch of AI spawning in the level from the work I did last night but I'm pretty sure that has to do with the EQS_FindSpawnLocation I made, I only wanna ever spawn one AI but I'm struggling with that too lmao
Yep, when in doubt: create an empty map with a player location + one AI pre-spawned to get rid of distractions.
sorry for this stupidity on my part, I should genuinely know shit but on top of wasting all my time and being depressed af it hasn't helped
it boggles my mind how I don't know how this shit I put together doesn't work
hell even last night
self-pity wastes time, sorry about this
ironically enough lol
Don't worry I feel this way about stuff I build at work too 
It's pretty normal to come back to something and go "what was I doing, man".
Build it one day, forget the next lmao
I've been programming a long time, and I continuously have to relearn things.
Yup same here lol, I'm always like "I should know this"
Which is why every teacher/tutorial vid in the world is going to tell you to comment things, even when it seems obvious. That's not for you today, that's for you next week.
oh, right, just remembered, i'm spawning the extra AI from the gamemode override, my bad lol
@opal crest @hallow flint π€
despite being false it's just standing there when it should be looking for other points
Hmm okay so now that you can see those flags, does the BT traverse in the way you're expecting?
Is it constantly on the far right "wait node"?
at the very least I'm happy I can study just one AI behavior
a lot of the time yeah, unless I'm outside the attack range I'm pretty sure
from what I understand, it should shoot 3 times, then move to another location
at least from what I've seen in the lecture and the example content he provided
Interesting, it does go into the left branch but yeah I don't see any shooting
but he's never shooting, despite the behavior tree suggesting otherwise
EBTNodeResult::Type USBTTask_RangedAttack::ExecuteTask(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory)
{
AAIController* MyController = OwnerComp.GetAIOwner();
if (ensure(MyController))
{
if (ACharacter* MyPawn = Cast<ACharacter>(MyController->GetPawn()))
{
FVector MuzzleLocation = MyPawn->GetMesh()->GetSocketLocation(TEXT("Muzzle_01"));
AActor* TargetActor = Cast<AActor>(OwnerComp.GetBlackboardComponent()->GetValueAsObject("TargetActor"));
if (TargetActor == nullptr)
{
return EBTNodeResult::Failed;
}
FVector Direction = TargetActor->GetActorLocation() - MuzzleLocation;
FRotator MuzzleRotation = Direction.Rotation();
FActorSpawnParameters Params;
Params.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn;
AActor* NewProj = GetWorld()->SpawnActor<AActor>(ProjectileClass, MuzzleLocation, MuzzleRotation, Params);
return NewProj ? EBTNodeResult::Succeeded : EBTNodeResult::Failed;
}
return EBTNodeResult::Failed;
}
return EBTNodeResult::Failed;
}```
this is how it's handling shooting, its executing and it should return true to actually execute the task
but yeah sure
Can you also print that out? Make sure that this node is returning true
sure
bool bIsShooting = NewProj ? EBTNodeResult::Succeeded : EBTNodeResult::Failed;
UE_LOG(LogTemp, Warning, TEXT("Shooting value is %s"), ( bIsShooting ? TEXT("true") : TEXT("false") ));
return NewProj ? EBTNodeResult::Succeeded : EBTNodeResult::Failed;```
something like this should work i think
yup, shooting value is true
I don't think it would even return anything if it weren't
this is clearly not null, it's not giving me any error
i have no idea why this is a thing lmao
Okay so that looks fine as well
Umm
Open that projectile blueprint now
And add a print statement on event begin play
"pew pew" or something lol
Wonder if they're getting created but immediately destroyed for some reason
Or being shot from elsewhere
the projectile works, I can spawn it from my main character, I'm reusing it between all characters but I guess it doesn't hurt, I can always breakpoint it
weeeeird
it is getting created
maybe I need to spawn it a little bit in front of it
i guess that answers my question then lmao
I think I did tinker with the settings of the projectile
okay then, that does answer my question then lmao
thanks dude
π
I still think I need to tinker with the AI a bit, it's behavior is still weird
it should move as soon as it shoots 3 times
It does seem to execute moveTo though but yeah might have to investigate further
thanks for the help, sorry this was a stupidly specific thing but it is getting better
is possible to store arrays in a blackboard?
or can they only have single value types?
No array support
If you need to have an array in there, you need to wrap it in a uobject
thanks comrade!
what would be the reason for a node to flicker in behavior tree?
A-lot of tutorials use either a spline actor or a location actor to make patrol routes for enemies, and then you select which spline from the world you want that enemy to reference from, but the tutorials fail to tell you how to make them just guard area not roam around it, any tips?
check visual logger
Dont watch tutorials, they'll always fail. Build your knowledge on top of fundamentals of how AI tools working and programming
the question you are asking depends on how did you architecture the system. Unless spline is circular, I dont think it can roam? Basically you should just reverse the order of spline points to follow whenever you reach the end point so it'll loop
or get closest spline if it's near the current area and roam in there when reached to end point
I know, but theyβre useful when building up the logic behind them
they are nice for quick infos and getting some ideas, probably it's better to just ask here instead of watching them
noy saying they are completely useless but mostly not worth the time
I made it so it simply gets the spline length and runs around it
Yeah, depends in how messy the tutorial is
when you reach latest spline point just reverse the order
it'll loop around that
before starting movement store the spline points in array and build the movement data on top of that data
so you'll be able to control it
So if i want the enemy to stand guard I would make only move on the first spline?
well depends, no idea what the context is here
how you want to make it stand guard, whats the "roaming" behavior is etc.
those depends on game design mostly
If youβre willing to wait Iβll send the pictures later, to see if you can understand it better
I'm around this channel often
Ok, thank you
never used it π¦
@celest python thank you π
@celest python im home now, the spline has a timer where it moves a static mesh around the spline, in the BT, it checks the current location of the static mesh and makes the enemy move with the static mesh, when he detects a player, he will stop and chase the player until he loses sight of him, then he'll simply return to the first action
why "timer"?
but anyway, how the static mesh follows the spline?
do you get spline points and move towards the locations?
Timeline*
guard area
stand guard
also can you define what "guarding area" is?
i get the length of spline, lerp it then get "the location at distance along spline" laster set the static mesh
@sudden citrus I'm 800 lines into writing a new AI system and this is all your fault π€£
The multiple points of the splines is what i call the guarding area
So it's something like I said earlier, when you reach the end of the spline you want your AI to turn back and follow it again but in reversed order
i make the spline closed so it just loops constantly, but yeah, similar to what you said
use this, and whenever AI completes moving to a point store the index as variable
when it is equal to this, just reversely follow the spline points this time
you can create a GetCurrentSplineIndex() function and set an enum/bool on path end, like bReverseFollowing etc
And if its true you can provide an index properly
the location is probably blocked
consider using a simple actor to be the reference location instead of hardcoding, makes it much easier to check this stuff
also you have some errors to look at
Hello,
I am working on a project and I am currently playing and learning AI.
I have two NPC pawns, both having the same path points which they were using to patrol(If they are unaware of the player). This path lies on a nav mesh.
I was trying out multiple navmeshboundsvolumes in the map to see if I can use multiple nav mesh for an NPC pawn. I confirmed that it works. So for shits and giggles I made a gap between the two nav mesh and placed one of the NPC pawn on the second nav mesh. (Remember that the patrol path lies on the first nav mesh)
When I did this, something very peculiar happened.
The second NPC started patrolling in the second nav mesh.(Not following the assigned patrol path). Can anybody help me understand this behaviour? (I can share images if required)
oh
did you actually make a copy of the navmesh during simulation?
No. A new one
ie you aren't talking about making 2 navmeshboundsvolumes
Sorry. No I meant making two nav mesh bound volumes
Oh? Does it kinda merge it at runtime?
just with different areas that are added to the generation of it
yep
which does make your claim rather odd
Yeah. I can show in VC
nah, maybe a short recording or something
Hmm, let me check how to record a video xD I don't have OBS set up
This is the screenshot for now
how to make the navmesh work with foliage in UE5?
i have set the custom navigable geometry to yes, it just wont work for some reason, no idea what im doing wrong
so basically my AI keeps getting stuck everywhere
anyone?
Ye they are false errors
Soooo, CVPR this year had some really interesting stuff.. given my latest exploration of language guided art generation, the rabbit hole is VERY deep π
If you're interested in the future of games, worth looking at some of this stuff.. ML based generation is in its infancy but already has huge potential for disruption of the industry
Got research projects over the summer dealing with various aspects.. ML based generative media really.. art, 3D models, video, cinematography, you name it.
Hey, I'm looking at UPathFollowingComponent::FollowPathSegment on UE5.0.2 and i noticed that if acceleration based movement is disabled, RequestDirectMove is called which teleports my actor directly to the end of the path segment. Is there a way to make the movement respect the Max speed on my move component without using acceleration or do i have to write my own path following component?
With Blueprints when telling an AI to move to a location is to possible to make the pathfinding avoid going to close to certain actors? So for example it will run around players or objects by a few feet instead of trying barge through them
I'm using a Behavior tree with Move To task
I noticed that my controlled player characters don't affect the nav mesh, even though I have "Can affect Nav" turned on....and when I drag a non-controlled character into the scene the navmesh under him is yellow (but controlled characters is green under them)
About Blackboard Instance Synced keys. I'm currently using it to share information about the Target. LastKnownTargetLocation for example.
My problem is that I would like my AI's to be capable of targeting a different target then other AI's. LastKnownTargetLocation could hold the Location of a different Target then.
One idea would be to convert all the Target related Instanced Synced keys to objects that holds a Map<TargetActor, DataType> where I use my current TargetActor to get the correct LastKnownTargetLocation for example.
I just thought someone might have a more elegant solution to this.
Get rid of synced keys maybe and let the not synced keys be set by some sort of AITeamManager / Subsystem, where AICharacters can subscribe to, to get their keys updated from the System.
One way to do it would be to have a sort of "AI manager" actor (or subsystem)
Which can hold this type of shared information, or have a second blackboard for shared data
Or, you could for example have a shared target BB key, and a separate individual target BB key
second blackboard? One behaviour tree can only use one blackboard. How does this work then?
Yeah you would need to work with it in a separate system from the BT
Tbh I'm not 100% sure if it's designed to be used in that fashion, so it might make more sense to just store that data as regular variables in the manager :)
Nope but I'd guess the decorator is trying to observe a key that doesn't exist
I would love to use multiple BBs, where I can switch one BBs that holds shared target data. It's a bummer that it doesn't support multiple BBs.
Thanks zomg
Ah. I've got a decorator that isn't actually using the blackboard but was trying to use the Abort: Self/Both on change thing.
Apparently I need to restructure that.
Oh, yeah I mean the abort thing is for choosing how it aborts on BB value change
Right, I thought it would just poll the perform check thing
All good. Just need to update this to use a blackboard key instead and maybe a service
I guess you could try setting bObservingBB to false
At least it looks like it won't try to set any observers to it in that case
That's code only I think
If you mean not in BP's, yeah it's possible
Yep.
This actually may explain some of the other weird behavior I was seeing
These are just growing pains... need to ditch BT but I'm not ready to rewrite the selector / sequence fallback and fallthrough logic into blueprint yet
If I have a slime that makes a trail of damage causing slime, and I want most NPC's to avoid it (Obstacle nav modifier), But I find that it messed up the slimes own pathing. How can I make that so that the slime itself doesn't see it as an obstacle, and try to avoid it? If thats even possible.
One way to do it would be to create some kind of nav area modifier for it
