#gameplay-ai
1 messages Β· Page 135 of 1
Tried converting my 4.26 project to 4.22, I setup everything exactly the same, yet the behavior tree is really buggy. AI perception doesn't seem to update the same. Were there major changes to AI perception between 4.22 and 4.26?
why you change from 4.26 to 4.22?
Trying to add compatibility for a project I plan to release as a marketplace asset.
Going to try it out in 4.23 and 4.24. Might be the engine version that has some issues, or might be I didn't copy everything over correctly.
So the problem with 4.22 is it gets stuck on "Rotate to face BB entry". It is supposed to rotate to face the player and the correct BB variable is set during the time it gets stuck. Not sure what is causing it to hang up....
yeah that bt task was broken
for a few version
i made my own version of it, which is a lot better and handles different focus's
(for SetFocus)
Hiya. Is there a way to make AI go up things?
To go down, my bot just falls. How would I make it climb a ledge, or a ladder?
Is it just a climbing animation?
The bot gets to a link, then I have to some how get it to the top of the link, ya?
yes you have to do that logic yourself
root motion montage or you do it programmaticly
Ok cool, thx
Is there a waiting at proxy link event/state?
and how would I go about interrupting a path? say the bot is going from point A to point B, and falls into a hole.
When it comes out, how do I tell it to not go to Point B? is there a interrupt function, or do I just set the MoveTo to where it currently is?
I have maybe a silly question about selector nodes in BTs...
If a selector has two options, and no decorators or other thing limit the options...
Will it always default to the leftmost one? or will it randomly pick one? π€
it seems always left...
everything in BT's is always processed left to right
so for random desitions my "random" service is kinda the correct approach π
all stuff is Left to right, Selector will run till some task returns success or it reaches end. Sequencer will run till something returns failed or it reaches end.
Ah that makes sense. I'll look into making my own task then. Thank you.
AI perception, specifically sight, also seems a little weird where it doesn't pick up on things until they are directly in front of them, but then works perfectly fine other instances, heh. May be related to the rotate task messing up the behavior tree flow.
Ahah, a little bit of debugging and I see that the AI Sight is not rotating with the character. How do I set it to rotate in 4.22?
Hah, WTF, tick was disabled in the AI Controller and that was messing things up.
Tested if that fixed the rotate task, but it didn't, however my own rotate task works perfectly.
Searching for a guy with knowledge of "supported agents" and corresponding multiple ReCastNavMesh: How do get a specific RecastNavMesh of the multiple nav meshes of a specific "supported agent" to use it as "nav data" parameter passing to navigation functions. Working on BP most of the time, but if someone knows a solution for CPP, I can expose it to BP by myself. Someone experienced with "supported agents" and multiple RecastNavMeshes?
can't do that in BP
ANavigationData* UKaosGameplayStatics::GetNavData(AActor* InActor)
{
const FNavAgentProperties* AgentProps = nullptr;
UNavigationSystemV1* const NavSys = USolsticeObjectLibrary::GetNavigationSystem(WorldContextObject);
//Works for Controller and Pawn
if (const INavAgentInterface* AgentContext = Cast<INavAgentInterface>(InActor))
{
AgentProps = &AgentContext->GetNavAgentPropertiesRef();
}
return (AgentProps ? NavSys->GetNavDataForProps(*AgentProps) : NavSys->GetDefaultNavDataInstance(FNavigationSystem::DontCreate);
}
``` @opal bolt
Hi. Anyone knows how to check if BB key is invalid? (c++)
Both IsVectorValueSet and IsValidKey returns true when in reality it is invalid.
nvm, figured it out π
Thanks. Do you have any idea how to get specific Nav data without passing the actor as parameter? E.g. checking for example for names of the "supported Actors" on a RecastNavMesh, which is assigned in project settings.
I can get all RecastNavMeshes of all supported actors simply by using GetAllActorsOf class with searching for RecastNavMesh. But then I stuck. Is there no possibility to check the RecastNavMesh result array for a specifc supported actor or a pawn class? Not even on CPP level?
My goal is at the moment, to get the navigation data ("nav data" in BP) without having tp spawn the actor first. For example, to get a location of BP node "Get Random Reachable Point", which has a input parameter "nav data". I want to use it to get a location for a specific "supportet agent" (specific AI pawn), before spawn the actor.
For that, I would have to choose the related RecastNavMesh out of RecastNvMesh array, which fit to the "supported actor" I need.
you can just get the classdefault
of that actor
for example
then you can just supply the class of actor you want to spawn, and it will return the navdata
@opal bolt ^
ah, mom
I see you changed to "TSubclassOf<AActor> InActorClass"
But the body is the same, you use "Cast<INavAgentInterface>(InActor->GetDefaultObject())"
I think the part "Cast<INavAgentInterface>(InActor->GetDefaultObject())" I have to change to make use of InActorClass
simply like this? "Cast<INavAgentInterface>(InActorClass)" ?
@pine steeple ^
of course, you have my full attention π
there i fixed the function
in header, put this UFUNCTION(BlueprintPure, Meta = (WorldContext = "WorldContextObject", Category = "Navigation")) static class ANavigationData* GetNavData(const UObject* WorldContextObject, TSubclassOf<AActor> InActorClass);
{
UWorld* World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
if (!World || !InActorClass)
{
return nullptr;
}
const FNavAgentProperties* AgentProps = nullptr;
UNavigationSystemV1* const NavSys = Cast<UNavigationSystemV1>(World->GetNavigationSystem());
//Works for Controller and Pawn
if (const INavAgentInterface* AgentContext = Cast<INavAgentInterface>(InActorClass->GetDefaultObject<AActor>()))
{
AgentProps = &AgentContext->GetNavAgentPropertiesRef();
}
return AgentProps ? NavSys->GetNavDataForProps(*AgentProps) : NavSys->GetDefaultNavDataInstance(FNavigationSystem::DontCreate);
}```
and the fixed function
@pine steeple UK I have to thank you thound times. I would never get the solution alone I think.
I am still wondering why there is no BP exposed function for that, because nearly all BP nodes which work with Navigation use "nav data" as bp node input parameter. And when someone use "supported actors" (so have multiple RecatNavMshes) of course it is very, very relevant, on which nav mesh you want to search.
thanks a lot! I will try the function later. But I am sure it will work.
does anyone here do their BT tasks in C++?
i have a mix of both
BP for simple tasks, c++ for more complex/involved tasks or tasks that do not require an instance
as all BP tasks are instanced and costs a bit of memory
Well I'm glad I got this ExecCalc working
wrong channel? π
π
Does anyone know how "Move To Location or Actor" works?
More specifically, what does Project Goal on Navigation do, and how can the Async Task reference be used (Can it be used to call an Async function which will execute while the controller is executing the movement)?
hey is there a way to make AIMoveTo choose randomized paths ?
as in its not taking the optimum routes but acts a bit drunk
@jagged needle the task reference is just to that movement task, nothing more. Project to navigation will project the Goal location to navmesh before attempting to move. If it fails, the move will not happen
@timber relic not really
:/
you would have to do that by adjusting costs by overriding the navmesh class in c++
oh i can adjust costs using modifiers and query filters
Thanks for clearing that up, @pine steeple
hey im trying to change StopMovementOnFinish via blueprint
how would i go about that ?
If I want to make a new SpawnAIFromClass function in my BPFunctionLibrary so I can set parameters that would normally be SetOnSpawn, does SpawnActorDeferred mess with AI in any way or am I free to use it to set variables before finishing the spawn and then handling the controller and behavior tree?
that is the purpose of SpawnDeferred
Hi I am trying to use behaviour trees. I need to return the location of the Terminal
Hey there, noob question. How do I handle "patrolling" in a way that lets say cars are moving alongside road but if player stays on their path they try to move slightly to avoid the player BUT their movement will be restricted tostay on the right part of road
trying to use a service. last couple days I can not figure out what I am doing wrong
tried doing it through a task
not sure.. I should cast to from event receive AI and grab the actor location and set it as a blackboard vector
right?
but my cast always fails
I can get it to move randomly
like find and move to a random location
just not a specific task location
I tried it with a task
but it fails
is this just completely wrong?
Can finding a location only work with perception in a behavior tree?
If you point me to a up to date tutorial about Custom Locations. No Patrolling or nothing. Like going to a location and performing a task. I got it to work earlier I have no idea why I am having so much issue now
oo nvm I figured it out playing around with the AI controller
hey yall, I'm new here so excuse my newness but I was wondering if anyone here knows anything about creating an AI similar to the one in this video at 4:00. https://youtu.be/2qB3CNvOoGg?t=240 He even shows his math but I don't know how I'd translate it into blueprint. Any help is appreciated, thanks.
Patreon: https://www.patreon.com/miziziziz
Twitch: https://www.twitch.tv/miziziziz
-Support Me-
Buy my games: https://store.steampowered.com/search/?developer=Narayana Walters
Buy my game development course: https://www.udemy.com/course/how-to-make-a-retro-style-3d-fps-in-the-godot-game-engine/?referralCode=B84F9511AA88B9195DDC
Buy my cour...
If anybody reads mine. The thing I was messing up was Get Actor Of Class
instead of Cast to
@civic girder There are lots of tutorials on patrol and attack. Or do you mean the zig zag part
Not sure. Good luck
all g thanks anyway
Is the nav volume on the persistent level?
Hello guys I'm trying to check if my player can reach a location, initially the path is block by geometry but then it opens to the ai. there is a does path exist node on the behavior trees, but I'm not using trees so any other alternative ways of doing this ?
is it a code project or blueprint only?
c++ lets you directly compute paths via the nav mesh
i'm starting to create the AI components of my game, and some of the courses i'm taking are using behavior trees with EQS graphs. this tech is experimental, and all of this kind of looks like it can be done with just CPP, some enumerations and a state machine setup. to anyone who's worked with this before, should i just go the CPP route?
does AI get activated at a certain distance from the player or is all AI in the map active at all times
When EditableTextBoxes have focus and the player presses escape to cancel entering text, it leaves the player with no control over their pawn or the UI until escape is pressed again: how can I fix this?
Input events don't fire because the editable text box has focus when inputting text
@unborn jungle the #gameplay-ai is an odd choice, but you need to react to the first escape and remove the keyboard focus from the textbox
Any ideas why the wait is ignored please?
This is a tree for a "base unit" I have 3 types of Units in my game at the moment and was hoping I can use this 1 tree in every type of unit, As units will all share similar Move, Attack, Run etc.
GetRandomLocation and MoveTo works but then it skips back to GetRandomLocation ignoring the Wait command
selector runs until something succeeds. You probably want Sequence.
I just tried the sequence node and it looks like it gets stuck on GetRandomLocation now and never moves to the Move To node
Just keeps flickering between Root and GetRanomdLocaiton
That's probably because GetRandomLocation isn't succeeding. Make sure it calls finish execute with a success. We know it wasn't succeeding before because it was getting past that on your selector.
Finish Execute success π
Doh forgot the checkbox...
lol thanks for the help π
Ok next thing is to fry my brain with trying to work out how animation blueprints work. :S
My unit just kinda floats around atm without walking lol
Easier than AI imo. The only big brain moment for me on anim graphs is understanding that you can put a state machine inside a state to nest transitions.
e.g. walking vs. idle might be nested within Alive vs. dead; and so a transition from alive to dead overrides any stateful change in walking and idle.
I'm having a tough time getting the design feel right for event driven responses to things in behavior trees.
E.g. I have a general setup for an animal to wander around, flee when it sees humans, or attack. But now I want to make it so that if you hit the animal you can knock it into a stagger state. That feels like something that shouldn't be handled in the behavior tree. So what do I do? Handle it in the controller, and push a state change to the blackboard that triggers a task that again calls some functionality from the controller? Feels gross.
Also, it feels like a lot of my tasks end up being wrappers for calls to logic on the controller.
Sorry was late and thought it was UI π moving to umg for the answer but how can I react to the first escape? The input doesn't seem to register in the PC and the OnFocusLost event doesn't fire for the editabletextbox
so i am making a tower deffense game where enemies spawn in waves. I got it to work great however i have ran into a recent problem were some of the same enemies i spawn dont move or do anything. most of the enemies are fine but just a couple that spawn in the wave dont move / get stuck at spawn point. When i try to just spawn that wave and not the earlier waves everything works perfectly half of the time and the other half it fails. I dont know whats wrong or how to debug /recreate it consistanly any ideas?
Stuck in ground? Using crowd avoidance?
@pine steeple The ai controller is using "DetourCrowdAIController" And Its not so much they are stuck in the ground more like they just choose not to move. I have an agro range on them to chase and attack my player if close enough if not walk on path. The ones that get stuck half the time chase me if i get close and the other half dont when i get close to them to check whats going on. I almost feel it just happens when a lots going on in the scene but i dont think that makes sense. I tried adding a delay in the spawn but that did not help. may be i am spawning them too high off the ground? Any ideas?
I usually have a bool in the ai pawn thatβs replicated and then in Anim bp use that to blend anims by bool
@pine steeple there is a apwn limit? since when ? That might explain my issue. Now i got to think of a way to fix this without rebalanceing my entire game. Probubly a longer spawn delay between waves.
since for whenever π
you can up it
but be warned without optimization running a lot of AI will soon eat your performance
@gritty peak in project settings:
Max Agents
Oh @pine steeple thank you so much it was driving me mad. I checked and it is 50. i bumped it up to 65 for some breathing room, i think the final spawns of the wave were getting stuck so this is probubly it. Will have to of cource play test to get the number just right.
Anyone know what the "Grid Path AI Controller" does? How does it differ from the other AI controllers? Can't seem to find any information about it π€
@strange kestrel it uses the UGridPathingComponent
not something i have looked at or had dealings with, but the comment says ```/**
- Path following augmented with local navigation grids
- Keeps track of nearby grids and use them instead of navigation path when agent is inside.
- Once outside grid, regular path following is resumed.
- This allows creating dynamic navigation obstacles with fully static navigation (e.g. static navmesh),
- as long as they are minor modifications for path. Not recommended for blocking off entire corridors.
- Does not replace proper avoidance for dynamic obstacles!
*/```
from what i can see it will use a Grid that you define whilst in that grid's area, outside of it, it will use regular path fidnding
Hmm interesting, thanks for the info
ya'll
MaxPerceptionDistance = Cast<UAISenseConfig_Sight>(OwningController->AIPerception->GetSenseConfig(UAISense::GetSenseID(UAISense_Sight::StaticClass())))->SightRadius;
Is there a better way π
I would like my AI bot to walk when entering a triggerbox, then continue running when it leaves the bounds. Is setting the max walk speed the best/only way to do this?
guess it depends on how you want it to work... you could have a walk mode bool that is used to toggle speed, or some other such solution as well
Can someone tell me why the navmesh is not generating on my spline mesh or rather only in fractions
i can change my agent radius to something very small then it generates fully but it still only generates in straight lines
not to mention that my actual actors in game just run off the path and fall xD
turns out the way i added the mesh to the spline wasnt very good, i tried an approach based on spline distance and now it works wonderfully
Is there a way to limit the displayed size of nodes in a BT when having very long parameters? It's really triggering with >30 chars
unless you modify the node in C++, no, but you can hide the properties via checkbox
tho this hides all params
Guys, I want my AI to see through other actors (with perception system). How can I do that? Rn actors breaks line of sight
Im using c++ so let me know how π Or where I can read about it, cant find.
so you want it to always see your player for example?
i mean, without C++, you COULD change the trace channel
and setup a custom trace channel
which avoids certain actors, but if you want to do your own tests/traces whilst trying to perceive the player, your player C++ needs to implement the IAISightTargetInterface interface, and override virtual bool CanBeSeenFrom(const FVector& ObserverLocation, FVector& OutSeenLocation, int32& NumberOfLoSChecksPerformed, float& OutSightStrength, const AActor* IgnoreActor) const override;
@pine steeple thanks for the info
Can I make a custom event like ''event begin play'' or ''event tick'' from a behaviour tree task?
@lyric flint i am confused, you want what?
nvm I figured it out π
ok
hey
right, so show me your exact task
yeah let me fix that for you
here
@lyric flint
if you want to know what ClosestFoodLocationKey is i can explain
these are the variables i use
what it looks like in the behaviour tree
closestfoodlocationkey is the blackboard key I guess?
Ah yea, I use that too π
yeah and make sure you tick the eye
so its exposed in the BT Tree
but this should work
i tested it and works fine for me
how do I specify that?
what do you mean?
this will get all actors in that radius that is of the class Food
I dont understand how the filter works, Can you assign a class to an actor?
actor is a class
this is food, see it says blueprint Class
Food is the class of this Actor
Right but what if you have 2 or more types of food? π
Ah I see π
Ohh, didnt know itd work like that
yeah that is the good thing about inheritance
Let me copy your homework and see if it works π
@pine steeple how do I set ''my pawn''? lol
nvm was bugged
@pine steeple i copied what you did but for some reason the blackboard key isnt recognized?
what you mean?
in the behaviour tree
the task
cant select the key?
fuck me forgot the eye
π©
lol
hm still doesnt work tho
what is the issue?
?
so its failing
you do know you have the task open
and select the ai from the dropdown
and see where it is failing?
huh?
cant really tell
doesnt do anything
only when the actor dies it goes to ''is not valid''
oh hold on I think i might have found the issue
it almost worked once?
Im so confused right now haha
I think it find the location now
but im not sure
it gives coords
but it fails
omg
its the
succes tick box
fuck me man
@pine steeple it works π
nice
thanks a lot man! appreciate the time you spend on me π
its cool π
do you mind if i can ask some questions about the bp you gave me? I dont understand some of it
I work with the AI system on a daily basis for work so i know how it works π
sure go ahead
the part after the sphere overlap
why do you set closest distance and closest food?
nothing connects to closest food so what does it accomplish?
it uses the sequence node
so when it gets to the end, the next number on the sequence fires
this was purely to make the BP clean
Ah okay π
so 0 will fire, it will set Closest food to null
ah wait you are on about nothing connected to Closest Food
that will empty it, set it null/invalid
as tasks are instanced, it could remember it from last time
ah I see thanks!
For now no π
im just sabbling into making simple ai villagers, Its really fun haha
dabbling*
well enjoy lol
anyone have any experience dealing with multiple actors on the same navmesh and getting them not to constantly collide with each other?
You can try using rvo or Crowd avoidance
the documentation on detour crowd controller is pretty sparse. and i'm just having tons of issues with nav mesh. how do other games set up their nav controls for their ai? is it all custom?
My ai collision issue was related to the class I used. I redid my setup to use same pawn for both player and ai, now it resolved itself.
Is there a way to abort a sequence and prioritise another one? My AI will not eat when hungry unless it goes trough all the other sequences first even tho its first in line
if its in a sequence, not really
first one that fails will return fail and exit the sequence
so the wait task is pretty bad then I assume?
simplest model for what i think you're trying to do
is have a service or controller decide on an action
have the actions ina selector
and each gated with a decorator
I got this so far
very simple
but when its hungry, Id like it to drop what its doing and eat
make the IsHungry decorator abort lower priority
thanks π
seems like a common question but is there a way to make AI Move To a little less "perfect"? (with blueprints)
right now my guys are doing a perfect goose step
not in blueprint
you could try using crowd avoidance and adjusting speeds dynamically
thank you i will look up crowd avoidance
I'm not sure if there is a solution for this, but how do you launch AI enemies that are using Blackboards? We have similar AIs that don't use blackboards and we can launch them with no problem, but the more advanced ones don't budge. I even tried repossessing them with the dumber AI controller before launching them and they still refuse to be launched.
@pine steeple it stopped working? Any idea?
Cant figure it out lol
it probably fails getting the actors
it is not finding any food
there is tho, I tried making it find something else but its the same issue
and its odd cause I didnt change anything lol
probably changed your collisions
yup that was it haha
In the new ai controller u created in construction do you have βrun behaviour freeβ?, also do you have in Ai pawn bp that it will be placed and spawned also?
Hey guys, sometimes my AI gets stuck or does "rapid switches" between two tasks in the Behaviour Tree... Any clue why that is?
its failing to move
MoveTo task fails, then exits the sequence, then the BT starts again, and it repeats
because its not finding a way to the waypoint maybe? so navigation issue?
or its stuck in ground, no navmesh, etc
Visual logger is a great tool
for AI related stuff
It was indeed a navigation issue... Turns out that sometimes the nav mesh is not strechtched out over the entire level. I spawn my level elements^^
Will tell you why your BT is failing, why AI can not move, etc
so in the future, that tool will be indispensable
yeah, will check it out as soon as i need it i guess π Any clue why that navigation problem happens?
no idea really, maybe you need to switch it to dynamic?
.. it was already on dynamic. Is it possible to make a static navmesh inside a BP?
no
alright, i guess i have to look at invoking then now^^ thanks for your help π
What does your get waypoints bp look like?
@visual parrot It turned out to be a navmesh generating issue. WPs are working^^
π
anyone has a behavior tree service example with c++
Can anybody hit me up with some AI behavior tree wisdom?
I'm trying to add a node to my moveto action in a sequence that checks if a condition is met before running that movement. how would i do that?
I tried compare bbentries but this involves me setting a random blackboard value up for this
nevermind i figured it out, i needed to create a custom decorator π
Can someone tell me the difference between perform condition check and perform condition check ai in a behavior tree decorator?
have you tried placing both nodes down to see difference?
Ai node just has convenience outputs of controller and pawn
@pine steeple i see thanks. @visual parrot I have and saw no real difference between the two other than ai node has a convenient controller input
They both get called same time
the thing is the descriptor says that only the best one will be called which i find odd
Yeah if you have two and it's an ai controller it will call the ai node
"only the more suitable one" will be called
you can have behavior trees for non ai characters?
i see, i can't personally think of a single application for that though so i see why they dropped it
We actually use it in the red solstice 2
We use BT as a mission system. It works and is easy to use.
We cheated heavily on that
hmmm so like a mission tree i guess huh
Yeah
We made special c++ asynchronous tasks and nodes for the game designer
They can just slap nodes into a BT to create a linear mission
ok i can see the use in that then, when you say asynchronous tasks do you mean like player can finish A then C and come back to B in the sequence?
That is possible but our missions are mainly linear story based
Well i appreciate the insight into the behavior tree
Quick question about common Ai practice. So say i'm making a diablo-esque game. How would i handle AI? Currently i'm setting the ai controller culling to 2500 which is outside the view of any player. i'm assuming for the server an AI that's just sitting doing nothing is not really expensive right?
I ran a test and i'm easily able to handle 300 in a tight zone but i'm curious how that would work. Would i need to destroy and spawn actors in a ontick event checking if the player is say 5000 units away from the spawner or something?
Does anyone have a good tutorial or blog or article or great video they found extremely useful to creating complex behavior trees in UE4?
I'm so exhausted on the waves of "this is how you do things with behavior trees"
and every single time its just setting the EQS default settings on a tree node or the easiest AI imaginable in any game of 'walk to position' or 'patrol' lol
I'm trying to get a further grasp of how people are managing complex AI with behavior trees.
Before I decide to just create my own brain process and skip the behavior tree.
But they worked hard on a flexible AI system which comes with some great and neat debug features so I'd like to give them a good shot before just doing a Finite state machine through a custom BrainComponent
@warm ibex complex AI with the built-in BTs usually comes to making several BTs for behaviors
and then using the run behavior tree tasks
anything else is unmanagable
@noble hearth if you feel like you should destroy an Actor on Tick, you should had had never spawned it in the first place
creating and destroying actors isn't free
does anybody know if the cooldown tag decorator means that the cooldown is shared gamewise (AKA between different actors) or if each actor has their own tag cooldown? π€
thanks for the info.
So considering a state machine brain wouldn't be a re inventing the wheel approach in UE4s case.
I didnt want to start going down that path right away. Wanted to give UE4 BTs a chance.
But at the same time as I'm starting to try to use it more and seeing how people are using them, they feel meant for small tasking.
Then hoping to tons of different trees maybe.
It almost feels like trying to force mini states without a state machine lol
So then really just make an AI brain that runs a state machine and we're all set I think?
I'll give it a shot trying to more or less think of an AI State as a Tree itself maybe.
managed to test it, each agent has its own cooldown by tag π
@warm ibex BT's can be pretty complex
this is my Hunter Monster
and it runs sub trees
π
BT's are really really good
people just get confused on how to use them
awesome! yeah see this is what I was picturing like a web of webs.
I'll keep looking for a handy article/tutorial/video it'd be nice to delve deeper into them.
I really just see people doing examples of 'MoveTo' or quick patrol.
Then say they're useful lol
These images would be the first example I even see of someone going deep with them.
I see how much UE4 really did for nodes and the BTs and how approachable they are when it comes to debugging or analyzing them.
So I can see how much power is behind them I've just been having no luck with finding more elaborate breakdowns on them lol.
yeah i mean i have been doing this for over 2 years
i know BT's like the back of my hand
Cool cool, also as far as the things to do safely from within a BT node.
The BTTask Move To that's in code I was looking at it.
It mainly focused on commanding the AIController to ->MoveTo(
Which then manipulates the Movement component.
How have you found useful to track if a task has started?
I was considering just keeping like a
CharacterCoreComponent of some sort and just having flags 'IsSearching' 'IsJumping' ext ext
But those basically live not on the blackboard.
Also in the case of controlling the components I was thinking it might be good to send events to components rather than directly change info on the component.
What have you found to be useful in your experience with BTs so far.
i mean the move to task makes sense
i use gameplay tags for states, i made some custom bt decorators for gameplay tags, this really helps keeps things organized, i also use states for certain AI (like hunter)
these services just pull the values
Hunter is one of the more complex AI
he can go inside vents, jump down from ceilings, climb out from side vents etc
can break down doors, stalk you, etc
got it, so more or less you could run a selector and a sub tree 'per state' as an approach.
If you're in a subtree is it basically having you come off the main tree or does it always come back to the main root to go down to the subtree
always goes back to root
ok thanks, and as far as the Behavior tree asset does the sub tree end up having its own data or can I possibly push the same data to the sub tree
have to use the same BB or a BB derived from the root BT
and data is shared, the subtree is just run as a sub instance of the main tree
that is also the nice thing about sub trees is you can use a derived BB inside it, if that is your thing
not something i personally bothered to do
he is an example of Gameplay tag determined nodes
very clean, niceeeeee.
I haven't touched gameplay tags yet.
or the Gameplay Tasks
things to look into
yeah i don't mind making BT's tho they can be time consuming at first
but once you have your core Services, Tasks and Decorators down
it becomes easy
Yeah that's been my mentality toward the UE4 tools.
I might be good with c++ and making shell things.
But there's a whole engine here, no need to re invent or come up with a easier solution when you can just take some time to embrace something that's taken years to make really powerful.
i probably have over 180 BT Tasks lol
reckon some of them are dead tbh
need to through them
haha niceeeee, I do AI & gameplay all day at work.
But its not UE4 but I love to learn so UE4 behavior trees studies.
Then to see what crazyness I can do once I get UE4s flow down.
Thanks for the infos, very inspiring stuff, good luck on the BTs!
And thanks for your time
np
@pine steeple as you set sub trees do they automatically exist (data wise)
or do they load when you arrive on it for the first time.
I figure all sub trees within a main tree get loaded when the main tree gets spawned.
I see service examples of like finding the player or setting values.
Is this a preference thing? Or should we be avoiding setting blackboard values inside of the tasks?
it probably depends on exactly what you're doing... services can run parallel to tasks
nothing says you can't assign bb vals in a task- but for flexibility, it might be a good idea to offer it as a parameter so you can choose which bb value it uses
Tasks and services make sense for adjuting BB values
Decorators don't make much sense
has anyone used
void AddEnumFilter(UObject* Owner, FName PropertyName, UEnum* AllowedEnum);
If so the third param It seems it doesnt like me directly passing my enum type
UObject filtering passes a TSubclassOf<UObject> AllowedClass); and that's basically MyActorClass::StaticClass()
What is it for enums?
@warm ibex ChosenMovement.AddEnumFilter(this, GET_MEMBER_NAME_CHECKED(UBTService_CivilianData, ChosenMovement), FindObject<UEnum>(ANY_PACKAGE, TEXT("ECivilianChosenMovement"), true));
or you can use the new style
StaticEnum<ECivilianChosenMovement>()
which i should replace mine with
new hotness it is.
when you get your value from the blackboard for an enum
GetValue<UBlackboardKeyType_Enum>
I see we have
UBlackboardKeyType_Enum::FDataType
is this uint8 the literal enum value that I'll just have to cast to my enum class type?
If i have a parent AI Controller and 3 types of unit can they all be passed through 1 AIController or would I need to create Children of the Parent AI Controller?
I have a BP_BaseUnit which then creates 3 types of Units which Inherit from this because they have similar things such as Health, State, Value, MoveSpeed etc, Hope this kinda makes sense. lol
You can have them all use the same controller class yes
A controller is created per-actor, the class just defines the type of controller, not the instance
Hmm i cant seem to make it work.
If i put the unit state to Idle using a Enum then it sets all the other units to idle.
How exactly are you changing its state?
I set a Variable in the Controller called UnitState and then during Play I was changing the UnitState by selecting a new dropdown option
if you go into play mode and search for controller in the world outliner it should show one per ai character
Ahh ok i,ll check thanks !
Doesnt seem to create an instance of the controller for each unit on the field?
2 units same controller
can someone tell me what might cause this behavior? the AI just has a MoveTo node where the character is. Runtime generation is set to dynamic.
https://gyazo.com/86888c37d10727abe9fee45fd044848a
Note it says controller class. A class is a reference to the type of the controller. The controller is created using that class... if you search in the outliner for BaseUnitAIController, you should see a number of them equal to the number of AI units
Ahh found it thanks!
So when i set the state to Idle at the start ALL units will be idle and then during play if I change the Unit State then the tree will refelect in that dropdownlist i guess.
It depends on where you change it... if you change it on the specific spawned controller instance then it should only affect that particular one, and if you select the same instance in the BT editor while playing, it should show how its state has updated
jfc
:triangular_flag_on_post: Gamescammers#6929 received strike 1. As a result, they were muted for 10 minutes.
:triangular_flag_on_post: Gamescammers#6929 received strike 2. As a result, they were muted for 1 hour.
https://www.thegames.dev/?p=70 i wrote a little article on BTTasks in C++
Nice one, didn't know about the memory function since I always did them in BP's so far :D btw the code samples have encoded & chars into &
its switching locations too fast probably
indeed, but if I set Runtime generation to static then it doesn't do this weird behavior...
is that good? you can do that or add a delay
a delay? sure, but that's a hack, i'd like to know why it does this behavior in the first place
maybe EQS and dynamic generation don't work well together
EQS and dynamic gen work fine
but it looks like your using navinvokers
those i am not sure off
@pine steeple it's a pretty simple setup, this is the BT:
and this the EQS:
the moveto node (with dynamic on) just skips quickly and back to wait. With dynamic off, the moveto runs appropriately.
i will look into that. thank you.
back again with another stupid AI question. both of these AIs are using the detour component with RVO disabled. if an actor's target location is blocked by another actor, the actor just walks in place endlessly. is there no unreal mechanism to fix this or am i going to start having to do some freaking math?
this is because the enemy actor is projecting null on the navmesh. set your actor's mesh to stop affecting the navmesh
i am, but crowd avoidance is set to CrowdFollowing->SetCrowdSimulationState(ECrowdSimulationState::ObstacleOnly);
for the spiders?
well if they are all obstacle, they wont avoid each other
why was they not moving with enabled?
i haven't yet figured that out
you know how to use the visual logger?
turn on enabled, and see what visual logger says
Window -> Developer Tools -> Visual Logger
press start in the visual logger, and it will start recording
ok gimme a few minutes
oh my god bro
i fucking wish
ok let me check
do you have ECrowdSimulationState::Enabled?
yes
dude what the hell
oh interesting! i didnβt think of that, will check tomorrow (is late here) π
thank you
show me the result of visual logger
so i can get some idea what is going on, so we can fix it
its really easy, and brilliant for debugging AI issues
yeah i might put it on my blog
LogCrowdFollowing (Error) Invalid navigation data in UCrowdFollowingComponent::SetMoveSegment, expected 0xEA47D600, got: 0xEC05C100
now, do you have multiple navmeshes?
i deleted the second navmesh and it's still happening so i have to figure out how to set the first navmesh
and from your project settings?
under Supported Agens in Navigation SYstem
i have two agents
let me delete one
OMG
IT WORKED!!!!!!!!!!!!!!!!!
YOU BEAUTIFUL PERSON
so what i do in our game, is the AI on big navmesh, is set to Obstacle Only
so the ones on the crowd avoidance navmesh, can avoid them
np have fun π
Hey guys, working on a project with a bunch of AI, we're trying to implement EQS now. Anyone have some good resources on it? Aside from documentation
There is a few youtube tutorials on it
there's a udemy course that's pretty good. if you're willing to pay for it
i use them extensively in our game, they are brilliant
our AI's "Aggro" system uses EQS to determine its target
that is how flexible they are
bit like this
@pine steeple so the spiders are properly avoiding each other, but now they're getting stuck like there's some kind of "friction" that's stopping them. is this something to do with the nav agent radius?
of course
also there is option like slow down at goal
and velocity whilst avoiding
which you can tweak
yep looking at that
these values we found work well for the avoidance
poorly documented unfortunately
let's try it!
it's about the same so that means there's something wrong with the actor itself
thanks for sending that over! im gonna keep it with those settings
What is the best way to make stealth AI, for games such as Metal Gear and Spliter Cell?
General run down is, Use perception, if player makes a noise, investigate the noise location, etc
patrol the last known location for X time, before giving up search
notify other AI close by you heard that sound, that kind of thiing
Right
if player is spotted in sight cone, then you attack them
UE4 has AI Perception system
which would be perfect for this
I am using Character Interaction update 3 which has something I always wanted
Just wanted to make it slightly better to suit stealth genre
yeah, for things like crouching behind barricades, you would need a system to detect nearby barricades (EQS query for example) then trigger when near barricade to go to crouch, that stuff
there might be some YouTube tutorials on it, but yeah the basics of this sound pretty easy to flesh out, fine tuning would be a lot harder
Yup, that's what I am finding hard
I have instant detection and long range
Pretty much making it Dark souls of stealth games
Also, the way I am designing the level, maybe I need to tweak a few things to make it presentable
For combat, it is perfect for what we want, behaviour like terrorists in training camps
Open assault, rush the player
Thanks, I guess I'll have to check some videos and try myself, trial and error until I get good result
hello guys. i need help to make an AI random movement and catch the player but without using the movement component. Any idea? thx you π
@pine steeple any idea for a decorator to see if theres nearby objects?
or is there an easier way to skip the task?
would anyone know how to set a blackboard value as a bitfield?
basically an int used for bits just want to store it on the blackboard.
I figured worse case there isnt a masking type and I just store an int and check on it through composite decorator checks
Is using "Wait Blackboard Time" a good way to implement weapon firing timing for behavior performance?
Move-To Patrolling AI stops for a bit after reaching target point
The next target is already calculated but still it pauses for a frame and starts over
@lyric flint use the visual logger, Window -> Developer Tools -> Visual Logger
it will tell you why the AI failed to move
Invalid path
wich means?
it tried to move to somewhere off navmesh
ah
if your tree is blocking navmesh and the location does not have navmesh
ie you move to center of tree
thought the acceptance radius would fix that
what is partial path?
we fixed a lot of these issues by using EQS
the problem with turning off affect navigation is that the ai just walks into it lol
it means move to the closest point we can get on the path, if we can not reach the goal
where is that option?
should be on the moveto task
yeah you know about the real time gameplay debugger
press the ' key and select your AI
you can see what path it wants, and stuff
visual logger also maps in the level the locations
turning off can affect navmesh fixes it but eh
yeah
so you need to move to a location near the tree
not directly on the tree
could be the center is too high
you need to maybe set the move location Z lower
that seems silly theres gotta be an easier way
well there is a height limit to path finding queries
rvo avoidance only works on what? other ai's?
yes
hm I got a workaround but its weird
I mean I know why the bushes work even with navmesh
@pine steeple do you know to make the navmesh tighter?
Is there a way to tell an AI to move toward a topographical location? Without specifying height?
I just want to tell it to move back and to one side a few feet, but I don't want to worry about whether it's uphill, downhill, flat, etc.
What's a workaround for adding structs in Blackboard without me saving off everything I need as actual blackboard key/values...? Is there one?
@fresh remnant
I was thinking you could potentially make a component and just keep reading off it but you'd have to keep accessing that component every time you want to reference some data. But if you store stuff in one component it doesn't necessarily stop you from just keeping relevant data in their relevant components.
Not sure the correlation between blackboard and UE4's networking but you dont necesaritly need to be saving everything on the blackboard.
You can even look at the MoveTo task behavior it just sends commands to the player controller which sends a command to the pathing component which has its own info already stored inside that component.
Blackboard is more or less direct information that's needed most of the time.
Or just storing away everything you feel needed specifically for that BT.
But it can definitely be a balance.
@warm ibex yeah I think my usecase falls exactly in the middle in this case where I'm trying to pass a struct between different AI tasks and requires a few elements (Vector, and some integer ids). Didn't want to make components or manager just for that, but still want it encapsulated so it makes more logical sense. So in the end I just created the different blackboard key values and pass them along individually.
Is there anyway I can make the EQS filter out location that is already taken by other call of EQS?
So that all EQS does not return the same location.
pass in the results to the second EQS?
Ah, I mean by I don't want the EQS run of different AI to return the same location. Anyway I can pass other AI EQS result into EQS?
well your AI can store there EQS location in your AI Manager/Director
other AI eqs queries will just block them with a test
and you clean that out routinely
which is what i do
Thanks, I will try that.
How do you actually communicate between AI Manager and EQS? Do you have like custom EQS class that has the pointer of the AI manager or access to it via the AI? Or you use custom EQS Manager?
i have a static, i can pull from anywhere
UFUNCTION(BlueprintPure, BlueprintAuthorityOnly, Meta = (WorldContext = "WorldContextObject", CompactNodeTitle = "AIDirector"), Category = "Level|LevelManager")
static class UAIDirector* GetAIDirector(const UObject* WorldContextObject);```
Hi, do you rather use the UE Ai or implement algos like GOAP yourself and would that have advantages?
GOAP doesn't quite work out of the box with Unreal
so if i want more complex behavor i cant go with the internal api
what about pathfinding? are meshnaves ok, or for more complex do i have to implement my own pathfinder?
you can run BTs from BT tasks
the crowd avoidance and RVO could be better, but normal pathfinding is solid, once you get familiar with navigation system options
you could run GOAP with unreal BTs, it just won't be super-simple
are dynamic nav meshes very performance intensive
since i have a tile renderer
@patent hornet GOAP can write my own api its not that bad
but if the internal is great i can go with that
they are okay when configured correctly
if you decide to blow up half your level and regenerate navmesh all at the same time, you will feel a spike
can i bake it at runtime only once? like render the tiles and update the mesh
for sure thats possible, i think i will go that way, i have no moving env
i just want to get sure that performance/quality is scalable
for mobile as well
took us quite a while to get the navmesh behaving, but we do have large procedural destructible levels
as long as you don't generate the... "ground" at runtime
you can have your navmesh packaged with the level just fine
i do generate the groundtiles
floortiles
but only once, that cant be a problem? @patent hornet nothing is moving too from the tiles
navmeshes look quite solid so far, but i dont have the exp
probably not, especially since you can delay the game start
yeah sure
i can give you feedback later
thanks for all that information @patent hornet
unless you have RTS type controls
you only need to have navmeshes and pathfinding server side
you can even get away with it with RTS controls, but the game will feel less responsive if it needs to wait for server to start moving
@patent hornet ok, i understand, to you have any recommendation for multiplayer service / api to use?
not developing for mobile here, so no idea
not sure if i will publish to mobile, i just want to have everything to make it possible at least
Is this doable in blueprints too?
my recomendation for AI is that the default BT is actually quite nice
coding the tasks themselves in blueprint is super nice thanks to being able to use Delay nodes and the likes
but other than that... no, not very usable
and the unreal BT is super basic so it breaks down the second you try to have something remotely tricky on it
while it works super well for typical "enemy AI" where the AI follows a rigid pattern, it breaks down enterely on complicated cases. For example its nowhere near good enough to have a decent PvP bot for a arena shooter
it can still do it
run EQS service for which BT you want to be running and run it
the service would be pretty complex
but it would work
how i can make a if node in the behaviour tree ?
Decorators and Selectors
like how i can make the behaviour tree to know if a boolean is true or false, like if it's false execute a task and if it's true execute a another task
call the boolean in a decorator
Decorators and Selectors @lofty sail
even this is possible, this basically an if statement
thx
How do I make an EQS task that gets a random location around my character and moves to it? I'm having a hard time trying to get this to work. Tried to follow a tutorial but it was outdated.
(@ me when you reply please)
@sick badger show me what you have.
So "Run EQS Query" I have unplugged because I had tried to copy it over from the "AI Behavior Toolkit" (marketplace) Behavior tree into my new one that i'm using with a different AI system, but it's not working.
The new one I tried to make from scratch is the "RandomLocation" Task.
In that Task I tried to copy what the tutorial I found said, but the problem is I seem to have nothing to set the blackboard value key... I already made a vector called TargetLocation in my blackboard but I don't know how to use it here.
@pine steeple
you need to make a property of the type BlackboardKeySelector
how do i do that?
in the Variables section, click Add, and search for BlackboardKeySelector
and name it like my blackboard key?
name it LocationKey
ok
then click the little Eye next to it
then plug it into those two nodes?
right
ah you already had a key in that first picture no?
i had it on the blackboard but not inside the task
character's moving around now! thanks!
oh one more thing
I have a float for "Wait Blackboard time" But I want to make it work with a range between two floats, is that possible?
ah ok
hey guys, is there a way to make my Enemies detour each other when they're chasing me? Cos currently they're just stacking one behind the other struggling to get to me..
@waxen ore use the crowd avoidance maybe? Detour crowd following component for ur character movement component
π hey, yeah this sounds good! You mean using a Crowd avoidance AI controller instead of usual AI controller?
You also mentioned Detour crowd following component, not sure what this is as I it seems like there is no such component I could attach to my enemy blueprints
hmm it would be a c++ thing maybe
Yeah actualyl the AI crowd Controller uses that
: Super(ObjectInitializer.SetDefaultSubobjectClass<UCrowdFollowingComponent>(TEXT("PathFollowingComponent")))```
I see, I temporarily used RVO avoidance but this is unreliable as it may push characters away from the navmesh making them stuck
yes RVO doesn't care about being on navmesh unfortunately
so you have to have someway to force them to get back to the navmesh
if you're doing BP, it's probably going to be a bit harder to make sure they're not off the Navmesh, what I did was I overrode the velocity they tell me to go if I know I'm going to be off the navmesh. I'm not sure what other folks do to keep them on with RVO on
You might have to deal with it after the fact, once they are off, to get them to move back in by forcing their velocity to move to a nearby nav point
like detect when they are off the navmesh, I believe that's possible with BP, and then find a point on the navmesh closest to the character location, then go into a state where you slowly walk them back during Ticking
Yeah thatβs definitely an option. Thanks for the advice!
few gotchas on RVO: max 50 crowd movers at a time unless you up the limit in project settings, problems with tile size depending on how large ur whole map is that u have to set up in the Navmesh options, also doesn't pay attention to walls/collisions unless u register them as blockers for the RVO
but navmesh should be fine mostly for the pathing stuff, they just stray off when they need to veer away from something
So I think using AI crowd detour controller for my enemies would be a better choice right?
I just wasnβt able to see yet where are the settings to tweak avoidance parameters in that crowd detour ai controller
Are you using the regular character movement component?
Yep
Character movement in unreal is a mess imho π .so in your enemy's movement component if you select it in your character's blueprint, you should see some RVO properties in the details panel
alongside the "max walk velocity" etc settings
there's also RVO settings in Project->Crowdmanager
I set my max agents to 1000 π
I will have 3-7 enemies max
oh great, then that works well
Thanks a lot man!
What am I not understanding about Behaviors here?:
- The first task runs and returns "success"
- the second task goes to "In progress"
-then the first task runs again? Why does it go back to the first task?
actually second task does finish with success, but I couldn't catch that onExecute, something else makes it finish. But whhy does it restart 1 before going to task 3 still?
so the order goes like this:
Task1(sucess)->Task2(sucess)->Task1(sucess)->Task2(sucesss)->Task3(success)
i can't get ReportNoiseEvent to register with the AIPerception component on the AI controller
player character class
ai controller
i only get sight updates
tried different numbers for loudness and range in ReportNoiseEvent node.. can't see anything in the visual debugger
also don' understand why there are sight events for the AI pawn, there is only one actor with the perception stimuli source component in the scene because by default every pawn is registered as a sight stimuli source (need to change a setting in .ini)
pawn does need to call some MakeNoise function
for that to work
don't recall what it is exactly
ReportNoiseEvent
i do that in the players character bp
also tried in the controller and level bp
.. i've looked at a couple of tutorials and they show exactly what i did..
does you ai have sight set?
is your team boxes all ticked?
cause unless you implement the team interface, you need to at least allow neutral
yeah, i have all the affiliations ticked .. as seen in the screenshot above (have them both for sight and sound)
interesting
forgot to set the instigator in the ReportNoiseEvent call ... π€¦
that could help π
Hmm. I added a AIPerception component in blueprint, then after playing around a bit I added the component also in C++. Then loaded the editor, deleted the component added from blueprint. Problem is I gave the C++ one the same name as the blueprint one, so they co-existed. When I deleted the blueprint added component, it also broke the C++ added subobject. I can get the C++ added AIPerception to work if I rename the variable and the subobject name, but I really want to use the original name. π Any tips?
I tried removing the component in C++ and resaving the blueprint hoping that cleared up any old data, but even after resaving it without the AIPerception component and then adding it again in C++, the component remains broken, except if I create it under a new name. Weird stuff.
Oh... that makes sense. The characters that were placed in the map still had old data.
Never mind, that was it!
Hey !
I'm working on a grid base game, and I'd like to implement my own pathfinding without a navmesh (partially because the level is procedural and I don't want to have a massive, dynamic navmesh). My issue is, i can't find a way to make my character move toward a location without a navmesh or an AI controller, as I really don't want to use theses tools.
Is there a simple way to just input a location and have my character run in a straight line toward it ?
Yes, Character->AddMovementInput π
You would have to turn the location into a direction first
AIController->SimpleMoveTo is a good one as well (never mind this one, it still uses nav mesh)
Or AIController->MoveToLocation with bUsePathfinding = false
This one is perfect, thank you !
is it possible to make an environment query request without an AI querier?
So I have an issue where I'm trying to make a character a dynamic obstacle. When a character moves, I need it to update the location of the obstacle to the new location of the character. My issue is exactly as explained in this post: https://answers.unrealengine.com/questions/914190/navigation-around-pawns-that-are-dynamic-obstacles.html. However, I really don't want to use detour crowd AI controller since that has issues such as units slowing down. And also ROV is not an option since I can't have units pushing each other around. Anyone got any suggestions?
From research it seems I might need to use grid path AI controller, but that has really limited documentation :/
Since the nav mesh isn't automatically updating because bCanEverAffectNavigation is set to false, try manually triggering an update with the static function
UNavigationSystemV1::UpdateActorInNavOctree
or maybe UNavigationSystemV1::UpdateNavOctreeAfterMove
Any idea why my character doesn't move all the way to target? I'm using Move To Location. It seems like the bigger I make the character capsule radius, the less accurate the move is.
I don't want to shrink my character capsule, because I need units to not overlap in the same grid
all I'm doing
Acceptance radius -1 will cause it to use the capsule's radius as "stop on overlap" radius
So specify some small positive value to make it more accurate
ahhh ok thanks, I'm not sure that behavior is documented or I just can't read
setting the acceptance radius to 1 still does the same thing
so that's not it
perhaps I'm doing this wrong? do I need a capsule for navigation and a separate capsule for collision?
Guys I need to have 4-5 enemies creating a circle around the Player while attacking him, but currently they're just struggling to get to him stacking behind each other doing some ugly sliding. I tried turning on RVO avoidance with radius of 500, weight 0.5 but they still just slide and slide. Please help!
I want those blocked enemies, to detour attacking enemies in left or right direction finally getting to the Player
Try the Detour Crowd Controller
If you press the expand button, have you unchecked Stop on Overlap?
it's unchecked
The fact that AcceptanceRadius == -1.0f will cause internally that agent radius is used is not documented indeed. I just double checked and it actually takes 10% of the root component's bounding cylinder.
so 10% of radius is normally used
haha wow thanks for looking at the source for me
It's np I'm working on movement stuff as well so it was good for me to double check what -1.0f did
I'm out of ideas though for your issue
ah great, np
I'm new to AI and at first I watched quick tutorial which used pawn sensing but then watching some more I learned about EQS and AI perception and right now I'm very confused, which one should I focus on the most? Is one of them significantly better than the others, maybe one of them is outdated or should I mix them up? I also see all of them doing kinda the same thing but just in a different way. I know that EQS is still expiremental and probably will stay this way but I read that it only needed some UI polishing.
I can't understand what are you talking about. They have very different purposes, where AI sense is usually used to determine the target and EQS - to determine which way it is best to approach found target. EQS is used for finding stuff in examples, but, as for me, never on practice it is used for that. So, which one you should use is depending on type of AI you're doing, but if you're doing common "Shooter guy", then you're likely to use them in conjunction
hi, i want help for a very best cover mekanizm π¦
I can understand his orienting question because although the two systems can do very different things, there are some purposes that can be done by both like detecting enemies in front of you, in hearing range etc. I would say EQS can easily detect the same things AI Perception can.
Generally AI Perception is helpful for triggering things, i.e. when things should happen. For example when an enemy comes into view, AI Perception can trigger an event node where you can handle the reaction in. EQS is a supportive tool for determine what to do or how to do it, like when you know now is the time to change positions (for example, the enemy walked out of line of sight - detected via AI Perception), EQS is helpful for choosing a good new position.
π
why doesn't my navmesh get affected properly by the simplified box? The left part after the empty line should be all out of bounds
could anyone help me with a few ai?
im looking to have deers and crows the roam around
and react to player movement
@lyric flint check out tom looman's udemy course
@tardy abyss 4 legged animals like deer are hard because they don't pivot on the spot like humans do. This means that when the nav agent makes them turn, they look pretty funky. They ideally have a 'turn radius.'
Hi peeps!
I am just looking over decorators and services.
Started looking at layers of a service class objects by studying UBTService_DefaultFocus
Inside this function
- UBTService_DefaultFocus::OnBlackboardKeyValueChange(
I came across - AAIController::SetFocus(
So I was wondering if anyones utilized FFocusKnowledge?
-AAIController
FFocusKnowledge FocusInformation;
Reading through code calls in AIController it looks like it is to call a focused actor?
But there's more to that since there's focus & priorities so I figured maybe someone here has utilized that FFocusKnowledge more whom might have more info its usage.
its just a layered focus system
higher priorities take over from lower priorities
{
typedef uint8 Type;
const Type Default = 0;
const Type Move = 1;
const Type Gameplay = 2;
const Type LastFocusPriority = Gameplay;
}```
take this for example, Default is lowest priority, then Movement is second priority, but Gameplay is the highest priority so its focus is the one that will be used.
you can make more, like i have 2 extra focuses that are higher priority to Gameplay
then you can use ``` /** Set FocalPoint for given priority as absolute position or offset from base. */
virtual void SetFocalPoint(FVector NewFocus, EAIFocusPriority::Type InPriority = EAIFocusPriority::Gameplay);
/* Set Focus actor for given priority, will set FocalPoint as a result. */
virtual void SetFocus(AActor* NewFocus, EAIFocusPriority::Type InPriority = EAIFocusPriority::Gameplay);
/** Clears Focus for given priority, will also clear FocalPoint as a result
* @param InPriority focus priority to clear. If you don't know what to use you probably mean EAIFocusPriority::Gameplay*/
virtual void ClearFocus(EAIFocusPriority::Type InPriority);````
to set and clear your focuses.
then AAIcontroller, inside UpdateControlRotation, it calls, GetFocalPoint, which gets the highest priority Focus, and applies rotation to the control rotation to rotate to that FocalPoint.
@warm ibex ^
hmm okkie, thanks @pine steeple
That went over your head didn't it ? @warm ibex
@pine steeple nope nope I got it its an ordering and we can manipulate the order. helps AI with prioritizing.
was just asking in case there was a part of it i was really missing.
This just cleared up what I was understanding.
nice
does anyone know how to handle flying enemy pathfinding over pits?
think a landscape with a sunken pit, and I want the flying enemy to be able to fly over it... navmesh wouldn't be able to make a path over said pit, how do you do that?
thank you
Could try using NavLinkProxy
Does anyone know why my BlockAll, BlockingVolume seems to be hollow. I'd like to fully clear the navmesh within its insides
Hey All, I'm just getting started with Navmesh, and it's being really mean to me : /
At 1:30 in this youtube, you can see the dude running off in the wrong direction for no apparent reason π¦
Mannequin randomly fails to take simple step forward on a navmesh :(
What's all that about?
Hello. Im trying to make an AI pawn tank that when it can see the player, it will move to them and shoot. However I have tried using AIPerception and PawnSensing and neither of them work as I cant attach them to the turret at the top. Does anyone know of a way to do this?
So you are trying to use sight?
Correct.
Yeah so the sense sight in default form is ok for humanoid pawns
i assume your BP only?
Yea.
Now are you talking about AIPerception here?
yes
The problem with that is I want the "cone" for his sight to move with the turret at the top. Whereas right now the AIPerception move only with the forward rotation of the whole pawn
yeah that is the issue, it also does a line trace from the pawn, and that will not be at the turret height
hm.
we ended up making our own detection system for turrets
but it depends how complex you want it, do you need Perception system complexity or just fire at closest target in cone you can see?
Alls I need is say the turret rotates around and sees the player, I then just want it to move to and shoot the player. So almost like if the turret can see the player, set a variable to true which will fire the move to and shooting events.
i would probably not use perception system for this, but make your own system. Without C++, perception would not be viable (its lacking a lot in BP)
if you are using behaviour trees, this could just be a simple BT Service
that flips a blackboard bool
Hm. How would I make my own system to what I want. It would need to check if it can see the player then make sure nothing it in between the player so that it doesn't go to the player if its behind a wall?
Hi, I am using a Move To in a RTS style so click a location and move to that but my "units" are overlapping each other, Whats the best way to stop them doing this?
@cobalt palm i cheat a bit, i get targets in range (how you get this depends on your system), then i check to see if they are within cone forward of turret, then finally do a line trace from turret to pawn. If everything checks out, we have a target
Ok. So the line trace is to check that they are not behind a wall?
correct
Ok cool. Ill have to see how to make the cone. Now do I make a custom BT task with this?
Yea. I found this video in the pinned messages of a tutorial series. https://www.youtube.com/watch?v=Gsfnf25WAig&list=PLbRBWFaQHaW__LcCtV-KnqqgIFOyyFhr5&index=2
In this video we'll look at giving the AI sight, creating an idle and combat state, and get the AI to chase the player while laying the groundwork for future tutorials.
Now I assume I could just change the location to the turret of my tank
The problem with that is I need it in a general way since the pits could be massive, and enemy track a moving target so they need to take the shortest path from any given side
Proxy you must pre determine the location from and to, no?
is anyone familiarized with this error log ?
LogCrowdFollowing: Error: Unable to find RecastNavMesh instance while trying to create UCrowdManager instance
Every change i make to the crowdmanager logs it, and even though i have my controllers set to use UCrowdFollowingComponent it's not being applied as well
Hello everyone, my code does not compile when I add a UAIPerceptionComponent to a Pawn in C++. Does anyone have an idea?
I just added these two lines to my Pawn inheriting class in C++, and that is enough to throw this error
UPROPERTY() UAIPerceptionComponent* AIPerception;
missing AIModule in your build.cs file
Damn. Let me try and I'll post here. Thank you.
That was my problem. It does work on AIController without the AIModule. But I need the module to use it on Pawns. Interesting, thanks again.
an anyone help me set up a bird flock that reacts to players and other animals?
Hi!
I have started working on AIController for RTS-like pawns, using the AI Perception.
But I can't find a way to access (get/set) the senses config within the Controller Blueprint. This stuff.
How can I access it within a Blueprint event to modify?
Hey! Are you trying to set each property individually through blueprint graph?
For now - to understand how to access those properties, and how they match with 'stimuli' I get with OnPerceptionUpdate, so I better understand limits of what can be done.
Ideally - yeah, I'd want to adjust vision cone and sight during gameplay, for example.
I am afraid that can't be done trivially, because SensesConfig of AIPerceptionComponent is EditDefaultsOnly
I am not sure if it can even be done :/
I see. Can they be at least 'read' somehow so I can extract individual value?
There is a workaround.
Here is my setup, but I am currently experimenting and I am not sure if it will work 100% at the end.
(sorry my C++ is a decade rusty, so I stick to BPs for now).
I could think of having different perception setups and switching between them, if necessary. But would still want to 'read' values so I could for example debug them visually (that vision cone), or use for in-game visualization.
I have a C++ class that extends from Pawn. In that class I have the AIPerceptionComponent.
you can update the senses config in C++, for example like this
void UCppHelpers::SetVisionHalfAngle(UAIPerceptionComponent * perceptionComponent, float newHalfAngle)
{
UAISenseConfig_Sight* sightConfig = Cast<UAISenseConfig_Sight>(perceptionComponent->GetSenseConfig(UAISense::GetSenseID(UAISense_Sight::StaticClass())));
if (sightConfig != nullptr) {
sightConfig->PeripheralVisionAngleDegrees = newHalfAngle;
perceptionComponent->ConfigureSense(*sightConfig);
}
}
I'll let @misty wharf write, maybe he has a BP solution.
I don't recall there being a BP method for it, that's why I use the above for example
you can use similar simple methods to also access values from it if you can't find a BP method to do so
Since SensesConfig is not exposed to BP, I think all answers would require C++ one way or another
I see, thanks guys!
Writing this method down. I was hoping to make everything in BPs, but this is second time in a week I ran into things being restricted to C++ sometimes.
Starting to understand why everyone is seeking C++ programmers and not just BP guys who drag n drop nodes π
you can get away with doing mostly BPs but on occasion you need to write small helper funcs like this :)
Hello. Im trying to make a service that checks if the player is withing a certain "cone" however after the player is in this cone the ai is supposed to move to them. Can someone see why its not working?https://streamable.com/9ddy3l
I'll ask the basic questions first, did you set the Blackboard keys when you added this task to the BT?
Yep. The only thing that isnt set right away is the TargetActor (so the player) but is set with the player is in view as you can see at the end
@cobalt palm did you set your aborts up properly?
for when the state changes?
the way you want to design the BT, is high priority stuff on the left lower on the right (for states)
then with your aborts, you can control executing say Movement State to enter combat state
Right now I only have a selector going to a MoveTo node. That activates when a certain key is set to combat.
can you show me?
that will not work
so do this
make another Selector from your Selector
and put your state decorator in that
let me show you
like this
now make another selector from your first selector
for non combat state
and put a wait node (say wait 5 seconds)
Still doesnt move to me. Let me check the VisionCheck again
@pine steeple is that because the service will not execute if the selector aborts?
@cobalt palm can you click on your BTS and show its properties like in this image?
could enable Tick on Search Start
tho really needs another state to hold the bt alive, instead of bouncing executions
Which property do you want to see?
This one?
No, I mean when you placed your service on the Selector node
You should click on it and set the blackboard keys