#gameplay-ai
1 messages ยท Page 160 of 1
hmm. you and i have opposite ideas of what is significantly less work ๐
though there could be good cases for dynamic navmesh usage instead... imagining a really "w i d e" door where you need characters to run across naturally such as diagonal
? I click a boolean on the doors problem solved. Alternatively I am placing down hundreds of nav link proxies
cpu work is a thing too...
navmesh update is relatively cheap, one way or another - doesn't seem like something thats done a lot, just on door opening, even then it could be set to lazily update every second and probably be fine. Funny enough, Death Stranding had to hand place a ton of nav link proxies over all cliff drops so the Ai could traverse down.
i mean...
- I would not personally ever call navmesh generation "relatively cheap". we might be agreeing that it's far from a death sentence, but it's not something you should just casually use. you could make it async so at least it won't hit the gamethread, but then it might incur a small delay before it takes effect now. I'll admit though it may not be a problem if your game is simple and you have ample CPU budget to throw away.
- unless you keep updating the navmesh while an animating door moves (expensive), you may have to wait for an animating door to fully open or close before you can actually invoke an update. that might cause weird AI behaviour, i.e. walking into a door that's closing or not choosing to go through door that is opening. with a nav link you could update it instantly when the door starts changing state. can maybe work around it a bit if you just have a collider for the door you turn on/off and the visual representation doesn't really do anything.
pros and cons anyway, do what you think is best
Any clever ways I can force a pawn off a ledge?
Not trying to get the AI to jump down to the ground - I want them to walk straight off the ledge.
If bNotifyTick set to true, what could be the reason to a decorator not calling it's tick function?
When you reach the end of a path, just keep going in the last direction you were facing?
AddMovementInput(FVector(towardsdeath));

