#gameplay-ai
1 messages · Page 32 of 1
sooo do i stop using the BT and program my own in the enemy blueprint?
you didnt share much context so i dont know
prefered way is designing your BT properly and manage the control flow with BBs and decorators
Use the visual logger to debug. Also check your NPCs collision settings. Sounds like they have something blocking visibility that is larger than the mesh.
but if you need to jump from random node to an another, BTs are the wrong tool for you
basically, i got an enemy that patrols around.
when it sees you, it looks at the last known location for 3 seconds. after that, if it doesnt find you, it patrols again.
if it looks at you for 3 seconds and it spots you, it will run after you.
thanks - looking into this visual debugger here in a few
anyone?
does it AutoActivate by default?
can you debug to see if its activated?
oh wait mb I already got this fixed last night lol
I know Ive been having a hell of a day lol, sorry for the trouble man
there were no troubles - just long pauses between communications 😛
Yeah I apologize
Tools -> Debug if you’re looking for it
thanks - i got an article ... have yet to play around with it... work on it tommorw more than likely
how do you set the location of the enemy within the behavior tree tasks?
I just want the enemy to dodge incoming projectiles
Do you mean like manually set the actor location? Same as you do normally
What I tried to do was set value as vector then set location in another task
Didn’t work though
I’ll have to debug when I get home
you realize tha tsetting the location will warp the actor to wherever you're setting the location instantly right? I'm not trying to tell you how to program your game ... maybe this IS what you're looking for....
But If this were my project and i "wanted to dodge incoming projectiles" ... I would:
1: Detect incoming projectile coming my way
2: GetAIControlledPawn()->AddImpulse(FVector) in the direction left/right (random??) that you want to dodge. Maybe even wait till projectile has moved past or landed wherever it is destined ... whatever your logic is - until it moves back into harms way (if appplicable)
I"m trying to debug why my player pawn is only AIPerceived from the initial spawned enemy out of a spawner class i made...
Tracking this down i found that UAIPerceptionComponent::ProcessStimuli() this->Owner is always AIController_C0... and the pawn is always the same... but i'll have N# of pawns spawned every few seconds - I was expecting different controllers/PerceptionComponents showing here....
Is this a singleton? I would hope not - am I up against a ghost/problem with PIE play testing?
ROOT PROBLEM: AI Perception of my player is only perceived from the first spawned enemy.. any successive spawns the player does not show up in the list of UpdatedActors:
whats a good way to move enemy to player?
service that updates a BB location variable on a MoveTo task
or
task with a Move To node in the blueprint
In this Unreal Engine Tutorial I show how to add an enemy with an AI Controller that follows the player.
It is a very simple AI but I introduce some basic AI components: The Blackboard, a Behavior Tree and the AI Controller blueprint.
See my social profiles here
G+: https://plus.google.com/+JayAnAm
Twitter: https://twitter.com/jayanamgames
Fac...
No it is not a Singleton. Something you are doing is breaking it. Either a collision problem or a set up problem.
i dont think collision is the case... using ACHaracter as a base ... so the Capsule is set to Pawn - which has Visibility set to ignore by default (and not changed)....
This makes 0 sense. The first wave of enemies reacts and behaves fine - why doesnt every other one? Same system, same spawner....
You have nothing else added to the character that has collision? Have you tried debugging it with the visual logger?
Hi everyone. Looking for some assistance. I want to create 2 different types of units, one which can go up steep ramps, the other can only go up small angles. I want the NavMesh to respect these two different types of units, so that the unit who can't go up steep ramps doesn't consider paths that go up said ramps. Is there a way to do this without creating two different NavMeshes?
i'll add visual logger to the mix - what would you have me debug?
CharacterMovementComponent->WalkableFloorAngle
No. You need to create 2 separate agent properties or they will try to navigate in ways that will get them stuck.
Which does nothing for navigation and will cause NPCs to get stuck.
Yeah, the CharacterMovementComponent just doesn't allow them to get there. It doesn't affect the NavMesh data. So am I am guessing I would have to touch the engine code in order to accomplish this without creating two different NavMesh's?
Do you know how to debug? It's a matter of setting aside your assumptions and verifying everything is expected at each step.
Nope. There are supported agents array in the navigation project settings.
not used visual debugger yet - but was goign to throw this into the project today and get started with it... https://docs.unrealengine.com/4.27/en-US/TestingAndOptimization/VisualLogger/
the problem I have is that all of this code is native UE Source - i have no overrides....
so the PawnPerception actors - i cant wrap with VisualLogger (not without al engthy build of engine that i dont really feel like doing in a shotgun attempt at what may result in nothing :/ )
You do know you can edit engine files, right?
this
i wanted cake & eating it too :p
From what I can see, those properties there don't have anything to do with slope, unfortunately. Unless I am missing something.
What do you mean wrap with visual logger? You just add log statements
sure i'll try the log statements
in this reading - it wrapped entire functions with a VisualLogger macro
No idea what you think you are reading. It's just a log macro that is for the visual logger. UE_VISLOG
There should be a setting for floor angle
this is ActorSnapshotting - (this was towards @uneven cloud )
@viral parrot i'm only attempting to help on a subject that i dont really know much about - but i did find this in ProjectSettings:
aside from that i'll stop giving you incorrect informaiton.
You don't need to use snapshotting. Just use the log macros.
Haha. No worries. I appreciate you trying to help 🙂 The NavAgent properties of nothing with slope or angle, but yes the generation settings allow for you to create different NavMeshes with different settings. The problem is that all my levels would need two different NavMeshes which is quite expensive.
The entire point of the visual logger is that it's a timeline debugger that is separated out by categories and actors.
Multiple nav meshes isn't really that expensive. I've shipped multiple games with 3 (indie, AA and AAA).
Ok, awesome. I will see how it goes. Thanks for the help 🙂
only 3 ? you shouldn't have multiple nav mesh bounds ?
i was using them to keep my enemys in a certain bounds of area they can patrol
3 separate nav meshes to handle different sized NPCs. Not bounds volumes. They are not the same thing.
is there a better way to keep an ai enemy in a spot for roaming ?
one single bounds volume ? or it's np to have many ?
I FIXED IT YAY!!!!!
I'm a little confused about the layout of the smart object components, there's a good few there but I'm kinda confused as to where to put what logic for basic AI tasks.
Theres:
The actual smart object component tied to the actor
Smart Object Definition
GameplayBehaviourConfig
GamePlayBehaviour objects
Could someone explain the flow of these components? I've read the documentation, but it's pretty unclear as to why all the components are needed, and what kind of setup you would need for say, lining up a character with an object and playing an interaction animation
There's only one component.
Smart object component registers the actor as a smart object.
Smart object definition is a data asset that defines the smart object. It has slots (locations the object can be interacted with) and defines the behavior.
Gameplay behavior classes are the implementation of the behavior that happens when a smart object is used.
Gameplay behavior config is the data that is used for the gameplay behavior.
Thanks for the explanation.
So, in the example of getting an NPC to sit down at a location I would trigger that on the Gameplay behaviour I would trigger that on the Gameplay behaviour and pass data about the location and animation through the config right?
The issue I'm facing is that I can't seem to find a way to set the config variables on the definition asset through the smart object actor...
You don't set it via the event graph. Data assets are static data.
Have you tried following the quick start guide? https://docs.unrealengine.com/5.1/en-US/smart-objects-in-unreal-engine---quick-start/
Hmm, so where do I set it?
Yep, but they didn't go into passing any data through, the tutorial literally just plays an animtion in GamePlayBehaviour without details about accessing custom data or anytihing
Why are you trying to set a static mesh?!
I'm not...?
I added a skeletal mesh component to the smart object actor to see if I could pass that data through the components
I figured I would have an instance editable variable of skeletal mesh on the config and I would be able to set it on the actor, but as you said I can't seem to do that
No you can't do that. If you look at section 2 - Create the AI Gameplay Behavior again, it will show you how to set up the config, how to get the config in your gameplay behavior and that you are sent the smart object when it's used.
Yep I'm already doing that, but again they don't go into settnig data on the config.
The question really is, how do I set the data on the config per Smart Object Actor?
Surely the entire point of the component is to pass variables from the actor to the behaviour blueprint?
I'm having trouble trying to get my AI character to move towards the player charcater.
Fixed it
I realise I sound confused, lemme show you the example
You set the data on the definition.
Yep, that all makes sense.
Here's the setup I have now:
2 general questions:
-
There don't seem to be any settings for working with lining up animations to objects, is this something taht should just be done on a different actor and the values copy pasted onto the definition?
-
As you can see here, I'm getting warnings for attempting to line up a skeletal mesh to a location value from the data asset, what is the correct way to fire off this functionality? Should I just be calling an event on the character itself instead of handling it in the gameplay behaviour?
-
I don't believe there is a way to get the slot offset in BP, unfortunately. I recommend instead of setting a vector, which will never work, to use an offset from the smart object actor.
-
Your 2nd image is unreadable, so I can't fully read the error. However it looks like you are trying to manually move the character's mesh component, which you should never do. Just move actor to location.
-
Ok, will get a little more tricky when it comes to multiple slots, but I guess I'll work that out.
-
Error basically says it's unsafe to call move component to from a gameplay behaviour BP. This logic is called after the character moves to the object, the logic is there to line up the mesh in order for the animation to be facing the location correctly. I've seen tutorials use this method plenty of times (theres steps I haven't added yet like disabling collision), but how would you recomend I do it? Simply moving to the location isn't enough as the orientation is often off
Well you aren't even adjusting the slot location or orientation. Which does a lot for lining things up.
Set actor location and set actor rotation are what you should use instead of move component.
-
How so? Adjusting the rotation data seems to be purely a visual thing for design, but yes the location offset is good.
-
Cheers, will go with that method 👍
Hi! I’m trying to get my first job in the industry and want to make a playable demo to show off my skills. Does anyone have ideas for unique AI mechanics that would stand out in a portfolio?
Design is up to you but
- Show off you know the difference between a SM and BT
- Use EQS
- If possible utilize C++ BTTask with memory structs
- Systemic AIs lets you be more creative and easier to impress people if you can get it done
- Implement your own utility system on top of the BTs execution flow
- Make AIs remember/forget things with a timespan
and specifically ask Luthage about other ideas when she is around because she's the most experienced when it comes to industry
also a placebo hack is commenting your work with like "this implementation is inspired from this gdc/book/talk/website" gives the impression of you're able to research things on your own and I saw benefits of this trickery during my interviews 😄
Optionally also get used to interoping your AI with GAS
Thank you so much for the advice! May I ask what you mean by systemic AI?
Its related with the overall desing of the AI and/or the game you're developing the AI for
Authored AI: More like CoD AIs, what AIs are going to do pre-defined and scripted
Systemic AI: Hitman like AIs, everything is like a simulation and behaviors are abstracted away
Ahh alright, that sounds really interesting, I’ll have to look into it
Some games also combine this and do some creative stuff like Uncharted
Thanks again 🙂
np, dont forget to check pinned messages for more cool things like this
and GDC talks
is this the correct way to set a vector in bt?
or well, is this A correct way?
I cant add impulse in a behavior tree, so I should set a boolean there and do it in the enemies bt instead?
the problem would be i can only fire it once with begin play
why couldnt you add impulse in a behavior tree? you should have any access to actors & their children components almost any place?
It didn’t have the blueprint
sorry i'm not following... the node?
you have BTTask/service you can do ... and any of them can have actor pointers in them?
Hmm I’ll give that a try in the morning then, thanks!
Hi. Does anyone know why calling a RunEQSQuery node and binding to OnQueryFinished can take 10+ seconds to dispatch/finish the EQS? The EQS is only a SimpleGrid, 2000 radius and 250 density. Using an EQS Testing Pawn in the area I'm trying this in gets me maybe 15 items total, as the navmesh is skinny.
Could low framerate drastically increase the time it takes for an EQS query to finish?
It seems to be variable. Sometimes 3 or 4 seconds sometimes much longer. I call it in a loop, after it finishes and the results are parsed I call it again 3 seconds later.
Anybody knows how to use AnimationSharing for aggressive AI?
EQS is time sliced, so it only gets a certain time budget to run each frame before further calculations are deferred to the next. So... maybe? I guess it depends on how low is low...
Anyone else had troubles with smart object related crashing issues when you end playing? :/
Very simple setup, literally 2 characters walking to a smart object on a map (driven by a BT, pretty much identical to the UE quickstart guide setup), works fine when I run, but when I end the engine crashes with this message:
Assertion failed: OwnerController->GetPawn() [File:D:\build\++UE5\Sync\Engine\Plugins\Runtime\GameplayBehaviorSmartObjects\Source\GameplayBehaviorSmartObjectsModule\Private\AI\AITask_UseGameplayBehaviorSmartObject.cpp] [Line: 271]
Personally, I'd look at demonstrating a bunch of logic approaches (state machines, behaviour trees and Utility systems are a good start). I'd also look at demonstrating animation integration, so maybe something like having a battle between two sides with cover taking. A lot of employers ask for things like pathfinding which is pretty silly, but you could do worse than implementing some crowd agents to demo that. Also maybe things like doors/ladders/elevators etc. They'll likely want to see lot level skills, so stuff you've made yourself in C++ and then stuff that integrates with Unreal Engine. I'd probably want to show of writing AI toolsets too, so look at maybe extending an editor somehow (enabling states in the behaviour tree editor springs to mind of the type of thing). Ambient AI stuff like having citizens in a street using smart objects might be a good demo too. That said, a lot of this depends on the studio and the products they work on, so maybe figure out where you want to work and build the demo's to suit?
Other than that.. how about some multi-agent coordination? Or some more advanced navigation stuff, like having a system that allows flight through tight spaces. Or just some actual gameplay demos that don't suck and have an AI feel (if you're going for more gameplay AI rather than tech)
Might even be better to just make an AI centric indie game and show that 🙂
Yeah I was definitely thinking more along the lines of a gameplay demo, but that’s all great advice! I’ll definitely look into all of it, thanks!
I'd like to take this time to personally thank whatever badass wrote FAISystem::CheckIsTargetInSightCone and blessed us with this amazing comment:
I'm trying to come up with a decent way for enemies who are in combat to notify other nearby enemies to also join into combat. I have two initial thoughts, but any perspective would be much appreciated:
- When an AI enters combat, use
Report Noise Eventand tag it such that when other perception components hear a noise event they check the tag. If it's equal to Combat, they then also enter combat and report a noise themselves. (I'd also likely do a pathfinding check to see if the two AI are close enough for the noise to be successful. If there is a room between them, the noise perception would be discarded.) - Have a
BP_AIGroupwhere each AI registers itself with the group. This blueprint runs on tick or on callbacks and, if any of its members enter combat, the rest of them do as well. (This feels slightly less realistic because it doesn't take distance into account.)
Any thoughts?
It was late last night but I finally realized what you mean , thanks for the advice!
my ai is bouncing away when hit him,how can i solve that?
-
Look at job descriptions in your area and write down the skills needed. Gain those skills.
-
Make tech demos in C++ if you are looking for a programmer job. Lots of people say to make solo games, this is a complete waste of your time. If you are unsure about what to make, find interesting talks from the GDC AI Summit and recreate what the talk was about. Use programmer art or free assets. We don't care what it looks like.
-
Do game jams. Being able to work in a cross discipline team is a skill you need to have. We will ask you questions about working on teams, so prepare your answers. Things like conflict resolution and pushing back on design are key topics.
-
Network. Go to local events. Form relationships with different people. Most jobs in the games industry are from your network. My current job wasn't even posted before I was hired, which is incredibly common.
-
Apply everywhere. Apply to gameplay programmer jobs as well as AI specific roles. Apply to smaller studios, which have less competition than the big ones.
Thanks so much! So for tech demos, do you mean like a fly-through build where you can just watch how the AI behaves, or actual short playable demos?
Neither of your options are great, but the first one is better.
I use an AI message system that I created. That way you can send whatever message you want and listen for whatever you want to.
We don't have time to play your demos. Your portfolio should explain what you did and how you did it. Then have short gameplay videos.
I see, that’s very different from what my teachers taught me. I really appreciate it!
You're welcome! Unfortunately teachers don't hire so the advice is not always up to date. I'm the AI lead for a AAA studio. We get hundreds of applicants for roles, so we don't have time to spend more than a short time looking at a portfolio.
We get hundreds of applicants for roles
really?
like 100s for AI programming role or in general?
Yes. The last junior role I had open got > 300 applicants. Granted 90% of them were academic AI (machine learning) and 0 game dev projects.
wow, interesting
Senior is a lot different. We've had a role open for months. Most of what we get is junior applicants. But I have 2 juniors right now, so I can't mentor another.
I assume senior in AI role is also very comprehensive
its also less attractive than other roles i guess, or at least less popular
so no wonder its been open for months 😄
I think it's harder to get the experience. Not a lot of people hire junior AI engineers. People usually start as gameplay. They either get experience by picking up AI tasks or find someone to let them move over.
The 1 senior I have now has never done AI before. So I'm mentoring 3 people, which is a lot.
I started out in UI, because I have a background in art. My 2nd job was gameplay, but I was able to do a lot of AI work, because I had done a lot of AI things on the side. Which allowed me to specialize as an AI engineer for my 3rd job.
I started out of curiosity without any prior experience/role, then got hired in a local studio to assist existing experienced programmers. They werent able to do AI because of the workload so I wanted to take some initiative to learn, ended up reinventing some things in the engine like perception and EQS but that gave me some confidence. Later on I continued with the motivation of getting hired as AI programmer until I really got bored of trying to workaround things because AIModule makes everything very difficult. These days I feel like I'm decaying even further from anything related with AIModule especially after I worked with Kythera for a month
I was a bit of the opposite in that during job 2, I had a month of downtime as they were trying to get funding for a game. So I documented all of the AI systems in UE. So once I started using them professionally, I fully understood them. I also worked with a bunch of people with a decade of UE experience, so I learned how not to fight the engine.
How did you go about documenting the ai systems if you don’t mind me asking?
I started with Epic's documentation. So it was mostly pages of links to start with. Then I dug through the code and added notes. Then I tried the various things out and added what I learned.
I see
Sounds like you out in some good work!
Is there also a c++ version of ai tools in unreal?
this isnt as much AI related - as it is collision based. Study up on your collision settings/presets - its fundamental towards basic elements of game design.
This makes sense, thank you! In the above example (one NPC in combat should send a message to another), how do you know which NPCs to message? Is it based on proximity or are they connected together when spawning or...?
I do it based on proximity.
when using character movment the character will sometimes jitter left and right when taking a corner or moving diagonally, is there a way to fix this?
I do have smooth rotation of the character, but it still jitters pretty hard sometimes
If I'm going to do this, probably I'll make a component for listening AI group information. You can make a gameplay tag to tell the group and use a enum for their state like unaware/alerted/battle, etc. Then you can collect the information whenever you want to tell the group member situations and make your logic to trigger the specific AI pattern.
In my own implementation, I used a message bus to notify my team/squad of events.. the squad controller used the info for target selection (don't all fire on the same enemy when multiples are visible) FMessageEndPoint is the place to look. I really enjoyed using it. So having an actor that coordinates response for the group makes a lot of sense. Mine had timeouts and the like too, so best to add yourself some debug visualizers
Sorry for duplication, I asked my question likely in wrong place first time. Just noticed the AI chat here now.
I have highly modular vehicle and each component of this vehicle could be as target for AI. I'd like to use AIPerception to detect those targets by AI but the issue is the sight can only detect actors (not components). I plan to replace some of my static mesh components to separate actors but I am afraid about performance, since components are lighter than actors.
I don't want excessive calculations since I need to check each static mesh component on visibility (whether it is blocked or not) and distance by custom functions although Sight has already done it if they could be actors. And it uses time-slicing under the hood not to take all CPU time. I will not have so much vehicles. The more interest for me is those components. Does it make sense to replace those "target components" to actors? And what about performance in this case?
That would depend, do you want to see all of the component parts (i.e. if any of them are visible) or do you want to just randomly know if any part is visible to mark the whole thing visible?
I wrote my own sense using the AISight as a template and did some stuff with that for things like checking individual bones on a skeletal mesh
My use case was just "is some part of this guy visible", for which you could just subclass the function that picks the point to do the sight trace too
But then I went overboard and had stuff like concealment volumes (bushes etc)
Have a look for the sight target interface I think its called? GetSightTarget or something similar.. its been a while 🙂
All those components are individual separate parts of the big vehicle. If only one is clear by visibility (AI can hit it) and others are blocked by some other collision it means that only one par is visible by AI and could be hit
Thanks
Its a function you can implement that chooses where to look on the actor.. you could just tell it to look at each component in turn
Its basically what I did for my bones
I just had a "percentage of bones seen" value, because I wanted to alert a suspicious agent if it saw a foot poking out from a bush
Just had a quick look into IAISightTargetInterface. It has a method CanBeSeenFrom. But not sure if it could help me. It just perfectly works if I needed to detect what points and how much AI sees. It would work like in your case if I needed custom interpretation what is seen and what is not. But still GetCurrentlyPerceivedActors or event will return me a central actor (vehicle). In my case I look for a way to operate over targets in more simple way having an access to all targets "from the box". For example, calling GetCurrentlyPerceivedActors, giving to AI targets to attack
Well, you can just take the returned actor and get all of its components, the point is that you can implement CanBeSeenFrom and do the tests for each component there
OK i checked on my better/main PC that doesnt have low framerate and it still takes forever for the EQS to finish
hah...ok...
it was an EQS with no tests on it
i added an arbitrary/useless test (distance, prefer lesser or filter only, from 0 to the simplegrid's radius size param) and it works fine
this is...normal behavior? we aren't allowed to just generate a SimpleGrid or something and return the items as an array without waiting 10 seconds?
Hello, is it possible to use AI senses with player controller? I need to check whether player sees AI characters of a certain type, so that they do something, and I thought that applying their senses against them is a way of doing that
Anybody have any good recommendations for learning systemic AI or utility AI?
I am doing the same thing right now. And I've got this working. My player can detect enemies with the AIPercetion component
I saw that AIPerceptionComponent.cpp 191 is saying
// Whilst it should be possible with some code changes, to make perception components work when being added to other AActors than AIControllers, it's not something Epic support.
UE_CVLOG_UELOG(!AIOwner && Owner->GetWorld() && (Owner->GetWorld()->WorldType != EWorldType::Editor), Owner, LogAIPerception, Warning, TEXT("%s: Perception Component is being registered with %s, they are designed to work with AAIControllers!"), ANSI_TO_TCHAR(__FUNCTION__), *Owner->GetName());
Did you encounter any problems though? From the comment it seems that something should break
I can confirm that I added my custom AIPeception component to my PlayerController. It is just a component that I inherit from UAIPerceptionComponent to make it Blueprintable to extend it in Blueprint. You can't create a blueprint from AIPerceptionComponent directly. Then I Implemented IGenericTeamAgentInterface to get Detection By Affiliation working and print the result that comes from OnTargetPerceptionUpdated and it prints me a correct enemy pawn. At this step I have no issues but maybe they will be later.
I need the same methods of target detection. Since my pawns can play from player commands and be as AI as well, this is a reason why I want to get it working with a player. When player plays, a pawn still has to detect available targets as AI
That's weird, I've tried to do something similar, but it didn't work to me. I'm not sure what direction the vision cone is looking at though since I can't use perceptions debug thingy 😦
try to check on all categories under Detection By Affiliation (Neutral, Enemies, Friends). I don't remember but by default it has wrong one selected. You need to implement this interface if you want to categorize them. And use the cone 180 to ensure the bot sees around. Of course, increase the radius.
Hi! Quick question about the AI Sight Sense. How could I change the height of the AI? For what I understand, the AI does a linetrace from the location of the AI to the location of the Target, but I would want to use a custom height, like the eye height of my AI.
People in UE forums tell me that I have to make targets inherit from the IAISightTargetInterface and override the CanBeSeenFrom function, but I'm not 100% sure of it
override this method in your character:
void AActor::GetActorEyesViewPoint( FVector& OutLocation, FRotator& OutRotation ) const
{
OutLocation = GetActorLocation();
OutRotation = GetActorRotation();
}
As I remember this is how I solved this
for example:
void YourCharacter::GetActorEyesViewPoint(FVector& Location, FRotator& Rotation) const
{
Location = GetMesh()->GetSocketLocation("eyes");
Rotation = GetMesh()->GetSocketRotation("eyes");
}
Ohh thanks! I'll try it
By character, you mean my AI right?
or the targets of my AI?
your AI character
yeap. I have been doing that a long ago. But as I remember this is a way how I reached this
Thank you so much!
Hello everyone. Is there a node similar to "GetRandomReachablePointInRadius" , but gets all the points in the radius rathern than just the one.
You want random points in radius including unreachable by navmesh? If so, you could use this:
Not exactly. I want all the navigable points in an area based off a point I give it and a radius.
It worked perfectly! Thanks. My only problem is that, for example, even if the enemy head is above a wall, and the player's head is above the same wall, the enemy should be able to detect it, which is currently not happening
In this case, should I make targets inherit from the IAISightTargetInterface and override the CanBeSeenFrom function? or it would be better to create my own AISight sense and override the function that generates the linetrace
How do people generally solve spawn animations? Especially if the NPC is supposed to crawl from under the ground. We're spawning the actual actor in the intended position and animating the mesh from underneath. Tried a Gameplay Ability, but that made it pop from t-pose into the starting underground position, so now just doing it in the anim BP, but I feel we missed a trick. Spawning underground and animating up with root motion doesn't feel right, I want the capsule in its intended position
"All points" would just give you all points in a continuous space, which isn't really sensible. This is not a waypoint graph, but a navmesh. You may want to run an EQS query if you want a selection of points
By all points I just meant all the points with in the radius. But I could just use the run eqs query and feed in the nav data?
You want two million points?
I dont necessarily want that but I want to be able to get points in a radius and manually filter then out accordingly. Which I guess running the EQS could do for me
Or all points an X distance apart?
X distance apart
well here we go
"all points" isn't a mathematically sensible concept
if you're imagining a grid, the navmesh won't tell you that
so yeah if you try a simple EQS query which generates a grid and casts them to the navmesh, that will work perfectly for you 🙂
That makes sense. I didnt think of it giving me points that were 0.001 away.
"get random reachable point in radius" doesn't get all points and pick a random one, it generates a random point and checks if it's reachable, or starts from the origin and nav walks in a random direction
if you want to control which part of the target AI bot has to see, you'd better override CanBeSeenFrom(). This will be much simpler
nope, there is no function for that. It doesn't make sense. It could be any location. Try to have a deterministic value. For example, 10 random locations
Dont think there's a node for that, no
At that point you probably wanna evaluate them or smth? If so the eqs can be your friend
GDC has a lot of really good talks. Game AI Pro also has a good article on Utility by Rez
Thank you will check those out
Worked as intended, thanks a lot for the help!
Hot damn, turns out using a much smaller RVO radius was all that was needed to eliminate most of the "body blocking" on the nav agents. 🥳
The way we handled this was to spawn with deferred spawning, turn mesh visibility off, finish spawning, play the montage while pausing BT logic with an anim notify in the spawn animation to switch visibility back on at an appropriate frame.
Is it correct to run behaviour tree on event "On Possess" or it is more correct to run on "Begin Play"?
On possess makes most sense as you're guaranteed to have access to your pawn
I've created a behaviour tree where the enemy will roam around an area and if it sees the player character, it will begin to chase the player and shoot. Once the player character leaves the area, the enemy seems to just stop. I would like the enemy to roam around the area again. How do I do that?
In other words, is it possible to go back to "Look Around"?
Yes. First of all, I’d move your is set decorator to the left so it takes priority. Then get rid of the is Not Set decorator because it’s redundant at that point, if is Set failed then it’s obviously not set.
Then on the new right branch (is not set behaviour) you can do a random wander behaviour, where it gets random locations and moves from point to point. You can watch the 3rd pinned link video to see how they do that
if player is not set it should roam
so maybe when you leave the area try to reset that, it's probably stuck on hasseenplayer, i would log that value see if it changes when your trying to change it
i used the ai controller to set player, and the aiperception to turn it off/on
not sure about the correct way or not, but this seems to work well so far
instead of a canseeplayer boolean, i just set the player object / set it to nothing
Hello everyone ! I need some help with receiving Yaw input from ai controller. How to get rotation only in one axis ? So I need them just look left or right
whats a good alternative to a timeline inside a bttask?
Im trying to set velocity on timeline update
this but in bttask
Hello! Quick question about AI Stimuli Source C++. How do I change the height of the Stimuli Source so the AI can see the character in a custom height, whereas by default, it tries to see the center of the Capsule Component. I need this because if my AI is half hidden behind a cover, it's will not be detected. The start of the trace is correct, it traces from the eye of the AI (as I wanted) to the center of the seen capsule which is wrong.
I have tried to override the GetActorEyesViewPoint function in my Character, but it doesn't work. Should I dig the Perception System code or there is a simple way to do this? In the picture, the left Ai can see the other, but the right can't.
There's no such thing as yaw input, because AI do not use input. You can get the control rotation from the controller and break the rotator to get the yaw.
So when I put a rotate to player task the ais rotation is off by 90 degrees, any advice?
you did it in bp ? i had the same problem i ended up using the behavior tree one
rotate to face bb entry
No, I used the bt one that is premade
If I wanted some mass ai what are some of the cheapest forms?
Use vinterp to on tick
Try drawing a debug line of your forward vector to make sure the mesh has the same rotation as the root
I really gotta work on using debugging for blueprints lol
I think I don't understand this EQS behavior. If I configure distance test to Filter Only (no scoring), give it some max, then queries set as All Matching / Single Random Item from Best work a expected (on the right) but queries configured as Single Best Item seem to give just wrong result (left). There is no difference between these two, same query and setup, the only difference is Querying Mode.
anyway, for now I will use workaround Filter & Score with Score Factor 0, works as expected
unclear if it is just debug rendering issue or query issue
You need to implement this:
IAISightTargetInterface::CanBeSeenFrom
Thanks, this is exactly what I need !
Hey guys, I need some pointers on how to create in-fighting (where enemies fight each other). I already have aggression values and some attack animations set up but they only attack the player for now. I cannot seem to figure out how to do this for AI vs AI and there's literally no resources online.
Thanks in advance!
what parts not working ?
Single best run mode filters out slightly differently. It takes the most expensive filter only and saves it for last. Sorts all the items by score and runs the filter ONLY until the first one passes. Since you have no scoring tests, it starts with the first one generated. The rest are green not because they are valid, but because they aren't even being checked. It's a performance saver.
how are you detecting the player vs the other AIs ?
im trying to make a tower defence game and ive come across an issue where i cant seem to get the ai to move around the world, i have an ai controller and a nav mesh, the AI bp doesnt seem to be firing on event begin play even though i have the parent and child actor connected
the child actor spawns in the world playing a walking animation but doesnt move off the spot it spawns on
so just to clarify, this begin play is on the parent? Does it work on the parent?
its not working on the parent
you're saying it's not firing, but in the other channel I thought you said the move is failing
in the level bp im getting the child AI to spawn off points around the world and when they spawn they just walk on the spot
so this is failing
for one you should prly not do things in the level bp, but we'll focus on the AI part for now
"not firing" != failing
ye ok
if your moveTo is failing, first thing to check would be your navmesh is showing ok, then give it a different destination and see if it works.
this is my level bp
you'll likely need to use the Tools-> Debug-> Visual Logger, but for starters, I'd try playing with the destination coordinates, see if your goal location is bad
ok
omfg ive spent 6 hours trying to fix this and it was just th z value omg i had it set to 0 and it needed to be set to -4000 bruh
im so pissed
so much time waisted
aye, lots of problems will have simple answers like that 🙂
the player detection is being done via a sphere trace
oh? Not AIPerception & EQS?
only the player detection is being done via a sphere trace
ok, so which part doesn't work then? just them attacking each other?
I've set it up in a way that only certain prey can be attacked by predators
they "hunt" for them
it's an OHK for now
just them attacking each other?
yes
they seem to just stand next to (or inside) each other
so they do the hunt part fine, just don't actually attack when they get there?
(collisions are funky because I am using the character class)
I have a lion and a crocodile, both of them hunt deer and zebras
but they don't interact with each other
the same thing with hippos, they are apparently the most aggressive animals on the planet but they only attack the player in my project
did you make this interaction code yourself or is it some plugin?
this is the whole list of interactions but very little of it is functional
all me
ok, so predators attack prey but they don't attack each other?
yes
k, well we'd need to look at that code
I'm doing some refactoring with herbivore food rn, after that is done, I'll need to make it so they compete with each other as well
right my b, hold on
this is the BT
hold on I mis-configured a few things
alright, looks like I have some other stuff to deal with for now
I'll come back here later
thanks for your help man
Hehe np
Thanks a lot, that definitely explains it! Would deserve better visualization to communicate it better but I guess it is the result of EQS not being officially finished. I suspected this must be some special case as there were some related questions or issues (https://issues.unrealengine.com/issue/UE-137553) but nothing exactly like this.
Getting super inconsistent results when setting up an eqs query to find a valid location for a ranged attack.
Basic system is: generate a wide grid around the player, trace to the midsection of the player from each point and filter out any thing that hits something on the way (the player is set to ignore the trace, everything else blocks), then score for the closest item.
Everything looks fine in the testing pawn, but when running it live the points all seem to register as valid, none are being filtered by the trace!
Can't seem to work out why it's going wrong, any help would be great 😃
Everything looks correct on the test pawn
At the end the issue was the skeleton. The head bone I was using for GetActorEyesViewPoint() had wrong transforms, it was pointing upwards. Using a client to activate AI debug on the server character helped 😄
Hey is there a way to feed custom path points to MoveTo function so that it won't do path finding ?
i tried back tract the moveto function to look for a way to do this and found this function "FORCEINLINE FPathFindingResult FindPath(const FNavAgentProperties& AgentProperties, const FPathFindingQuery& Query) const" but can't backtract this function any further.
Hello
Is there a way to control how "AIs" BTs are loaded in game ?
For e.g: I don't want my wandering AI to wander when the player is out of side (for performance)
lots of different ways
Yes. You use async loading and soft references. However if you don't want them to do things when too far away, start by turning them off.
You can override the path following component and inject custom path points there
Anyone know of a performant means of checking if the AI is on a nav-mesh? Is a nav mesh trace suitable?
okay thanks, i was wondering if they was a way to "automatically" stop the AI, without (for e.g) check at each tick the player distance
Project to nav mesh. It's a function in the navigation system
Nope. If you use C++ the significance manager is really nice.
thanks!
can someone help me out with this? #ue5-general message thanks!
Can you show the tree ?
I think you’d be better off to stick that bool in a bb key and check it using a decorator, so if it fails you can abort up
Why my ai stops working ? I set up just a montage when i hit him and now sometimes after one punch, sometimes after a couple the ai just stops
https://streamable.com/o5nrsg
this thing isn't much help
https://streamable.com/6qyijp
in that BT debug view, you can pause and step back/forward
should tell you what conditions are failing
So when I use normal navmesh it takes ages to create the navmesh for even a small testing area i'm using.
I also tried to do navmesh invokers
but that was worse and droped my fps in game to the 10s from a smooth 120
It seems like this stuff just works out of the box in the tutorials I see with them using it in much larger settings
is there something I could be missing?
I'm struggling to find answers online
Hi, does it make sense to write my own AIPerception system? I got modular vehicles which consist of multiple components. And those components are going to be as potential targets. Most of the time I will query those components not actors. Since AIPerception works with actors it arises a question about writing my own optimized perception system. Does it make sense? Maybe reconfigure vehicles and replace components by actors? I've got tests. With many actors I have an increased spawn time that does not bother me a lot since I don't spawn a lot during gameplay but with actors it even works a bit faster than a single actor with tons of static/skeletal mesh components.
Hello, is AI sight sense always a cone? Is there a way to make it a pyramid instead?
How would you handle making pedestrian crosswalks - I could see about a BP actor that is basically a nav mesh modifier and it swaps out the nav meshes, but how would you construct the logic that would make a pedestrian keep going if the nav mesh changes when they are in the middle?
I originally used collision boxes at an intersection but it became an organizational nightmare because there were so many of them to deal with (2 per each corner)
NavLinkProxies maybe to connect the 2 sides of the road? You can dynamically enable/disable them and you also get events when a pawn uses it.
the whole thing must be failing, it just shows it moveto, then wait but it's not finding a spot, and it should still be fighting
So if I did a nav proxy, I could keep them always enabled but just change the cost of the nav mesh modifier? The tricky part is making the AI wait like a person would instead of looking at the high cost and then routing around it although I guess if all the cross works were my cost it wouldn't try to route around it per se? I wish there was a system already in place that I can just buy off the marketplace like traffic systems
Right now the two edge cases I'm dealing with are 1- making them wait in place for the light to change , 2- making them continue once like changes but they're in the middle of the cross walk
But an ideal system would take into account the actual crosswalk light - If I did that I'd be able to set up a timer that just made their AI wait
I would say keep links always active. On entering make the pawn check the traffic light/crossing light. If it is red you could make it cancel the move and put it into a wait until the light is green and then continue the move. Then once they start moving through the link even if the light turns red they will continue walking through.
However no clue how scalable this approach is. Another option might be making the crossings smart objects with slots that pawns can occupy until the lamp turns green and then in the smartobject behaviour you let them cross the road by modifying their navigation class or just simply telling them to walk to the other side. Again only problem with this approach is scalability as in maximum concurrent pawns being able to use this system. No clue if smart objects have a slot that can take "infinite" pawns or every slot can only have one occupant.
How could I make them respond to entering a nav mesh modifier? That approach to work I could extend the cross rocks out to both sides of the sidewalk so they enter them earlier but checks for the light like you said

I guess I need to learn about smart objects I have no idea about them
There's an event when reaching a NavLinkProxy which you could hook on to. ^^
I would do it as a dynamic modifier that changes the area class. Area classes can change the entering cost and/or the path cost. You can also trigger different behavior based on the area class if you know C++.
Problem with changing the area class is that it does nothing to make them actually wait? Is that built in the navigation where the cost is too hig
You'd have to add that functionality regardless of how you do it. You can get the area class during path following, if you know C++.
Nav links are an OK solution, if you are BP only. Downside of it is that you have to place all the links.
You have the source code. So yeah... but.. why?
I'm so confused
adding nav mesh invoker
and having a tiny navmesh bounds
literally drops my fps from 120 to 30 by stepping into it
all default setting
it seems like even tiny amounts of navmesh are taking rediculous resources for me and I don't see it elsewhere
What's confusing? Invokers are expensive.
not this expensive
this is unusable expensive
just to be clear a 1m^3 drops the fps by 20 and it's not even big enough to have one AI in it
that's not normal
it also runs much cheaper on a fresh project, practically free
so clearly there is something I'm missing
but I can't figure out the difference since i follow the same steps in both projects
I'd stream it in the voice chat to show whats up but i'm between microphones
Try running the Visual Logger instead of the EQS test pawn and see what the results are (Tools > Debug > Visual Logger).
Ahh good idea, I'll give that a shot 👍
Use #profiling to determine exactly what’s causing the drop, you might be missing something
yeah good call
would anybody here be so kind as to show what a good example of efficient use of navmesh invokers? I think having a better understanding of what a good situation looks like might help me a lot. Like just some settings or what your navigation profiling looks like. THank you!
what i have just looks nothing like the videos and they never seem to show much of the details
Why would this break my ai ? without it everything works fine, with it after a few plays the ai just stops working
do I need to override abort for a task to abort properly and move on to a different node
considering that I don't need any custom abort behavior
Where did you put that?
These things are better done outside the task using bb keys and decorators
in my enemy bp
I mean where is that event being called
Not sure what you’re trying to do exactly
in the character bp, when recieve notify tick on notify state
it's a function
it's on the end
I'm just trying to ask if the behavior tree system breaks when I don't override abort and it tries to abort
I've ran into werid issues when I didn't manually override abort before and I didn't know if that was the issue, or if it was something else. I'm assuming it would be something else since it doesn't make sense for a user to always have to implement abort for every task, when they don't need any custom behavior
I'm moving tasks to c++ now just for fun, and so I'm trying to make sure nothing will break
EBTNodeResult::Type UBTBreakVehicle::ExecuteTask(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory)
{
return EBTNodeResult::InProgress;
}
void UBTBreakVehicle::TickTask(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory, float DeltaSeconds)
{
//UDrivableVehicleComponent* VehicleComp = OwnerComp.GetOwner()->GetComponentByClass<UDrivableVehicleComponent>();
UChaosVehicleMovementComponent* MovementComp = OwnerComp.GetOwner()->GetComponentByClass<UChaosVehicleMovementComponent>();
if (MovementComp->GetForwardSpeed() < 10.0) {
FinishLatentTask(OwnerComp, EBTNodeResult::Succeeded);
}
else {
MovementComp->SetBrakeInput(1.0);
}
}
like here is a very simple task I made to make a vehicle break until it is going less than 10 uu, was just wondering if this looks all setup correctly since it's my first c++ task
So you’re calling that function several times ?
Ok, so you’re calling a function that’s supposed to run in one tick, several times and this function calls an event that has a delay (latent action) in it, do you see how that could cause issues?
"calling a function that's supposed to run in one tick" ?
Yeh, functions run in one tick, they do not support latent actions
Yes but even tho you’re calling the event at the tail end, it’s prly getting bottlenecked inside the event because of that delay
Ultimately you’re calling an event that’s already busy trying to complete, so it tries to start it again, but then the delay is over and it jumps
Delays cause all kinds of problems 😀
without the delay and trying to play the montage breaks it as well
and the montage shouldn't be run that much
The montage is also latent
If you’re calling that event on tick, you’ll have the same issues
how would i go about doing a hit reaction then, i followed a tutorial mostly
Ah i c what you mean. Not sure if you need to override that when doing it in cpp
I haven’t played with animations within AI much, sry. All I can tell you is firing latent actions on tick will cause such issues
ok, i'll have to look into that
just call it once and not in any tick
also since it looks like you're doing it without a behavior tree
(which, you probably should be)
I would manually code in that gate with a bool and branch instead of doing the do once node
Looks like it's a weird order of operations thing on the eqs behaviour BP that was causing it to behave differently in-game, switching it to trace first seems to have resolved it... Very weird though
This is from engine code:
UBTDecorator_CheckGameplayTagsOnActor::UBTDecorator_CheckGameplayTagsOnActor(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer)
{
NodeName = "Gameplay Tag Condition";
// Accept only actors
ActorToCheck.AddObjectFilter(this, GET_MEMBER_NAME_CHECKED(UBTDecorator_CheckGameplayTagsOnActor, ActorToCheck), AActor::StaticClass());
// Default to using Self Actor
ActorToCheck.SelectedKeyName = FBlackboard::KeySelf;
// For now, don't allow users to select any "Abort Observers", because it's currently not supported.
bAllowAbortNone = false;
bAllowAbortLowerPri = false;
bAllowAbortChildNodes = false;
}
Does anyone know what does the don't allow users to select any "Abort Observers", because it's currently not supported. mean? Why they are not supported? Is there going to be some ill effects if I copy this class and allow aborts?
it means you can't set that decorator to abort the part of the tree below it
it will not even show as an option
Does BT node memory persist between multiple BT nodes executions? Like if I have a task that does some things and caches intermediate values in node memory, should I reset those variables in node memory after BT task is finished so that when I execute it again I won't get old data on ExecuteTask, or does BT component actually handles this and each ExecuteTask guaranteed to have clear node memory? 🤔
to expand Zlo's answer,
Why they are not supported? Is there going to be some ill effects if I copy this class and allow aborts?
they are not supported just because epics didn't implement code to observe gameplay tags changes on actor. So if you fork this node and allow aborts it won't change anything because the decorator itself doesn't call RequestExecution anywhere. So these bools are set to false just in order not to obscure users by providing flow abort options that won't work (there will literally only be None in the flow abort mode dropdown in BT editor)
Oh, now I understand. So it needs to be event based and handle listening for the tag added removed etc. Now I'm wondering is it even worth doing that in observer, when I could easily make a BTService that polls for the tag every 0.1s or so. Sure, it won't be event based, but much easier to implement.
UBTDecorator_CompareBBEntries seems like a good example.
Yeah polling is an option, but UBTDecorator_CompareBBEntries is not an example of polling. Quite the contrary - it's an example of event-based approach - it subscribes to blackboard value changes and on event it reevaluates the decorator
Now another question - is there a quick way to force all items to fail in UEnvQueryTest except for iterating over all of them and calling ForceItemState?
for (FEnvQueryInstance::ItemIterator It(this, QueryInstance); It; ++It)
{
It.ItemIterator::ForceItemState(EEnvItemStatus::Failed, 0.f);
}
What I meant was: UBTDecorator_CompareBBEntries is a good example of event based approach. My bad putting it after the initial text.
No. The node memory is created when the task starts.
What about BT services? does node memory persist after OnCeaseRelevant if execution got into that BT service again?
I do not believe so, but you can test it.
The last filter test doesn't run on all items when using single result run mode.
i tried with a bool, it still breaks the ai
i used the bt for the attack from the enemy, i need to use the bt for the hit reaction as well ?
You need to override abort anytime you have things to clean up from an inprogress task. Shouldn't need to do so otherwise.
Your task looks fine, except you aren't checking pointers and are hard coding values instead of making them variables.
i figured a hit reaction would be pretty common stuff to do, ig i'll try some other tutorials
the one i used didn't have a bt, so it wouldn't be noticeable it breaks
Hit reactions should not be in the BT. They should pause BT logic if they need to take over the AI and you need to cleanly abort all your tasks that do things like play animations.
So i need to abort the whole thing if the enemy getting hit ?
how would i make it so i can keep punching, but he punches back sometimes ?
like a fight
i feal like if i'm punching rapidly and the bt is cancelled he won't fight back
hmm
so then the enemy attack in the bt is probably not a good spot ?
so set a key before i play montage, then check in bt to abort stuff, then set it back ?
Huh? Where did you get that from?
well how would i cancel stuff in bt when i play montage ?
and how would he keep fighting
That depends on what kind of hit reactions you want. Do you want additive reactions that do not stop the attack? Or do you want stagger reactions that do stop the attack?
i want he still attaks on the random amount, but he gets hit also, then attacks after the random time
You pause the BT. Like I said.
hmm
That didn't answer the question.
i don't want to stop him from attacking
so pause the bt, play montage, play the bt ?
Then learn how to do additive animations and don't pause the tree when you play the animation.
ok i'll look into, i tried a simple additive with the punch, and also tried the idle but it failed again
i'll have to dive deeper ig
the tutorial i saw was short, and it worked for them when walking and trying to attack
Having some issues with the CharacterMovementComponent and performance. Currently I have a BaseEnemy Character, which has the simplest AI behavior tree. It moves to a chosen Goal (actor) on spawn.
My hope is to have ~80-100 of these enemies all walking to various goals at once (tower defense), but when ~15 of them are spawned, performance starts to tank. I go from 120fps to ~50. Then when I get to 20, it drops to 40, and when it gets to 30, it drops to 25, and so on.
Profiling shows it is definitely the World Tick as a result of the CharacterMoveComponent.
I have tried changing it to NavMeshWalk, enabling all the optimizations that made sense to do, but still performance just tanks, and I'm not sure why, that doesn't seem like a crazy amount of enemies to have on screen. (And render time in the profiler is fine, it is fully game thread limited, due to CharacterMovementComponent).
I tried as a test just swapping out for the FloatingPawnMovement component instead, and that has tons of problems of course, but performance stays stable for way longer (50+ enemies at 60+fps).
Is there any additional things I should look at that could be tweaked?
I'm looking into influence maps and have a few beginner questions:
- Is anyone using any good existing plugins off the marketplace? I did a scan, but can't find anything for 5.x.
- I want to discretize the world into cells. Should I do this by walking the navmesh somehow?
- ...how badly will world partition hurt me as I learn about this?
How difficult would it be to procedurally generate a spline path to have something like a bird fly between two points that may have obstacles between them?
You need to profile more. Not just that it's the movement component, but what part of the movement component is taking up all that time.
Yeah, that is mostly just laziness from me during the prototyping process, will probably add checks soon, though everything there should always exist if it’s functioning in the behavior tree. There was one issue, and that was that I needed enable the ticking behavior in the constructor
Are you sure its the CMC that's causing the performance hit? I've done tests with ~50-80 enemies and the bottleneck was the animations. (Using animation sharing I was able to get to 60 enemies at 60fps) with a fairly beefy computer
(Though if you have super-low poly characters than I could see it more likely being a problem with the CMC than the animation system)
(My enemies also had simple logic for hit-reacts + attack, though I was dynamically moving them in/out of the animation-sharing system to support this)
Oh hell, so, I've been running it in-editor, and profiling it that way. I decided to run it standalone, to make sure I was getting a little better profiling, and the issues are pretty much gone. I go from 120fps to like 90fps after everything is spawned.
If I run in editor I get like 90fps and it drops down to 25fps once everything is spawned.
I did not realize that running within the editor viewport had such a large performance overhead
Even having extra editor tabs eats FPS. IIRC I lose like 30 fps just by having another set of tabs open
any tips or resources for stealth enemy ai?
like complex detection systems, for instance if the enemy says more than x amount of the players bones, it detects them, and so on
also, which ai features are c++ exclusive?
anyone??
You’re asking very vague and broad questions, less likely you’ll get an answer than asking questions on specific issues you encountered
ok , is there any features for ai that are c++ exclusive in unreal?
im going off of this
Prly a few. Ik GameplayTagInterface has to be exposed using cpp. Why are you asking ?
Realistically, you’ll need cpp at some point or another depending how much depth and performance your game needs.
Ahh that did the trick, cheers
Take a look at the PawnSensing component. That will get you part way there. You can then combine that with custom logic when a Pawn comes into view to calculate how much of it is in view and do varying actions based on that.
Additionally you’ll also get sound sensing as part of it, and can likewise do additional logic specific to your use case
mainly because I want to make the enemy to be able to see the bones of a player, and other advanced stuff like that
Using the pawn sensing component is a good starting point. You can use the FOV you setup there to do a cone/shape trace if it senses a pawn and get the bone name(s) that are hit. I am not sure however if it would return multiple bone names, but it is at least a start
The pawn sensing component is old and depreciated. The perception system replaced it 7 years ago.
Always profile with a packaged test build. Not in editor. Not in standalone. Not a packaged development build. You always want to profile on the closet thing to a shipping build as you can get, which is a packaged test build.
About 75%. Sure you can use the EQS in BP, but you don't have access to most of the functionality. Like writing your own tests. Same with all of the other systems.
ah alright, thx!
The AI perception components are pretty nifty.
any good resources for learning them you would recommend?
Get engine source. Read the code. Don't understand why people complain about the documentation. The actual code is better than any documentation.
This is the problem with me learning Unreal from YouTube videos... I think i watched 3 videos, are fairly recent (oldest was only 8 months ago) on simple behavioral trees, and they all used the PawnSensing component for the AI. Though I'm not quite ready to fully build out my enemy AI yet, but i'll learn the perception system.
This is the problem with tutorials. They are made by inexperienced amateurs while also speaking with authority. There are official tutorials on the learning library. AI with Blueprints will go through all of the AI systems.
Yeah, I’ve mostly used official documentation, but I like to listen to YouTube tutorials occasionally so then when I’m ready to use a system I have a general idea of the terms, and usage, so I know what to lookup in that documentation 🙂
hi, any ideas on how i can use a custom event in a task? i have tried to use casting with get player character but it give me error of "accessing none"
Why are you doing a pure cast? You’re bypassing the cast failed route entirely, so you’re bound to get accessed None.
i have tried to use the impure cast aswell but doesnt work with it, just also tried with "isValid" but the "Scanner Event" is not running
so either way it doesnt seem to work
If this task is inside a BT, I imagine you’re already storing the player char in a bb key when detected so get that value and then cast
wow that worked well, didnt think of that. thank you very much
In a multiplayer game, what is best practice for observing values set in an AI Controller in an animation blueprint? For example, if there is an enemy nearby, I would like the animation blueprint to play a different idle state
The AI controller exists only on the server, but the animation blueprint is not replicated. So you need to drive a lot of it via the character. I prefer using gameplay tags (which can be replicated).
Okay, thanks. I'll use gameplay tags
Would you use a gameplay ability to apply the gameplay tags, or can do I so from within the AI Controller? If I do it from within the AI Controller, I don't think they replicate, but I'm not sure
I'd recommend using GAS for playing abilities in a multiplayer game. You can add loose gameplay tags via the gameplay ability system component from the AI controller.
One the of the parameters of the add loose gameplay tags function is to have it replicated.
Great, that worked
Hello everyone. I am having difficulty detecting collision from an Env Query Item. I want to see if there is a wall nearby the possible point I want to navigate so my idea is to do a sphere trace test in the EQS to the item. But it does not seem to work as intended
Sphere trace will generally hit the floor way before it hits any nearby walls
Unless youre doing full get overlaps
Well I tried offsetting the item height so I would think it wouldnt hit the floor yet
I keep getting the whole grid regardless of the configuration so I am assuming I am not doing it right.
Extent 500 is huge
With that offset though
Your wall would need to be 2 floors high
Would it be better to work with the overlap test? I have no experience with those.
On large grid sphere trace of that size is prohibitively expensive
And overlap is worse
Id cache the wall geometry then do just pure math line box intersection
c+× required for custom tests of that detail
Ill give that a try. Thank you!
Is there any information on games that have shipped with EQS? I can't find any information online
Lots of games have shipped using the EQS. I've shipped several. What information are you looking for?
Just where I would find these games? How do you know lots of games have shipped with it? 😮
Been searching forever and can't find any haha
I work in the industry and talk to others who work in the industry.
Like I know that Hogwarts Legacy used the EQS, because one of my coworkers worked on that game.
Ah fair enough, I work in the industry too but haven't have a chance to speak with any UE devs
This is the info I'm looking for 🙂
The large disclaimers by Epic to not use it is pretty frightening when starting a project
The EQS hasn't had any major changes in the 7 years that I've been using it.
Yeah awesome, that's good to know 🙂 Cheers!
From what I heard, they want to make some UI changes, which is why it's still experimental. However I think that's been a low priority for a long time now.
Yeah if it’s been in beta for 7 years you’re prly safe 😀
what kind of setting should I be looking at for optimizing navmesh generation
other than tile size
is there a setting I'm missing to slow down how often it tries to rebuild or to make it rebuild in a less sudden and immense load?
Hey, I'm running into a weird issue and I'm not sure if I'm using behaviour trees properly.
In of my selector nodes I have service, and every time the selector node finishes a task and then re-evaluates the tree and select a different task under the same selector node, my service restarts
it calls CeaseRelevant and BecomeRelevant, is this normal?
The selector node with the service does not stop being relevant since the next task to be executed is under that node, so am I doing something wrong or just not understanding BT
I'm trying to create a wander behavior using State Trees and EQS and maybe I don't fully get State Trees as I thought....
I have the first State (Wander) with an EQS Task. It runs the query in the Enter State, but the query runs async and once it returns, fills the location in an output parameter.
Then, there's a child State (Move) that uses the output location as an input and creates an AIMoveTask to perform the movement.
I immediately see an issue when the EQS task doesn't return in the "Enter State" method because it is async, so when the Move Task starts, the location is not set yet.
But having sequential (non-children) states would not allow me to pass parameters between one and the other.
Any pointers on how to go about this, please?
How do I utilize EQS Distance test to score items in middle range higher instead of either closer or further ones? 🤔
could you use the reference value for that?
do you mean like making a context with a point in between closest and furthest point of generator and scoring items nearest-first to that intermediate point?
huh, looks like guys in epic gave it a thought too
there should be a "reference value" parameter under the scoring settings
you could also probably just return a list of all the positions scored linearly and then pick the middle item from the list
Reference Value
Used to normalize Test's results in such a way that the closer a value is to Reference Value the higher normalized result it will produce. The value farthest away from Reference Value will be normalized to 0, and all other values in between will get normalized linearly with the distance to Reference Value.
This option is only available for Distance and Dot Tests.
oh wow there actually is. never used it before though and not even sure how to utilize it in my distance test. It's not like I can hardcode the reference values here since the range can differ from NPC to NPC and the generator range is taken from NPC's parameters. I could, however, push the mid range to blackboard and bind it to reference value... 🤔
well distance is only one of the tests I have, I guess i'm just better off writing my custom test
eh if only EQS assets were providing multipliers for data binding 😔
would be nice if you could just give a custom curve for normalization 😄
yeah I dream about that
Yes. That is how it works.
There are different scoring factors available. Linear, inverse linear, square, ect. I'm sure you can make your own.
Yes
Curious if anyone knows how to deal with sub-levels and navmeshes
https://gyazo.com/ab479984f703b80d0a065d5ad55b9c2b
I have several sub levels that I want to stream into a persistent level, but when I do so, the nav mesh disappears
I need all navmeshes to be Static because run time dynamic is so expensive that its hurting my performance
yeah, I put another service to find out cause I was using the Run (sub) behaviour tree node and I thought that might be the issue
I just turned mine into a task, after thinking about it, since I was waiting for that service to set a key. I figured I could use the parallel node to run that task and the other node I wanted
I take it you are using world composition?
Im using unreal engine 4.27, I have not used world composition
oh
is that just nested levels in the Levels window?
So that's world composition. You can't build the nav mesh in the sublevels.
- Delete all nav mesh actors
- Your bounds volumes can be in the sub levels, but you need to also have 1 in the persistent level.
- Load all your sub levels in the levels window.
- Set your persistent level to be current.
- Build navigation.
- Save
You should have recast actors only in your persistent level. The nav data will be saved to the sub levels, but you won't be able to see that.
I currently have that setup as you described, should all of my sub levels be visibile when I build paths?
also, do world settings matter here? what about Force Rebuild on Load in project settings or in the recast asset settings?
I end up with nav meshes all over the place when I build all of them together:
its builds the navmesh as if all of the levels are combined into one
If you add multiple decorators to a behavior tree sequence, are they OR or AND'd together?
it goes through them one at a time, so an OR
but
if you fail a decorator check
it will pass over the logic so I guess its not really an OR
So if I wanted the sequence to fire if the player is not in range, but we have line of site, I just need to make sure that is in that order?
I guess its more of an AND 😅
yes
if a decorator for either one of those fails it will move on
I won't be able to respond to any answer for a few hours so please ping so I see a reply. I'm using AIMoveTo in BP to move my AI, and noticed the Finished is firing multiple times when the AI reaches it's goal. I have tried it both with and without Stop On Overlap checked, to the same result, and have code running from the Finish that should theoretically change the AIs entire state to one that doesn't run the bit of code containing the MoveTo in the first place (so when it reaches it's goal, it goes into IDLE from WANDER).
I've been able to work around this by following the finished with a DoOnce and running subsequent code out of that, the reset of which is connected to the AIMoveTo's exec pin. This does seem to fix the issue, but it seems hacky, and was wondering if anyone else has experienced code firing multiple times out of an AIMoveTo's Finished pin?
Edit: 4.27.2
Always first assume you did something wrong instead of it being an engine bug. Use the visual logger to verify that the move to isn't being called again.
That is, for what it's worth, always my assumption; I'm a clown with this stuff. I just like to identify if it's a known bug (in which case I could stop and implement a known fix) instead of looking for bugs I don't know to look for within my own code
That seems like a backwards approach
UE has some bugs, but when you do encounter them there might not be a “known fix”, or easy to implement. better to start from the premise Luthage mentioned
That makes sense, though I also assume within a couple seconds if no google search returns mentioning any related bugs, that it's entirely my fault (which was, of course, the case here)
I just don't want to bang my head off the wall trying to debug something that's a known issue simply because I don't know it's a known issue, when in most cases it only takes seconds to figure out if it is. You don' t know what you don't know, after all 🙂
(I should clarify that I meant I always assume it's my fault before assuming engine bug)
The folks that made UE are way smarter than I am, I assume blame for simple systems not working 🤣
Do detour crowd works on UE5 already for basic pawns or still needs the complete character movement component ?
I would like to explain a little bit. I don't know what causes this problem. When I replace parent enemy bp with flexible combat system parent enemy bp it fixes the issue but after a few hours later this problem happens again I don't know why
I haven't touch enemy ai blueprint yet. I just only replace animations of character. and a few changes in animation blueprint of character
after changing animations of character this problem started
there is no compiler error
nothing to find this issue
this is log warnings. I guess bp ai parent can't load mesh form data table
It should work just fine, it affects PathFollowingComponenet, not the MovementComponent
And former ends up by calling AddMovementInput
Goal: Stop the AI from attacking during a finisher
If the finisher event is active then enemy will not play animation (attack)
Which one’s the finisher event and is this task inside a tree?
I hope you can see the node called 'finisher event'.
Yes this is a task
I can now
You shouldn’t have delays inside tasks
How am I supposed to stop/interrupts animation when finishers are active?
One way I couldn’t think of is making a bool bb key, and having a decorator check if that condition is met
But animations within trees are a bit tricky, others might be able to give you more insight
Why are you returning while an animation is playing? UE BT tasks are stateful, which means they should stay in the task until the animation finishes.
Not entirely certain what you are trying to do, but this will cause a lot of bugs.
I want to cancel the task when player 'special attack/ finisher' is active
Why? That doesn't make any sense
Currently, when the player performs a special attack the AI still performs an attack animation.
Goal: Stop AI from attacking while Player performs special attack and just play victim anim instead.
Which is a reaction and should not be in the BT. If you just cancel the task, the AI will try to do something else.
So how do I achieve my goal? I only want the Player attack and AI victim animations to run smoothly during the finisher event.
so
what's the idea with navmesh bound volumes and infinite generated worlds?
are you supposed to like spawn one on each tile
or like just make a massive sized one
or is there a way to tie it to the character?
the invokers need them to spawn so I need to somehow always have one near moving ai right?
There’s a GDC talk on Death Stranding’s nav generation
Anyone happen to know if there's some situation where a decorator may abort even though the check function returns true?
I'm having a peculiar issue where I have a decorator in my BT which is set to "abort both", and for some reason it keeps aborting itself. It does a simple value comparison with the BB, and I've verified the comparison is passing.
And yet, in Visual Logger it's clearly being rejected:
LogBehaviorTree (Log) Execution request by BT_CustomerCannotFindTapeTask::BTD_BBTag[47] (result: Failed)
I added logging into the decorator's function, and it returns true every single time so I don't really know what's up with it
LogBlueprintUserMessages: [BTD_BBTag_C_2] Wanted: Customer.ConversationOption.OrderItem --- Actual: Customer.ConversationOption.OrderItem --- true
Hard to tell from this, can’t see your task or what the decorator is checking or if it’s setup properly. Did you do all of this in cpp instead of making the tree in bp so you can see what’s happening at runtime?
Nah it's a regular BP thing with a regular BT :) As said, it's simply doing a comparison with a == b, the log output above shows the values it's comparing, and the comparison result, which seems to indicate that it's checking it correctly
and the visual logger is saying the particular decorator which is passing is first being activated (as it should be), but it later requests execution again and aborts itself despite the condition still passing
My AI is being very two faced, to some locations it'll accept a partial path and to other locations it wont
Show the tree please
It's quite big but this is the relevant part
Oh right and the decorator on the right should have Aborts both enabled, was just testing it with it turned off
You said it’s the decorator that fails tho, so need to see that side with what’s under it
There's another similar one which is checking for another type of value
But that's not the problem as I said, this is the one which is failing
That's the one yes
Ok, so your comparison passes but still aborts?
Yep, initially it passes and begins executing nodes within the sequence, but moments later it exits. Based on the visual logger output the decorator rejects, but I don't see any reason for it to do so based on the log output from the check function
Hence why I was wondering could there be something else that would cause the decorator to abort besides just the check function
(Removing "aborts both" from the decorator causes it to no longer abort and it works as expected in this specific scenario)
I would have thought that the BB value it checks changes and that causes it to abort, but the logging seems to suggest the value never changes
So Visual Logger is usually the right way to diagnose. But what I often do is run the game and watch the tree, pause and “step back into” when the issue occurs.
Yeah that's also what I did, it seems to support the visual log output
So the comparison never fails, but it still aborts?
Exactly
Is there anything under it that could be failing, causing the tree to abort up?
Or is it not even getting that far
It starts running a node which plays some speech, but that one can't even fail/abort
Very odd. I’d honestly do an engine restart just for sanity check. I had an issue yesterday where a function never fired for some reason and restarting the engine fixed it lol
Doubt it’s that but 🤷♂️
Yeah it's not that either :)
Maybe this is the sign that's telling me I should refactor this part of my behavior trees because it's a bit clunky to handle conversations within it anyway lol
Maybe. I think there’s some dialogue plug-ins out there that can make your life easier
Yeah might try using FlowGraph for it, think I've seen folks use it for that purpose. My convesation choices are not super complex anyway
I may have heard people here say BTs are not the way to go with dialogue anyway
Yep :P
Hey Guys, I don't really know where this belongs..
But I'm tryign to use the Navigation Invokers and Dynamic setting as portayed in a lot of YT Tuts.
However my Animals completly tank my performance with there Invokers..
Is there any way to optimize this? I don't understand why it's so terrible..
Second picture (with hte car) has the Navinvokers on the Static Spawners of the animals.. Why does this work so shitty?
I see "Behavior trees and EQS" at the top. Is this also the channel for Statetrees, or am I missing a Statetree specific channel
It is
Is this a good one week plan for learning basics of AI?
Day 1: Introduction to AI in UE5
-Start by familiarizing yourself with AI-specific features and tools within UE5.
-Explore the UE5 AI documentation and available resources.
Day 2: Behavior Trees and Blackboards
-Dive directly into Behavior Trees and Blackboards, the core of AI decision-making in UE5.
-Create a basic Behavior Tree for an AI character.
Day 3: Implementing Basic AI
-Learn how to create AI characters and integrate them into your project.
-Set up simple AI behaviors like following the player or patrolling.
Day 4: AI Perception and Sensing
-Explore AI perception components, senses (e.g., sight, hearing), and how to use them.
-Implement perception systems for your AI, allowing them to detect the player.
Day 5: Advanced AI Techniques
-Study advanced topics like EQS (Environment Query System) and AI task systems.
-Experiment with more complex AI behaviors, such as decision trees or state machines.
Day 6: Optimization and Debugging
-Learn about optimizing AI and game performance.
-Profile and optimize your AI code and game.
-Debug any issues in your AI behaviors.
Day 7: Project Enhancement and Review
-Enhance your UE5 project by adding more advanced AI features or improving existing ones.
-Conduct thorough testing and debugging.
-Document your project and review what you've learned.
This one-week plan assumes you have a strong foundation in UE5, so you can focus on AI-specific aspects. While this accelerated approach can provide you with a basic understanding of AI in UE5, keep in mind that becoming proficient in AI development typically requires more time and practice.
Asked for a planning from chatgpt since someone mentioned it's good to use for planners
Howdy, are there any nodes available to set any of these settings in a blueprint for the perception component?
Invokers are really expensive. If you MUST use them, they should be on non moving actors. Tutorials are pretty good at showing you bad ways to do things.
None of those are "do the AI with Blueprints course on the learning library", which will go over all the AI systems.
Not in BP.
Yeah exactly what I thought as well! 😂
It's a nice idea, I think I'll use them to set a static area where animals can roam so that I don't have to build the NAvmesh of my complete landscape, but yeah.... It's definitely a challenge! 😛
@uneven cloud do you know if theres a way in UE4 to bake static navmeshes into sub-levels and have that navdata stream in when the level is streamed? I guess I have a weird setup where Im trying to dynamically stream in sub-levels that occupy the same space, but only one of them is active at a time (before they get unloaded and a new one is brought in)
I feel like Ive tried every possible combination of settings but had no luck getting the desired result
I think there is, but have you made sure the target location is on the navmesh to begin with?
why Attack task here is running only once?
he's not going to CD, just never runs again after a first time
Yes there is. However, the streaming the sublevels to the same place is likely causing you problems. Why are you doing this?
I did a write up here on the forums about some of the details of what Im trying to do: https://forums.unrealengine.com/t/navmesh-of-sublevel/35996/30
Bumping this thread. I have a setup with nested sub-levels that encompass the same space but are not active at the same time: I want to be able to stream a random sub-level in with a static navmesh manually built. However, if I build navmesh data for all of these sub-levels, that navmesh data is discarded or not recognized when streaming ...
Im essentially loading in geometry from sub levels thats static into an arena
What kind of information are you looking for? If it can't find a path, then you aren't going to get much from debugging the A*.
though the geometry is static the entire time its active, the arena itself is dynamic in that it can load in different premade levels
Unfortunately you need to do dynamic generation for what you are trying to do.
If that is the case, since Ive been using that in the mean time, it really hurts performance for me as Im running this on Quest (android). Do you know of a way to limit when the dynamic navmesh recalculates paths or evaluates dirtied tiles? I feel like I just need to handle this in C++ but have not found much guidance online for doing so.
Is your secondary uworld able to log to the visual logger? In normal cases you can log out where it's tried. I've just never seen that actually be useful.
You can hide it on load via C++. If your geo is static after the sublevel loads, then it shouldn't dirty titles.
for some reason when I profile it, my CPU is taking on way more extra load when my mesh is Dynamic vs Static
so something tells me that the navmesh, which shouldnt be changing at all, is still evaluating its state or doing pointless updates since my CPU usage is so high
thats why Id like to be static but have not found a way to do so 😭
ive tested this on a very simple rectangular navmesh setup that doesnt dynamically load in any new geo
and I saw the same CPU usage hit
It only dirties the nav mesh when geo moves.
Ive gone through every component of my enemy AI blueprints to make sure nothing on them affects navigation too
but that didnt seem to fix anything
What exactly happens after the first run?
AI minions go to waypoint, attack enemy first time, when they see them, then going to waypoints again, and ignores enemy forever after this
For starters your second decorator is pointless
If target set = false, it’s obviously not set
And you’re prly not forcing the tree to re-evaluate so it gets stuck in the right branch
"pointless" decorator at right branch must prevent this branch from running and return logic to attack branch
Is it doing that?
i dont know now
Watch the tree at runtime, hit pause, and use the arrows to see what happens
When is worth it use StateTrees?
Hey, can anyone tell me how can i provide custom path points to my controller and let path following component use these points instead to finding a path....
I got a function inside of path following i.e. UPathFollowingComponent::RequestMove(const FAIMoveRequest& RequestData, FNavPathSharedPtr InPath) to perform the move to...
but i am not getting how to feed custom path points to InPath parameter...
any help 😦
is there a way to make visible in run time the information in the detail panel of nodes in the behaviour tree editor? I tried with VisibleAnywhere, but it kinda doesn't.
I don't think so. Your best bet would be to write the values into the BB
(or any of the logging facilities)
Hi.
Why is my AI not moving at all? Just a simple move to location or actor node doesnt work!!
Need more info, could be lots of things. Did you set your pawns controller? How are you calling the MoveTo? Do you have a navmesh? People need info to help 🙂
nahh, just unchecked some thing in that node
and checked bac
and now it works
i tell you unreal is weird.
unchecked projection and put it back
tried even deleting recast and that did not do the trick
Hey, i have a simple AI that just follow the player and attack it when it is close enough but i'm having an issue where when the bot kills the player, it crashes with this error :
Assertion failed: !ErrorDetected || GIsAutomationTesting [File:D:\build\++UE5\Sync\Engine\Source\Runtime\Core\Public\Misc\MTAccessDetector.h] [Line: 90]
Acquiring a write access while there are ongoing read or write access
Does anyone know why.
Here's also a screen of the behavior tree. The BTS_Attack just checks if the distance is less than 150 and if it's the case, it attacks
The BTS_Attack and the gameplay ability that is called
but it basically just applies damage to the player and if the life is less than 0, the player is destroyed
u can try disconnecting assign and see if that helps
u are by error doing some writing
"Acquiring a write access while there are ongoing read or write access"
also u can just see if you fire that event manually and see if it crashes
i think it could be that get ability and assign stuff happening almost at the sametime
I'll try that to remove the destroy part of the death to see if it still doing the error
ok it seems that if i don't destroy the player when i kill him, the error is gone
I don’t know what’s causing the error but activating a GAS ability every tick in a service node doesn’t seem like a very good practice
The fact is i don't activate it every tick because i check if the distance is less than 150. On top of that, the service execute 0.10s
still, i would not put it in tick
x)
and assuming you are not experienced with unreal, skip the whole GAS system xD
i pretty much copied the way they setup lyra bot firing
Unfortunately your assumptions are really wrong
I think gas is at times multithreaded so that’s probably what’s causing your issue
I wouldn't allow myself to judge someone's level simply with a question, even less so on a subject as vast as unreal.
Hmm i'll dig into that. What i know is when i don't give the player the ability to die, there is no problem, so i know it comes from this ability
I'll debug further
Didn't say that neither
I still don’t understand, show the code for your service
i said 😄
No sorry your service
The decorator is only a variable, which is set in a query
Oh sorry I see it now
for this part i pretty much copied the way they do in lyra
i'll try to give the ability to die back to the player but i will remove the destroy part to see if it is related to the entire ability or only the fact that the player is destroyed at some point
I mean, there are errors you will have, I’m just trying to figure out how it would be related to other threads
okay so after testing, it definitely comes from the fact that the player is destroyed
Yeah
so it is not directly related to the death ability
Maybe because the bot tries to acces the player as a target but the player doesn't exist anymore
Yes that and your EQS context is probably failing
yep
But eqs shouldn’t be multithreaded so
i should check in lyra how do they handle this
Couldn't you hack it with an IsValid branch and account for player death? Set to idle if not valid or somesuch?
but the problem is that i'm already checking if the target is valid in the behavior tree
ooooh i might have an idea
i'll test something i'll keep you updated
okay i tested a feww things, i've removed everything from the behavior tree of the bots, and even after that, the game crash if i destroy the player
@real arrow it seems that you were right with the thread thing, i got this error that i didn't see
Another thread asked to have a read or write access during this write access
Ok i found the source of the error
But i really don't know why it causes such errors
It comes from the AI perception
if i deactivate the sight perception it works like a charm
Is there no way to properly organize the order of properties in State Tree tasks/evaluators/etc? They all show up in seemingly random order (within input/output/parameter categories). It's a bit odd to see that random bag of properties not grouped in a meaningful way.
Anyone knows what this means? Didn't know the abilitysystem had anything with smart object 😄
AI Stimulus gives me a stimulus location, but how can i get an object, which is stimulating an actor ?
why by using a navmodifier or dynamic obstacle on a box collider the navmesh modified by it always exceeds its borders by quite a lot?is it possible to modify the navmesh only precisely where the box intersects with the floor?
The nav modifier has a box extent variable that defaults to 100, 100, 100. That extends the area. Adjust that variable to get the behavior you want.
You mean Failsafe Extent?it's already at 0,0,0. Furthermore, setting it all to 300 or 0 doesn't seem to make any difference. Maybe it's bugged in UE5?
Hello, I have floating pawns going to a random location every few seconds, but they do strange things when they collide (with an other pawn). I see read on the internet that you can turn up RVOAvoidance if you use CharacterController, but I use floating pawn. Is there a easy way to let them not collide in a weird way?
hey im trying to get my enemy to move towards my tower in game
im using this blueprint and its not working
Do they need to be floating pawns?
The Character class has a lot built in. If you don't want to use that you'd need to custom code it fwiw. There are interfaces to use for RVO iirc, so Character might not be necessary, but I don't think that's available at all in BPs (in case you can't use CPP)
its just a variable, idk what component i would set it if i would set a component
How is dynamic navmesh regenerated when I move an object on the level during gameplay in terms of does it regenerate entirely in the whole volume, or does regeneration happens only on the tile (and maybe adjacent tiles) where the geometry and hence navmesh has actually changed?
Yah but is that thing valid?
If you call this on an invalid controller it will of course not work
Try calling your code from Event Possessed and use the Controller input the node Event gives you
Might need to cast it to AiController
how do I check if its valid? this is my first time delving deep into pawns
It would either give AccessedNone error If accessed anyway or you would use an IsValid check where you could print on the not valid pin
Are you setting that variable anywhere?
no
I have Print Text off the OnRequest Failed and the text doesnt pop up
Then it's probably invalid
I already gave you an alternative
Do that please
Cast to Aicontroller?
Just read the whole thing
what alternative are you specifically referring to? Event Possessed wouldnt work as I dont have a main controller. I can try casting it to AIController, just lmk what your specifically referring to please
Why don't you have a Controller possessing the pawn?
I'm referring to the Possessed one yes
Im not possessing it tho?
An AI is usually possessed by an AIController
What is that dropdown
for components
Eh. It's a Actor. Usually Characters placed into the scene or spawned have a default AIController assigned
It's a setting in the Character itself
its spawned
Then change the top drop down to Placed and Spawned
And then please try the solution with the Possessed Event
And remove your EnemyController variable
It cant slot into the first slot instead of EnemyController
Okay, you will need to use Event Possessed where you have BeginPlay atm
Otherwise your GetActorOfClass won't be calling
And I also wrote that you might need to cast the NewController pin to AIController
Because NewController is of Type AController which is parent class of AAIController (as well as APlayerController). The MoveToLocationorActor node probably wants an AIController, so you need to cast.
when would I be calling on the possessed event?
You don't call that
It's called by the Engine when the Pawn/Character gets possessed
Which happens "Automatically" due to the DropDown you changed earlier
ah ok
Since you require a valid AIController, it's much better to use Possessed instead of BeginPlay, because Possessed is the Event that calls when a Controller should be valid :P
at least on the Server, but that's a different story and AI is Server only anyway, so doesn't matter
where do I connect the NewController?
To a AI Controller Cast Node
Also you should think about sooner or later replacing GetActorOfClass with something "better". That node is just an escape from proper coding
But not important for now
oh yeah im also dealing with my previous code breaking and idk how to fix it
Does your tower block the nav mesh? Likely can't reach it. Try projecting to the nav mesh with an extent to find a location near the tower. Then send your new location instead of the actor. You can check the visual logger (tools/debug) for the error of failing to project if you are passing an unreachable location.
Only on the tile and adjacent ones if needed.
Get actor of class isn't an "escape from proper coding". It's only problematic if you have multiple of the same actors. Get actors of class only has perf problems in the editor. In a shipping game, it uses the uobject tmap.
I know it's a hashed map
Doesn't change what I said
Beginners tend to use that instead of properly setting up a system that allows easier access to their Actor Instances
It does. You don't need to shame a hobbyist for using it.
I don't shame anyone lol
"an escape from proper coding" is shaming.
This is similar to other things in UE. E.g. Widget Bindings. Sure you can use them, but they are highly unperformant compared to not using them
Perf isn't black and white like that. Underperformant is only a problem when it becomes a problem. A beginner hobbyist is unlikely to have problems with those nodes, especially compared to all the other ridiculous things they might try to do.
All valid, GetActor(AllActors)OfClass can still be easily avoided. I stand by my opinion that it should not be used if not being the only way
It can be avoided completely, if you know what you are doing. But often it's completely unnecessary. Dev time should always be weighed with perf costs. Especially with beginners who struggle with the "better" ways.
yo, is it possible to make a box collision into a task?
What do you mean? What functionality are you looking for?
box overlap
That doesn't really explain what behavior or functionality you are looking for.
Do you want to turn on collision in a task? Do you want to listen for collision events in a service? What are you actually looking for?
i want to turn collision into a task i guess
That makes no sense lol
like in behaviour tree task
Turn collision into a task? That doesn't make any sense
Ya we know what tasks are, do you know what a box collision is tho?
yes i guess
Do you have any idea on why Failsafe Extent does not seem to change anything at all?i tried in an other UE5 project and setting it to enormous numbers or 0 changes nothing
Again, explain what it is you’re trying to achieve with this, not “turn collision into a task” because that makes no actual sense 😀
I don't know. It used to work, but I haven't used recast since 4.
Thx anyway🙏
Maybe it's just broken in 5 sadly
ok, im trying to make an ai scanner detection with box collision (begin overlap), the reason why i thought of making box collision into a task, so that mabye i can get a bool to go true in behavior tree, cus i have a bool from blackboard connected with box collision code , and when it goes true in BP, it stays false in behaviour tree. hope it makes sense now 🙂
It's weird for it to be broken. It's worked for many years. Is there a bool option that sounds like it has something to do with the extent? I can't look, because enabling recast would break my project.
You mean in the project settings?near the failsafe extent properties on the modifier itself doesn't seem to be any
Your problem is with setting the blackboard. Sure you could move the functionality to a task or service (not recommended), but you'd still need to set the blackboard
I meant in the modifier itself.
Is there weird collision in your actor? Nav modifiers take all of the collision into account, not just the mesh.
Nope, just a plain box collider. The only other component is the nav modifier
Also, i tried setting the box to be a dynamic obstacle directly instead of using the navmodifier, but it still has exactly that same extent
Let's see if pinging @celest python will help.
Little bit of a newbie question but how expensive are typical heuristic based AI like behavior trees compared to learning agents at runtime?
i dont have a nav mesh
How do you expect an AI to navigate if you don't have a nav mesh?
I got code from a tutorial for a basic AI and it worked for them. the enemies just need to move in a straight line towards the tower
what is better make own ai class and make it with c++ our use beaver tree for make ai
I added the NavMesh and its still not moving
It's really better if you look at the AI with Blueprints course on the learning library. Random tutorials you find are often going to tell you really bad ways to do things.
Ah ok. Also I know this isn't an ai question, but if all the things in my game are pawns, could I make the game play inside a parent pawn class?
If you are asking whether it's better to use a behavior tree or to do scripted AI, that depends on your skill level and what behavior you are looking for. If you are asking about the perf difference, all BT nodes can be written in C++.
What do you mean by "the game play"?
It's a rogulike tower defense game where you slowly upgrade a tower. Having the upgrade system and wave system in the parent class is what I mean
You could, but it'd be a nightmare. Games are incredibly complex, even for simple games and having everything in 1 mega class will be a lot worse for you in the long run.
Many things should go into components. It's IS A vs HAS A. Like a tower HAS An upgrade system, not IS An upgrade system.
Oh yeah, I just meant the waves and at then end of a wave you get to pick an upgrade. The stats will reside in the pawns tho
If you use IS A (class) and HAS A(component), it really helps thinking about it logically
In what way?
I don’t know if I’d call them heuristic, but behavior trees will outperform neural networks in both CPU and memory (in normal use cases, of course you could make a massive BT). This is assuming that when you say learning agent you mean modern ML or RL, though.
GPU is maybe different. It’s so very use case specific though that the answer to your question is almost meaningless.
Handle the upgrading system in an ActorComponent
The tower is the Actor
Then add the upgrade system (ActorComponent) into your Tower Actor(actor)
Then create child blueprints.
Hi, I'm noticing its hard for me to tell whats happening in my Ai BP here because its just erratically flickering and hard for me to debug whats happening in the behavior tree. Is there something I'm doing wrong? The tree is acting as it should in game but it looks crazy in my viewport. (it only seems ok at the very end beccause I hit pause, ignore that)
Even when it starts attacking (BTT_DefaultAttack) you cant see it happening in the BT.
Is that a furry??
no.
Phew
So it's not reaching the wait node
Or you mean the way he's moving towards the player?
yeah it looks like its not even reaching the default attack according to my view of the BP but in the game it looks to be working fine and reaching that point.
Does the enemy wait 4 seconds??
These happens quite fast it's hard to notice. You can make a node only for printing and see if it's reaching that print node (there's probably other ways to test it but that's what I know for debug if it reached it or interrupted or whatever.)
ok i can try that, where should i place the print node in the sequence?
Just like you do with the other BTTask
But just put a print string with execute finish true, that's it
Again, not sure if there's a better way to test but that's how I do it
Or if we can use breakpoints?
yeah breakpoint isnt triggering
btw same result even when i use this ai controller on the default mannequin
Use the visual logger. It's in tools/debug.
yeah looks like in the visual logger its never reaching BTT_DefaultAttack, just switches between these 2 the whole time.
as well as clear focus
Is it failing in the nodes??
Try to make a custom moveTo Task.
Look at the timeline not the snapshot. The timeline gives you more information. You can also add your own vis log text to your BT tasks
Maybe it's not reaching the exact spot so it's failing?
Don't guess, debug
True
It's failing on the MoveTo
its weird because it works in game
Yeah I saw. It's reaching a place and it's failing
Tye to create your own MoveTo BP Task?
ok let me try that too
Update?
Sorry had to take care of some stuff
ok seems to be something with my enemy bp, because the mannequin now works as intented
@uneven cloud hey Im using this tutorial like you said, in the video the Behavior tree goes from having no branches to like 5
https://dev.epicgames.com/community/learning/courses/67R/unreal-engine-introduction-to-ai-with-blueprints/mG7/building-the-initial-behavior-tree
am i lost or was that something UE4 did and not UE5
He just put the tasks he created in the tree, in order, connect the dots
when? Ive watched it 3x now, i might have just missed that part
He’s only showing the completed result but adding tasks into the tree once they’re created in a left to right order is not that big of a leap 😀
I cant find the Random Wander node, idk what im fucking up on
It’s a task he created
the only task I see him creating is FindNavigLocation
Oh haha sry, I misread your question
That’s just how he renamed his Sequence node
Useful to name them properly so you know what you’re looking at later
if i have so many bbks to make my ai to shot me, then if i come close, draw weapon, attack me, then if i lose him he sheath the weapon, is it optimal or is there a way to make it way tidier? because I feel like it is a mess tbh
haha yeah, I hate video tutorials for this exact reason
thats the video on my screen lol
Yeah, I getcha and that one is one of the few good tutorials
You could prly condense your range bools into a range float and use decorators to determine what to do based on what the range is, but idk what your tree looks like. In general, you want to keep it “as simple as you can, but not simpler”
u mean like lets say Index "Fight" and if its 1 its long range fight if its 2 its chasing if its 3 its attacking?
still gonna learn services
I meant more like bb key range float >= 10m melee, >=20m range attack, else flee sort of thing
Where one branch failing leads into the next option
oohhh
damn that one way to go
yeah i will try that
thanks man
i see you a lot on this server answering, gj
You wouldn't need so many decorators if you used the prioritization that's already built into the tree. Higher priority should go left with lower priority to the right.
tank you
@lyric flint sorry for the ping, but you're probably the only one who knows much about the inner workings of state tree: when I bind a nested member to a task property in UE5.3, I always get the error "...but binding source type " does not match property type 'typename'"
No such issues in 5.2.1, so is this a known regression?
By nested I mean stuff like Character→MovementComponent
And enum compares are even more broken in 5.3, expanding them freezes the editor due to an ensure condition ("couldn't determine property copy type (MoveType→Left)") and the comparison itself also shows the same error about the property type not matching as it does for nested properties
Again, no such issue in 5.2.1
i place the nav volume bounds and adjust it to the nav area
but it dosent generate
please can anyone help me solve this ?
You have to press P to visualize it
i did that
Make sure your floor can affect navigation and that debug drawing is enabled for the nav mesh
Hi guys I'm new here but have some questions around state trees
I have the same state tree on 2 AIs but only one of them calls on tick
Hi @uneven cloud, I came across your really insightful comment earlier about doing tech demos when building a portfolio for game programmers. I’m curious if something like “smarter Pac-Man AI” would pass the bar for a sufficiently meaty demo.
The original Pac-Man’s AI is deceptively simple, but I want to jazz it up and put my own spin on the game with Unreal’s toolset, such as behavior trees, A*, EQS, AI perception, and others. Does that sound like it’d make an impressive enough demo? Or would you recommend going back to the drawing board to drum up other mechanic/system ideas, perhaps from more recent AAA games?
edit: I know Mix and Jam (https://www.youtube.com/channel/UCLyVUwlB_Hahir_VsKkGPIA) has some great demo examples, would those be valid project ideas to consider?
Not really. Knowing how to use the BT and EQS is an incredibly basic level of skill needed. I recommend looking at the GDC AI Summit and finding a talk that you find interesting as an inspiration. Utility is a common one people do, but there are many other options.
Gotcha, thanks so much Luthage! I will take a look there. Somewhat tangential and off-topic, but would you say GDC talks are also good inspiration (and of the right caliber) for gameplay and UI demos? I still have to finalize the programming specialty I'm going for
Probably. There's a lot of AI content, because of the AI Summit. Not sure about general gameplay or UI.
I see, thanks again! 🙂 I think watching a few AI Summit videos will give me a good idea of technical meatiness, regardless of specialty
Did anyone encountered in weird jitter when AI is walking on sloped surface (client only, navmesh walking only)?
Sounds like a #multiplayer /prediction issue
AI are server owned and do not use prediction.
He mentioned only happens on client so I figured it’s not an AI issue per se
Nav mesh walking is broken in 5 for multiplayer. The client tries to use phys nav mesh walking, but there's no nav mesh. So it switches to walking. Then gets server replication and jitter happens.
It's a movement component issue. In that it's broken.
Fair enough
I'm waiting on our movement team to fix it, so we don't use nav walking
I tried to enable navigation generation on client and to set the client to be nav mesh walking also but it didn't fix my issue.
They are using prediction in client side right?
No. They don't have an owning client.
But if for example I'll run "slomo 0" on the server I'll see the AI in the client keep moving to the same direction
Isn't that prediction?
Client prediction only works for the owning client. Which is for player controlled actors.
That is not prediction.
Prediction is that the owning client responds to input before the request is sent to the server.
Your AI movement starts on the server and then is replicated to the clients.
Got it thanks
Your welcome
New to AI bur very curiois.
Would BTs be recommended for a turn based game or are there generally more suitable approaches given your AI could be computing a possible action for longer than a traditional real time game
If anybody has any resources they can recommend specific to turn based AI that would be good too
Hey, if you have a custom c++ BTService node, can you stop the node memory from being cleared when it calls cease being relevant?
State trees are much better for turn based games imo
Hey, is there a maximum range to Pawn sensing. I put the sight range very far but my actor only sees the other pawn from relative close?
Can some1 explain what is this thing and how can i use it?
Afaik pawn sensing has been replaced by AI perception