#gameplay-ai
1 messages ยท Page 171 of 1
Navigation Invokers are working as expected in UE5 for me. Is your Navigation Generation (still) set to Dynamic
you mean this?
Mmm I found something interesting, the ai character with the invoker that doesn't work is built at runtime.
Now, if I add to the scene a bluprint of the same class with the components already included, now the invoker of the other guy starts getting the navmesh generated
Like if the nav system doesn't notice that invoker is there until I add another one at editor time.
Just tested- for me, enemies spawned at runtime are invoking nav mesh correctly, and I definitely don't have any editor instances of that actor class in this test level
are you manually registering the invoker or that works automatically for you?
In my case I have added the NavigationInvoker component to my actor's C++ base class in the regular way-- perhaps the issue you're seeing is only when adding it as a BP component?
shouldnt be different though
pretty sure the only thing ive done is
NavigationInvokerComponent = CreateDefaultSubobject<UNavigationInvokerComponent>(TEXT("NavigationInvokerComponent"));
NavigationInvokerComponent->SetGenerationRadii(3000, 5000);
that, plus "generate around invokers" and also "Runtime Generation" "Dynamic"
that last one was what I was asking about earlier
its also easy to think its working if you have navmeshbounds still, because unless you tell the editor not to ("Update Navigation Automatically"), itll still generate it, and itll still work regardless of whether your invokers are working
Thank you very much, that one fixed it, I had it static.
ahhh- so it probably was pre-existing navmeshbounds that made the ones work in editor ๐
I guess this setting didn't exists in 4.27?
I don't remember to have touched it before
pro tip here-- hit ' (apostrophe) while facing a character, and hit zero on your numpad to pull up the view of what navmesh the character sees
there's a lot of tools in there, this one just tells you what is happening on the navmesh for that character at runtime
at editor time?
no at runtime
assuming you are using the normal playercontroller/character systems, it will use the center of the main player camera to pick an actor and let you look at some things related to that picked actor's controller -- like navmesh, behaviortree, eqs, etc
obviously only useful with a player controlled camera
' does nothing for me
youd need to be in PIE or standalone (unpackaged) but otherwise it should work
I don't think these show up in packaged builds by default
(assuming you are using the standard character possession system)
Semicolon triggers some debug info, but ' does nothing, either PIE or standalone
maybe its " lol
for me its ' though-- i have no idea why itd be different-- this is* a UE4 project upgraded to UE5 like yours was
Ahh cool, it's the keybind that doesn't work, via cmd EnableGDT does it
i think they changed it to shift+' (")
I'm going to bed, thanks for the help!
Glad to help!
Anyway of extending the debug view for EQS tests? For example showing a debug line trace for every item for the EQS trace tests?
Not sure but look in the code for the appropriate test. They might have some options in there that might not be visible... if not, then you might need to just make a custom test (copypaste the original test's code into yours) and have that draw debug info. Also, Visual Logger might have test specific debug data but not sure
Okay, I'll have a deeper look. Thanks zomg
Huh?
You could write a test which checks the flag I guess but it doesn't do that by default
yea I'm thinking about my inventory system and I figured I could just keep everything as an actor and hide, disable collision and disable ticking on the actor if it's in someone's inventory (without attaching it to the owning pawn)
but since EQS doesn't care and I want to use it I guess I'll go back to the drawing board
Hey folks, I have a simple behaviour tree which just navigates the character to a position, but this position is constantly changing. To make it work, I set Observe Blackboard Value, but that makes the character stop and start again each time the value changes. How can I make the target change smoothly?
actually I can just set my items to WORLD_MAX on Z axis to move them "away" from the game world in case some EQS uses a query of "get actors of class around querier within distance"
that should do the trick ๐
Doesn't that test use a sphere overlap so if you just nocollide them they shouldn't show up anyway?
the problem is that if I pick up an item in my game the actor actually stays at its old position in the game world (ticking, collision and rendering disabled) until the player either equips it (then it's attached to pawn) or when it drops the item (then world location of the item is set in front of pawn). EQS queries still pick up the item from the position where it was prior to picking it up, even if ticking, rendering and collision is disabled on the item actor.
Like, the EQS querier goes near the spot where the item was, then the get actors of class inside radius generator would get the item's pos
on the ground
instead of nothing since it's picked up by someone
How come you wanna keep the actor during that time?
What purpose does it serve to be in the world if it really only is data in an inventory?
Depending on how they are implemented it can make sense. For example to hold actor specific data
Fair enough, but in this case it seem to add trouble to another system :p
Could be worth it tho, idk.
I ended up using actors because that way I can use actor components for handling them
for example my inventory is just an actor component that stores any kind of actor that has an item component
that way every actor can be an item and I can even change that during runtime by adding and removing components from actors
and it's easy to place them in the world too ๐ค
in editor
I mean, yeah id use actors aswell, i just havnt had any reason to keep them alive after i pick them up ^^
I might end up turning them into uobjects but then I'd have to reconsider how to handle the whole actor component thingy :\
Its not super obvious to me how thats very beneficial over regular interactable hieriarchy or interface
Toggling it on and off should be a breeze
Just destroying it, and spawning the same class again..
Issue here was my target was going outside of nav mesh bounds, hence the weird behaviour
Usually its a very fixed set of interatctables/pickups anyways (not like you suddenly decide to put a powerplant in the pocket)
Annoying when that happens
Anyone have any clue why my AI's might be getting stuck on this edge? Navmesh largest step height = 35, character largest step height = 45, so since the navmesh is generated across it, and the char's step height is higher, shouldn't they be able to cross it just fine? ๐ค
(the height of that step is about 25 units)
collision hitting the capsule at weird angles?
Maybe, but from what I understand it shouldn't matter because it has the whole step up thing in CMC ๐ค
It's probably collision in some way. Maybe you have collision on for your AI mesh, and it's sticking out of the capsule?
Checked it, and although it had collision on the sprite component I turned it off and it had no effect
I guess I'll have to add some breakpoints into the CMC code for stepping up and see what it's doing there
Is there a way to make floating pawn movements turn when moving around? Or do I really need to use character movement for this invisible reference object?
I just run this on tick
What's the best way to "pause" a behavior tree, say for something like a robot that gets temporarily powered off?
Didn't rotate at all.
you probably put it in the wrong place. That's a screenshot of live, working code for a floating pawn that rotates
On tick.
In the actor I want rotating.
I'll double check my nodes but I'm sure I copied them exact.
Only difference is the speed, I just set that to 10.
That might actually be your problem, mine is set to 360
I'll try that but even at 10 the values themselves weren't changing at all
Nah, still not rotating.
there's a node called Claim Resource or something like that, if you claim the Logic resource using it, this pauses the behavior tree... there may be a pause on the BT as well but don't remember for sure, claiming should work either way
Has anyone had any luck with Smart Objects?
I've followed this guide from epic exactly, and its not finding the smart objects in the level.
https://docs.unrealengine.com/5.0/en-US/smart-objects-in-unreal-engine---quick-start/
What does it mean when the AI seems to trigger BTT_FindWeapon over and over but a breakpoint on the code inside never triggers?
The AI itself completely freezes/breaks infinitely
do you mean that breakpoint on the node to the right of BTT_FindWeapon- if so then BTT_FindWeapon is failing. Sequences stop at the first failure.
no sorry, a breakpoint on BTT_FindWeapon triggers but any breakpoint inside on the code (to see why it fails) does not
this breaks
id normally say it was a blackboard condition decorator but there isnt any
ah, I'm on an older version so might be the same thing
4.24 I believe
Sometimes the BP debugger needs you to have the specific instance selected for it to break
Which can be an issue with things like bt tasks :P
I tried all of them, no dice
Best to just print the data you want, the debugger is unreliably anyway
i wonder if this one is firing?
Gotcha, just wanted to check if I was being a dum dum ๐ thank you
ah that's interesting
the execute AI should fire always if the node actually executes
abort fires if it gets aborted after it has activated
yeah the debugger really is squirrelly in here
like a finish execute not succeeding or what would an abort be?
if a decorator causes the branch to exit or such
ah, right
finish execute with false will just result the node counting as failed
I dont think that's it but thats really good to learn
Yeah you usually don't need to deal with the aborts for tasks, unless your task is asynchronous and doesn't finish immediately on execution
abort is useful if you are waiting for an event, so that you can unbind your listener
its not that the debugger never works though
im seeing good fires on BT tasks testing here
Yeah it works most of the time for me as well :P
yeah
usually it works ok but I've noticed when it gets stuck in a loop like this it never does (and thats when I wanna debug the most haha)
bigger problem is that it often doesn't show any of the values when you try to inspect them so it's a bit useless for that
one caveat here
the way blueprint debugging in general works (in my experience), is that if you have a breakpoint somewhere, and you continue, and the very next breakpoint would be the same breakpoint, it will not break
it should but it doesnt
if you then add a second breakpoint and then hit continue, continue, continue, it alternates between those two as expected
bigger problem is that it often doesn't show any of the values when you try to inspect them so it's a bit useless for that
almost entirely useless yeah
its a yahtzee moment when it works
very true ๐
Lately when I inspect values I get a full on crash about 1/10-20 times... painful
ouch
curious what the crash is
I'm the crash curator, it seems (windows 11, rtx 3080ti, ue5)
feels like I've seen everything by now
Does anyone have an up to date AI melee attack system. I followed this one and the AI just never attack. Been stuck for hours. https://youtu.be/HuH3MTWGDNk
We have now got animations in place for the melee attack and now we are going into the behaviour tree to add the behaviour to the NPC to attack us when we are near them.
Link to Attack animation: https://1drv.ms/u/s!AvfMAVHw1KCio4EleOT4cnppOaPSUw
Support me on Patreon and get access to videos early, join our developer community on Discord, get...
Fixed it, I remove the simple parallel that is in the video and swapped it with a selector. If that's not the right way, please correct me. Thanks!
thanks, so I am currently finding an asset to add more points/bones, so this might help me right?
https://www.unrealengine.com/marketplace/en-US/product/npc-eyes-sight-system
anyone have tips on optimizing ai? I plan on having groups of ai within my game and the max being around 30. But it really starts to tank frame rate.
Always profile first
And prove the overhead
Later on you can create a strategy to optimize
Hello everyone - I am running into a wierd issue with what should be basic AI perception stuff.
I have an NPC BP (BP_SkeletonNPC) with a base npc class (BP_BaseNPC) that has the AIPerception component on it. The component has been configured to use sight, I have enemy/neutral/friendlies checked, etc.
My player character has a base class (BP_BaseChar) as well, with the AIPerceptionStimuliSource , set to Sight and auto registered as well.
When I am in debug mode, I get the image below registering when I enter into the radius of my NPCs vision
However, for whatever reason, these events do not seem to trigger on BP_BaseNPC and I cannot quite figure out why that is.
Any thoughts on what step I may be missing on just getting a simple perception trigger to print something?
This would be my first project using a fair amount of ai. With that in mind, trying to test and add to systems that interact with the ai is proving difficult at 20fps. I was just hoping to know if there is a setting or something I have overlooked that improves ai and the use of behaviour trees
You can run ~50 AI without any serious bottleneck in UE
most culprit would be movement component and rendering characters
If you get 20fps with 30 AI, you did something wrong at somewhere
Profiler will show that error
Behavior Trees generally very optimized, even with very complex and confusing tree structures
Especially when you do it with C++, they become invisible in profiler
Generally perception can become a pita from what I can see in this di,scord
To optimize movement cost, you can end up writing your own movement component or just use FloatingPawnComponent for non character classes
For more than 50 AI, pathfinding can cause serious bottleneck too, if you are not moving to an actor and to a location (vector)
It requires some C++ and a few workarounds
alright, ill look into figuring out exactly where the issues are coming from. Thanks for letting me know something is going wrong
Perception really isn't that hard.. I guess it might be worse if you're only doing blueprints
Dammit, I was looking for some 3D models of navy ships so I could do some visualization stuff and there really aren't any nice looking free 3D models, which is surprising
You'd think someone would have photogrammetried a ship by now ๐
is it possible to make AI sight not work in the dark?
There was a convo about this a few months ago
Search for keyword "thief" in this channel
hey, question about ai.
I duplicated my UE_Character and created another IA controller for it. In there I am just making the character move to a different point with "AI Move To" node. The AI is moving, but not walking or running, just literally dragging it self to the other point. Am I forgetting something? Do I need to do something to trigger AI Animations?
funny thing is that when the AI is idle, the idle animation is active. But not the walking or running
hello guys
i have a pawn which contain a simple mesh that simulate physics
when i made this pawn as ana AI and giving it floating movement component it start teleprting and lagging during its lovement .
so any idea for a good movement component to this type of pans or any good settings to make it move without that lag
No, you're on your own with that
I got it!!!
hi, so I've started looking at aiperception, and from what Ive seen OnPerceptionUpdated (using sight) should only update when entering the viewcone, and once when exiting. However I get it every frame. What could be the reason for this? I'm using a pawn, not a character, it's for a spaceship, so the character contains a lot of things I don't need.
I can't remember the details, but maybe its OnPerceptionEnter / OnPerceptionUpdated / OnPerceptionExit??
Updated maybe just increases the perception time
If I recall, I used it to allow for the perception to build up and used a threshold to activate proper perception
Its been a few years since I used it
those events do not seem to exist. I have only OnPerception Updated, On Target Perception updated, and on targetperception info updated.
I'm using blueprint only..my c++ is very rusty ๐
IIRC, It's OnTargetPerceptionUpdated that has the behaviour you are looking for
yeah, you're not going to get very far that way
The perception system definitely needs you to read the code to get the most out of it
And honestly, needs a bit of C++ code to wrangle it too
Yeah, it looks like there is some weird behaviour with affiliation also..
and I cant set itusing blueprint anywhere..
as I can see..
The affiliation thing is just a integer comparison with the Team ID
Yeah, two pretty fundamental bits need C++ (teams and the location to cast a ray to to confirm visibility)
But you have to implement an interface
Aye, I made mine use random bones on the skelmesh sampled so that it wasn't always the torso ๐
well, to confirm visibility, cant i just use the "stimulus successfully sensed"?
I can use center for this, I will use this for some quite small enemy spaceships.
Hah, that's clever. I had to use it since on most of my pawns, the actor location was bottom middle.
Yeah, if your Actor Location is center, the default implementation has what you need.
another thing, can I assume that "Info last sensed stimuly array" from Get Actors perception should only contain the senes defined in the AI perception component?
I seem to get 3 array values, even though I have f.ex only added sight.
or, sight and. hearing in the current test.
this one
Just testing to see what sense I get, and the odd thing is that it reported index 0,1 and 2. Even though I only have 2 senses added. So, I wonder if I'm doing something wrong ๐
I haven't used that call (I've always been able to get away with just using the delegates/events), so I'm not sure. It's my guess that you're getting the last three stimus events regardless of the sense.
They could all be sight, but reporting the last three updates.
heres the printout
and the senses
so, I would have expected, 0 - True, and 1 False.
Try printing out all of the info for the stimulus.. age and whatnot.. might give you some ideas whats going on
That index is not index of the sense, but index of the stimulus i.e. the action of sensing something
(I've just started with this, so I might be missing some things..)
use the stimulus updated events unless you need to get that data from some other place
I see, so it does not correspond with te sense. how do I get teh sense then?
the events fire when the stimulus status changes, eg. visibility or a sound was heard
well. the status seems to change every frame.
you can use get sense class on the stimulus object to get the specific sense class it came from as well
since I get a steady stream of printout
Are you running it on tick or something?
If you're using targetperceptionupdated, you'll get a struct with the stimulus class associated.
You can then select based on that to see what sense was triggered.
I would recommend using the other event, it's much simpler to work with
it gets called once per updated stimulus if any updates occur
target perception updated, as epigraph mentioned
okay, I will try that. Really appreciate the help ๐
for sight events you will get one event when target becomes visible, and one when it becomes hidden... for any other events, you will get them once when the events occur
yeah, this makes sense.
Hey guys I'm having a verry hard time with BTs. I'm trying to check if my AI is already parrying with a service, it's working normally and set the "AlreadyParryingBool" Goes to "TRUE" and then after the animation stops the "Parry" value of the AI comes back to False, But even if the "Parry" Comes back to "False" then the "AlreadyParryingBool" set by the service keeps failing as if the "parry" bool was still "True"
tryed to see if the "Parry" of the AI comes back to false, with a print string, but even tho it keep failing so my AI parrys once, and never come back to "false" state.
so when the string gets printed it returns "false" but the Ai refuses to parry again and the "IsAIParrying" returns True even if I'm running the service twice to set the value back to false
It's a bit hard to say since there's a lot going on in that, but it seems the state isn't being reset for some reason
Does it print the expected number of times? eg. after parrying once, when it should reset, does it print the values then as expected?
Yeah since I putted it on main selector, i'm getting "False" value every 1-2 sec. and I tchecked with breakpoint it does to all the way to "set blackboard value as"
also when I try to hit the AI it returns false into the service, but the bool never returns to False for some reason
If you remove the IsAIParryingDecorator, (maybe replace it with a cooldown, just to test), does the AI parry more than once?
The decorator won't get updated unless the BT activates that node.
Oh yeah if I remove those conditions, it just parry every single hit and is really hard to kill but never attacks as long as I attack too ^^
the main selector is allways getting fired, the ai keeps moving and attacking etc... Just stop parrying so the main selector running the service should refresh the decorator ?
Or maybe I need to put a task to refresh the decorator ?
๐
Yeah, if you add a task to the left of AiParrying that sets your parrying key, it will probably work.
It's not great since the right pattern is to use a service here, but I can't see how that's failing.
I've been having to deal with so so many weird issues I could never actually understand it lately it's like I'm barely able to set a value from true to false peoperly everything keeps failing xD
allright it's getting worst xD
So I've done this task that also gets fired and still dosent trigger my "AIParrying" Back to "Not set" (False)
Set a breakpoint in the BT, and doublecheck that AiParring? is set to false in the BB.
Yeah, Try there (and if it doesn't get yet, on the sequence above)
Yeah It gets fired since my AI does really parry me, just once
Maybe I missed something is the parry task itself
What is the rightmost image here. It looks like it's just successful if the human AI is parrying? Should it be setting something in the BB?
The other task you see on the right side is not pluged yet, it's a starffing task when the AI is not attacking
Ah, okay.
I'm looking into my parrying Task maybe I failed something
I would put RefreshParrying under the sequence node 34, left of the AIParrying, to be really sure we're updating, but it does feel like a regular debug session is the solution.
Now It's Spamming hard "Refresh" when I attack, and never going to parry if I put it after, it never gets fired again and parry once only
and thats also really weird since it's a "Sequence" that is supposed to try to execute the entire sequence, but never does
If you have a sequence where a sub node has a decorator which fails, the sequence itself will fail
yeah but it'supose to display the red mark to say it failed, and it didnt, like the refresh was constantly running
Can I access a variable of the BP_Character from the AI_Controller? If so, how? thanks
get controlled pawn and cast it to whatever
Maybe Refresh Parrying failed? Or doesn't have a finish execute?
Thanks a lot!!
I went for a simple task to replace the service etc...
Looks to be working a lot better but I ran into another issue x)
but I think it's no longer AI related and this might do the job when I checked my entire parry system
I have to say that setup a full directionnal melee AI and player is not begginer friendly for the AI work xD
allright thanks guys for helping, i did not find my issue, My ai is tanky AF and parry 95% of every hit, but we are getting there ๐
I'm off for night seeya
can i make a behaviour tree check a bool if true or false?
is there a way i can get the stimulus location of only certain characters ? i want the character in this controller to go to my heard location but it goes to its own
hello guys
what is the best movement component for pawn class that contain static mesh ( simulating physics)
because floating mov comp made my ai lag while moving and act like teleporting
thank you have a good day
There is none
The builtin movement components all assume a kinematic pawn (ie. non-physics simulating)
You can try making your own movement comp, or handle moving directly in the pawn
ok
thank you for the answer
I'm trying to make a drag and drop mechanic for placing ai pawns in the play area at runtime. The issue I'm having is as soon as I pick up a pawn and drop it, it no longer moves around on the nav mesh. Anyone know how to get around this?
I've considered destroying the original ai pawn on drop and spawning a new one but that feels wrong
Really depends on what the problem is that's causing it... it could just be your AI logic getting confused when it gets moved like that
At the moment it's only a sight perception in the ai controller, and a rotate to faceBB key, and a task that spawns a projectile. Best I can tell it's losing sight of the nav mesh when it's picked up and doesn't pick it up again when it's dropped back to the map
How are you moving it if that's all it has?
also sight perception has no relation to navigation
It's just supposed to rotate at the moment.
Does it before pick up, doesn't afterwards.
And I only mentioned sight as thats how it's getting the look at target
is it possible to rebuild navmesh at runtime?
yes
Rotation wouldn't have anything to do with the navmesh. Probably you're pointing it at something invalid?
how can i do that?
there's an option for it in project settings, runtime navmesh generation or something
if you mean runtime generation then its already set on dynamic but it doesnt work...
How did you determine it's not working?
If it's set to dynamic, changing anything which has "can affect navigation" enabled will trigger the navmesh to regenerate for the affected areas
i have a procedural level and when i click simulate the path is not green
and also AI doesnt move
basically there is a blueprint that generate the level procedurally
when i move the location of the nav mesh bounds volume then it reload the navmesh
but i cant do that while playing
Try it with something that will actually try navigating
The navmesh visualization mode doesn't always update
If it doesn't regenerate the navmesh, you would probably have to ask the navigation system to do so, there's probably a function for it somewhere in UNavigationSystemV1 or something along those lines
there is no command for the console that can rebuild the navmesh?
Not sure, I guess you could try the obvious ones like rebuildnavigation or something but most features don't have console commands out of the box
Hey I've got an AI moving a pawn with FloatingPawnMovement, pretty simple just gets the location of the player's actor and uses the MoveDirectlyToward node. The problem is, it misses if the pawn has physics motion when it starts moving, it doesn't seem to realize that it won't be moving where it thinks it will
Is there any way to fix this or make it better at compensating for the physics?
It kinda depends on how you want it to behave
If you want it to go where the player will be once it reaches the player, then you need to calculate the position based on the player heading, and move there instead of towards the player
no no the PLAYER isn't moving. The AI pawn is moving
Ah so it's using simulate physics?
yeah
Yeah none of the movement logic really works with simulate physics
zero the velocity before you start moving, that would fix it at least
That would probably look super weird though. The goal here is to have a missile that gets kicked out by a kinetic launcher, then activates its rocket and changes direction
Ah
One way to do that would be to keep updating the movement direction over time as it changes its heading
so that you store the target position, and for example on tick update which direction the target point is relative to you, so that way it would adjust its heading over time but should still go through the point
The problem is I dont control the movement direction right? That's determined by FloatingPawnMovement and MoveDirectlyToward, I just give them the target point and it goes
Huh this gets a LOT better if I use SetVelocity on the floating pawn movement instead of physics
Yeah it probably does, as said the movement comps don't really like physics :)
Anyone know of an alternative to the AI move to behavior tree node? When I set the key to player, the ai updates and follows fine but it is very stiff. If I create a custom move to and have the ai get a random point within a distance to the player, the ai doesnโt update while it moves like it does when moving to the player so the ai goes to the previous location first.
Is there a way for AI to see through meshes so they can run to the player? I have them set to spawn in a building and I want them to run out and attack the player wherever the player is, like a spawn point. However, they can't see through the building to attack the player.
if you want them to always know where the player is, what do you need sight for?
you can just get the player pawn location and have them go there
If you have nothing that would block sight then there's not much of a reason to use perception :)
True, very new at this lol
fwiw, you can set the sight trace channel on the geometry to ignore if you want it to be seethrough
I think the channel is visibility by default, it's configurable in project settings
Gotcha I'll look at that, thanks for the help!
I got it! Set the channel to visibility like you said and then in the static mesh of the walls has it ignore visibility. boom then can now see me
Hi there, I was wondering if someone here could kindly help? I'm using the "Event Blueprint Update Animation" but it defaults its target to "Anim Instance" the code I'm trying to replicate has its target as itself - please see the attached image. Top img my NEW Animation BP while the one below illustrates the example I'm trying to replicate. I don't understand how they managed to target itself like that? How would I get it to target Anim BP Chicken?? Please help, thank you.
Anyway of using parameters exposed to the outside within EnvQueryContext classes? I want to have something like EnvQueryContext_BlackboardKeyLocation where I can set the BlackboardKey as a parameter.
hi, in this behavior tree task I'd like to get a variable from the for each loop, how would I go about doing this?
I have a boolean variable in the BP Bar Chair (the one im getting from get all actors of class
trying to check the value of that boolean for every spawned actor in the game
(occupied being the boolean)
Note that it says "Actor Object" in that selector
which hints that the pin you're dragging from is of type Actor
so you'd need to cast it to your particular class first
like this?
alright, thanks haha
Hi, I need some quick help with the navmesh. Even though I set the agent radius and height to 1 and 50 in my project settings, the recast navmesh always defaults back to 35 and 144. Is there any way to change that?
All the other settings seem to be fine, it's just these two
Is there a way to reference BTTask with blueprint? I'd like the pawn BP to call "Finish Execute" but I can't figure out how that's done.
Does it worth to use state trees in a new project? The feature is still experimental and I'm only starting to getting into it. Is there anything significant missing about it?
No idea but its commonly used around #mass territory so unless you go very further with implementations it should be fine
From what I can see (as someone havent used it yet) its just BTs integrated into FSM logic after each selector composite. If you need similar logic you can get LogicDriver's lite version and have a BTTask creates a SM and runs in while selector is active
Should be pretty much equal without some fancy integration
#mass is not just data things, its UE's ECS system and involves some crowd simulation
And state tree is suitable for crowd simulations
hence its used on city sample / matrix demo
I was thinking about it as a better tool for a small town citizens activities like work/sleep cycles and stuff
Yeah I think StateTree would be a good choice
I'd guess in #mass general approach is using selectors as LOD index and update behaviors based on that
You can use same logic for time of the day instead of LOD index
Ended up using an interface to solve this. A wee bit convoluted but at least now all my BP's can talk directly to BTTask (i.e. do things like call Finish Execute)
What are you using this for?
Seems like a reasonable way to solve that particular problem but just wondering what the eventual purpose is :)
hi im creating a tavern management game to get familiar with AI. However I can't find any tutorials on how to make ai have day night routines etc. Does anyone have some sources for me?
There's really nothing special to it
You create some way of tracking ingame time, and then have the AI look at the clock when it chooses things to do
I'm using this ai for an enemy that attacks the player. The task calls the pawn bp to perform an attack when appropriate (ie close enough). This worked but the behavior tree had no way of knowing when the attack ended. So the interface helps fine tune the behavior tree flow
Oh
Was it you who I was talking to about something like this a while back? ๐ค
I vaguely recall suggesting using an event dispatcher to someone having a problem like this
I don't think so? I don't think I brought this up with anyone anywhere until today
Ah okay, yeah just wasn't sure :) Anyway I would try using an event dispatcher instead, that would make it a lot simpler
Basically have an event dispatcher in your character class, such as OnAttackEnded
You can broadcast it from the character when it finishes an attack
and in your BTT, you can bind an event to it, and when it fires you unbind the listener and finish the task
you'll also need to add an abort event to the BTT which removes the event listener
Yea I thought about using event dispatcher that way, but the unbind thing could make it complicated. I might still try it though! Thanks for the suggestion!
that's all you need for it :)
it works pretty well for any kind of actions your characters can do which take some time to finish
I see, thanks!
You might want a "utility-based ai" , good article with a little overview https://mikelis.net/designing-building-testing-and-shipping-aaa-style-video-game-ai-24a3d47a163b
Hi! Question about EQS, if there are few generators connected to the root node, how does EQS picks the generator to use?
quick sanity check: I'm trying to create a behavior where a commander unit can issue a flanking order for some of the grunt units. I'm using EQS to see if there's a good flanking spot, and one of the queries I want to use involves scoring negatively when the point is already in proximity to allied units
for this query, is it correct to assume that iterating through the world's actor list is going to be perf-limiting - so I'll need to do something like keep a list of units relevant to the encounter or a spatial partition of some sort so I'm looking through a much smaller list of data on each query?
Gotcha, thanks!
Yeah, you want to try and avoid exponential queries. You can just keep a list of friendlies and negatively score points based on proximity to things in the list.
Hey, I'm having issues with my floating pawn movement component - simplemovetolocation doesn't respond to any acceleration/deceleration value changes
Hello, can someone know a way to allow AI to move in direction but always faced to Actor ? Using Behavior Tree I done this but It doesn't work. I have another solution : manually rotating the mesh in the actor direction but I don't find it very elegant x).
Hey, anyone knows how to run two behaviortrees on one AIController?
I'd like to have two bt independantly of eachother on one AI. By using the run behavior and parallel node it is not as dynamic enough,because by using the parallel there is a dependancy between the main and the side track (when main track is done it either waits for sub or restarts it)
So I think two bt would be best
Anyone did that before or knows how I can achieve running two types of tasks in parallel that work indepenant of eachother?
I'd advise you not to try that with the current BT implementation, because it doesn't do parallel's properly
What you could do, is have components on your AI class that does something and simply signal those from your BT
Whats your use case?
In theory you could do two BehaviorTreeComponents in the controller... but yeah from what I've looked at the code, there are places in there which assume a certain structure and it might start behaving erraticly
Definitely seems like a better approach would exist :)
Well I'm working on an rts ai. My idea for it would be that one bt is in charge of building structures and another in building units.
But yea as it is not that possible I'll think of something else
Just have multiple actors with different BT's then?
But if you're doing an RTS, then maybe using the new Mass ECS and StateTree's would be a good idea
Thats what I was also thinking about. i'd also need to manage squads of units and for this I thought of using seperate actors each with one bt
I did a bunch of squad stuff using multiple actors and it was a good pattern to use. I used FMessageEndpoint to connect them via events and I'd recommend that approach.
Awesome thanks for the tip
Ecs and statetree is not an Option because game will be released with 4.27
And would require a big rework to make existing systems work with that
You could always back port it. I doubt the ECS stuff uses anything 5.1 only
But yeah, having actors coordinating via events is pretty handy. You can feed debug commands up and down the chain of command and its all relatively clean to do
Add some debug logging for the event handling so you can catch anything weird
Are those actors you used aicontroller or an empty actor with a btcomponent?
But were they aicontrollers or just an actor with a btcomponent? Would the second be better for this as they dont have a lot of overhead?
Having a controller is basically the only way to use BT's, I wouldn't worry about the overhead, its just memory really
Your biggest overhead with an RTS is in the Units.. which wouldn't have a BT anyway
Units would just have a command following system really..
And you'll soon learn that it isn't AI that's a limiting factor ๐
Alright thanks for the explanation :)
today i learned special care must be taken to avoid calling Unpossess on the BT-driven AI controller as a result of a behavior tree task. (seems obvious when i say it like that but it was a bit of an indirect cause and effect). If you do it, the cleanup phase of the behavior tree will run a processing step, and since you are already in a processing step, you crash the whole game
in my case i deferred the unpossess until the next frame, not sure if theres a better way /shrug
Anyone know if a bound event in a BTTask gets unbound automatically when the task finishes or aborted?
I don't think they do
Just tested, yea they don't, damn.
Been playing with Dall-E today.. man its good
These large ML models are going to have a huge impact in 5-10 years
piloting prompts is definitely interesting
Wait is that the output for "Duke Nukem chewing gum" lol
It has issues with text ๐ I guess it was trained on some weirdo art sites
that was "duke nukem chewing gum, digital art"
haha
Ahh, it looks like there's some brand that appears like duke nukem to the model
I asked it for duke nukem chewing gum, 3d render and it showed a bunch of packets of chewing gum as 3d models ๐
with weirdo names
I guess it can't quite figure out what "duke nukem" is supposed to mean
The term "chewing gum" probably appears more in packaging than in games you know what I mean?
Here's "duke nukem, digital art"
Hmm I guess that's not it, they are vaguely similar characters I guess
what's the output for Arnold Schwarzenegger? :D
haha.. I think you have to give it more conceptual stuff than specific people.. so "body builder" or "blonde bodybuilder" or something
haha
What if you just describe duke, like.. "Blonde macho man wearing sunglasses, a red tank top, blue jeans and combat boots" or something lol
worth a try ๐
it's interesting that it got arnold's physique but none of his actual features otherwise
Its way too addictive.. I've been literally generating concept art for the last three days
So it generated some red tank top men.. but you kind of need to tell it not to do photographs ๐
That was with "digital art" added
Those are actually not bad lol
Hmm, so there's interesting.. this: Blonde bodybuilder wearing sunglasses, a red tank top, blue jeans and combat boots, digital art
Figuring out how to tell it what you want is really quite interesting
I guess it just goes to show how much the word "blonde" carries a gender identity with it :P
heh
okay... what does it output for "portrait of tim sweeney"
lol
need to keep it vaguely on topic
You can honestly get some really amazing artworks out of it though
yeah it looks pretty great
I'd love to use that to generate video box art for my game but that's not really very realistic lol
is there a way to lock the sight angle of a spawned AI to the original direction ? ive made a sentry ai but the sight follows the turret. i want the sight to face one direction because right now if i set focus it follows me so i cant leave the cone of sight
The sight checks are done into whatever direction the actor is facing
aaah so there is no option to lock the sight angle in bp
Can you tell I went a bit mad with the Simon Stalenhag prompts?
I mean seriously.. given I am just incapable of the patience that art requires, this is truly transformative
I did try some Ian McQue too
The goddam thing can do pixel art too ๐
I think I need to stop now and watch a movie or something ๐
It's absurd how good this is.
Pretty much transform plenty of creative jobs
Once we can do it with video
And then do it realtime
In the basic BTW and bb setup, I am trying to pass a point based on the actor's spawn location.
Basically I want it to wander around it's spawn location.
I can cast in the service to my controlled pawn and get the data but I was wondering if there was a way to get that data from the actor directly in the bb
I would just assign it into the BB when it gets spawned
In my fps project I have it set up so that as soon as the AI controller possesses something, it sets the pawn's position as the spawn location in the BB
Yeah, just set the BB value on spawn
Where would you set it? In the actor? Or the aic?
That's the part I am struggling with. Who sets it? Pawn, controller, service?
Which one do you think?
The game instance
Why there?
the ai controller would probably make sense because that's what is supposed to manage the AI logic anyway
when you possess something it probably shouldn't have moved much from where it spawned
How to make navmesh respect very low ceiling? In this case, wall with gap at bottom. Enemy is unable to crouch.
To be clear, actor height in Navmesh and Navsystem setting is 144 and walls all have same collision settings
Enemy is hopelessly stuck and thats very annoyng, shouldnt that sort of thing like properly working NavMesh work out of the box? I am trying to mess with settings, without much success so far
I can check if it works but I shouldnt have to put that sort of thing in first place... I mean, for example this works without problems:
I cant believe navmesh just flat out ignores low ceiling.
is there any other way? for example, I dunno, for given mesh separate collision used for navmesh and separate normal collision?
Huh! Looks like navmesh DOES take ceiling in account (easily checked by lowering these walls with gap at bottom), but I cant find where to change acceptable height of ceiling.
@bleak raven It's a bit obscure but in project settings you can define the properties of nav mesh agents. Including how wide they are (capsule radius), tall they are (max ceiling height), and slope stuff. The engine will, under the hood, assign characters to these agents based on the shape of their capsules if memory serves. If you have multiple agent definitions, you'll actually generate multiple nav meshes (I think... I don't remember if you need to explicitly tell it to do this). You can color them differently and offset them to make it visually clear.
So like... if you want one nav mesh for your normal characters and one for your giant fatties that don't fit everywhere, they can each have their own
If you only need one type of agent then just adjust the height and it should adapt to your ceilings as needed
Yes, I tried to change various settings there without much success - both in Navigation Mesh and Navigation System.
it seems to ignore Agent Height completely
Odd
solved issue, it was actually embarassingly simple - NavMeshBoundsVolume's brush was too small height-wise 
I made hexagon path finding but now I need a to make my own avoidance does anyone have any guide or suggestion algorithms?
found this dynamic nav modifier https://couchlearn.com/easy-dynamic-pathfinding-in-unreal-engine-4/
Unreal Engine 4โs pathfinding and navigation system gives all users a robust and easy to use system for adding AI controlled characters into their games. With the default settings, navigation is static preventing changes at runtime. Dynamically generating the nav mesh (Navigation Mesh) and adjusting it during runtime has very little documentatio...
How do I run a state tree inside AIController? For BTs there's a RunBehaviorTree but I cant find anything similar for ST. Also the StateTree property in the UStateTreeBrainComponent is propected and there are no public setters ๐ค
I want to do my AI logic in C++, anyone know the difference between UBTService, UBTService_BlueprintBase and UBTService_BlackboardBase?
Not much
BlackboardBase has some default stuff in there for using BB, but you can use BB from UBTService as well, BlueprintBase is the baseclass used for BP based services
So I should probably stick with the non BlueprintBase/BlackboardBase classes for services, tasks, and decorators?
if you're doing them in C++ you don't really need to use BlueprintBase, but if you use the blackboard then using BlackboardBase would probably make sense
I have 2 behaviors split by a sequence and each have their own sequences with a decorator.
How can I get it to only do 1 downstream sequence and not the other?
I tried with an enum and it works if the enum is set to 0. But any other index just stalls at the first sequence with a failure in the decorator.
if you want to only execute one sub-branch, a selector would probably work best
a sequence executes nodes until one of them fails, a selector executes nodes until one succeeds
so if you have a selector with two (or more) sub-branches, you can put a decorator on them to choose which one to go into and it will only ever execute one of them
Is there a tutorial/website that shows best practices when it comes to designing AI / behavior trees? What do you do when behavior trees become too massive and hard to maintain?
refactor them ๐
You can use subtrees and things like that
but in general, I tend to break my AI down into different systems.. I don't try and build everything in a single BT
for instance threat evaluation I use a utility system
squad control I use a multi-layer BT with different actors in a command heirarchy
Some stuff I use a simple state machine for
Smart objects seem to be mostly AI only. Using them with player requires some boilerplate. But documentation says it is also for player (https://docs.unrealengine.com/5.0/en-US/smart-objects-in-unreal-engine---overview/).
Anybody had luck using them for player easily?
Okay gonna ask here though its not strictly behaviour trees, but there seems to be ongoing support in Blueprints chat.
I have a pawn using the AI MoveTo node, is there any way I can trigger an event when it reaches a path-point as well?
Or failing that in Blueprint, is there anything I can do with behaviour trees to achieve this?
This pin executes when it gets within Acceptance Radius of the target
@tardy wolf
you could also achieve it with a behavior tree fairly easily using a sequence node.
Using that, by the looks though that's for end goals not path-points.
Doe's the MoveTo node in Behaviour Tree not apply mesh animations?
No idea, I haven't looked into the internals.
@tardy wolf Probably best off getting the path points and then breaking your ai move to to go to each one individually
Okay that's actually a good call
these concepts are unrelated.
I didn't think about that honestly
Huh?
@tardy wolf Use Find Path to Location Synchronously to get these points.
I do this to make a little path indicator. But be aware it could change as they move around and what not.
I think I'm already using that to draw the path. Interestingly that's one of the reasons I wanted the "has reached path-point" event, to remove the segment that's no longer needed.
@waxen anvil Move to just tells the actor to move. If movement naturally triggers an animation then the animation will play.
Well I'm using the same default character and anim bp that UE5 Projects come with. So I'd assume thats the case but my AI just slides around
@tardy wolf I redraw on tick so that the path render starts under the unit' feet. but check to make sure enough time has passed, And the target has changed OR the unit has moved far enough.
Aah, yeah I'd rather not be doing something like that on tick if I can avoid it.
@waxen anvil I don't actually remember how it works by default. Check the animation bp. Is it grabbing the velocity of the character and setting animations accordingly?
That's the usual method I've seen. Commonly shown on tutorials too.
It's not that expensive. I actually trigger much much less often than tick. Mind you I'm doing this for < 10 units at a time.
specifically I trigger, at most, 4 times a second.
Turning on Should Move and changing ground speed works
Same with changing the velocity
honestly better to use moveto in behaviortree because you can observe the blackboard value-- this means it will keep adjusting the moveto based on the new target location. Then, if you want to actually abort a move, you would simply invalidate the blackboard value so that the MoveTo fails.
Probably, yeah.
I do wish the gameplay debugger could show the path segments though
is using EQS on walls possible? or is it all limited to the navmesh
technically yes, EQS can generate points however youd like with a custom generator
pretty sure all (or most) of the builtin generators are pushed onto the nearest collidable floor (not even sure its the navmesh)
you could generate EQS points in a 3D space if youd like
Hi guys. Do you know, why service vars have "instance editable" check box, not "editable", and why i can't assign them to blackboard value but just set them in BT?
Hi guys,
How can I do a pathfinding when target also moves. I am using a* but result is not consistent and since my board is a hexagon they do back and forward move which is not what I want.
anyone know any article related to his topic ? like I saw there is multi agent pathfinding but I don't know how to use them
Any way of extending the AISightSense cone shape with another shape, like a sphere around the AICharacter?
Cant you do two sets of senses?
Long sight and shortsight?
Doesnt give the cone but almost similar result anyways
That is one solution, but still, I would like to use another shape.
If you want to do a custom shape you need to do a custom sense for it
You might be able to extend AISense_Sight and modify how it checks, haven't looked at it that much though so not sure
If not, creating a custom AISense subclass would certainly work
Okay, I have a look into it. Thanks you both Squize and zomg.
Yeah, I did my own sense calculation.. proximity, sight, concealment etc. Basically wrote a simple utility system on top of the perception system.. so the perceptions were the inputs and then some maths were used to figure out the final sense scoring function
Things like dot product with forward vector scaling the sight sense so that things off to the side are less percieved
use a curve for the scaling so you can basically manipulate it as a set of summed/threshold curves
Things like being sat in a bush reduced the perception.. or laying down, or not moving etc
Wrote an extension to the visual debugger so that the perception values were visibile in a graph
Helped a lot
sounds nice
๐ค is there any chance combining BTs and STs would be possible since they are both managed by respective UBrainComponent descendants? I'm still starting to get into the ST and currently I think it'd be great to have STs for selecting some global NPC states like interacting with a smart objects, reacting to player or other NPCs, getting into combat, and have the BT's to handle the actual sequence of actions in combat or maybe following along the player
Sounds like it could be a reasonable method yeah... but if they are using the brain component on a controller, I don't know if it'll work
I guess you could have on of them be the default brain comp and add the other one as another
and hope that they built it in such a way it doesn't make assumptions about what's what, BT definitely does some assumptions about being on an AAIController subclass and such, but maybe it doesn't look at the BrainComponent prop
Does anyone know why the apostrophe key WOULDN'T bring up the AI/Perception debugging menu? Because I've pressed it half a million times now with some pawns running around in a scene with AIControllers attached and nothing happens when I do.
iirc it may be affected by your keyboard layout
on a US layout it pops up from ' at least if you are currently possessing the player pawn and you have a HUD
if you're not possessing something that has a valid HUD, I think it might not show
that did it
you have to be possessing a pawn
i was simulating the scene
thank you very much
Could I make it so the acceptable radius has different values for when to start moving and when to stop
I want it to stop moving at 100 and only start moving if the player is 200 away
Handle it separately I guess
You can check distance to player and then trigger movement
I'm having a ton of trouble w/ registering/binding the perception system event callback. Here's where I setup my perception component in my AIController class:
It seems to work because I can see the debug visualization as expected:
Unfortunately, the call back function is never called. Here is its definition:
any help is appreciated.
Ok, figured it out. If anyone is wondering: ConfigureSense() needs to be the last thing called.
Hey ai gods can you help me understand something, im making a racing game I know@cliche but would it be possible to use a nave mesh envoker for the ai cars spawned in? So they can read the road? Most people use a spline and ray cast for objects in the way but I want to use nav mesh. Any tips would be great
I have put an nav modifier here
but still my AI keeps going there
how?
Update: So i realised that on floor underneath and on second floor i also have nav meshes so the AI probably uses them, how do i stop that?
Are state trees evaluators instantiated or are they sort of BT's cpp uninstanced nodes? So far I'm thinking about them as a hybrid of BTs services and decorators . I'm doing a state tree dependent on the time of day where the time of a day is divided into 4 gameplay tags (morning, noon, evening, night). I get it that I can override the Evaluate function but in this case I'll have to query the custom DateTimeSubsystem to give me the day time tag which seems redundant because the tag will change only once in 10 minutes or so. What I'd like to do is to subscribe to the subsystem's delegate that the time tag changed but I'm not sure this is the intended way of working with the evaluators. Also can evaluators tick time be set like in BTs services?
Ok so even if I were to subscribe to a delegate in EnterState override I'd still have to get the FStateTreeExecutionContext& out of somewhere in the delegate callback function to update the state property which changes the active state. Now how can I do that from an evaluator?
Dear diary server, my NPCs correctly move to the location of the line trace I hit on.
Only problem is if that target is a pawn which is actively moving, the NPC will move to where the line trace hit and then when he gets there he has a lightbulb moment and moves towards where the target pawn actually is.
I have this service node preceding the Move To task, set to update in intervals of 0.2s
The 3 move nodes is to specify different acceptable radius (and later, Move To Interactive Actor will become its own sequence.)
Move To Pawn also has Observe Blackboard Value set to true
set a reference to the actual target actor instead of it's location
and use the move to task with update goal
All things currently configured on MoveToPawn
I get the impression I'll have to make a custom task rather than using the built in MoveTo
actually that should work tho
hey guys , why "AiMoveTo" can give "Aborted" as a result ? my ai isnt moving , navmesh is there , ai controller is set but function still fails
if your tasks are executing correct
@shy hare try to increase the acceptable radius to half the capsule size of your character
if you trace on the ground it may think that it can't reach that point
this is fails on my vehicle ai , i made exacly the same function for human ai and he moves just fine
still not working
whatever, try to increase the radius, try to bump the z-offset up
yeah did it , not working
ok, maybe it doesn't work with the vehicle movement stuff
i'm not familiar with that, so good luck ๐
alright , anyway thanks for your reply๐
So question is the same , can anyone please help ?
try with visual logger enabled
it tends to contain some more information on why moves fail
Starting to realize what my issue was earlier - turns out that my Behavior Tree only updates what the command target type is (and hence updates the resulting move to type) when the move action is successful.
So if I moved my guy to a location, he will believe that he's still moving to a location when I set a pawn as the target
Also works the other way around; if a pawn was his last target, he'll still move to a location as if it were another pawn until the move action finishes
your first move to that checks if it's pawn should use pawn as target, not location @wintry flint
This possible in behavior trees
If that's a question, yes
Is it a built in decorator or will I have to create a custom one
Can't remember, I guess you'd just need something that checks distance to something else
I'm pretty sure there's a get distance to node
Howdy, if i wanted to impliment a dectection system where the ai determines if you are Visible based on how many bones in your skeletan are visible (if 7 out of 14 visible, you are Seen), would that be workable with the built-in Stimulus AISense-Sight ect system, or would take some totally custom solution?
I can see it working as "if you see someone via AISense-Sight, then check what you see to check if thier bones are visible", but the issue of how the target is initally detected seems like it'd be an issue here, as it seems to detect your character's root or middle or something (haven't dug too deep here)
With C++ you can customize how the sight check is done, which would allow you to consider the visibility of each bone individually, and return a lower stimulus value
this is done via the IPerceptionSightTargetInterface or something along those lines
That's a good point, i had made a note of how i'd need to do some C++ to make a custom sense node, but i didn't really put 2 and 2 together there.
A custom sense for this would let me keep the default SIght for maybe basic stuff, but have a special heavier one just for the player that does the bone check.
no idea how that'll turn out but it's a start, much appreciated.
Yeah it's pretty simple to do, you can just add the interface to your player pawn and implement the function for it
Excellent, i'll keep that in mind and try that out pretty soon.
Hey everyone, Im having issues with my AI perception, its facing a single direction even tho the capsule is being rotated and is also set to orient to movement. does anyone know a fix to this?
ope figured it out, I disabled tick on the controller, but enabling it again fixed it lol
Yeah, pretty easy to do. I did that for my perception. You can raycast to points on the skeleton and accumulate a visibility score over a few updates. Basically what they did in Stalker (and Brothers In Arms earlier).
Is there a MoveTo task for state trees or an easy way to make one?
state trees? You mean the one that's used with mass?
I don't think so considering mass doesn't even support navmeshes yet
are state trees only supposed to be used for mass? I thought they were like a behavior trees alternatives which can be applied per actor/ai controller
hmm if it is only for mass why is there a UStateTreeBrainComponent for AIController then... ๐ค
I'm probably wrong here
Hello, would you happen to know of a bug or something like that, that could "corrupt" AI navigation ? Because something strange is happening on my levels. My AI works fine on some maps and on others they sort of Teleport far away to the navMEsh boundaries and even outside but only when they try to move. I thought it was a code problem but it works fine on other maps and even on new ones I create to test. And i can't find what can be the cause of this situation.
To give you an idea, all the AI were spawned together in a regiment like formation and only the AI that were in attack range are still just in front of me while the others had to move and somehow TP far away like the ones i encircled in red.
What are you using to move them? Do the AI's affect navmesh when placed?
When placed no
I use a custom movement component as well as a custom moveTo task
The thing is that they work fine on some maps and on others they just glitch like this
There's really nothing builtin that would make them teleport when trying to move afaik
If navigation is messed up... they simply don't move
So I would think the problem is in your custom movement comp, perhaps it's getting 0 as movement input and screws it up or something
(or in the custom moveto)
hard to say
you can also try using visual logger and seeing if you get any useful output into it
ah I forgot to add something, the AI unlock themeselves when the game lag (<15IPS) and bug again if it picks up
so they move normally again on the bugged maps if the framerate drops.
There's plenty of reasons why you'd get a bug that might occur on specific levels but have nothing to do with them. You'll have to break out the debugger and figure out whats going on
I doubt its anything anyone can help with until you narrow down a test case
Quick question, is there anything in EQS outta the box that lets me sort location priority based on elevation? IE, Cat AI; find the player, and always try to be higher up than they are, so make movement choices largely based on elevation.
I know there's plenty of other ways to get an AI that data, but curious if there's something simple i'm missing.
Maybe try using a Distance test with test mode set to Distance Z or Distance Z absolute
that would at least give it relative to position of the querier for example
or you could probably use it with a custom context that always returns a point at the floor height or whatever, so it would be comparative to the floor
All good points, i'm just finishing up some unreal courses On EQS and need to dig into such weeds. I'll take a gander at those.
if all else fails, i can prob just get normal eqs navigation info and then write something somewhere that checks all those points in releation to the player, adn then passes on one that's higher.
yeah you can for example get the results from the query and manually find the highest ones
or you can write a custom test to do it as well
I'm pretty sure DistanceZ will do what you need. But if you're working with C++, writing Custom Tests is very doable if your needs get complex.
I'm rusty with C++ but i'm certainly not against it, just trying not to write anything that the editor itself already does.
The Unity instinct of "the editor doesn't give me anything, i need to make everything" can lead to alot of wasted effort if i'm not careful.
That's good practice in Unreal. There's definitely a lot in the box.
Yeah, big pro and con really. If you wanna do something, there's prob a tool or data structure already in place somewhere. But that can also lead to overcomplication if you try to use it ALL, or not knowing when to stop looking.
unity doesn't give you shit, so just write whatever ya gotta. It's both maddening and freeing.
I have often got to the point with Unreal where what's there is so close to what I need but not quite, and changing it becomes a whole adventure.
god, i can imagine.
Yup, looks like Distance Z did it. I actually hadn't even noticed the Test Mode Distance vector option before, so thanks for pointing me in that direction.
Question, what are some good use cases for changing the Projection Data trace mode? Swapping from navigation to Geo By Channel mdae it alot easier to get higher-up locations on the navgrid.
i take it the navigation trace mode is tied into using Navigation Filters, which are... i guess like AI Agent nav profiles??
Sorry, another question
Any idea why the pawns in the content example navmesh demo wouldn't be moving? the level script seems to grab them and give them somemoveto orders via target points, but nobdy actually moves in the demo.
navmesh could be missing, sometimes it won't autogenerate and you have to press build->generate paths
you can check that by using P to visualize navmesh (make sure the viewport is focused when you press it)
if navmesh exists, could be the points are invalid, or some other reason... visual logger tends to have more debug info for navigation if you enable it
Dear diary server, today I learned about "Is Blackboard Value of given class"
This probably would've saved me some labor if I knew about this a week ago
what did you run into without this?
(anticipates answer, lol)
I had a service node checking every 0.2s what kind of actor I had targeted in my crosshairs
And a bunch of booleans for decorators to work with
ohh I see, moving the check from blueprint into decorator, for sure!
just watch out for deleted actors that blackboard still references, behavior tree doesn't take kindly to it
Clearing focus should help with that, right?
Or alternatively, just setting focus to something that isn't the actor about to be deleted
Be it by setting the focus to self or something else.
Could see that being acheived with an interface
yes sure, the main issue is having tasks that reference actor blackboard values process after the actor becomes invalid
the most important part is: clear the blackboard value referencing invalid actors (due to deletion)
I think this is most important when you are observing the blackboard value
unlikely to be an issue if you don't observe
(observation causes blueprint tasks to continuously realize new values of the blackboard value you have passed in)
Hello, Ive got a problem with my AI detect player. i was trying to make the AI sight (detect player) smaller but its still detect him even far away. even when I went for 0 in the radios box for some reason its still detect him
O.o
If the origin vector is the pkayers location, then yes it will
This probably isnt how id try and adjust ai sense config
I was just following guides. 90% of them show it, and its not working
i did put a bool as a decoration , but its not working
Bad guides then ๐คทโโ๏ธ
How are you detecting the player? Using AI Perception component?
That's just getting a location near something
Theres a sight module there
True then he goes to the follow state sequance which use the same Black Key tho
but if I change there wont it affect the other sequences ive got? ( he detect other object and interact with them just perfectly)
The code shown has nothing to do with the initial detection tho..
Depends on your setup, but usually it should not ?
You mean on the player or at the AI itself both have perceptions
this is the find one
Follow one
and this is the main
the IsPlayerInRange is badname but goes for attackRange not the detect
this all seems pretty complicated when the sensing component works fine without any eqs
Is there a way to offset Stimuli source location?
sensing and EQS are entirely different systems for different things
It's a vector, just offset it?
My perception system doesnt detect it because Stimuli is too low on the ground. I want to offset its location on z axis. As far as I know it's location is set to the root of the actor and I dont know how to offset it
what sense is it for?
Sight
you can implement IAISightTargetInterface and customize how the check is done
thx! it worked
๐
Hello, I<ve got an issue with the Perception system ...
it worked previously and suddenly it's not
Do you have any idea of what could go wrong ?
I've debugged the sight sense of my AI pawn and it's activated
I even debugged the standard C++ register as source to check if something was wrong and I couldn't fnid anything
my pawn has:
and the AI pawn has
it's enabled ...
If you enable the gameplay debugger does it draw the perception sight line towards you?
lol.
i just reset the affiliation in the AI pawn, put t all back and MAGIC
XD
they were all selected but for some reason it wasn't working
Yeah by default it treats everything as neutral iirc so it needs to have the affiliation set up correctly
Oh, that's interesting ๐ค
the only thing that ha^pened is reparentnig
so I guess it broke something somewhere
sorry for bothering you all
lost 1.5 h -_-
Rubber ducking works ๐
Reparenting can do all kinds of fun things
Howdy, i'm planning a project where you have a team and can swap to them, with an AI taking over for a character not under player control. Are there any fundamental choices i should make early on to ensure that the player and the NPCs are more or less treated the same by the game? (where to put input, what should be on pawn vs controller, ect)
I read that there's some specific framework you want to use if you are making a bot that's meant to simulate a player (like AI being player 2 in a co op game's SP), but i can't really remember what it is. Playerstate? no idea.
Kind of a broad question, but i know you can run into gatchas pretty easily with this kind of thing and i'm not yet familiar with the Unreal's myriad of bespoke Types for things/rigid seperation of things.
You would probably want to keep input etc. in player controller
And make it so that you don't do any actions directly in it either, instead on input you call functions on the pawn
This way for your AI, you can simply have the AI controller call those same functions to achieve the same result
That sounds right, I'll see about doing that. Much appreciated!
what about using a AI controller for both player and AI ?
AI Controller is esentially a child class of AController and this way also you can have some shared behaviors
Are there any fundamental choices i should make early on to ensure that the player and the NPCs are more or less treated the same by the game?
Yes, absolutely yes. Can't stress enough yes
Use a common Character base class for all the characters you want to switch between at least
I go overboard here, but it can be costly, by pushing a lot of logic down into the base character class and using it for all characters, NPCs, enemies, the player itself
It has the net effect that I can just possess any character in the game and play as them and it all works, inventory, everything
menuing, equipment yadda yadda
But when it comes to AI for this specifically, its not that difficult: PlayerController provides the Character input, and AIController provides the Character input. You would just want to unpossess and repossess the characters as you switch, properly destroying and spawning the controller actors as needed
It has the net effect that I can just possess any character in the game and play as them and it all works, inventory, everything
This can be really nice for setting up/testing animation blueprints and actions for new character meshes, testing gameplay abilities etc. In my project, I can just set the PlayerCharacter override on a test map to any character in the game and it works
Instead of inheritance, you could also use interfaces and have many implementations that share the same mechanism for talking to them as well, this has some nice benefits, but requires a bit more planning to pull off without getting a bit stuck into corners
The really nice benefit there is you have much more control to remove unnecessary logic and streamline performance later on in the process without having to conditionalize the base character class or such. But again, more up front design work to get a good result in my opinion
In terms of "getting it right early", its fairly easy to tutorial yourself into having 10 characters with 4 different base classes in Blueprint
Before you know it, you want to be able to have enemies follow the patrol point system you've devised for your NPCs, or have NPCs be able to fight you
(definitely projecting literally my own challenges)
Anyway, @neat heron if you have any specific questions I'd love to share any insights I've gained doing a pretty similar thing
Hey
I'm having trouble with my navigation mesh
it seems to only want to apply to certain parts of my tilemap.
my nav mesh bounds engulfs the entire tilemap
oooh fun 2.5d
is there like a max nav mesh settings I should be altering?
there is a max slope setting
I suspect that's the issue
and of course the nav mesh volume needs to encompass the surfaces to generate on but I suspect you've got that buttoned up
probably that big yellow volume thar
I have max slope setting to its highest number
plus it doesn't seem to be affecting flat surfaces
are flat surfaces in that underground area receiving navmesh?
Nope.
initially I thought it might have been a way I set this up, maybe nav mesh is generated by aiming raycast down so they only detect the top, but the bottom is generated for the first area while the top isn't so it cant be that
I then thought maybe there was a maximum amount of navmeshes that could be generated and I was going above
so I tried moving my nav mesh about
but even when I move it to the side.
it still doesn't generate new paths.
wait
I've fixed it.
Worst part is that I don't know how.
The only difference I can find is that there's a new extra recast navmesh default
maybe nav mesh is generated by aiming raycast down so they only detect the top, but the bottom is generated for the first area while the top isn't so it cant be that
It's not that
I then thought maybe there was a maximum amount of navmeshes that could be generated and I was going above
Not that I'm aware of, and for a small level like this you should be totally fine
so I tried moving my nav mesh about
Before some other ideas I have, do Build -> Build Paths just to check
I've fixed it.
Awww darn it I shouldve just read the whole thing
The only difference I can find is that there's a new extra recast navmesh default
These get made for you. If you delete them all and do Build -> Build Paths (or move a navmesh volume, assuming that youve enabled Update Navigation in editor preferences), they will come back
Typically there's only one, but I do think thats not a hard and fast rule
My other idea was to check collision using
little known fact, but navmesh generates on top of meshes which are setup to collide with Pawn
sounds like its not your issue if some jiggling of the handle got it to work ๐
I swear I pressed build paths before and nothing happened.
Well it's working now and that's what matters.
its technically no different than just moving a navmesh bounds volume* or another collidable mesh when you have "Update navigation" ticked in Editor Prefs
Mostly just a lazy way of making sure I get parallax
nahh thats a great use for it
not lazy
2D is really just 3D with all the Z multiplied by zero iddnit
nice, it's much fun
where one of my pitches for a game got selected to be a project a team could work on
my friend is a uni teacher doing unreal courses in australia
good luck on the project, always nice to see 2.5d get some love
Hi, my move to task is not rotating the Ai. I checked and use controller yaw is true. i dont understand why is this happening.
if you leave it as default it will navigate to the target based on its max rotation speed etc. You can set that max rotation speed to zero to turn in place with no time required, or have it set to something appropriate and massage it to avoid situations where its impossible for the actor to reach the destination. There is also "Set Focus" that turns the AI directly toward a target which is easy to miss
max rotation speed is a setting on character movement component, "Set default focus" (my bad) is a BT task
So when I set Set default focus service on my move to task it still doesn't rotate.
welp, check the max rotation on the character movement component
so i didnt find the Max rotation in UE5 but there is rotation rate. which in z is already set to 360
Cool, and whats Orient Rotation to Movement set to
false.
yep! that works! thanks a lot
๐
just turning it on worked.
ehh i guess its because the AI controller isnt giving you a rotation anyway
ยฏ_(ใ)_/ยฏ
i guess so.
this just tells it to try to rotate it toward the forward axis of whatever X/Y controller input vector is given to it
adhering to rotation rate
oh i see. Thanks again tho.
it was wired cause when i used rotate to face bb enrty that node didnt work as well and the BT got stuck at that node
yeah Set Default Focus is good to know for that, often you want them to do something while continuing to turn to face the player even as they whip around to the back of them or whatever
not just be consumed with the act of rotating toward the player
yeah true!
its just a shame, the final project's backgrounds are gonna look worse
why would they look worse? for a 2.5d game like that you can skip all the anisotropic filtering etc
No, it's more the fact that I have a background artist who made their own backgrounds, but they don't fit the style and it might harm the project's grade if I don't include his works in.
Though I'm growing less sympathetic with him.
Since we've had six weeks to do stuff.
The age old student problem ๐
and I just did some image reverse searching and found that all his images are just already existing images with artistic filters put over it
can't choose your coworkers either, well mostly
and any original art looked like it was done with the shape tools in MS paint
Your tutors are probably interested in seeing how you deal with issues exactly like this... at least I am with mine ๐
I'm like 75% sure I'm gonna just kick his work off the project.
Ok, so then how do you deal with that professionally?
We're allowed to use copyright free assets.
ditching poor work is fine, its how you approach the issue and resolve it
or rather, properly licensed copyrighted content
nothing is copyright free
maybe broach the subject of the art direction, see if he can tweak it to better fit with the project
So for instance, you might adopt a "sign off process" and then just not accept work that doesn't meet the quality threshold
But you have to do it consistently, so it doesn't just happen to one person
Like the backgrounds I showed before, it said it could be used in free and commercial products. Didn't say anything about crediting them but I'm gonna do so anyway to be safe.
Usually you'd have an art director signing off on art anyway
But student teams often don't have people specifically for those roles
I think the others have done well, I can tell that they, despite not knowing pixel art They're trying their best to do it.
Yeah, honestly its not unusual to have some people on a team not.. really engage
Honestly, We're supposed to be a team of 5 people, but one guy didn't even show up and then there's the background guy
so really, we're only working with a team of 3.
See it with indie "teams" all the time.. a handful of people working and a team of 15 on the list ๐
Just learn what you can from the experience
I've had a few similar experiences on professional games (although never quite that bad, because we'd sack people doing nothing)
We did have people on the team where their work was sub-par and we had to be honest about it
They moved into doing marketing artwork instead of in-game stuff
Students really don't like the discomfort of having to be honest with others though, which is understandable.
One should always be honest about it
No sugarcoating
No "im affraid to offend them" kinda thing
Professional and constructive feedback should always have a place. And if a person cant handle the truth, then.. well. Sucks to be them
It's important how this feedback is communicated tho, as zoom points out. Straight up trash talk feedback is just fueling the wrong fire
@mint terrace Okay, We're given two grades; the grade of the final project and another grade of our individual work, I'm gonna inform him that unless he gives us backgrounds that fit the style and are original, we won't be including his current backgrounds in the game.
There's a really important line between plain, helpful and truthful feedback and being a jerk. Teaching a module on giving feedback prior to assigning groupwork is something I wish would have happened in school.
For sure. Some people cant stand recieving either tho ๐ honest, well ment feedback
Totally. Assuming Positive Intent is necessary skill in whatever you're career you're in. That should probably be taught too.
I always felt better when we got people from industry in, because those guys were brutal, but explained that everyone got the same brutality and it wasn't an attack on someone's worth. For some reason having someone from industry do it makes it OK ๐
When I do it, I'm being mean ๐
well, according to some colleagues ๐
Part of the reason we give group projects is exactly to navigate some of this stuff and to learn some production practices (things like CI/CD, source code control etc)
Weird how many companies mention source code control in their job ads. Given that pretty much everyone uses it. You'd have thought it was a given.
Lots of them mention Jira/Confluence etc. Which I find a bit weird, like you couldn't learn them really quickly.
I have literally taught git to 75% of the people I've helped hire. Not just how to, but what it's for, and what source control is. And not just new grads. That's gotten better recently, but it's weird how you can tell who has had a good job before by things like that.
Every company uses something different, and even if they use Atlassian stuff, they all use it differently. Can't see the point of teaching that.
Its usually so that students have the right bullet points on their CV for the HR people
All of my students will be using git next semester, mainly because that's how they'll be graded (part of my plans to get them to do some TDD)
Some of them already use git, so it'll be fun to watch the rest ๐
Is using behavior trees neccessary for NPCs? They seem way too overly complicated to me, cant i just use Blueprint Macros instead
You sure can
If you don't find BT's useful, don't use 'em
They are very convenient for dealing with sequential AI logic like doing task A, task B, task C, having conditions for those, etc., but if your AI works in a way where BT's aren't so helpful then you can certainly use some other approach as well
Okay ty!
Hi guys, what is the best way to implement an AI pet, which in the future can help its owner.
when my actor dies...the nav mesh doesn't update correctly (this actor is an obstacle) I'm using Dynamic Runtime Generation and it works great with movable obstacles for example. What can I do? Thanks!
This is a complex topic and there's no simple answer to it
if you're destroying the actor it should cause the navmesh to update... if you're not destroying it, you'd need to make it nocollide
i would test it destroying a basic actor...ty
Main reason dynamic navmesh obstacles with characters isn't sufficient is that generation isn't fast enough to treat typical characters as obstacles for the navmesh
Dynamic generation tends to be about not pre-generating the navmesh before runtime (made standard with Navigation Invokers as of 4.26 or so)
Hi, So my Ai controller that I am moving via the Move To node in the Behavior Tree does not rotate. I was able to rotate the character via turning on Orient Rotation to Movement but my controller is not moving which makes it so that my AI Sight perception cone does not rotate. Even my set default focus does not work. I don't understand what this is happing it was working fine yesterday.
So i made a new Controller, Character & Behavior Tree and the character rotates Just Fine.
i compared all my values and they are basically identical.
I'm using it in my other project where the player can build a bunch of stuff, works quite well for that because it doesn't matter if it takes it a moment to regenerate when something is placed :)
You kind of want things to pause anyway, because stuff appearing on the ground in front of you would cause you to pause too ๐
would the actor being overlap method to pick up items be the same for AI characters as it is for main character player ?
It can be
how would the process be ? this is how im doing but for some reason the branch for my ai character randomly activates which i dont understand and it doesnt activate when the ai walks over the pickup item
I have no idea what that's intended to do
It looks like you're comparing if it overlaps with the player and choosing the branch based on that
so basically what i want it to do is that if i overlap it does something else and when ai overlaps it does something else
but for some reason when my ai overlaps it does nothing]
so i wanted to know if thisis even correct
Based on the picture it doesn't look correct :)
the Other Actor value is the actor that you overlapped
assuming this logic is within a character class that you're using for player and ai chars, to determine if the current character is the player, you can check if the controller which possesses it is an AI Controller or not
aaah
@misty wharf this is in a different bp class which is for my pickup itmes
so when it overlaps it gives the item for which the bp is then dissapears
would this work the same in a separate bp too ?
Ohh I see, so this is actually inside the pickup itself
yes
Right - in that case the Other Actor should indeed be the character so that part is correct
hmmm
And I think your comparison to get player character should also work
player pickup works but not for my ai
I would assume it's because of the cast in the second screenshot
Because you're casting the player character to the third person character
so even if an AI overlapped it, it would still do the rest of the logic on the player
i want the ai to pickup the item for me . so i just want it to overlap and pickup if either i overlap it or the ai
so i put the checks
Oh I see
It's a bit hard to say tbh. Try putting some prints in there to see which branch of the code gets activated, or to print out any of the other values you're checking
This should give you a better idea of what's happening when the pickups occur
ok i wil try that
thanks
i was just a bit confused bcuz as the ai is running around it suddenly randomly overlaps sometimes so i will check why that is happening
@mint terrace Oh btw, thank you very much for the large amount of info a few days ago. I got distracted and forgot to respond, but i'll def keep alot of what you said in mind. alot of it was stuff i thankfully was already aware of, but getting confirmation that other folks doin' the same thing also are on the same page in encouraging. Much appreciated!
np
Question about Mass AI, i haven't really touched it much but if i was interested in a game where you fight like, 500 3d enemies on screen at once (or some large-scale RTs thing), would that be where i want to start as a... framework?
I know most examples on the learning portal have been for traffic or landscape items, so is it more for scenery/basic stuff or can you put more complex AI onto it?
(if this is way offbase onwhat the system is, aplogies, i've got some reading mateirals on antoher screen but i haven't really dived into it. Planning to do that today.)
is it anything like the unity EQS system?
depends on what approach to your AI Pawns you take
with Characters and CMCs you will have a hard time running even 200 AI
Why do nav invokers still require a navmesh bounds volume?
what's a reasonable NPC amount for "classic" AI?
I know that two Earth Defense Force games where made in unreal 4, games which put a focus on massive amounts of Dudes and largescale env destruction. So large numbers are clearly viable, it's largely about how you do it i guess.
I love EDF