๐
might be able to get somewhere adjusting some of these values. Perching, for example, reduces the "hang over" look and drops them instead, might need a generous navmesh though. Zoombapup and HoJo bring up good points. You could also change your navmesh generation so steeper areas are still valid
it could be sweet release! MovementComponent::GoTowardsTheLight(FVector(m_vYourAncestorsAreWaiting));
Well, you get notified as you change path points and the final path point to go to just goes in that direction until its reached, so you could fudge that part to just... overshoot a bit ๐ which seems like a very bad idea to me ๐
But it'd look funny
Just be sure to post a video here
lol TBH that's what I'm thinking
Thinking lemmings going over a cliff!
Do you ALWAYS want things to overshoot the paths though?
Is this something the player selects? i.e. a point to go to?
Or is it meant to be automated?
Automated, only when there's no alternative created
So, additionally, the nav is generated at runtime
(but that may not really matter.)
I'm just thinking that if the path itself is trimmed to the navmesh bounds, then you'll have to check if the last nav path point to see if its near an edge of the navmesh (i.e. a side of a navpoly without a connecting poly)
Aahh, lemmings. Good times.
I was also thinking of using nav link and making it jump to a point way below the ground and making em die over a collision box
That does sound sensible, use the functionality that's there
Or you could do a Rama and automate it ๐
Just launch yourself over any navpoly edge that isn't bordered by another navpoly
That sounds fun, I might try that ๐
hi. how can cast to player AI in player controller?
GetAIController()
its not work
my main player character have ai and i wanna cast to ai in the player controller
Okay, so where you cast to AIController and pop that into the playercharacterAI, that doesn't work?
Is it possible to disable AI Navmesh temporarily? Maybe that's my solution?
Its not the navmesh itself blocking your character from walking of the ledge
Its whatever movement component you use along with the path obtained
Disabling the navmesh wouldnt give you a new location beyond some random edge :)
hmm couldn't I override the character movement with just pure input?
if you just give the character movement input it will go where ever
only navigation movement locks into navmesh
Noooooooooooooooo
^ @viscid oasis
Not working unfortunately.
probably fighting against the AI which is in control of it or something
Hmmmmm yeah
reject ai controller return to lemminge
yes, you're right
Had to run it on tick, but aside from a little blend hop worked like a charm.
lol
It looks to get to the edge and then I override it. The challenging bit is my navmesh is generated over a voxel of instanced meshes
lmao ๐
Mainly with debugging, tbh.
It's really weird. My first character attempts to stop and the movement input kicks in, and over it goes
but the subsequent characters just walk straight over.
Herd mentality ๐ค or perhaps hive mind ai...
... my god
BP_Skynet
I wonder if I don't bother with an AI Movement toward a goal at all. I can just have it run as an input in a certain direction, and override that whenever I need em to do something else.
It's a 2D plane anyway, so there's no real pathfinding tbh.
yeah input is working fine.
Anyone knows about this? nevermind
Thanks for the help everyone
I'm using FindPathToLocationSynchronously to get a predicted movement for my characters but I've noticed an issue. The character (cylinder) on the left is possessed by another player and the one on the right is just a character placed in the world. When I try to path through the character on the right, the pathing avoids the character properly. When I try to path through the character on the left the pathing wants to move right through.
If I run show Navigation I can see that the un-possessed character on the right is affecting the navmesh and the possessed character on the left is not. It's the same character actor in both instances with their mesh set to Can Ever Affect Navigation = True. Any idea what might be causing this?
If I enable Runtime Generation I see players now affect the navmesh .. but the pathing behavior becomes erratic with the movement trying to correct itself repeatedly. It's important that my characters follow the predicted path from FindPathToLocationSynchronously. Players will move only on their own turn so I don't need to worry about players pathing into eachother
Are you calling move to several times?
You're updating nav mesh data for dynamically moving characters... Simply stop doing this, it's a bad idea. Use detour or rvo or implement some other way for characters to avoid each other
Oh wait.
Sorry I missed the turn bit reading too fast on phone 
Even still, you're going to have to do a bunch of weird messing around with this method
Like setting the currently active player to not affect navmesh gen, and setting all other characters to affect it, and update the mesh at the start of every turn
I'm ok with this and I appreciate the suggestion!
As for your original Q I didn't help at all for that, sorry :(
My original Q?
Like "Why are some characters affecting nav mesh and some aren't" ?
If an agent affects the navigation it causes issues
It wont be able to move properly or even fail to find a stable path for the goal
Because the point it's standing on wont have a navigation
I dont know if get the question right but
iirc you can also try to get the 'current path' from AI Controller instead of trying to predict it
And alter the process
I think I'm gonna try disabling affecting navmesh for current player and updating the nav mesh after every move. Just gotta find where to trigger the navmesh update/rebuild in c++
I know I've done it before somewhere (I think in BP) but can't remember where or how
Ahh, right it's a console command Rebuild Navigation
Which .. doesn't seem to work anymore. hm
Well, I'm calling UNavigationSystemV1::Build every time a player moves. I can't tell if it's actually DOING anything, the output log tells me
LogNavigationDataBuild: Display: UNavigationSystemV1::Build total execution time: 0.00s so either it's doing nothing or it's doing it really quickly.
My characters still aren't affecting the navigation mesh though even though I have them set to "Can ever affect navigation". I'm just waiting to see the navmesh update to show they are considered to be in the way then I'll deal with the tweaking of making sure the current player doesn't affect itself.
I'm thinking my navigation build isn't doing anything
how can i display AIPerception debugging?
I am in a laptop and cant press numpad 4
I'm thinking Runtime Generation = Static completely prevents rebuilding, even when you try to force it
it can't be rebound, as far as I know. You could turn on the on-screen keyboard and press it that way
It will show above your other windows
you have to turn on numpad in the options button though
here
You want to show AI perception debugging in the blueprint editor?
I think it can only run in in game - the component is not active when not playing
ok tyvm
Np
wow, updating old UE code from really old versions of UE to 4.27 is a real chore ๐
Whats better to use, pawnsensing or perception?
the boilerplate chatacter is not beign deteted by AIPerception sight what am doing wrong?
this was the issue
Well hell, I finally managed to get this damn thing compiling!
Kind of need an analytical method of getting closest point on the spline now though. Sampling it is not going to work out ๐
Man, its a long time since I messed with Unreal character movement.. anyone know if there's a default air movement velocity? I need some aftertouch when launched in the air.. I'm pretty sure there was?
isnt there a standard function for it?
Think so... but can't recall the name ๐ haven't touched this stuff in many years ๐
Same with the movement.. I know it exists, just don't have it saved in main memory anymore ๐
Hmm, doesn't that find the vertex and not the point on the spline?
There's a ton of options ๐
I found Input key to be the one i was after atleast ^^
Thanks, I'll take a look tomorrow
Technically, I want the distance along the spline in spline 0..1 space that is closest to a world location.. ๐
Knowing the total diatance of the spline, all thats left in my original function is to divide by it
I think distance had to be updated manually when creating it tho? Didnt play to much around with it once my setup was working
Thinking of how to minimize the number of "closest" splines I need to check..
Imagine I've got say 1000 spline paths
Need some rework aswell... some custom stuff .. where i can combine intersections etc
Probably some cached vector array of sorts
anyone can help with ai vs ai?
Probably fudge it and have a large collision sphere to enable the spline checking for overlapping splines.. then do the checks for those
then the physics sweep and prune can at least minimize the spline checks
I dont really need to know about the splines beyond the collision of them,
So that might be my best bet towards goal
Yeah, I'm riding them, so need to be able to check where to aim for etc
Im simply fomlowing them, the navmesh handles the pathing already so
Riding them - rollercoaster kinda thing?
jet set radio kinda thing
or jet grind radio if you're in US I guess ๐ for some reason they changed the name
wish me luck imma implement some flying AI
Hi all anyone know how I could have it so a For Loop from array dosen't fire the next loop until it's done one it is one ?
I'm trying to have it that the AI will got to array item 0 then on next loop on success item 1 and so one
In short, how would I make it so one AI pushes another out of the way?
What I've got right now is a series of AI characters moving towards a target location. When the first AI character gets to the target location, its 'AI Goto' node returns a success and it stops moving as if it were a static object. When subsequent AI characters get to the target location, they try to move around the first AI character so they can get within the acceptance range of the target location. If they manage to do so, it looks like they basically turn into a static object.
After enough time, there's too many AI characters sitting "statically" over the target location, the ones that have yet to reach within the acceptance radius are basically stuck perpetually trying to get there. What do I need to do with the AI that have already succeeded in their movement command so that they can get moved by those that have not?
Add another node following the delay. As far as the loop is concerned, the loop is done when it runs the last node in the body. Either that, or move the delay to before the move to node.
so I tried that it seemed to break the AI when it reached the first entry it kinda broke didn't really know whether it had succeed or failed etc so I scraped For loop for now trying a bit of a manual way of doing it
I am using a tile grid system of my own design, and I have a job system for when I tell my workers to, say, build walls or furniture. How can I prevent my units from walking into a tile that has a pending job attached to it?
I was thinking of using a grid EQS, but wasn't sure how to implement it
That would be wise. For loop wont execute latently. What you are after is more along the lines of a recursive function that decides to continue executing after a given time.
make your pending job nullify that are of navmesh
should I do this by spawning ANavModifierVolume's?
what is currently spawned/defined for the pending job area?
my jobs are UObjects, which are added to my UTiles which are handled by my AGridWorldController. the gridworldcontroller has multiple ISM's to manage the in world meshes for the tiles. the Tiles know about their location in the world, and have a pointer back to the gridworld managing them
so when the job for making a wall is finished, the job is deleted -> tile gets a new UInstalledObject -> the ISM manager for walls places the mesh in that location which updates the nav area
so my first instinct is to place a ANavModifierVolume at that job's location, but the default ones that get spawned don't have a brush made
i guess that works, unless you're saying it doesnt ๐ but i was wondering what was there because of there is already a mesh object to mark the pending job area, then it could just have a collision that affects the navmesh area, for example, first set it to obstacle just in case AI are current in or set to path through it, then to null to remove it (hopefully safely enough that any AI in that area have left it by the time it is nullified)
only saying it doesnt right out of the box because newly spawned ANavModifierVolume has no UBrush x3x
just need to fix that I think
ah, well if that doesnt work, maybe you can handle it with a simple mesh box that is hidden since collision can still work on hidden meshes
hmmm, ok
i know it sounds weird, im thinking of games where the area gets marked by a flag or the building framework or construction tape to show where it is to the player and that seems to double as a way to handle navmesh updating
oh, that. I'm going to be using a decal actor that references a 100x100 size canvas render target to "color" the ISM meshes for what's going on. namely used for my marquee selection
so the ISM gets creating after the pending job completes right? its not there during the pending job?
i think its a good visual call out, but also means you can handle the navmesh problem with that same mesh
I think I'd still need to block the nav area if I change floor tile types
most likely, but the pending area can handle the transition from normal to obstacle to null so that the thing built can already be null
i wouldn't think nullifying right away would be good for the rare occasion something is there already or is going through it, i guess if its turned based its probably not an issue
definitely not turned based, more like a base builder like rimworld
then i think it better to make it high cost (obstacle) first before nullifying
it would cover some situations, but i figure there still might be a problem where an AI decides to go through the high cost area because it's the only way to get through - then it nullifies, and now they are stuck, so i guess this needs a better solution regardless
Would you need a new nav modifier when you already have the mesh instance? With collision it surely can affect nav aswell
mesh hasn't been placed yet
Ah , and ISMs cant be set invisible per instance i think... guess you need a placeholder
yeah
right now I'm trying to spawn an AActor with a UBoxComponent at the location
i did recommend this ๐
I mean.....
guess my reading was to fast ๐
but would ISM even be necessary? its a temporary thing
true, it could be anything really
but walls?
there's a lot of questions i guess
if its a 1000 block wall, perhaps?
i think its like rimworld
I can definitely confirm spawning 1000 actors just to block off an area isn't a good idea 
reminds me of that other game... dont starve?
well, its up to the player isnt it?
I guess I'll make a ISM for this
dont starve is more 1 by 1 as you mention
thats what i was thinking. Either block the player from doing this in the first place, or atleast dont crash to 1 fps if they do ๐
i think in rimworld you can cue up several tiles
yeah
so yeah, i guess limit the player there
i was actually thinking of 1 tile at a time
well the AI units can only work on one tile at a time, but right now if they stand in tiles that have pending jobs then another unit builds a wall on top of them
well... couldnt you tell the AI to get the hell outta there at some point?
which I could either A: teleport them out, or B: prevent them from standing where a pending job is
before "completing" the building, get all units in volume, and tell them to gth out
the issue i can think of, is a situation where multiple tiles are already built on and then building another makes it very limiting to where the AI can path to, but i still think its better to try to tell the AI to move somewhere then solve for teleport
Try to move -> if failed -> teleport
i think there is a degree of player-made problem, like boxing in their own units, but aside from that, the AI should obviously try to get out of that area
Have a "reserved" flag on the tile, so that pending work disables new workers going there?
That wouldnt directly work with existing solution I think , since the ai is already using the nav system
Oh, so you already have an object.. so my advice, would be to disable collision on the builders and tiles entirely
atleast, as i understood it..
nobody ever collides the builders with the tiles ๐
use the pathfinding to avoid the tiles sure.. but collide? nope
yeah, using it instead of doing something like adding A* pathing ๐
don't do that ๐
A* is easy man
collision is way too bloody harsh and has tons of edge cases
like preventing the unit from standing on a tile with a pending job 
There's even an A* pathfinder in the codebase, built for Fortnite back when it had builder mode
yeah, but a pending job shouldn't block a unit right? so having collision on it is weird
seriously, play almost any builder game and you'll see, the units path through "pending" builds.. they path around built items
semi built is also blocking, isnt it ? in games where there are stages of build progress
i was thinking of when the job completes and several other jobs have been cued, how the AI could path out but then has to continue to find a place to move to until it can find a free space - though again, i feel part of this is caused by the player - meaning the AI could still get boxed in
i dont play many builder games though ๐ฆ
Well, yeah, players can always be idiots.. but you can always teleport in those extreme cases, or just let the builder die (timberborn kills em)
the ones im thinking of usually have a buffer around the built structure
Its different between completely unbuilt but planned and building-in-progress
Ye
it would seem better to make the area high cost before nullifying it to get AI out of that area and hopefully keep them out, but even then, its not 100%
Yeah, this is the kind of fun project where you have to playtest what happens
See what you find acceptable
But for my part, I'd try and avoid physics interactions on objects as much as possible, both for performance and for AI reasons
haven't really seen many 3d ones, tho xD
The earlier conversation with building around AI is amusing. I play Oxygen Not Included.. They didn't bother fixing it, they just mark the ai as "Entombed". Suffocating til death or release. ๐
yeah
Timberborn kills your builders for all sorts of reasons ๐
Not sure there's a proper fix for it anyways ๐
well i think boxing in your own AI is the fault of the player
I don't think there is
im just thinking of how to get the AI the hell out of build areas in particular cases
I think its fine to kill players boxing in builders... its another mechanism the player can learn
heck even The Sims kills the npc if the player blocks them ๐
i agree, or maybe the player tears down what they built to free them
You don't, you just don't collide them and hope the pathing has reduced the chances
teleporting could open you up to much worse things anyways
all these bugs, edge cases and whatnot
lol, still sounds like the same problem of trying to get them to a free space somehow
I guess the teleporting thing depends a lot on the game style
Anyone who plays a builder game more than five minutes pretty much understands that you have to build things up in tiers. And as a developer, you really shouldn't fix all the player's problems or you're making an ant farm more than a sandbox game. Player still needs to play the game.
i still like having a buffer, but only if that works for the design obviously, then the AI can always move between built tiles
well in my case it might work, since it's going to be a robot themed game, so teleporting them out of stuck situations may work
Not really, I mean they're meant to be doing something, so they shouldn't be hanging around on a tile in progress anyway
i agree, the AI will probably be doing something, though in some cases and AI might want to path through a built area and then gets stuck ( i guess they die ) or the player builds a clustered area of stuff all packed together making it limiting where the AI can move out to
Deploy "escape" jet-packs!
i think it would work to have them "ghost" through until they can get to a navigable spot
just b-line to nearest place
I think most games get around it by not building things immediately. So if you build an enclosure, most of the AI will be able to pathfind out of it by the time its complete
and if worst case, put a timer that kills them if they take too long
I guess this is something you should test per-game
im thinking of blizzard rts games where there is a buffer between buildings so builders and similar sized units can always move between them
Build rates and number of builder units etc.. probably impacts this a lot
pretty sure the buffers are high cost
can't really do that, remember this is a base builder like rimworld or dwarf fortress, but in 3d
games ive not played ๐ but if it doesnt work it doesnt work
kill em, kill em all
robots would just run out of jucie , stop working
Is it normal my KeyID is 255 from the beginning?
I guess this is causing the issue I'm trying to solve since yesterday
Same blackboard key on another BTTask is not 255
that's an invalid key though 
Isnt invalid is -1?
no
lol Epic setting a negative value for uint8
typedef uint8 FKey;
const FKey InvalidKey = FKey(-1);
It'll be 255 if set to -1 i guess
so the obvious hope is that you just didn't pick a key with your FBlackboardKeySelector
and the non-hope is that you found another bug in the least maintained systems in UE4
I guess I found a bug or I discovered something else
Because I solved now
TargetGoal.ResolveSelectedKey(*OwnerComp.GetBlackboardComponent()->GetBlackboardAsset());
I needed to call this manually
Why would I have to* resolve the key by myself on ExecuteTask?
Anyway in the end it appears to be fixed, thanks for showing interest in my issue HoJo ๐
Yiure gonna need more specific questions as well as do some research yourself
Try to figure out how to make AI and if you get stuck on a specific problem then you can ask here and get a useful answer
Sounds like you might be better off using waypoints than the ai pathing. I feel like it will be tough to get that level of accuracy. I think the biggest thing will be making sure your agent radius keeps the ai an accurate number of units away from the walls
(this coming from someone not super experienced with this)
Hit "show > navigation" in the editor to see the effects of increased agent radius
Yeaaah, I've had similar experiences with inconsistencies in the AI movement. Actually very similar to what you pasted there except my problem was the AI would slow down around corners https://www.youtube.com/watch?v=X2X5gexrugo
Hmm maybe try tweaking the "Max Simplification Error"? If I see to recall, that will affect how complex the shapes are
Might me able to tweak it to make the corners more .. corner-y
Hmm, try tweaking the character movement's acceleration too. Possibly if it's high enough you won't see the slowdown?
but it might just kinda jitter around .
You're welcome!
In the characters make sure "Can ever affect navigation" is disabled for the class defaults, capsule (if there is one), meshes, etc
Oh wait, are they TRYING to walk through eachother but they collide?
Ok, that's just normal collision that needs to be tweaked. Gotta be either capsule or your mesh that collides with others of the same type
What is the "proper" way to change navmesh generation? (Cell size + agent radius). I see I have these properties directly on my RecastNavMesh in the world but editing them gives the error
LogNavigation: Warning: Changing AgentRadius directly on RecastNavMesh instance is unsupported. Please use Project Settings > NavigationSystem > SupportedAgents to change AgentRadius
If I go to NavigationSystem > SupportedAgents, I can add a supported agent but what exactly does that DO? Define defaults to be used for RecastNavMesh instances? I deleted my recastnavmesh to force it to regenerate and now I get
LogNavigation: Warning: NavData RegistrationFailed_AgentNotValid, NavData instance contains navmesh that doesn't support any of expected agent types.
Really unsure what the proper process is here.
Oh, I see.. it's weird. You gotta change params in the Navigation System settings, then delete your RecastNavMesh, then click your NavMeshBoundsVolume, uncheck "Supported Agents > Default" (or whatever your agent name is), then check it again.
I get some REALLY weird navmesh generation though. I mean, look at this. With an agent radius of 20, it generated the mesh so it literally clips into the object
Ok so that โฌ๏ธ is a result of the Max Simplification Error. It simplified the shape so much that it clipped the object.
Do you have the mesh set to no collision?
Hmmmm are you sure there's no other component on them that might be colliding?
I guess it's POSSIBLE it's the AI movement doing this. The movement finds it can't go around the enemy so it completes a partial movement that just leads up to the enemy ..
For testing, maybe make the path wide enough so that one COULD go around the other and if you could just plop an enemy down and keep it stationary
make sure that the moving enemy goes around instead of trying to go through
that should at least tell you if it's the AI pathing or something weird with collision channels
Ok, so it is an AI pathing thing
Somehow your enemies are still affecting navigation
It's weird because they should not affect nav generation by default
What plugin? Just out of curiosity
When an AI move is blocked, it will sit there trying to move for 4-5 seconds without success. Is there any way to lower this timeout?
โฌ๏ธ Found my answer
UPathFollowingComponent* PFComp = GetPathFollowingComponent();
PFComp->SetBlockDetection(5.0f, 0.2f, 3);
These numbers are for BlockDetectionDistance (default 10.0), BlockDetectionInterval (defaut 0.5) and BlockDetectionSampleCount (Default 10). By lowering the detection distance and sample count, my AI will timeout within a second if it is blocked
Question; for static navmesh level streaming, when building a path to an area that is not loaded, does the path building job handle loading in the sublevels?
Doubt it
Anyone have success with the crowd avoidance? My AI keep running into eachother .. it's like the agent radius is too small, but I see no place to configure that. It doesn't seem to use the same agent radius as normal pathing
Here's what my crowd detour currently looks like. Often the player will correct themselves multiple times, sometimes they will get stuck on other players. I really don't care if they take the FASTEST path but I definitely want it to work cleaner than this, ESPECIALLY since there aren't even any other moving actors.
Is there no way to retrieve which "CanBeSeenFrom" point the AI saw the perception stimuli? Currently my working solution is to do those traces myself to retrieve that data.
Does behaviour tree has a OnEnd/OnFinish event that i can bind to?
there might be this of a specific task or condition, but not the tree itself, BT executes as soon as it is told to run
but it does know what is loop or runonce
BT's can loop
anyway I can get an event when it restart from root?
Ah I mean, it does know where root is to return to it
any event indicating a restart/end that I can get?
There seem to be no composite node event.
i still dont get it, i think you're trying to do something that doesn't fundamentally work with how BTs operate. I believe BTs execute from the root each time and will change to a different branch based on how conditions change
you start from root, then a selector to decide which branch, even if there is only one, are you trying to check something from the root level every time it executes? I guess there might be a way to run a task at the very beginning of the BT each time as a way to determine when it restarted, but again, im pretty sure that's every frame
Hello, I'm working on City, i want create traffic with simple cars (color boxes/pawns). I know i can use splines but I don't know what to start with. Then i want to spawn car and tell him to go to this location and he will go along the splines. Any help
Hey ! I followed a Youtube tutorial to start with IA, i'm quite happy with the result
My wolf is chasing me and attacking me when in melee range.
Issue is, because of the 1.2 second delay, he is not moving anymore when he's attacking. It's waiting his attack to finish before allowing him to move again.
I'd like to copy the WoW mechanism on that matter. But if i change the Parallel finish mode, it wont even wait for the attack to be finished.
How to make him finish the attack animation while chasing me if i start moving during his attack ?
yes i use a anim montage
upper body
i think ive done like the tutorial says
in the tutorial, result is the same
the character is attacking without moving xD
he set up so he can attack while moving with the player character
but the AI doesnt
So, if I understand correctly, you don'
t want the wolf to move until the animation attack has finished, yeah?
no no, that is what is happening right now
I do want him to be able to move whatever he's attacking or not
right now, attacking makes him stop moving
๐
So, two things obviously to check. 1. the actor is allowed to both move and attack at the same time. By the sounds of it, that's working.
Now you want to ensure the animation blend is able to work with the wolf attack animation + whatever locomotion?
yeah
thing is
i feel like right now
even if he's attacking while not moving
only upper body attacks
i mean im fine with that
but maybe thats a hint
regarding how the logic is right now
Yeah
maybe i did the blend wrong or smth
okay, and locomotion is a blend 1D from idle (X=0) to full movement (X=400) or something like that?
yeah cool cool.
So from what I can see your instincts are right - you want to blend between the two animation from a certain bone and up / down
i guess yeah
Okay, I'm a bit rusty but try a blend depth on your wolf neck of 1, not 0.
And see what happens.
And triple check if that bone is called what you're referencing there.
yeah i copy-pasted it
yeah nice
let me try depth
it doesnt change anything
i mean im actually unsure
thing is he is attacking while "finishing" movement
or if you prefer
he's starting the attack before stoping movement
but attacking leads to stop movement
i feel like this main issue is related to the Behavior Tree
Show me the BT?
removing the delay will cause him to not have a cooldown
the 1.2s delay is in MeleeAttack
That's okay. Would it work if his attack animation had to take into account he's ready to attack again?
Ahh
Ok, first reverse what I've done JIC.
Cool
So, in your attack montage, you want to create a notify
that signals the end of the animation.
What you wanna do is have a way for your BT to check if the wolf is ready to attack again. This is different to your cooldown and is more about the animation has completed.
so its too soon in the anim
i thought it was to be used later
to trigger the damage
Yeah, but you also want to notify that the montage is over.
yep.
There's a few ways to do this, TBH, but this is a way I prefer since it's more event-driven.
Yeah like 'AttackFinish' or something.
i want his cooldown to be longer
I reckon start your cooldown after the animation has finished, but up to you.
Great question
ok, so your anim notify can be signalled from your animation instance.
AKA animation blueprint.
If I recall correctly, this can also be called on your Pawn BP too.
Either way, you want to then get a reference to your AIController -> BT -> SetBlackboardKey(Bool) bWolfAnimationReady (or something).
So, first create the key in your BT.
bool ?
yeah true / false.
Boolean value.
There's different types of Blackboard keys you can set. One of them is a bool. You still have to feed in the name of the key.
Ah nice
Then we need to programm a new task ? or service ?
Ah you can add it as a task I think
(I can share screen in pm if you want)
those are decorators
shall i create a service ?
no ok
but its a service i mean ^^ not a task, right ?
started this :
wonder if its the right positioning
Close. But I'd treat the 'wolf animation ready' as just a value.
And I'd set it off and on via the animation BP.
with a cast, then
Yeah a few levels deep, I'm afraid.
We need to tell the BB about the new value.
This is how I'd do it, but there's other ways naturally.
so I'd image it'd be a chain like Blackboard->AIC->Pawn->AnimBP
oh i was starting in the event graph from the animBP
but ok
ok, where do you create that chain exactly ?
in the AI blueprint ?
Cool
do i use the notify there
yes
I've created a bool : "IsAttackFinished"
Great
How do I set it ?
Where have you created that bool?
Ah, no create it on your Blackboard.
Great great
So, now you have to reference your blackboard via your animation blueprint.
this i fail to
Well, how do you think you'd go about it?
with a cast ?
i cant cast to Blackboard_wolf
also tried cast to BB component
dunno what to put in there
Why can't you?
dunno ๐ถ
heh
trying this
Ah, good idea but our blueprint doesn't know how to reference that.
You've gotta move up the chain, so to speak.
so, AI
So if you wanted to reference your pawn, how would you do that?
You know where the AI lives?
I mean, your AI Blackboard / Behaviour Tree.
hmm kinda.
self actor ?
Let's talk about inheritance for a second. That'll help.
You know how inheritance works?
Okay. Well, basically things inherit from a base class. This is kinda fundamental to OOP but whatever.
okay
Okay, so in a typical game
PlayerController
---- Pawn
---- SkelatonMesh
--- AnimationBlueprint
right
Ah, technically the pawn doesn't live under the player controller.
The Player Controller just possess the Pawn - makes a reference to it.
But I digress.
yes true
When you have AI
AI Controller
---Pawn
---- SkeltonMesh
---AnimBP
--Blackboard
--Behavioural Tree
Same deal - pawn doesn't technically inherit.
So, in most cases, you have to tell the blueprint what you want to access and see.
Yep, but we need to go up the tree.
cast to AI_wolf ?
Gotta up the tree
AI Controller
---Pawn
---- SkeltonMesh
---AnimBP (start here)
--Blackboard
--Behavioural Tree
isn't AI controller the top ?
my AI controller for wolf is AI_wolf
Yeah ?
Okay, so you're at the blueprint animation.
That's okay. This is a new mental model
I'll give you a hint
The AnimBP is directly accessible by the pawn.
BP_Char is my pawn.
Unreal, understandably, has some things under the hood to make accessing parent objects easier / safer etc.
Good! BUT! How does the blueprint know what sort of controller you're referencing?
still cant access blackboard_wolf
yep; you're just saying 'Hey, blueprint, I want THIS specific class."
Great question.
controller will work with both i guess ?
I'll be honest, AI Controller for me doesn't work for some reason, despite my having an AI Controller.
Controller for me works. I'll dig into the code.
using the normal one
Defs if it's a Player Controller ,it's controller.
So, with how AIs and stuff work, you won't get access specifically to a Wolf_Blackboard.
So we gotta use a name reference to that specific key.
ok thats why
this is what i was missing
In this case, it's a name.
And it's VERY specific, so be careful
I've had issues in the past with conversions of strings to name, or enum to literal bits etc.
Strings you should be fine, but JIC, use names.
nice.
so now
i dont really know if it will actually help in the behaviour tree
what i mean is
2 things :
- should not this one be elsewhere ?
and 2) We need to untick that boolean at some point, right ?
just in case :
Good questions
Q1. Should that be elsewhere? Well.. it's up to you.
Basically, if you don't want your wolf to do anything until that animation is true, then put it there.
but entirely up to how you want to approach it.
In answer to Q2; Yeah, you want to have a trigger for when the animation starts and when it stops.
And it's almost identical to the animationstart - you just need an animation notify for when the animation should be finished.
well i feel like i dont want to interfere the MOVEMENT with my IsAnimFinished
as i said i want him to be able to move freely no matter what
if a wolf chases you, he wont stop when he has to bite ^^
alright, so again another notify
aaand another question to myself on where to put the decorator
the other way around, right ? We just did that, setting animfinish
Hey,
I have used a single blackboard for two behavior tree but the boolean keys seem to have different instances for both the boards. Any way I can use the same instance of the board?
@round sand yeah, should be a setting on the blackboard that says sync. (or something like that)
@astral sail Yeah, pretty much you're just setting the bool value the other way.
This might just be a UE5 thing, but in my test I had access errors if I didn't reference the component directly.
in my cpp I think i have made objects of blackboard instead of using the one which is already been instantiated
@astral sail might cause you issues -
what do you mean ?
Looks good - run a breakpoint on that 'Get Blackboard' JIC.
There's a func called 'GetBlackboard', and there's the component itself.
yes, i'm not touching that
Try GET and if you have issues, reference the other one.
It'd be pointing to exactly the same one. My AI Controller is a bit modified
we re using this one
Right click on that node
er.. component.
And 'Toggle break'
Basically the system will stop and take you to that when it's triggered. Handy for debugging.
that will debug what ?
Ah. Debug as in if you have a bug in your game
It can help you get rid of that bug - debug.
nevermind
i mean
i understand this helps debugging
without having to print string or wtv
but i dont know how you get notified
that, i.e., this castTo failed
The editor will literally stop and take you there
When that point gets highlighted. You can hover on the end points and it'll say stuff
Yeah, it's fine for small things, like 'is this running?'
okay
Don't worry too much about it.
so now
that i have my 2 events
i dont know where to put the IsAnimFinished decoration
in melee attack ?
yeah that's what i thought
but
that's why i was wondering about the link between all of that
and my issue ๐
how is all of that related
mmm?
Sorry, I'm not sure of your question?
Well
Should the wolf be able to move regardless of its attack?
well that was my issue , maybe i misexplained
its like
he is stoping
when he's attacking
It looks as follows :
Chase me => Is in melee range ? Yes => ATTACK and wait before doing anything else
I guess you want to check if the wolf is able to attack again?
So maybe you put the animation ready check in there?
Yeah, see if it's somewhat working
right now
Then tweak it based on your logic.
What's the default bool state?
Click on it in the BB
no but like
i think i know why
and thats why i was wondering
about the positionning
of that decorator
like
this bool
get touched
when the attack anim is called
but at the beginning, the wolf doesnt attack me YET
so the Bool IsAnimFinished
is False
and will ever be
hold up
Your bool state - is it telling the BT that the wolf is ready to attack, or that it can't attack?
Okay, so if there's no animation started, you can go ahead and do the rest of the BT, yeah?
well, the decorator is at the top
so i guess it returns false
at the very beginning
and that is why the wolf isnt moving ?
Yeah, so it needs to have it's default state set to true.
how do i do that :/
i mean i can set it to true at begin play
but i feel like it wont help us
let me try
Nah that'll work
You can also just reverse the decorator - to 'not set', and switch your aim notify
So if the wolf attacks, turn ON the bool.
good
everything is smooth
but
i have the same issue
regarding wolf's movement
its same as before
As in, the wolf is moving and not attacking, or attacking and not moving?
lol which one?
in "MeleeAttack
"
now he doesnt wait between attacks
he'senraged ;D
same pb as before
i put the delay in what we've created maybe ?
heh
So, the wolf attacks and keeps moving?
Monitor your BT as the wolf is moving - see if you can follow it along
doesnt work, as the BT is the master
yeah i have two screen
i know exactly whats happening
shall i screenshare ? ๐
sure
Is there any way how I can get a blacboard value into a EQS context?
I have a vector position n the blackboard and I want to use the position as a context for EQS generator
but the blackboard key selector have nowhere to be shown, because the context is just an item in the generator
hmm, I think I found a "solution". I will not search for the blackboard value from the context, but I will create a standalone task that will take the blackboard value and hard-set a context value.
the context will basically act just as a temp data structure
@elfin sonnet how are you setting context values directly from a task? Just wondering as I had some EQS stuff I wanted to parametrize and it didn't seem very straightforward to do that
yeah I havenยจt figured it out yet, but I just discovered something called FAIDataProviderValue - that could maybe work with the first method
Ah :)
Excuse me. I am planning to make a 2D game in which I have the player have a circle around him. I wanted this circle to interact with collisions so it doesnโt pass through them like this: ue4 3 - YouTube so I followed this tutorial here: Ue4 Tutorial - Stealth Vision Cone (Procedural Mesh) - YouTube and created it with EQS. My issue is to know h...
yeah, this seems to be it
gonna try to replicate this
so maybe the context could take the value from the generator data-bound value
It would be handy to be able to directly pass values into the context but it doesn't seem like how it was designed which is a bit odd
I looked into it a bit and couldn't find a good way to either construct a context, pass values into it, then pass it into the query, or get the context from a given query object.... I'd imagine it might exist but wasn't very obvious at least where it is
my main problem is that I can't pass the blackboard values by reference (into the EQS context) so I have to hardcode the BB key names, lol. I will see if that works, but for obvious reasons I'll have to write a custom generator that will hopefully be able to choose a BB key by variable.
and then somehow get that variable from the generator to the context... if context supports getting the "parent" generator
but I have no idea if that's the correct way
something that could be worth a try is try getting the querier
if you pass the pawn as the querier, you can then grab its AI Controller, and grab its BB
you could then access the BB directly, and maybe you can set the BB key names as parameters for the context so you can configure it in the EQS editor
Whether it's any better than what you proposed not sure :D
oh yeah, I am actually doing that now ๐
I am yet to test it, but I think it will work.
I had this, but that ofc doesn't work (there is nowhere to set the values in the editor, the context is just a data structure for the generator)
so I have to hard-code the key names as FName
instead of FBlackboardKeySelector
if it won't work I will have to read up on the FAIDataProviderValue and eventually try passing the "start location" via the generator into the context
hey how to sync a single blackboard with two behavior trees?
Hello, I'm working on City, i want create traffic with simple cars (color boxes/pawns). I know i can use splines but I don't know what to start with. Then i want to spawn car and tell him to go to this location and he will go along the splines. Any help
You'll have to try something first. You know you want to use splines already, so just look at the spline component and what functions its got available to start with.
yeah but main thing for me is how to make AI find path like what splines do bot needs to use to get to location
sort them by distance from the end of the spline to the target location?
It sounds like what you actually want is more of a graph
say a graph of waypoints.. a "waypoint graph" if you prefer ๐
I wonder...
Waypoints sounds nice actually
But i wonder how i'd solve the pathing in terms of when to force ai over a road vs free walk
If a waypoint is within treshold, but is not connected to a endpoint at desired location (within treshold) but still gets the ai closer... should it follow the road..?
Guess i should just play it out and see what fits
Guess regular pathfinding solves it anyways . Probably no need for custom waypoints
Sometimes its best not saying anything ๐คฃ
can't wait until AI psychology and disorders are a thing
we're in a for a ride
Hasn't there been a couple instances where they became extremely racist or something, that vaguely feels like an AI mental illness lol
Microsoft's Twitter AI was a nazi lol
Rubber duck time
My projectile is set to report noise on hit, however my AI seems to not hear it and to into investigate mode. Le why?
I would start by debugging whether the appropriate nodes even run. Does the noise get reported at all? And does the perception update run at all?
Thanks for answering, I'll double check
Negative
I can shoot at his feet and still no response
Yeah so check if the report node or the perception event run
since first need to eliminate the possibility that the logic is wrong there
Secondarily, I'm not a 100% sure what "TargetLocation is set" does in the blackboard decorator, since technically speaking a vector is always "set" since it can't be a nullptr
so in theory that could be an issue
It does get called in the projectile on hit which is good
TargetLocation is where the hearing ping is
Is it a valid location
Is the question ^
If its an invalid hit, fvector would be 0,0,0
I'll double check, gimme sec
Not sure how a hit could be invalid but who knows
Aye, okay so in the AI controller, I need to find out if the Stimulus Loc is a valid loc?
I'd just print it before/after setting to see what value is being put into it
^
Will do
Gimme sec, and thanks SO much for assisting guys
100% not even getting called
That's in the AI controller
bullet hit is fine, I have vector
Ah ok
Did you remember to configure the hearing sense?
Hearing looks correct, is the detection by affiliation set up how?
This ist he DefaultGame.ini
I was instructed in the tutorial to add the second script for AISense_Sight
Perhaps I need to add the hearing to script in the default game .ini
?
I don't think that's the issue
I've never done that..
๐
Anywho, we know it's not sensing it in the AI controller at the very least
Isnt there a component for the noise stuff?
This is inside the projectile
Not the reciever but a 'sender'm
Chris has hearing set on the actor and AI
@crimson galleon Come again?
was responding to Squize
Oh
At this point in my prototype, only my player character and this projectile has AIPerceptionStimuliSource component
In my player, it's set to this
In my projectile it's set to this
you followed/watch that one ai tutorial with the drone scanner enemy?
Ayeeee
maybe there are other vids on hearing that can help
I have some experience with hearing, but I don't think it was efficiant. I had a Make Noise running on a tick which worked, but I don't think it was the best
That's the thing, I'd have to cycle through so many vids and just to get to that one tiny moment where my exact problem is touched upon. Some of these vids are hours long
I have it working on step
Crouching makes less noise etc
I tried on stepping, that didn't work either haha
There was something about loudness that was messed up
Actually it did, I didn't have the instigator plugged in. Well walking makes noise and works haha
๐
okay, some progress, turns out hooking up instigator to the actor instead of self worked...but I don't know if it's the whole bloody actor loc or just the loc of the shot yet
id assume the loc your feeding into the report
do you destroy this projectile after it hits? like after the report?
i cant imagine it being the problem, but maybe it existing for a little longer, or perhaps hidden so it still exists makes it work
it sorta makes sense, but shouldnt ๐
Aye, well thanks for rubber ducking @crimson galleon @misty gale @misty wharf
Wouldnt instigater be whoevever shot the bullet ?
Ideally, but when I do, it does not work
You had self
I put Self in but when I do, it does not register
Can you explain that but differently
reference the player who shot the bullet...
?
that would be the location, but i think instigator is the one who.... instigated it
Not hardcode player char
When you spawn the bullet
You either plug in an owner or an instigator, or both
might as well try this to even see if it works
Instigator plugin player
Then get instigator for instigator in noise event
As in, in the projectile, in the noise event, somehow get instigator?
This part, I'm confused
Ye
So then now I can GetPlayerCharacter in there?
BTW this is working, the AI is moving towards where I shot now
Aye, I guess I ask that because the Target is Self
So that would just be a Self (projectile) is the instigator, not the player
I'm probably just not understanding it right though haha ๐
And projectile is destroyed
So instigator = null
Instigator of bullet would be the owner/instigator of gun really
So for the record, this is what you mean right?
Yes
Now we're getting the instigator of the bullet, which would be the instogator of the gun, which in your case is the player
It could now be any player.
Indeed, well I call the projectile in the AnimBP on a notify
And the player BP has the player arms and AnimBP
So PlayerBP > SkelMesh > AnimBP > Projectile Shoot > Projectile
?
Unlike my setup but if it works it works?^^
Hell yeah, it totally works as intended now
so it was PEBKAC all along....