I was also participated in that conversation right? I remember something like this. But my idea was to not letting state machines affect the flow of the BT, and from what I can see your previous method was exactly obeying that rule 🤔 Main problem of BTs, you can not jump from a node to another node like state machines, and default flow logic of BT not helping radically switching behaviors. That's where you integrate different tools into BT's flow, but without breaking the BT's "prioritization" logic.
#gameplay-ai
1 messages · Page 173 of 1
I haven't tried yet but assuming from the docs I read, your previous setup is very similar to StateTree (i.e. selectors on top of the state machines, no sequences or other composites etc.)
Hmm
Yeah it's definitely feeling more difficult to abandon state-like thinking for this. The HFSM on top of the BT definitely was making it easier
Without it, I'm trying to implicitely create those same sorts of transitions through the decision logic
which I think can have its strengths but it's harder to design
I can't say if you are "thinking about BT's right", since I'm still not sure if I do 🙂 But, the way I would probably start thinking about this is:
a) When will the agent "care" about sound stimuli?
b) Would the sound stimulus cause the agent to cancel any behaviour?
Then I'd put a 'HeardSoundLocation' into the BB, and add a decorator to a node in the part of the tree where I care, and make sure that the decorator can cancel any behaviour that it should override when it changes. And yes, clear it once it is no longer relevant. (it might help to have an age for the stimulus so that we can ignore sounds that are too old)
I have too many ideas but I'm quite lost between them
I wrote and remove multiple times 😂
Is there any reason to avoid using BT as a state machine of sorts if it works for you? 🤔
I mean it might not have all the fancy features as a more FSM-specific system but if it works it works lol
Yes, this is basically what I've done. I needed to add clearing the value in the perception handling as well. It was straight forward enough to add it as a way to break out of the patrol to look at something.
Trying to make it respond to hearing something while chasing is mind bending a little right now
No, not really. I do agree if it works, it works. But I'm challenging myself to think differently about it because I'm hoping it will give me better insight
and then I can go back to the state machine approach but also have a better idea of how to do more complex things
fuzzy states
Ah right, sure if it's for sake of learning why not :)
The way I'm reasoning about it, it's turning into the same thinking of these nodes as lots of mini-states.
that don't really have well defined transition
Yeah, that's probably a different set of behaviours using the same data, which is one of the things that BT can be pretty good at.
I'd not explicitly define "sound" or "sight", I'd have them as "interesting thing" or you name it. Both visuals, sounds, or other senses should feed a single abstract variable in BT and AI should be alerted in same way. If you abstract it, you can make your AI act more fluid and solve the behavior switching issues a little bit more. And I'd go more task oriented rather than having multiple BT nodes*. That's how Alien Isolation does. I wouldnt have "Attack" node either. It should be a part of your BT directly so you can prioritize it to cancel less important behaviors like investigating etc.
BTs can not jump from nodes to nodes so having abstract prioritizations help a lot to manage enter-exit thing between behaviors
- So if I have a target, go to it.
- If i hear something, go investigate... and then start searching?
- If I don't have a target, and didn't hear something, go to the last spot I saw the player and then start searching....
hmm
I guess I just need to copy those nodes
There isn't a way to have two things go to the same node
I think Eren is suggesting that "hearing" and last sighted could be the same behaviour. It's just a PoI that the AI should check to see if there's a delicious player hiding over there.
Yeah, I could see doing it that way. There is a moment upon hearing where the agent should look and go "huh?" which is different than just continuing to chase the player
this could be a BT directly
Although I think that's where this is breaking down too. Going to the last seen location is really just a patch for... keep going to where you saw the player until you get a new stimulus
But you shouldnt jump between nodes like that or copy them, i guess. I'd try to have them as more prior behaviors in BT and use a service or a BTTask to enable them by discarding current behavior
If thats not possible I'd try to copy
If you have Alien Isolation try to see its BT with this modding tool: https://github.com/MattFiler/OpenCAGE
I think this points to me that I need to work more on the perception side as well to be giving blackboard better data.
I have a service in my patroller that just gets the current highest priority point to check out. The service is responsible for "remembering" everything it gets from the AIPerception world and deciding which point is most interesting right now. So it's doing all of the interesting stuff like deciding if sight is more important than sound, and ranking by age, distance, and type of target seen. The BT is therefore pretty simple.
Is there any reason to have it as a service in the BT rather than on the AIController's tick and perception changed events?
Not really. It's just a delegation to make the AIController a bit more general and useful with different units. I don't know if that's the right decision, but it's working for me so far.
The main benefit of having those kinds of things in services is that you can use the BT to control when it's doing its thing and such
I'd think blackboard as memory and support/manage that memory with services, and think your BT flow as "roundtripping" logic, not states. You will switch to attack from search behavior if your AI see any player. And one way or another if your AI wont die, you'll end up switching to search or another behavior again. Try to design your blackboard with values that can support the behaviors with the info, for example if you visit the search behavior 2nd time in a very close time, and in a very close location to previous one your AI can get more aggressive etc.
That's just a mindset in my imagination of an AI, not trying to alter your AI design. Keywords are "roundtripping" "memory" and "services".
But it's mostly just a question of whether that makes sense for you or not
So this BT isn't actually possible with UE's implementation?
Since there's no parallel node (that allows sequence & selectors below)
This is from that AI Arborist video
Its Simple Parallel
But probably not good enough compared to other engine's parallel nodes
Right, to use simple parallel you'd need to combine all the logic for fire & reload into a single task
rather than have the decision logic in the BT
The way to think about it, is to consider priority at the higher level.. so what splits one priority from another. For instance, patrolling is kind of a "every now and then" thing right, so higher priority than taking a break, but lower than say "spotted something fishy to investigate"
Then think about what variables you need to break those different high level priorities apart.. the investigate thing might be "aware of something weird that needs investigating" right?
So your condition on your higher priority investigate BT would just read that value as being set to something not null
The difference here, is that if that value then gets reset to null.. you don't have to do anything, because the priority will automatically switch back to patrolling
i.e. there's no explicit state to have to transition
Same for if you spot an enemy, clearly higher priority than investigating something... etc etc..
You Cheat using a service to do the parallel logic.
Want to hear something funny? I got locked out of DallE2 because I've been generating too much stuff with it 🙂
also ran out of my gdrive space saving the results 🙂
haha. You did melt their 3090's.
They basically said "come back in 24 hours" 🙂
This is definitely one of those things where we NEED an open source version
but the training of that model was around 300k so unless we get some kind of distributed training going, not going to happen
It seems like with ML, that models have gotten too big for hobby-ists to generate them. Yeah.
I'm waiting for microsoft to give me OpenAI access now.. so we can build some extra stuff using cognitive services.. that'll be fun!
I'd totally lend my GPUs to a GTP3@home effort though.
I suspect that'll happen before too long
I mean I've got a relatively beefy GPU, but you need NVIDIA/META/OpenAI/Deepmind/Microsoft kind of grunt for these large models
at least for training
apparently this DallE-2 is estimated to run on an A100
so might just squeek into a 3090 with a bit of noodling
easily fit on my A6000, but we need it training first
There was an article a while back about these AIs and how the training cost being so prohibitive is one of the big problems
In that those who have the resources to train them can potentially gain a quite distinct advantage
It really is, and allowing people unrestricted access to them
This is perhaps the most transformative example I've seen of ML's potential for the creative sector.. its really shit that its not freely available
I've been generating storyboards for a new game as an example.. hence why I ran out of credits 🙂
If training is 'embarassingly parallel' then it ought to be possible to build a global network of hobbyists to train liberated models through p2p connections. Could re-revolutionize the space if it isn't already happening.
I hope microsoft buy the rights to it and incorporate it into powerpoint 🙂
Haha. That would be the one thing that would get me ever use PPT again.
Yeah, there are efforts towards that.. but getting people to coordinate is a huge ask
seriously, its the PERFECT tool for powerpoint
I suspect Adobe will do something like it.. they're big into ML now
But then they're shit at dev, so maybe not 🙂
Clippy, "insert clipart of a dog dressed like a boss, designing a behaviour tree"
I mean adobe has an image hosting thing.. they could scrape the crap out of it too
I can walk to their office and ask them kindly to start working on it, lol.
I was generating "aircraft carrier buried in mountain, in the style of simon stahlenhag" 🙂
It's going to be wild seeing IP rights intersect with this.
and the question of how copyright applies to the training data
is the product from the AI technically a derivative work?
Yeah, the legal stuff is going to be bonkers
OpenAI claim ownership of all generated content, but I'd love to see that tested in court
especially when you get multiple models up to the same quality (imagen from google recently for instance)
One of mine from yesterday
And another.. for this storyboard
nice
my friend was using dall-e mini to generate some parts for some promo images he's making for some new music he's releasing in a couple weeks
Trying some different things
I quite liked the sort of steel round thingies..
One thing that pisses me off, is that it generates these amazing images, but often crops off the heads, or crops part of the round image 😉
Like this one
I haven't figure out a way to guide the prompt to zoom out a bit 🙂
I guess thats why we still have to research what prompts actually do
But the point remains, I couldn't in like a trillion years create these images myself
Well, not in like a few seconds 🙂
That's some game concept art if I've ever seen it.
Its really compelling being able to imagine something, describe it and see it
I was considering posting on indiedb with a bunch of this stuff just to see the reaction 🙂
Would be incredible if they could return a parameter space explorer, so you could see what was "nearby" but you didn't quite bullseye with your prompt.
There are a few things you can do in the interface
like you can mask off parts of the image and give it a prompt to generate the masked off areas
So for example:
That's Jake Birkett, indie guy, posts images like this every now and then on twitter
so I asked his permission to try this...
So mask off parts and add "post apocalyptic" to the prompt
Oh, that's crazy.
Would that work with any source image? Kind of a hybrid prompt?
Yeah, I found it a bit.. picky.. it didn't do well with like full head shots
I think it needs sort of enough space to generate the infil
There was a good example on youtube.. where someone cropped out a bunch of plants, then generated some ghibli trees, then masked only the trees and generated the terrain 🙂
Right. It's a tempermental artist, needs enough canvas to express itself.
Exploring the prompts and how to guide them will be a new creative skillset, mark my words
you CAN ask it for variations though.. like this:
So you can find something you like, ask it to add variations
The secret language thread was really interesting. (that gibberish had a semi-consistent meaning),
Yeah, a big part of this stuff is figuring out how prompt weightings work, some keywords nuke my generations 🙂
robot basically kills anything good 🙂 cos they pull in a ton of shit looking stock art robots 🙂
Can you prompt the variation? "This, but sadder"
I'd try some other words for robot-like things, like mech or cyborg
No, its not quite that directable, you can redo the same prompt and add sad, but then sad might change the overall look a lot
yeah, I did try mecha.. lemmie find it
I wonder how does it work with non english languages
Or "gundam" if you want to force a certain style, I imagine.
if you used メカ for example which is mecha in japanese
Yeah, that might actually work a lot better
I used mecha
One problem I've got, is that I broke out each image into a directory with the prompt used to generate it.. but i've done thousands of images 🙂
:D
ロボット or ロボ might be worth a try as well (robot and robo respectively)
I'll give that a go tomorrow night when I'm allowed to generate again 🙂
Here's something funny..
Lookit the hands 🙂
For some reason, it really doesn't like female ninja hands 🙂
This one here though...
I mean that one is fookin nice
It really does generate some nice poses
I'm happy that algorithms also hate drawing hands. There is balance in the universe.
I guess training on hundreds of millions of concept art pieces counts for something 🙂 apparently its dataset was 460million image/text pairs
I mean its not generating anything NEW, its all derivative.. but I suspect thats like 80% of commercial art, it not more
So, there's definitely some lab out there trying to tune parameters for doing this with 3d models, right?
And frankly, I've seen people trying to charge money for worse 🙂
yeah, I suspect that Epic will do it with Megascans once they reach a bigger database
But there's already a dataset called shapenet that we use for generative models on 3D objects
Did you guys see InstantNerf btw? 🙂 just a heads up.. thats the future of rendering too 🙂
I guess I do like the whole dystopian thing way too much 🙂
It also pairs well with generative art. Discontinuities or a sense of the broken is thematic.
Yeah, exactly
some of the more.. atmospheric images have that nice sort of "not photographic" thing
Instant Nerf is way better than I thought it would be. Image based 2d to 3d has come a long way.
Can anyone help me understand player controller and player indexes?
so it gets the basics, but representational rather than an absolute rendering
I don't see the correlation
there isnt any
player index is just the index of the player in the connected players list
player controller is a class that a player uses to control a controllable class (character usually)
Ah, this is two years old, and looks to be the equivalent of "this person does not exist" https://github.com/marian42/shapegan for the shapenet dataset.
so do you need a player controller for every player?
but how does the player controller know which player it is "connected" to?
not the pawn, but the actual player
Yeah, if you're interested in sort of 3D graphics ML state of the art, look at Michael Neissner's youtube channel: https://www.youtube.com/c/MatthiasNiessner
YouTube
Welcome to our YouTube channel -- I'm excited to share our newest, cutting-edge research with you!
My name is Matthias Niessner and I am a Professor at the Technical University of Munich where I am heading the Visual Computing Lab!
I am also a co-founder of synthesia, a brand-new startup working on cutting-edge AI tech for visual effects and mo...
Michael basically has all the top profs in ML 3D generation on his channel, basically records seminars for his students
I quite like some of the work by Andreas Geiger
and his students obviously
Neural heads 🙂 https://www.youtube.com/watch?v=S7LY1DtJCsI
Project: https://philgras.github.io/neural_head_avatars/neural_head_avatars.html
We present Neural Head Avatars, a novel neural representation that explicitly models the surface geometry and appearance of an animatable human avatar that can be used for teleconferencing in AR/VR or other applications in the movie or games industry that rely on a...
This is great. I have some fun catch-up to do here.
This is getting closer to the sort of things I'm curious about: https://www.youtube.com/watch?v=ZqgiTLcNcks
Project: https://lukashoel.github.io/stylemesh/
We apply style transfer on mesh reconstructions of indoor scenes. This enables VR applications like experiencing 3D environments painted in the style of a favorite artist. Style transfer typically operates on 2D images, making stylization of a mesh challenging. When optimized over a variety of pos...
I've got a soft spot for Michael Black's lab and his work.. very similar to my own interests
AI mediated kitbashing would be a great gamejam/indie prototyping tool.
Paper: https://arxiv.org/pdf/2111.02444.pdf
Understanding 3D scenes from a single image is fundamental to a wide varietyof tasks, such as for robotics, motion planning, or augmented reality. Existingworks in 3D perception from a single RGB image tend to focus on geometricreconstruction only, or geometric reconstruction with semantic segmentati...
There's a load of work thats sort of on the cusp of usability
things like depth from rgb images.. instance segmentation and voxel creation
Thing is, a lot of this work is good for robotics guys too, so there's a lot of interest in increasing sota
There seems to be a lot of focus on RGB -> 3d.
So I'm just on the lookout for stuff we can use in games 🙂
I'm toying with a prototype over summer, where we generate an Unreal Engine scene from a camera image (i.e. we layout the scene given an input jpeg)
Though I pity whoever is trying to convince the AI to generate bones.
pose estimation is probably the easiest part now 🙂
Right, for people that assumes a skeleton, and maps input to bone parameters based on image processing?
it basically predicts a probability function for each pixel of a given joint
classic lib is CMU's OpenPose, but its a bit crap
I was thinking more of given enough footage of real thing, determine its points of articulation and construct a skeleton.
Oh there are those too, look at Michael Blacks lab for that kind of thing
look at the smpl-x work
Part of the SMPL made Simple Tutorial at CVPR 2021
Instructor: Michael Black
Contents: history of body models, scanning, registration, PCA, linear blend skinning, corrective blend shapes, SMPL, faces, hands, SMPL-X, dynamics of soft tissue, future directions like implicit surfaces and neural rendering.
Man, I remember when I was excited about just estimating Gaze from a camera when the person was wearing IR markers.
That was a fun grad project though.
Yeah, this stuff is basically easy now.. Google's MediaPipe does a pretty good version and is fun to play with
This is a demo of my pose estimator based on mediapipe library (https://github.com/google/mediapipe) and MediaPipeUnityPlugin (https://github.com/homuler/MediaPipeUnityPlugin)
It can capture people motion from a video file and overlay it on a specified 3d model in real time (30fps and more). This demo is recorded using Unity recorder.
========...
Its not quite mocap quality, but if you multicam some of it it improves
Epic gave a megagrant to a company doing exactly that about a year back
Move.ai I think they were called
Yes, I have a fonder on my hard drive when I was taking some notes on whether the free tools were good enough to do some simple home mo-cap.
Answer was 'not quite' and I wasn't excited enough to revisit my signal processing notes to clean up the input.
https://paperswithcode.com/sota <-- usually has the state of the art with code 🙂
You want monocular 3D pose estimation
Facebook is doing a LOT of this kind of thing: https://www.youtube.com/watch?v=eBf_SzIgIVI
Demo video for our paper "FrankMocap: A Monocular 3D Whole-Body Pose Estimation System via Regression and Integration", accepted to ICCV Workshop, 2021. Paper in:https://arxiv.org/abs/2108.06428. Code and models in: https://github.com/facebookresearch/frankmocap
There definitely look better than what I was able to dig up last year. Still an essential tremor that is pretty common to camera based methods, but there must be some post processing that I could do.
Yeah, for sure, you could also add a stability term into the model itself
I've seen RL versions doing that to good effect
also adding in physical properties like anti-self-penetration helps etc.
The jittering is probably the easiest thing to deal with for slower motions at least
Yeah, the silver hammer I used to use for things like this was a kalman filter, but that's going to make all motions smoother than they probably should be.
yeah, there was a filter method that motionbuilder used to use.. but the name isn't coming to me.. something like tubbman or something
I'd have to search the literature
I'd go for a kallman initially though
You've been incredibly good at indulging my curiosity 🙂 Thank you.
maybe scale the kallman based on joint velocity or something
No problem man, I like this stuff myself 🙂
omfg
We're installing a mocap studio at work soon.. so will get to play with a bit more expensive kit, but I want a monocular thing at home
Yeah, the prediction parameter is probably going to be "whatever the current rotational velocity is, continue that" so it'll smooth out changes to that.
that whole time i think i was instancing the FMyRecastQueryFilter wrong.
Oh, that won't help 🙂
managed to get the query filter actually hitting the proper filter functions, by changing InitializeFilter
Good work 🙂
👏 🎉
Did it require a source build in the end? I never did finish the thing I had that was supposed to annotate paths with the modifiers it passed through, and if your work works without a source build, I might have to dig it up.
i'm still trimming it down to a minimal working case, but it looks like to make a truly working custom nav filter, you just need to:
- subclass FRecastQueryFilter
- set bIsVirtual = true in constructor
- override passVirtualFilter and/or getVirtualCost
- subclass UNavigationQueryFilter
- set bIsMetaFilter = false in constructor
- override InitializeFilter to:
Super::InitializeFilter(NavData, Querier, Filter);
Awesome! That's in my notes now. Incredible work.
now to figure out a way to pass info about the pathing entity
now that i've got a minimal case, i posted a quick little summary onto the forum thread that inspired me
https://forums.unrealengine.com/t/modify-pathfinding-cost-detournavmeshquery-subclass/342472/13
then the big question is.. how to actually make use of this data
that is awesome that it's working
can you get to the querier with what you have or
actually looking at the polys and understanding the prev/current/next poly relationships will be the meat of it, but before that you'll need the querier I imagine
I think it should be sufficient to just store a TWeakObjectPtr to the given Querier at initialization . . .
yeah seems fine?
maybe I'll do one of these, I have ideas about some runtime cost stuff I'd like to do
i'm hoping it'll be sufficient to compare getVirtualCost's pb parameter to the location/rotation of querier, but i'm just getting to checking out the data in pa/pb right now
hmm. how to cast the Filter.GetImplenetation() up to the actual class, so I can call a function on it......
Casts is erroring i can't convert INavigationQueryFilterInterface to FMyRecastQueryFilter ..
FRecastQueryFilter implements INavigationQueryFilterInterface
FMyRecastQueryFilter extends FRecastQueryFilter
Filter.GetImplementation() returns *INavigationQueryFilterInterface
Cast<FMyRecastQueryFilter>(Filter.GetImplementation()) errors 'TCastImpl<From,To,ECastType::UObjectToUObject>::DoCast': none of the 2 overloads could convert all the argument types 1> with 1> [ 1> From=INavigationQueryFilterInterface, 1> To=FMyRecastQueryFilter 1> ]
ahmmm is there special casting for this sort of interface cast
yeah I think it's GetObject() and Cast<>() that?
no wait that's TScriptInterface
i shouldn't have to declare that my subclass also implements that interface.. but i wonder
/shrug
nope that errors that it's already a base-class
derp, static_cast is probably the answer, Cast only works on UObjects
Things I've never needed to use before for $100
lol in the thumbnail version, i thought the category was "mierdes" .. i may need to see an optometrist. But "mierdes" is definitely a good category.
QuerierLocation=(X=10840.777 Y=-10312.226 Z=99.159)
pa=(X=-10840.777 Y=10312.226 Z=10.000)
pb=(X=-10845.000 Y=10080.000 Z=10.000)
off to the races
interesting that X is inverted?
maybe that makes sense though in the level i dunno
oh wait Y is too
thanks to some poor souls previous notes in unworking code that Y and Z are reversed in Detour...
according to the doc for Detour (holy wow, real documentation!) pa and pb are the start position on the edge of the previous/current poly, and the end position on the edge of the current/next poly
so, yeah, it does look like to make sense they'll need to be inverted
which docs?
need some leisure reading materials
oh yeah its just the regular stuff https://docs.unrealengine.com/4.26/en-US/API/Runtime/Navmesh/Detour/dtQueryFilter/getCost/
Returns cost to move from the beginning to the end of a line segment that is fully contained within a polygon.
i just figured it would be documented on getVirtualCost but
since thats just a way to override getCost() anyway, this makes sense
oh tbf there is a See Also on getVirtualCost
((GetActorLocation() - MoveEnd) | GetActorRotation().Vector()) should give me > 0 if ActorRotation is facing MoveEnd, right
Dot product should work properly without normalization.
i guess GetForwardVector would be better
i suspect i'm doing that wrong. i need to do these calculations more than once every 5-6 years to remember how they go lol
hmm. it's not having the overall effect that i was hoping for. setting it to go to a target that is 500 units behind him, with three possible exits, one behind, one in front, and one to the side, i expect him to not pick the one behind every time
Are you only using the dot product? Or are you combining it with the original cost function?
multiplying the original cost times 1000 .. but then it applies some hueristic thing since it's a nice big poly that it's on, and reduces that in half or so. i'd still expect that to cost WAY more than taking the shorter path that i'm looking at, though
I see, so when a path segment heads behind the agent, you multiply the cost by 1k? And it still takes that path?
yes. i wonder if there's some way to visualize pathing costs
You could use debug draw?
It could be a mess, but drawing each path segment considered and the cost associated would be readable. (since it should compute the same cost each time, even if it visits the same segment more than once)
i'm going to try returning DT_UNWALKABLE_POLY_COST and see what happens.. that should completely eliminate that path from consideration....
lol.. ok.. now he turns, walks to it, but won't take it, and now the other exits are invalid
... i should probably check that the other exits even work
i feel like gameplay debugger should have this (visualization of costs)
but for all its power, it kind of misses the boat on that stuff
also the gameplay debugger lies-- if you focus a character, then change its controller (Possess), it will report no controller
fun fact
gotta be something i'm missing out on here - now he's walking to the forward exit, turning and going to the one he shouldn't use, in the same move
it's literally pathing him to the far end of the poly then back to the near end
i'm starting to suspect my idea is rife with holes that i didn't understand when i conceptualized it, and still don't
You might need to store the initial facing direction instead of the actor.
The navigation system will recalculate from time to time while you are moving.
I'd be curious if it works well at drawing a path when you just call FindPathToLocationSyncronously
i assume there's going to be lots of cost calculations, from one poly to the next
since that'll only fire off once
so you cant just affect them all
at least, the same way
youd need to factor in where in the path it is and how you might "plan" that route from where you start to where you want, and then yeah as epigraph is saying, expect that it will recalculate that as the agent navigates the original path
yea i'm checking to see if it's doing any re-querying
if you executed a single moveto, and just observed what calls getVirtualCost() is getting, i would assume you get 1 call per nav poly boundary
so is current where the agent* currently is right now, and prev/next signify the boundary that is being checked? aka, current has no direct relationship to prev/next-- so for all the calls to getVirtualCost() in the first round of navigation planning, youd get current being the same poly/tile/etc and prev/next would be iterating over the nav poly boundaries being considered?
I've been thinking. If this is really about exits and you only have a player agent, you could do something like "when player enters the room, mark the exit they entered from with a navmodifer_obstacle. (you could use a box collider the same size of the navmodifier to track the last entry the agent took)
ok, conceptually, it works, if the front exit is pretty close, he'll take that instead of the rear exit, which is the much closer route without accounting for turning
i think the exits are just a way to constrain it to check behavior (during testing)
i could make it so that the smart links for entrances and exits close .. but this seems like a much better way once i figure out the thorns
It is. It's a very cool approach.
if it's recalculating on the fly, it's not going thru my filter
i think it will only recalculate if needed
which would be if the state of the navmesh changes (like modifiers change etc)
would also include smart links changing
etc
hmm.. i don't see how any of the other data is especially useful.. right now i'm just using pb, which is the "end position on the edge of the current and next polygon"
hmm.
ok, so. MoveEnd is 'pb'.
Dot is the Dot Product of Rotation and Location-MoveEnd
If MoveEnd distance from current location < 200, then if Dot > 0.8, return maximum cost. If Dot > 0, return regular cost * 10k, otherwise return regular cost.
There is a backtracking thing in the nav system btw.. saw it in the docs yesterday, no idea what its about though.. just thought I'd mention I saw it
Hi are there any tutorials for neural networking in unreal engine
Hello everyone, is there a bug on the Move To node in the Bahavior Tree on UE5? I cannot plug actor keys into, only the SelfActor shows up. (Also transform keys)
Make sure your object keys have their class set to actor
It will not work with transforms, use vectors instead
Like this right?
Click the arrow next to key type to expand it
This will let you specify the type of object
the other arrow
There are not.
hey I am brand new to the UE AI world, so I hope my ignorance isn't too baffling lol. But I have a (hopefully) simple question. Is there a way to do an AI assisted MoveTo without a NavMesh?
no
you can certainly implement something else yourself but I'm not entirely sure how you intend it to work without navigation
my goal is to have ships fly around in space
but flying doesn't seem to be what the NavMesh is built for
unless I just don't get it
Yeah it isn't really
so there is no way to get AI assistance in flying?
Basic flight in space is quite simple though, just move the actor towards the point over time
There is no flying pathfinding out of the box no
Yeah it really depends on the specifics. If you don't have obstacles you need to avoid it's quite straightforward
yea I don't really have any obstacles to avoid, its just a matter of going from one place to another
@misty wharf thanks a lot for the help
👍
should i be doing AI in CPP or Blueprints I'm still procrastinating and I just don't know which one I should use as my AI is planning on being complex. ive asked this before but i also just dont know what to do or how to do stuff. Im making a stealth game AI.
Ai functions i need:
Path system
Ai to follow the path
Each Path point needs to have options such as whether it is just a wait type or it does an action and if i choose action it needs to give a list of what actions i can do. and obviously with the wait function i need to put in the amount of time.
Obviously Basic form of detection which i can use the perception system and see if the AI spots an actor that derives from my player class.
And i also want the AI to stop following the path after 1.5 seconds of seeing the player then the ai will either chase the player or go to the players last known pos.
I also want a way to get the AI to notice different things like dead AI (havent implemented yet as i dont know how to do it yet)
If you use BT's it's not hard to replace them with C++ based tasks later if it seems useful
even if you aren't it really doesn't make that much of a difference and is possible to change later
i cannot find any good tutorial or resource on what i want my AI to do
do you know any decent resources that will cover what i want to do?
There's been some discussions on this channel previously about stealth game mechanics and I think there might be some info on youtube but you'll just have to search for it because I don't really know them off the top of my head
Most of what you want doesn't sound too complex
i think most of them was me tbh but im just so confused and im getting really really stuck
I would suggest trying to break down your problems to small parts and then going step by step
For example the AI to follow a path and have actions at waypoints, you can just start by making your AI move to a specific point and then make it follow a series of points, and so on
why can't you move without navmesh? uncheck "use pathfinding", and if you're in a mode capable of movement, it should work
why would you want to move without navmesh?
if you're using character movement, or something derived from that, anyway
if a walking character finds itself off navmesh, or suddenly flying or falling
probably "yes". I find Blueprint to be crazy useful for Behavior Tree implementations, even though I generally prefer to write in code where I can. I'm a big fan of Behavior Tree, now that I have a much better understanding of how it works
i don't know if the current RecastNavmesh implementation supports it, but in a prior version of Unreal, I know of someone who set the navmesh height quite high, and basically treated it like a volume instead of a plane
Oh but do u know how to do it
I followed in your footsteps and built a visualiser for this approach. It's interesting how rarely the extra weight for direction seems to matter unless you do what you did and mark it as not traversable. If you are going around obstacles you tend to both go with and against the grain, so it balances out. Haven't figured out how to get the prior path segment so I can try to make it about changes in direction and prefer a straighter, if longer path.
Yes, but you won't like it 🙂
Haha but could u give an idea about it
It depends 🙂 what is it you're interested in doing?
I need a neural network for throttle control for my vehicle
This ^
Riiiight.. in that case my answer is overkillorama for you 🙂
You basically need like a single layer perceptron 🙂
But just for the record, my recommendation is to make your NN's external to UE and call them from a HTTP request
Oh
For your specific use case, I'd just hand code a simple NN in C++ and have done with it
Should I use raycasts to detect collisions
There are people who'd done plugins for PyTorch and the like, but honestly its too much pain 🙂
If you had suggested embedding python. I may have rioted 🙂
Isn’t PyTorch only python?
That's a bit of a difficult question.. again it depends on your game
Pytorch is C++ too
typically you'd create your model architecture in python, then save it and then load the saved model arch in the C++ version
So ur recommending PyTorch for this use case right
But again, that's totally overkill for a throttle control
wait you can use python with UE?
No, my recommendation would be to quickly do a simple NN in C++ yourself
Yes and no 🙂
Ok seems complicated lol
You can use python in the editor
But for some mad reason, they didn't enable it for the runtime
so python for editor stuff but not gameplay
Which is strange, because another group made it work at runtime too, but gave it up when Epic released their editor only python
its weird
As u said there’s a plug-in for PyTorch in UE right?
Epic added python I suspect because its required in the VFX industry
Yeah, look on github
blender uses python i know that and I think Maya and Max can as well
But I am not sure how do I start
Yeah, python is all over the place, hateful language 🙂
Pro: can't help you there.. plenty of tutorials out there on the interwebs about pytorch
Perceptron's are not complicated. The terminology makes them seem that way, but it's really worth coding one up outside of unreal to see how NN's work.
Thanks for your advice
what he said.. agreed.. make your own.. its pretty simple
you don't need GPT3 for a throttle 🙂
I can use tensorflow also right?
Yeah, pretty sure TF has a C++ build, but it uses their crappy bloody build pipeline, so probably not UE friendly unless some pyscho has taken the time to figure it out 🙂
Ok I’ll start with a basic neural network outside ue
https://github.com/getnamo/TensorFlow-Unreal There is this, but I just googled one up just now.
Again, you can use HTTP requests to an external model.. I'd write a python thing in PyTorch, host it via fastapi and then hit the fastapi with calls via HTTP requests in UE
Last question: do games usually use neural networks
The reason I advocate that, is that you can test it more easily and honestly its probably a wiser move to run the NN on an external GPU
That's a bit hard to explain, but in general, no.
But yes, some do
Or rather, they do for certain tasks, not always for gameplay
A load of games-as-a-service use ML for things like customer prediction, attrition, advertising, fraud detection and the like
Some have used them for training bots
Oh
I use them for cinematography
if you search for "GDC machine learning" on youtube, you'll see a bunch of examples
Lots of people doing ML for animation stuff right now
Thanks for your suggestion
actually. Epic just added some ML based animation deformation stuff to UE 5.0.1
I wouldn't recommend it as a beginner thing though 🙂
The Embark guys used reinforcement learning for balance controller on Ark Raiders
Well then I guess I shouldn’t use it
so yeah, its kind of a bit niche still
It’s gonna be my first neural network
pfft, its only simple
dot products and the like
numbers go up, numbers go down kind of stuff 🙂
if you do happen to come up with any interesting results, i'd like to hear. getCost receives a prevTile and prevPoly, but I don't see how any of the data in the dtPoly and dtPolyRef structs are even kind of useful (this may be my lack of experience)
if i don't come up with an acceptable result here pretty quickly, i'm going to have to shelve this work, admit temporary defeat, and go work on other tasks for a while, and probably tackle the problem from a level design standpoint rather than code
Well, you can get neighbours from the dtPolyRef, which might be useful
It might, though I'd really just like to be able to get the current candidate path (if that's even how the alg works). The filter might not have enough info about the state of the search to do that.
@ocean wren i'm not seeing anything that looks useful -- perhaps some of the indices/handles to other data might be able to provide further information, but i don't know where to plug them into?
The we could add a fixed, but non-linearly increasing cost to turns, and let the g term of the A* search nudge the path toward one that takes gradual turns.
@opal crest nope, i think the most state information you're going to get there is "here's the poly i'm looking at, along with the previous and next to be considered for this path" .. at least, i'm assuming it's the previous and next for this calculation
but without any position information for the prev/next, i don't see how it's useful.. unless one can dig other structures from that data
You really need to do a dyjkstra rather than an A* don't you? so that you can determine the cost of routes
Just feels to me that trying to do it from heuristic cost is missing something
That may be right -- I've honestly never researched pathfinding, what's been given to me in Unreal has always been sufficient before, with a little nudging here and there. Definitely implementing a whole thing like that would be out of scope. The time I've spent on this already is out of scope, but I thought it would be worth it for future exploration also
Well, its good to learn this stuff 🙂
My intuition is that there isn't any difference between adding g (path cost) to discourage a route because it's difficult terrain, and adding g to discourage a route because it has turns in it.
h definitely needs to remain untouched (since it measures how close you are getting to the goal).
You might be right.. but my pathfinding spider sense is tingling
Yeah, and this is definitely weird territory.
well if nothing else, i've sent some people down a .. erm... path.. of discovery 🙂
One thing I observed is that because the total angle to get to a place, if you don't have a maze, is generally the same between two routes. So just adding up the angles and assigning a cost doesn't change the result.
Which is why increasing it non-linearly seemed like a solution, since it would penalize sharp turns more than gentle ones.
But then the topography of the navmesh would start to matter quite a bit.
It might just be that we want to only penalize the angle of the first segment, so that the character doesn't head straight back, and then otherwise score it normally.
But yeah, it's been fun revisiting classical pathfinding because of this Q 🙂
honestly, since we're traversing a link and transferring control to a different BT Task, immediately after hitting the end, we're doing another pathfind anyway, so I don't expect long paths to matter too much
hmm. not sure if this is useful, but once the exit the ai is facing becomes farther away than the one it's not facing, then it will start backtracking to the bad one
the mindboggling part is it walks all the way to the good one, then reverses
so I tried this approach yesterday actually, and the pawn didn't move. that's when I came here. I had a feeling I may have been missing some other configuration and thats why the movement didn't work tho.
I'm pretty sure it should work -- although i wonder if you maybe need to HAVE a mesh for it to work. Are you using CharacterMovementComponent?
No I am not. and thats why I'm sure I'm doing things wrong. At this point I just have a blueprint class derived from the Pawn class. And there I have a custom Playercontroller attached
ok, my experience is using AI controlled pawns that are derived from Character, and use CharacterMovementComponent
ahh I see
I think thats where my gap in knowledge is. I don't have any "characters" in my current game just ships and vehicles
I am now feeling like I have gone about everything wrong
MoveDirectlyTowards might work for floating pawn movement or such
There's no reason for it to be a character if it isn't a character
imo
ok i'm not familiar with what is and isn't in the MovementComponent, but I do know that there's a lot of psuedo-physics handling over in CharacterMovementComponent
Yeah, if it's for moving spaceships it seems like kinda pointless :)
right, but something like the Flying movement mode might be useful to look at. I'd wonder if the AI movement stuff has a soft dependency on CharacterMovement.. like.. not a real dependency, but it doesn't actually work without it
hmm I see
iirc it doesn't specifically require CMC, it uses PathFollowingComponent
But I think it requires some variety of Movement Component
You can derive from Pawn Movement Component, but you will be doing a lot of the work yourself.
that does sound correct, but also the MovementComponent might have no idea how to move the Pawn to comply with the PathFollowing
Yeah
FloatingPawnMovementComponent might be able to, ProjectileMovementComponent might not :)
i'm.. also talking about things i only have a cursory understanding of, as all of my recent work has involved already existing characters, so my knowledge is incidental to my experience
this has been an incredibly enlightening discussion for me
I wasn't sure which direction to move in, but I think I know what to do now
FloatingPawnMovementComponent is a good start for spaceships, though you'll need to add logic for turning, etc...
sounds good because thats still a better place to start from than where I am now
oh, there actually is a FloatingPawnMovementComponent 😮
I don't remember if it responds to AIMoveTo properly though (even if your pawn has an AIController)
I really miss having an editor that can easily do "Show me all child classes of". Boggles my mind that that is lacking from everything
hmm. even setting that cost as unwalkable... it still applies the heuristic, which reduces the cost, which makes it not ignored..
Yeah, ultimately it's going to be balancing 'distance to goal' with path cost, and taking the greediest option. Weird that it overrides unwalkable though.
it's in the 'special case' in the function that calls getCost, for the last move in the path.. since it's also the only move in the path
i think
my getCost is only being called twice in this test level, one for each link out of the poly the AI is in
at least until the AI gets to a larger navmesh area
I see, so there's really only one nav poly.
effectively, yes. it's standing on a poly, that has a pair of navlinks out of it
And it's just trying to find "out", and somehow that ends up just being 'closest' because of the special case for last move.
The 'pb' that i'm getting for each call is the exact location of each of the navlinks entry points
That makes sense. It's normally drawing a path from the entry point of the poly, to the center of the next poly and pb is the point on the edge of the poly that intersects, and with the navlinks case, I guess that's the navlink location.
i take that back, it applies the heuristic, but then hits the continue anyway, because it's comparing the unwalkable score to the variable pre heuristic
so.. why the hell is it going there?
It intersects each neighbour edge and gets the cost from those
then once its got the costs for each edge, it does the funnel algorithm based string pulling
can you point me in the direction of what code you're referring to?
goddam it.. gimme a sec 🙂
Any built in ways to cull unreachable navmesh islands?
@shadow furnace are you wanting to remove disconnected mesh bits from the built data?
There might be a function on the Recast implementation.. there's a few functions that sound like it
Just don't know if any of them are made available to UE
This code is kinda crufty 🙂
hmm. there are facilities for disabling string pulling, but i don't see any way to Get There From Here
oh, there it is in the path following component
oh, nice, we already extend from CrowdFollowingComponent, so i can just add a new condition to disable string pull. maybe that'll help
nope
Hahaha.. classic unreal engine "maybe that'll help"... "nope" 🙂
Sweeney giveth and he taketh away
At runtime ideally
i would expect if they aren't connected, they're not going to be considered anyway? at least, usually
I guess you can walk the navmesh and just alter the polyref's so they can be filtered
ok i am actually going to shelve all of this mess, because all of this work has had zero change whatsoever to the actual behavior in game. only minor changes in a test environment
Its a learning experience, get used to it
yeaaah i've been doing this for a number of years. i just hate every time i have to put something onto a shelf never to be seen again
The issue here is we have a teleport ability that uses the navmesh
I suppose a simple "is reachable" check would suffice
ooooh
Yeah, I should be more specific
Could you teleport and just look for the closest point on the navmesh next to the teleport target?
You can do a navmesh raycast for the direction of the teleport
i'm not domain familiar with EQS, but I'd try an EQS check with an is reachable test, rather than going through trying to eliminate disconnected bits before hand. That's probably the more reasonable method.
If you'd like, though, I have just figured out how to implement NavigationQueryFilter and you can use that to filter out
iirc "search" is when the node is active and the BT is "searching" for the next node to execute below it
so basically it should start every time the node becomes relevant and and end as soon as it stops
So like second state after "activation"?
Yeah something like that. Best to look at how the code is ran tbh
Gotcha, thanks
Is there any way to make BT wait for a node to abort itself before switching to another node?
Recently I started to think Abort function being synchorous is almost root of every problem I'm having in BTs
I vaguely recall looking into this as well but unfortunately the answer seems to be no
Damn 
You could potentially have it set up so that you run abort logic in the controller or pawn, and have another node which waits for it to finish
or run abort logic separately in another node, or something
there's a few options like that I guess, depending on what it is you're aborting and how the rest of it works
I'm trying to make my AI switch to a specific behavior smoothly without cancelling everything instantly, but over the time I end up using FSMs for that rather than BT and I think I'm doing something wrong or BT's really not that efficient.. Probably I'm doing something wrong because whole industry using it
BT's aren't the answer to everything
I can also make sense aborts being sync because over the time conditions can change dramatically and you also have to manage the "aborting" state inside the tasks but.. 🤷♂️ It's ending up on choosing your poison
Over the time I start to approach them to more of a high-level layout of AI rather than a complete solution because 99% of the time I find myself needing to find a workaround for the issue I'm having and any workaround I find break the flow of BT
And over the time I start to feel like game AI is a very tacit knowledge
Like level/game design
Something you cant learn from books/articles/any other resource and only experience
Hard to say yeah
I think some type of patterns book would be helpful in theory
Eg. here's BT's, here's a bunch of things they're good for, here's a bunch of things they might not be good for
here's FSM's, etc.
Yeah, I wonder how AI people being recruited these days with this amount of lackiness of resources for those things
I never really looked at what kind of books and such are available for this kind of general purpose gamedev stuff... there's a lot for programming in general about just general purpose language/framework agnostic stuff
There is Game AI Pro 360 book, but I can say it's not really providing solution to real issues of the tools from what I read yet
But they show some real world examples from AAA games
http://www.gameaipro.com/ this is the one I know actually and seems to have some useful things
Home of the book Game AI Pro
haven't gotten around to reading any of it tho lol
IS there a way to accomplish a "one time event"? So for example, I have a bool called CanSeePlayer and whenever my ai perception senses the player, I want it to do a one time trigger, for example play spotted audio and maybe a dialogue line, then reset and do it again next time the player is seen
Sure, just trigger it from when the player is spotted
successfully sensed will be false for events where LOS is lost so you can use that to check
perhaps also a timer to make sure it doesn't keep happening too often if sight is only lost for a moment
can I just say #gameplay-ai has been lit lately, love to see all the activity in here
#gameplay-ai is actually quite active though 🥲
Is there any system readily available that can do hundreds of AI without completely obliterating performance?
Mornin all..
There's some new GameAIPro style books being written too.. but won't be done until next year
#mass is your best bet. Pretty spartan ai features but more on the way
Or roll your own
is there any documentation for this?
otherwise I suppose I'm gonna have to read through these?
Usually the answer to "is there documentation for this" is "no" even for things that have existed in the engine for a long time
Sadly :P
That'd be a biiiiig NOOOOO 🙂
😔
damn
Coming from unity and especially python, where everything has a documentation this is a change
You could always learn it all and write documentation for it..
python docus are terrible though, unity is better
But yeah, Epic have form in regards to poor documentation
python docus aren't great - true.
But at least they are docus
Yeah.. can't argue
You can sort of go through the code usually to get the same level of docs as unity has
although unity docs do sometimes have at least a few samples
Yeah, at least they show you some examples of functions in use
for many engine bits you can search for usages to see how things should be used, but it might be harder for something like AI stuff :P
it's intersting - because googling this plugin you find absolutely nothing
Yeah, if its blueprint and art related, you're golden
I think that plugin is almost brand new which is why
Well, its because it was a weekend project for one of the guys at Epic, hence the experimental tag
What is it you're after doing?
still a shame you can't even find a mention of it anywhere 😅.
anyways, I'll try my best to read the code
Trying to set up reinforcment learning
oh 🙂 ahahahaa... yeah no, doubt that you'll find good examples of that
Hoping a student of mine tackles that this coming year.. but haven't come across anything
I've last checked a few months ago and none of them had support for UE5. which was understandable at the time
yeah, you'll always have to compile them yourself..
yeah ... sadly.
With unity it was easy - MLAgents provides some great stuff
MLAgents was pretty crap too though 🙂
i gues I didn't go enough in depth on it then 😅
One of my undergrad students used it for a project.. I mean it "worked" but it wasn't "nice"
As with many things in games, ML gets no love.. usability is kind of shocking
Plenty of work still to be done. With RL in particular
I wonder how hard would it to be to make your own weather AI 🤔
The guys at Embark rolled their own tech for it.. which is what I'm doing. Building a kubernetes cluster for training etc.
There's a website which shows rain radar stuff and you can usually predict if it's going to rain in the next hour or so by just looking at it
I used it to set up some enemies for an arcade racer and it really worked nicely. But that' really all I've used it for. So not a a lot
the weather report usually just says "yeah it's gonna rain today" and not if it's gonna rain in the next 1h or so which would be more useful to know
We were doing level generation for this student project.. I mean it worked in a notional sense, but he was comparing different methods and some of them didn't seem to function
The aim was to look at learning by demonstration
Anyway, if you're just interested in RL then maybe that experimental thing might serve you.. haven't looked at it myself
But for production stuff, you'd be better off rolling your own kubernetes based training
kserve and all that
kserve->kubernetes->k3s->k3d
containerised python code, running in kserve on kubernetes cluster running on k3s in a k3d container 🙂
etc.
Basically, MLOps 🙂
It's mostly really only for personal interest 👍
Let us hear how you get on
although this does sound great 🤔
Its "the future" 🙂
goddam exploring Dall-E prompts is just too much 🙂
Trying to see if "Cyberpunk Zealot" overpowers "Studio Ghibli" 🙂
https://pbs.twimg.com/media/FUXYieMWAAA92Qn.jpg someone did this with dall-e mini lol
Apparently Studio Ghibli stands no chance against cyberpunk warrior 🙂
I am trying princess mononoke, but it might need the big guns.. totoro 🙂
Does anyone know a good tutorial for making your own AI movement system that uses the navmesh? Characters are too expensive for my purposes and Floating pawn Movement don't give me enough control
You could just look at how CMC works and pick the bits you like
Basic character movement doesn't need much more than just a gravity force
That would probably be a good place to start
Although I'm a little intimidated by all the complex code that works with replication (I don't need replication in this case)
Yeah I mean if you want to keep it as simple you can basically just have a movement force and a friction value
have it tick and it applies the force as movement on tick, and applies friction to slow it down if it's grounded
I implemented quake 3's movement code in unity at one point, their code is free and not too hard to follow
Yeah that sounds like a good idea, I'll go take a look at that!
Okay, so I need some pointers of what I fucked up. I started of with the TopMap sample project. All was fine, the Navigation worked, Even an AI Move To node worked. But then at some point I changed something and now no ai movement at all works, except MoveToLocation but only when I turn off Use Pathfinding
My NavMesh is still there, visible by pressing "P"
Oops. I take it back, AI Move To does not work in that sample project
AIMoveTo requires an AAIController to work, as it needs its UPathFollowingComponent
players don't have those
Right. So I guess to summarize my problem: AI Move To or any of the move to functions don't work. The character does not move at all, no log outut, nothing
The class is a child of AIController
In EQS, How do I put a custom circle center ? I want to put to the location of a Target Actor.
Create your own EQS context which returns the actor you want
Can it be modular ? Such I don't want to put 1 type of actor but a custom inputed actor ?
With some difficulty
EQS is not very easily parametrized
Your context can read the value from for example another actor or some other location to return it
Alright, if I understand correctly, it's going to be difficult to do this. My Target Actor is however present in a blackboard
One way which might not be too bad would be doing something like have your context get the querier
you can store the target you want in the querier, or you could even get the querier's controller and read it from its BB
Ok thanks a lot. I'm going to try this
BTW, I found a really good tutorial serie for AI, it's pretty advanced :
https://www.youtube.com/watch?v=6AiCpXOlrdE&list=PLNTm9yU0zou5y0cWEz59BQnHd0c6fC2XZ&index=26
Project Files: https://www.patreon.com/posts/62412743 .
This is the 28th episode of Unreal Advanced Locomotion System based shooter series. In this episode, I am going to start working on team-based AI vs AI combat system. Here, AI characters who belongs to different teams will be able to detect enemies from different teams and engage in gunfig...
Hey everyone im making a AI path follow system but i am so stuck
This is the blueprint i am making its a mess and i think its all wrong but i dont know hwo to fix
This is the Function that im calling
void UPathFollowerComponent::GetNextWaypoint()
{
if (CurrentWaypointIndex == Waypoints.Num() - 1)
CurrentWaypointIndex = 0;
else
++CurrentWaypointIndex;
}
Yep
You need to explain what the problem is because from what you said so far it's pretty hard to tell what even is the problem
its not doing anything at all
so execute AI never runs?
it is but i dont think I am getting "target" correctly
it's pretty hard to say because it isn't visible where it comes from
the blue lines that are off screen is just another call of the targetvariable
Am i even doing the general code correctly?
I mean the basic idea looks correct
You need to debug it more than just "I think"
Use print nodes nodes to see what values are being set into the variables and where the code is actually going
yeah i just tried and the Target is not getting set
but i dont know how to make a call to the component
Okay, so where does the target come from?
its a reference to my path follower component because thats where the functions are
Should the functions really be in the waypoint actor?
this is what im trying to do for context
The ones that are shown in the screenshot probably not
so Target is UPathFollowerComponent?
yes
Where does it get that?
I dont think it does and i dont know how to
ive tried making a function that returns a pointer to the component but that didnt work
yes
In that case what you can do is cast controlled pawn into your guard type, then get it from that
or you can do a get component by class from controlled pawn
either way should work
and the Behaviour tree this task is on the AI controller which is controlling theNPC
english failed me
@misty wharf How do you suggest doing this because every single time i fix one thing another breaks so do you have a better way of doing this system
the basic idea is good you just need to debug it and fix it
i know you cant see but im confusing myself like mad
OMG I COULD HAVE A FUNCTION TO DO THE CHECKS
isntead of spaget code
heh
having it as a function isn't going to make it work if it doesn't work at all tho lol
i think because im using so much spagetti code it is breaking my brain therefore breaking the cod
yes
The character moved to the first point
i just need to fix the looping
then i realized i wasnt incrementing the array
of waypoints
but my code was so messy i didnt know where to put it
Ah
It might make sense to set it up so that you have a function to which you pass the current waypoint
and it gives the next waypoint it should go to from that one
this way you don't need to keep track of the current index, and it will work regardless of what waypoint you start at
already have that function 🙂 just need to make it so i can return the index
Wouldn't it make more sense if it returned the next waypoint directly instead of just the index?
so make it return a waypoint actor instead?
so you can do something like move to waypoint -> get next waypoint -> move to waypoint...
@misty wharfis it better that im using components rather than throwing everything in the AI character class and should i keep using it So i can make like chase component and like kill player etc as some enemys cant move and some cant kill
If it makes sense to you, sure
well as im going to have multiple types of guards i would have thought it would have been a better workflow
It's a bit hard to say whether it's the correct way or not, because there are many ways of doing these things, and whether it's good depends on how you want things to work
im mainly worried about optimization and performance too
which i guess i can profile that at a later date
Actor Components should be fairly good. Scene Components will affect the performance of moving things as they need their transforms updated when moving
But in general unless you have hundreds and hundreds of characters moving about, you're unlikely to see scene components being a problem
I dont plan on having massive levels (I suck at level design and i am still thinking of how i want my levels to be
but my plan is for my game is having an angel thats fallen from heaven by accident and has to sneak their way back to heaven and humans hate angels so yeah
Apparently it cannot get to the waypoint
Just worke dout why its because every time my task runs its reseting the Array
Okay so i need to have the array on the NPC?
How should i se the initiall variables should i have like a manager of some sort?
because its resetting every time the code executes
@misty wharf sorry to be a pain again what should i do here?
You probably should store the current waypoint somewhere else than the task
that way you can then read the current waypoint in the task to select the next one
is there like a type of class or soemthing i cna store it in or where else could i?
or do i just make a function in the component that is like "get current waypoint"
thats probably the best bet?
Yeah you can just store it where ever it makes sense, could be in BB, could be in ai controller, or in the component
black board would probably help in the future when say i do my chase stuff when it returns to normal?
however i think quite a few of the variables only need to be set once at the start then just updated
Does anyone know what a "binary broad-phase filter" is?
context (timestamped): https://youtu.be/5ZXfDFb4dzc?t=2885
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
Probably zoombapup might know that, but I really liked that yt channel
He just means a boolean condition that seperates the logic into true side and false side
So filtering in this case would just check if true and enable specific behaviours to check if that were the case
imagine something like having ammo being a filter for all of your weapon handling logic
So its a boolean selector in a behaviour tree.. or a node in a decision tree, or a conditional value in a utility system
The "broad phase" thing just means at the topmost logic level.. before you get down into the details
You'll often hear of broad phase and narrow phase.. typically in physics, where you do a sort of higher level object sorting as broad phase, then individual overlap tests as narrow phase
wow, thanks a ton @ocean wren
Hey I am having an issue with my ai. When i spawn them in have a them patrol on a lane. For some reason certain enemy types do this fine where others get their navigation aborted. The odd thing is it only happens on one level. any idea why this might be happening?
My behaviour tree is crashing the editor and I cannot figure out why. It’s been happening since last night and I lost several hours of work due to it. I spent today setting up perforce and making commits before each run now. I’ve gone over the blueprints over and over but cannot find the issue.
First it was a memory exception and now it is an array out of bounds exception
I’m using arrays but only for each loops
Not sure why it would crash the editor instead of the PIE and give me a hint on what is happening.
Seems random but it doesn’t take long to fail
Crash output
I just stepped through every line in the code and have a breakpoint at the begin of every task, no issues. yet it crashed after the node was complete for the first time. it is a looping branch
looking at the unreal source it looks like it is the debugger itself crashing
It could be that you're stomping memory and its just appearing in the BT stuff. Try and isolate just the bit of functionality. So maybe copy your BT into an empty level with just what you need to make the BT function and debug it there.
Essentially, you need to make a reproduction case before you can fully debug stuff like this
Also, consider what assumptions you've made, check if they are true.
why does the pathfinding test discard actors that are reachable? is it something about the fact the actors root location is in the navmesh gap?
it seems it has to do something with these properties of navmesh. I tried lowering them for some other actors and it broke pathfinding for another actor...
well if the actor is in a gap between navmesh then it's not reachable via navmesh
I'll be here all night
Well I don't understand why but apparently I needed to move the looping call to the selector at the top of the graph vs the branch I wanted to run until a BB key changed. Really it didn't need to be that far down, makes sense to have it at the top since all of my branches are state specific
no crashes yet
well the gap is generated by the actors static mesh. I could of course disable "Can Ever Affect Navigation" property but that's not what I want
I've had this same issue
I solved it by just having it check path to front of the object instead of to the object's location
Of course for me that works because the objects have a clear "front" which must be reachable for it to work correctly, but for something else it might not I guess - I'd imagine there should be some kind of way to do a custom reachability check where you can test distance to the final location
well if they were modifiers as opposed to nav mesh occluding then it would still be navigable
i mean---- if they are not supposed to move, but also do not block navigation, then Can Ever Affect Navigation set to false might be the right call
if the actor is supposed to move, and you're doing dynamic navmesh generation, then yeah thats a pickle
I don't think not having it affect navigation is the solution though
If it doesn't affect navigation, npc's would try navigate through it which would obviously not work
I don't know what the target is for, I guess
Yeah I mean it would in theory work for that, but for example if an NPC needs to walk past it, it wouldn't be able to avoid it being there if it doesn't affect navigation
yeah assuming it's an actual thing to be avoided
/shrug
looking back at that screenshot I'm not sure it is something to be avoided?
more like a destination for ai to take cover or something (red circled part)
Well yeah, but even if it's intended as something like that, you'd walk up to it, and then if you'd decide you need to walk to something on the other side of it, you wouldn't be able to because you'd get stuck on it if navigation was disabled on it :)
if you disabled affects nav the navmesh could generate beneath
yeah but if you tried to move to something which is on the opposite side of it and navmesh was generated under it, the npc would just attempt to walk through it
yeah that's true
there are reasons, but then I'd wonder if making it higher cost would be better
then navs through it could be controlled, but navs to it's point would be valid
Good point, I guess as long as its movement cost was sufficiently large that it would never make sense for an npc to attempt to "shortcut" through it it might work
yeah tuning would be needed there
but if you are naving directly into a high cost area, then no other path would suffice anyway
would always be higher cost
so whatever cost necessary would work, assuming this didn't kill other pathing flows
if it's a cover spot, most times you don't want any AI transiently going in there or else face awkward RVO avoidance
or worse, detour crowds 🥁
Hey anyone played much with generating splines? I'm trying to get my ai to do some 'dinosaur movement' behaviour, and get them to follow a spline! Unfortunately the spline I generate from path points along a navmesh suck and was wondering if anyone had any suggestions to be able to get a more smooth transition?
Repost from #blueprint but was told it might be a good question here? Also worth mentioning I'm trying to achieve this with blueprints hehe
ok so
you're selecting some points along the spline to generate?
what if you produced the point on the spline to generate over time with a timer or a relaxed tick, and then fed that into blackboard with observe blackboard value
youd be able to control the resolution of the calculation, and observe blackboard value woudl allow moveto's to the point to update on the fly
should allow you to control the tradeoff of cpu vs accuracy of moveto along the spline
should be plenty doable in blueprint
Interesting, im looking into a way to produce this now. I'm currently using 'find path to location synchronously' and generating my spline based off those points. Would it also be possible to get the length of that spline and generate say 10 points across that spline with point 0 at the root, 9 at the final length, and then spread the remainder across the rest with equal distance apart?
if blackboard doesnt work for you then direct find paths are obviously needed, but telling the AI to just navigate to a position with blackboard/behaviortree might be what you are looking for [using observe blackboard to update pending move-to's on the fly]
thats the most obvious path. if you are already invested on direct findpath calls, then maybe use the async version and interrupt it as the up to date point along the spline changes
im suggesting ticking at a low rate to select these points along the spline as the current game time increases
Thanks I'll investigate the behav tree approach! I'm still quite fresh to using them so I have a bit of a learning curve to understanding good practices and such.
you can do a lot with it; its easy to think that its janky because moveto has to complete to the original position you requested and that you cant change that, but you can
will that moveto just be updated when the blackboard position changes?
if you have ticked "Observe Blackboard" then yes
Interesting! I'll check that out-
Also with this, what do you suggest I should use to generate the spline point?
generate the spline points you mean?
yes!
ha, I thought as much :p
recently we discussed a way to override how navigation costs worked at a core level to do something similar to this (limiting the required angular change of navigation paths to be minimized)
but that is pretty intense, and since you are intending to go for splines to generate the path ahead of time, i feel like it can be done without that level of difficulty
I see, I was hoping that this way would get what I wanted (or close to it) without going through too many hurdles
there's also something to be said for just modifying the maximum rotation on the character movement controller
i think in theory its supposed to somewhat respect it
ymmv
I was able to achieve the effect I wanted with 'add movement input' nodes to move if pawn see's player, and if not rotate and move until it directly sees player again, but sadly it had no accountability for path finding so that wasnt too helpful in the end :p
I guess to a degree this works, but i found it less than desirable on anything that isnt humanoid or bipedal :\
Trying to move this fella becomes a bit more obvious sadly
But thank you for the help and pointers! It's definitely pushed me towards a better direction! I'll report back if I get anywhere with this! 🙂
yeah it's not easy getting cmc to mesh with realistic simple rotations
AI is torture ISTG
Actually worked for me, thx. There's even a NavModifier component
Can I somehow inherit from DetourCrowdAIController, because of the avoidance logic already implemented, and use it inside my own AI Controller?
It's not exported so no, but if you look at how it's implemented it's extremely simple and you can just do the same thing in your own AI controller subclass
<@&213101288538374145>
It's been a while since I've seen one of these, used to be a lot more common it feels like or maybe I've just not been looking when they get posted lol
:no_entry_sign: tagamedeveloper#8802 was banned.
It's good to know Discord is finally maybe doing something about it
Zomg
Oh boy
<@&213101288538374145>
:no_entry_sign: blob#4362 was banned.
My gawd
i just tabbed away
lol
and it happened again
they're back with a vengeance
Zomg do you know why my location isnt updating and is this even correct?
Is it supposed to update the BB value or?
jesus between the neo nazis raiding servers supporting pride and this discord is a mess
IVE FUCKING DONE IT
Im trying to coordinate my ai and I saw that there is a team sense. Now I've found only some articles about how to use them but not really in blueprint, could somebody explain to me how the sense exactly works and what stimuli information it returns?
I don't think anyone has really used the team sense, it's come up a few times but it seems nobody really knows
In general the builtin team support with the attitudes hostile/friendly/neutral is something you need to use C++ to configure
The heavy duty tool for this is probably to customize the path following component, and control how your agent moves toward the next goal point on each tick. I'd guess that the faster your dino is going the slower it should turn.
https://docs.unrealengine.com/4.27/en-US/API/Runtime/AIModule/Navigation/UPathFollowingComponent/
Rama has some code/videos using this to add jumping to the path following behaviour of his AI.
The other thing you could do is manipulate the generated spline control points. But I honestly don't have the a good clue how you would wrangle to the math to get the intended effect (Maybe Freya's Bezier videos on you tube would help there?). I use some very simple splines generated from navpaths to visualize turn based movement, but for those I make the handles really short to make the corners tight but rounded.
Thanks for getting back! 😄
I'm playing around with DetourCrowdAIController and NPCs are avoiding each other as expected, but it seems they ignore player's pawn. Can I change it to avoid player's pawn too? Using Blueprints
You need to add the player pawn into the crowd manager
You can Implement the DetourCrowdFollowingComponent as your pathfollowingcomponent
Crowd Manager can be only changed via C++? Don't see a way of adding players pawn inside Project Settings => Crowd Manager.
Sorry but how could I achieve that?
Oh if you meant CrowdFollowingComponent in Path Following Component I have already done that, but it still ignores player
iirc yeah the crowd manager might be another C++ only thing
but it's basically CrowdManager::Get(World)->RegisterPawn(player pawn) so it's not super hard to do
oh yea that should be doable! Thank you
Sorry to bother, but I tried your approach, looked up UE docs as well as forum post
https://docs.unrealengine.com/5.0/en-US/API/Runtime/AIModule/Navigation/FCrowdAvoidanceConfig/
https://forums.unrealengine.com/t/registering-player-character-with-ucrowdmanager/313220/3
My Implementation looks like this:
``
UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
class MYPROJECT_API UUCharacterCrowdAgentInterface : public UActorComponent, public ICrowdAgentInterface
{
GENERATED_BODY()
public:
void InitializeComponent();
// Sets default values for this component's properties
UUCharacterCrowdAgentInterface();
};
void UUCharacterCrowdAgentInterface::InitializeComponent()
{
Super::InitializeComponent();
UCrowdManager* CrowdManager = UCrowdManager::GetCurrent(this);
if (CrowdManager)
{
ICrowdAgentInterface* IAgent = Cast<ICrowdAgentInterface>(this);
CrowdManager->RegisterAgent(IAgent);
}
}
``
I also added this component to player via constructor, but nothing seems to be happening.. Do you know why? Or how could I make it work, I wasn't able to find some decent tutorial sadly..
Unreal Engine Forums
Try this: a) Create your own class - child of ICrowdAgentInterface. For example: UCLASS(BlueprintType) class UCharacterCrowdAgentInterface: public UActorComponent, public ICrowdAgentInterface { GENERATED_UCLASS_BODY() virtual FVector GetCrowdAgentLocation() const override; virtual FVector GetCrowdAgentVelocity() const override; virtual vo...
Ah right it required that interface
You need to implement the functions in it - GetCrowdAgentLocation, Velocity, Collisions and MaxSpeed
You can just have it return the owning actor's location, velocity, capsule size and radius and max speed respectively
I see, I thought I could just add it as a parent from UE editor but this interface wasn't present. Going to give it a try
I did implement them:
void UUCharacterCrowdAgentInterface::InitializeComponent()
{
Super::InitializeComponent();
UCrowdManager* CrowdManager = UCrowdManager::GetCurrent(this);
if (CrowdManager)
{
ICrowdAgentInterface* IAgent = Cast<ICrowdAgentInterface>(this);
CrowdManager->RegisterAgent(IAgent);
}
}
FVector UUCharacterCrowdAgentInterface::GetCrowdAgentLocation() const
{
return GetOwner() ? GetOwner()->GetActorLocation() : FVector::ZeroVector;
}
FVector UUCharacterCrowdAgentInterface::GetCrowdAgentVelocity() const
{
return GetOwner() ? GetOwner()->GetVelocity() : FVector::ZeroVector;
}
void UUCharacterCrowdAgentInterface::GetCrowdAgentCollisions(float& CylinderRadius, float& CylinderHalfHeight) const
{
if (GetOwner()) {
GetOwner()->GetSimpleCollisionCylinder(CylinderRadius, CylinderHalfHeight);
}
}
float UUCharacterCrowdAgentInterface::GetCrowdAgentMaxSpeed() const
{
return 300;
}
But result didn't change
Maybe try registering in BeginPlay
In my other project where I use this, I have it in my player character and it registers itself in BeginPlay, the implementation of the interface is otherwise pretty much the same as yours
Also you shouldn't need that cast to interface there, since the class inherits from it already
Who do I ask if there is dynamic subtree injection planned for the State Tree?
cause if there is I can safely throw BTs in the bin
alternatively: please make blackboards stackable
then I won't have to throw them in the bin
They were talking about Epic was going to listen the community at #mass
You can also ~~hijack ~~ sneak StateTree into their scope @sudden citrus
Can you explain what you mean by that?
Ehh, I hope my English didnt fail me again 😂 AI team of Epic told they are going to listen community to add new features
So you have a chance to provide them these ideas
Ask someone at #mass
I mean the hijacking
Ah that was totally an incorrect word usage of mine
oooooooh you mean mentioning state tree in that topic, I thought you were talking about a technical solution 😂
lol yeah
I doubt dynamic injection would be possible in the context of Mass at least - it would change entity memory layout
I'm hoping to be able to support it in a Brain Component though - simple FSMs for crowd members and low LOD actors, complex in combat
Since StateTree is used together with mass maybe they can also prefer to get feedback for those seperately
That's what I tried to say by hijack sneak into their scope
let's see, I'll have a look through the channel, thanks
For now they'll only listen community for mass specific things but state tree is also pretty much related
I wouldn't hold my breath on them listening to anything
Nothing I've seen them promise they would do on the forums has ever materialized
I have slightly higher hopes for UE5 features seeing how they've hoovered tech talent throughout 4's life
probably backwards compatibility standing in the way of change more than anything
If you want a feature in UE you need to convince Fortnite players it's the best thing ever so that they all start begging for it 
I have a melee enemy and I’m trying to figure out how to make them attack at intervals instead of at the same time, any tips?
Easiest solution would be to add random delay between actions
this way they will not synchronize with each other even if they begin actions at the same time
Yeah, it really depends on how you need it to work but if all you need is for them to not look like they're acting in perfect sync, random delays between actions should do the trick :)
Thanks so much for the input
Hey all!
Noob question here but for an AI just chasing a player is it better for optimization to use the blackboard or just a MoveTo off and event tick?
for a single AI it wouldnt matter
but to answer the question using MoveTo node in BT is more optimized
Only path following component ticks in C++ to move the pawn and MoveTo node only listens for movement end or failure events etc
ok fantastic. I was getting to about 15 ai and it was starting to chug a bit so ill look into swapping it over to that.
always profile first
bottleneck might be something totally different
moving 15 ai should be nothing
Like only should cost 0.2ms or even less
well they are only are only 2d flipbooks so they shouldnt be the issue
ok ill have a look thanks 🙂
ok so did some testing and its definitely doing it only when the bot is moving. This is the setup i was using
ok i think it might have been the part at the end causing a loop even though it has event tick. Not really sure why i had that in there
thats not correct though
AI Move To already ticks behind the scenes, you dont need to update it with your own tick
AI Move To is pretty much same with BT's MoveTo task
so just have it go off event begin play?
yeah
also try to use BT instead
unless you really need something basic like this (which is fine)
if your game mechanics will extend on the long run its better to setup a BT
yea im just looking for something basic. Their aim is to get to the player (Which will deal damage) until there is no health left. Do i have to do the custom event to reset it because they seem to stop as soon as they reach me
probably MovementResults returns "AlreadyAtGoal"
cover all the cases and tie them to Chase node
from OnSuccess and OnFail outputs
by using Movement Result enum
Ok sweet that has fixed it. Now i can have over 100 with no change to the fps
Nice
Thanks for the help 🙂
Np 
Hello! Has anyone had much experience with using AI in a top down paper sprite game? My main issue is I am using sight as my main source of perception but my enemy can always see my main character through the walls because they are almost horizontal. Would sound be a better sense or is there a way to make AI not see through collision?
perspective on my ground plane
game view
it uses visibility as the trace channel by default
so as long as you block on that channel f.ex. via invisible colliders it should work
depending on how things work you can also change how the sight check trace is done, but for that you'll need C++ to implement IAISightTargetInterface
so you could for example trace closer to the ground to ensure it hits the low walls
I'd just build blocking volumes for my tiles
I assume you're using tiles
Hmm, I might have messed up.. I agreed to do a quick visualization simulation thingy for a navy event... probably going to cause me pain 🙂
I guess I could stick in a T72 or two and call it integrated intelligence or somethin
They want a visualization of some sattelites.. so might have to draw some satellite orbits
Its just a quad strip though thankfully..
I guess I'll have to write a scanning shader so we can show some ships being scanned by the sattelites