#gameplay-ai
1 messages ยท Page 115 of 1
you'll never have a massive BT so nice and clean that you can just take it in at a glance shrug
Well, having used lots of systems, I don't think the BP node-graph stuff is really much of a help
i usually use the BTTasks to configure and encapsulate a c++ Task
I guess being a C++ programmer puts me off some of it
yeah, me too.. although there's a number of features lacking IMHO
which can be as complex as an entire BT
it depends a lot on how atomic you get with each BT node
you could have a huge black box node that does tons of stuff ๐
yeah, i made a mission system with BTs
basically wrote c++ objective tasks
then used BTTasks to configure+encapsulate
and now my designers can just assemble missions from available objectives
without having an indepth knowledge of AI or BTs
but i don't think i'd enjoy debugging the flow control for a BT in c++ much
yeah, those kinds of systems should really be a part of the engine at this stage.. if AI got the same love as any other part of the engine
at least as generic systems
there is one AdvancedAi live stream from... 2016 or so
they were talking upgrades there, what they planned
but then it'd be just another undocumented half-assed implementation, so probably best not
the system hasn't changed one bit since
nope.. because Epic couldn't care less
they're not exactly AI focussed
which is kinda sad, because there's some great AI guys working there
worse yet, the AISystem is overflowing with typedefs
makes reading it somewhat... annoying
just been thinking to myself that I could do alright doing AI consulting for Unreal.. after re-doing some of the basic setup
basically get some crowd agent with AI LOD and whatnot in there
for AI Characters its generally recommended to have ActorComponents do the heavy lifting
You'd have to ditch most of the existing systems to do it right I think
AI Characters too slow
besides, most of the crowd agent stuff could use a rework
the Perception system is half broken - works fine in c++, from BP its quite awkward to use
add stuff like shared pathing etc
- there be CMC, the bloated 10k lines monstrosity that takes part in avoidance
yeah, I don't really play with BP for most of that stuff ๐
basically, there's a good few years worth of AI dev that could go into making UE4 a "good" ai platform
my biggest bugbear is still that you can't share blackboards ๐
it doesnt work
i think its everyone or noone scenario tho
multiple blackboards for a behavior tree?
yeah
for instance, coordinating actions for multiple characters
Zlo: yeah, thats the issue.. its basically a "global" share, which isn't useful at all
the other main issue, is that BB's can't have arrays in them
technically they can have objects
BB's imho, should look exactly like blueprint variables
objects yeah, but not TArray etc.
its just a holdover from when they were implemented
before the BP system was finished etc
hasn't seen any love since ~2016 or so
yeah
would be different if fortnite had bots
hence my feeling that it'd be better to start over and implement a usability-based setup
Fortnite DID have bots ๐
just not Fortnite BR
if they added a few engine Tasks
that doesn't really count as improving the infrastructure of the whole @spiral shuttle
aren't they still working on STW?
just.. not great for devs making stuff with the engine
at least in some capacity?
STW?
fortnite: save the world
oh.. no idea ๐ fortnite doesn't interest me
it's the coop sp/mp pve version of fortnite
oh.. okay? ๐ sounds weird
with hordes of zombies
But hell, I'm sure epic can find another decent game to copy ๐
l4d ๐
I guess whoever took the idea to copy PubG made their wage back ๐
hmm, L4D wasn't that popular, but I guess zombies are still "in"
millions? for L4D? erm.. doubtful
oh no, you're right
yep
console versions
i'd consider that a success ๐
hmm, I'm still doubtful, but yeah ok ๐
I guess across a bunch of platforms with Valve's marketing it'd do those numbers
Kinda surprised that Valve didn't get in on the BR thing
they did in a way
how so?
danger zone
BTs have really grown on me. I like the power of aborting trees on black board value change, and services help a lot with letting NPCs focus on multiple tasks like aiming, moving, shooting, and monitoring cover at the same time.
They are a pain in the arse to author for really complex behaviors though
I have not done much beyond basic shooter ai, so you may have a point
although its mostly from a design standpoint
the main issue is just that partitioning behaviors is kind of hard sometimes, knowing what specific conditions partitions one behavior into another etc
finding all the corner cases for complex logic is time-consuming and I'm not sure BT's are the ideal, even though I've used them a lot
Ahhh, what would be better then?
Well, thats a good question
I'm starting to think some machine learning by example might work
essentially the same as they do with robots
by observing human players
that could get downright weird to implement
you can't really let it learn from players directly, as that would get awkward
which means its your QA thats responsibe for teaching that AI
you can't really merge it well either
I think Machine Learning is really good in game for when trying to place out level metadata. But at runtime. its very heavy =/
I think Warframe just used "bigdata"(tracked where played wall climbed most often) to place level meta data markers in the level to teach AI where to wallclimb
If anything, you can use player data to do a lot of fun things to make AI a little more dynamic.
Example is to use heatmap data from online matches to weight navigation to help place AI in the right areas that simulate online games with players.
I've been building a Utility AI setup for a month or so now myself and I think it's going to work great for a common shooter. Was trying GOAP before but it just wasn't working out. I find BTs rigid and annoying to make more dynamic feeling behavior with
Anybody here with experience in c++ based decorators?
I have several and, for reasons I don't know, one of them spams my log with this
2019.08.26-15.11.48:339][660]LogScript: Error: P:\Perforce\Engine\UE-MyGame\Engine\Source\Runtime\AIModule\Private\BehaviorTree\BTFunctionLibrary.cpp(46): Runtime Error: "ensureAsRuntimeWarning condition failed: (NodeOwner != nullptr) && (NodeOwner->GetClass()->HasAnyClassFlags(CLASS_CompiledFromBlueprint) || Cast<UDynamicClass>(NodeOwner->GetClass()))"
The piece of code that is triggering this GetBlackboardValueAsActor()
bool UTADecoratorTagRequirements::CalculateRawConditionValue(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory) const
{
if (!OwnerComp.IsValidLowLevel())
{
return false;
}
UBTNode* nodeInstance = GetNodeInstance(OwnerComp, NodeMemory);
if (nodeInstance == nullptr)
{
return false;
}
AActor* actorToCheck = UBTFunctionLibrary::GetBlackboardValueAsActor(nodeInstance, Actor);
if (actorToCheck == nullptr)
{
return false;
}
.....
}
Funny enough, it's actually returning the right actor, but the log is a mess.
Does anyone know what exactly is this thing warning me about? I don't fully understand it
you could set a breakpoint and step into it
its probably shared between all BTs
the decorator
also, IsValidLowLevel() smells like Rama tutorial too many
iirc bIsInstanced defaults to false?
yeah, that would make it shared
and the NodeOwner is a CDO
so I modified the code to be sure which conditions fails in the ensure
hasFlags and canCast are false.
About the IsValidLowLevel() it's just me checking that reference is actually something we can use and not memory trash. Not so sure about it myself either
bool notNull = NodeOwner != nullptr;
bool hasFlags = NodeOwner->GetClass()->HasAnyClassFlags(CLASS_CompiledFromBlueprint);
bool canCast = Cast<UDynamicClass>(NodeOwner->GetClass()) ? true : false;
ensureAsRuntimeWarning((NodeOwner != nullptr) && (NodeOwner->GetClass()->HasAnyClassFlags(CLASS_CompiledFromBlueprint) || Cast<UDynamicClass>(NodeOwner->GetClass())));
UBehaviorTreeComponent* OwnerComp = NodeOwner ? Cast<UBehaviorTreeComponent>(NodeOwner->GetOuter()) : nullptr;
ensureAsRuntimeWarning(OwnerComp != nullptr);
return OwnerComp;
umm
why don't you just toss in a breakpoint
expand NodeOwner all the way down to UObjectBase in Locals
isn't it the case that you shouldn't inherit from the blueprint tasks?
and see what flags it has
@patent hornet
expand NodeOwner all the way down to UObjectBase in Locals
Did that, that flag is not there. Modified the code to spare me all the clicks to check that.
Flags are
ObjectFlags = RF_Transactional | RF_WasLoaded | RF_LoadCompleted (2621448)
The DynamicClass part is the one that rises more questions.
This is a Decorator made in c++. There's no BP version of it (@spiral shuttle is that what you mean maybe?), so I understand why that flag doesn't exist.
What is the dynamic class in this case?
for what? the decorator itself?
ah i thought that was a quote rather than a regular reply
my guess is that refers to c++ code created from the BP/BT
yeah... I guess? it's weird because this is the 1st time I see a decorator throwing this warning
btw iirc bIsInstanced defaults to false?
This is an instanced decorator. Forgot to mention that
so... nobody? any clues?
pure cpp? you don't use the BT editor at all?
no
any reason why?
How much have you edited the default BT? I cant think of a reason not to use it? Performance at runtime is exactly the same(since it's just a graph object). Unless your talking about BTNodes instead of the BT (Behavioral Tree) Or your running a custom system
it's not about speed, just flexibility
it's an experiment
(if you were talking to me)
Experiments are fun.
yep ๐
it also helped me understand the BT impl better
experiment/prototype to be precise
ok, fixed it.
Pro: it's fixed. No more errors.
Con: still don't understand why the previous approach failed.
I changed the above code for the one below
void UDecoratorTagRequirements::OnInstanceCreated(UBehaviorTreeComponent& OwnerComp)
{
Super::OnInstanceCreated(OwnerComp);
BlackboardComp = OwnerComp.GetBlackboardComponent();
if (BlackboardComp != nullptr)
{
ActorToCheck = Cast<AActor>(BlackboardComp->GetValueAsObject(BlackBoardKey.SelectedKeyName));
}
}
So, basically, I grab the things I need from the BB instance directly.
nice
yeah it also bugs me when i sometimes need to go a different route when the first one should've worked
that's the problem for me. I don't even know if that should have worked or not. buuut it's working. I'm mild-happy
though the behaviour in your impl changed
in the first version you checked the actor value in CalculateRawConditionValue
now you set it in OnInstanceCreated
I changed 2 things:
- the way I was getting the value from the BB.
- The place where I got it.
The reason for #2 is that, since this is an instanced Decorator, the BB is not going to change and the ActorToCheck (this is selected in the decorator using a FBlackBoardKeySelector) is not going to change either, so no need to get that every frame (potentially, it's always less than that). Also, because of that Cast<>. The place didn't matter really since CalculateRawConditionValue executes always after OnInstanceCreated
ah ok
yeah, me neither. Must be that specific code to process ยจselfยจ + the way I was getting the BB value
AActor* actorToCheck = UBTFunctionLibrary::GetBlackboardValueAsActor(nodeInstance, Actor); < i dislike that ๐
BlackboardKeySelectors are the only way
beauty is
you can filter them
Yeah, Iยดm using a BBSelector, as always, but I stumbled across that line and I was like... sure... why not...
but... nope!
Yeah, filters are beautiful
That Actor variable I'm passing to the line you dislike, it's a BlackBoardSelector. they use that syntax in many places within the engine. I would love to know what was failing
i have never use UBTFunctionLibrary
unless i suppose in bp ๐คท
never used it in c++
yeah, I guess we're in the same page now XD
i made a decorator
that aborts flow based on GameplayTag changing
but it sometimes doesnt work
and i am kinda lost why ๐
yeah, my decorator is related to that. I never have that kind of logic within a decorator. For they they are just conditions. You meet them? run the Task logic (or next branch or whatever). I have something similar to yours with this decorator. It checks the selected actor has the needed G.Tags (it reads them from the Gameplay Ability system component) or if it has any blocking g.tag (blocking in this context means "if you have this, the decorator will return false"). I have a boolean for each g.tag container to "match all" or not (in the code it just runs any matching or all matching).
yeah i want mine to flow abort
but it its not working so hot
it works for "checking" the tag
we don't use GAS, just GameplayTags indepentaly
independently
shouldn't matter. yeah, I don't know about that way you abort the flow. I always use a more classic approach (decorators are there to check conditions, to stop the flow I mark them as abort Self/Lower/... if needed in the BT editor)
isn't it wrong that you're removing the delegates on both handling functions?
HandleTagRemoved and HandleTagAdded are basically doing the same (except for the binding check in the if).
Is that right?
not sure what you mean
{
if (AreAnyReplicatedFlagsSet(MRF_DEAD) || OldFlagsNotEqualNewFlags(OldFlags, MRF_DEAD))
{
MonsterDead(AreAnyReplicatedFlagsSet(MRF_DEAD));
}
if (AreAnyReplicatedFlagsSet(MRF_COLLISIONS_DISABLED) || OldFlagsNotEqualNewFlags(OldFlags, MRF_COLLISIONS_DISABLED))
{
MonsterCollisionsDisabled(AreAnyReplicatedFlagsSet(MRF_COLLISIONS_DISABLED));
}
if (AreAnyReplicatedFlagsSet(MRF_IDLE_OPTIMIZED) || OldFlagsNotEqualNewFlags(OldFlags, MRF_IDLE_OPTIMIZED))
{
MonsterIdleOptimized(AreAnyReplicatedFlagsSet(MRF_IDLE_OPTIMIZED));
}```
just moved all my OnReps to a single Replicated Property
void UBTDecorator_HasTag::HandleTagRemoved(FGameplayTag RemovedTag)
{
if (RemovedTag.MatchesTag(ObserveredGameplayTag) && BTComponent.IsValid())
{
AAIController* const MyController = BTComponent.Get()->GetAIOwner();
if (MyController)
{
if (NodeMonster.IsValid() && NodeMonster.Get()->OnTagRemoved.Contains(this, "HandleTagRemoved"))
{
NodeMonster.Get()->OnTagRemoved.RemoveDynamic(this, &UBTDecorator_HasTag::HandleTagRemoved);
NodeMonster.Get()->OnTagAdded.RemoveDynamic(this, &UBTDecorator_HasTag::HandleTagAdded);
}
}
AIBT_VLOG(BTComponent.Get()->GetAIOwner(), "%s: Aborting Flow due to tag: %s being removed", *GetNameSafe(this), *RemovedTag.ToString());
ConditionalFlowAbort(*BTComponent.Get(), EBTDecoratorAbortRequest::ConditionPassing);
}
}
void UBTDecorator_HasTag::HandleTagAdded(FGameplayTag AddedTag)
{
if (IsInversed() && AddedTag.MatchesTag(ObserveredGameplayTag) && BTComponent.IsValid())
{
AAIController* const MyController = BTComponent.Get()->GetAIOwner();
if (MyController)
{
if (NodeMonster.IsValid() && NodeMonster.Get()->OnTagAdded.Contains(this, "HandleTagAdded"))
{
NodeMonster.Get()->OnTagRemoved.RemoveDynamic(this, &UBTDecorator_HasTag::HandleTagRemoved);
NodeMonster.Get()->OnTagAdded.RemoveDynamic(this, &UBTDecorator_HasTag::HandleTagAdded);
}
}
AIBT_VLOG(BTComponent.Get()->GetAIOwner(), "%s: Aborting Flow due to tag: %s being added", *GetNameSafe(this), *AddedTag.ToString());
ConditionalFlowAbort(*BTComponent.Get(), EBTDecoratorAbortRequest::ConditionPassing);
}
}
I'm just curious about the functionality of this.
When a tag is added to your monster, you remove both delegates, the add and remove.
Same thing when you remove a tag.
Obviously I can only guess but, aren't you running into a problem where, if you add a tag, you can't know when is it removed since you're removing the delegate?
I mean, this looks weird to me.
NodeMonster.Get()->OnTagRemoved.RemoveDynamic(this, &UBTDecorator_HasTag::HandleTagRemoved);
NodeMonster.Get()->OnTagAdded.RemoveDynamic(this, &UBTDecorator_HasTag::HandleTagAdded);
You remove both, add and remove, in both handling functions. But that might be me barking at the wrong tree
im removing when the decorator aborts
but shrug ill need to do more testing with it
this was written last year
just run UEProblemSolverBP::AutoFixAI() and UEProblemSolver::MakeGame(metacriticScoreToAchieve)
mining games on the blockchain
UEProblemSolverBP::AutoFixAI()
Throws a compiler error.
error C1014: Need more blood sacrifice: amt != 2000
nothing few interns can't fix
posted this awhile ago... reposting to see if it catches any new eyes. Just looking for some anecdotes or ideas to consider that I haven't already.
new to AI... just thinking this through... I have a basic unit (not the player) and enemy mob. If I want the unit to attack the mob, I'm torn between two options. 1) Use a behavior tree task to get details from the unit, and then damage the mob. All implentation done in the BTTask... OR 2) Use a BTTask to trigger a custom event on the unit itself, and the unit does the damage and any other implementation.
- wins with no contest there
Anyone here using current 4.23p7 having the AI seem to loop through the BT none stop in the packaged game, can't reproduce it in PIE or standalone
Hey guys, how do i add widgets to AI? I can't seem to construct widget for an actor component.
@torpid axle I'm 100% with @patent hornet
As a rule of thumb I like to let the BT decide how to behave (chase, attack, flee...) and let the AI pawn decide how.
General question:
Is there a magical way to combine Decorators as OR instead of the default AND?
I tend to do my own but I'm running in a way too specific case
Composites?
@azure cliff if it's a 3D widget, just add the component to your ai actor. If you mean 2D, it needs to be added to the player viewport
@slow bobcat Yeah i wanted it to be 3D widget. But i would like construct 3D widget on an actor if he has the controller/component i created.
I'm trying to have status effect icons on AI.
@patent hornet hehe yeah, I guess I can do my own that runs the delegates using and OR instead of AND. But I was trying to avoid it.
There's composite decorator for OR and AND
I never saw the need to composite them
@azure cliff not sure I follow. Are you implying that you have the same base class for everything but only some actors are AI possessed? Maybe override PossessedBy() and check if its possessed by your ai controller. If it does, create and add the widget controller?
@slow bobcat I'm using blueprint only. I have a EffectController as actor component on my AI. I want to construct 3D widget in EffectController for my AI.
There's composite decorator for OR and AND
What? I know about Sequence, Selectors and Paralell.
Sequence and Selector are not OR/AND operations.
I never saw the need to composite them
I have a task that I want to execute if DecoratorA returns true || DecoratorB returns true.
The default implementation threat them as AND. If DecoratorA == false, DecoratorB is never considered
@azure cliff ah I see. What you need to do is to add a WidgetComponent to your actor and position it. That's all. Doesn't matter where do you want to run that logic
So i just need to access the WidgetComponent to construct Widget?
PM
Hey guys, my AI has anticipation/parry window, damage window(Actually apply damage), attack recovery window. Should i implement this in behavior tree??
My AI would have status such as stun and slow as well.
I'm having a headache with moving the characters and interrupting it.
I have an investigation point. The ai moves there unless something else comes in the way. Easy right? Well... it's not in this case, not sure why.
I'm using a parallel node and it's not running for some f**** reason.
Do you guys have a better way to do this?
Inside that MoveToInvestigationPoint_BTT there's a AIMoveTo async task.
Any better way to cancel this without hating your life?
so your problem is that the ai won't stop moving?
nope. It doesn't even look like it actually running the parallel task while moving. It just gets into that Move node and nothing works until it's finished.
And I'm sure there must be an easier way to do this that I haven't considered
if the only thing that you're doing in the secondary task is checking a BB flag, i'd rather check that flag in the movement task
as it seems a custom one anyway?
that would work, if it weren't for that AIMoveTo async task. Once you hit that, you're trapped.
that custom move node just prepares some information to pass it to the Async Task.
are you sure there's no way to get at the TickTask event?
ummm yeah you can use ReceiveTick. Then maybe check on tick that BB value and stop the movement? I hate the idea that the movement stop is run within the movement task, but might work
you can also create your own movement task that's less rigid or check if the AIMoveTo task gives you some option to cancel movement
2nd to last comment with the imgur links
umm will check. Thanks!
parallels are tricky that way
moving the decorator up and aborting the thing would work
there is also a method to AI movement where you have a MoveTargetActor and you have AI chase it at all times, and just teleport it around
i find it to be much less of a headache then moving to location
for one it doesn't need to call StopMovement to initialize a new MoveToTask
so it doesn't just break all your animations for a frame out of the box
and if you want the thing to stop you just teleport the MoveTargetActor to the AI's location
yeah, that's what they say (more or less) in the reddit. Will try tomorrow whith that approach
hi all, I have some non-player characters I want to make invisible and turn off while the player is in combat
I unpossess the pawn, set the actor hidden, and disable the collision for them--it seems to work perfectly
but I was just wondering if anyone ever ran into memory problems with having too many characters in a scene, even if unpossessed and invisible?
I was debating between programming it this way vs actively destroying them when combat starts and then recreating when combat ends
destroying and recreating is expensive
just hide them and either move them to a location away from the players
or just make sure they don't interfere
I'm having a bit of trouble wrapping my head around a BT flow thing. I kick off an ability in a task, then the next task in sequence sits around waiting for the ability to end. But, I want to know if the assigned task has changed and if so, cancel the ability and calculate everything again. In my sequence I have a BB key of the current task and if I set it to NotifyObserver:OnValueChanged and ObserverAborts:Both, it will properly abort. But how do I make sure my CancelAbility task gets called?
Hello everyone, i currently have an AI that roams the map and chases the player when it spots the player. But i would like there to be some type of a jumpscare death animation. Similar to Five Night's At Freddy's. I have not seen a single tutorial or a forum thread that talks about how to do this. I assume it may have something with creating a cutscene i was just seeing if anyone on here by chance knew anything about this. Thanks.
@dark sequoia this is one of the issues i encountered. I went to use blueprint to handle those..
I think I decided that I just need to use one task to start and stop my ability instead of multiple tasks since the whole thing should be atomic. We'll see if it works tomorrow.
@patent hornet @spiral shuttle
Solved my problem.
Turns out that I had all the elements in place to make this work. I removed the parallel test and added the missing piece, this:
Thanks everyone for your help. As always, much appreciated.
I detected a problem with the Ai Perception system. it works like this:
- you set up who should your ai detect (friendlies, enemies and/or neutrals). Right now our AI detects enemies and friendlies
- The system relies on a timer that, on every update, process all the detected actors.
- When the system perceives a new actor matching the attitude flags, it process it and calls a OnTargetPerceptionUpdated callback delegate.
- If there are too many perceived targets, the code splits them in chunks so every timer update takes the same time. In the next timer update, it will process the remaining chunks.
#4 is out problem. The more chunks, the later certain AI actors will retrieve the call and process the target.
I tested this with 31 enemies. When an enemy is investigating, if it sees the player on its way, it will take a random time to react, generally way too long. What you see is the enemy passing by the player and, after couple "meters" it turns around and attacks the player.
But, if I change the configuration to detect only enemies (that would be "detect only the players"), they react much faster, because there's only up to N player actors to process (usually N is a low number unless you're doing a strategy game or a battle royale PvEvP or something like that with many players.)
does anyone know if there's a way to tweak either the frequency of the timer or the chunk size without modifying the engine?
Guys how can i change Dynamically the Subtree that i want to use for that specific Controller\Character?
i found this kind of BTTask_RunBehaviorDynamic
But i can't find it in the engine, i just saw people doing that in sep 2018
Is there any possibilities that this BTTask is deprecated?
@muted dagger it's still there (checked on 4.22.3)
@spiral shuttle Where exactly? xD
I'm working with the same version
Is that a task that i need to create?
in the AIModule
Neither i, but i need to do this "When you add a BTTask_RunBehaviorDynamic to your tree you get to specify a 'tag' that will identify given place in the BT as potential sub-BT injection location. Then at runtime you can use BTComponent->SetDynamicSubtree to inject given BT into that spot. This is done per AI so you can have on big BT that defines overall behavior structure and use dynamic BTs to differentiate between different AI types."
your best bet is read the source and work from there
the way i understand it is that you can assign a behaviour tree on a property of the run behaviour dynamic node
the assigned behaviour tree must not have decorators on the root node
that should be it
yeah, I use that for the engage behaviours. That way you can write different BT's for different attack behaviours (chase and attack, look for cover and attack....). It's quite convenient.
So wait
Can i actually get
A reference of the BT that i'm using inside my Custom Ai_Controller?
of the main one, yes
How exactly? And thanks for the help
UBehaviorTreeComponent* BehaviorTreeComp = Cast<UBehaviorTreeComponent>(Controller->GetBrainComponent());
BehaviorTreeComp->GetRootTree();
BlueprintsP talking
it should be easy to translate the above lines to BP
there should also be no need to get the BT this way
if you want to change the whole BT, just call RunBehavior on the AI controller with the new tree
if you want to use dynamic BT's, just use the task we've been talking about
Wait
what i want to do is
I have a BT that is the main one, and inside i have a selector with 2 RunBehaviorDynamic that have 2 different BTs inside
Everytime i touch a box for example the BT changes
yeah go with the RunBehaviorDynamic task node
And then i need to let the controller change the BT right?
yes
is it possible to inject decorators dynamically to the RunBehaviourDynamic?
no
Simple question
How can i tell to the behavior tree, if the variable on the blackboard is true than do that?
add a blackboard decorator @muted dagger
@shy coral Thanks, but still i can't set if the boolean variable is by default true or false right?
ah, I don't think you can use bools per se. The is set and is not set query on the BB decorator is looking for a set value or nullptr. The only things I know of that can be used with that is an object and a class, pretty sure everything else has a default value
huh, actually I lied, it does work with a bool...I set it up a slightly different way and got it to work
How exactly?
i need to tell trought the controller WHEN this boolean will become true
But i can only GET the value and SET the value to another type and not SET IT TO TRUE
I don't know if this is the recommended way, but you can set a BB value on the AI Controller
its better to use BlackboardKeySelectors if doing it from BT nodes
and if you have a BBKey decorator, and you set it to react OnValueChange
it will do so
Hey guys
I'm using AISightPerception and I'd like my enemy to move towards the player when in sight. Everything works fine except when the player gets out of sight, the Move To doesn't interrupt and the ennemy keeps chasing the player
Here's my blueprint setup
The enemy balckboard key is set to None as expected (saw it with the debugger) when the ennemy gets out of sight. However the move to still continues. Is there a way to perform a check while move to is executing ?
The BT is super simple
Ok just adding a stop movement node after set value as object in the false branch did the trick
edit : did a thing which I think is better. I use a decorator to abort instead of using stop movement, I was a bit worried it could give me weird things.
Btw I'm using the TeamID right now but is it good recommended or could I just replace it with tags ?
try using a wait node
Dimy: Watch out for the TeamID thing (if you mean the one that was provided), the trouble is that human characters won't have it (its on the AIController), also, its not initialized properly until later in the setup, so your AI character might not be correctly identified initially if you are spawning them in.
@ocean wren thanks ! The way I use it rn is by assigning the Enemy team ID in the begin play fonction of the AI controller and my character implements the GenericTeam interface (I assign the ID in the constructor)
Not a fan of the generic team interface.. for one thing, it should be on the Character and not the controller (so that the player can have one too), for another thing, it should have non-binary relationships (i.e. how much do I hate this character). Personally, I'm going the component route with a FactionComponent so I can actually edit it easily etc.
can i communicate with character and AIcontroller if this possible how can i?
@polar furnace communicate how so? Reading info off of a spotted player? Ect?
Ok. From the sounds of it my best tip would be to try to use a cast node and use the object output for communication between 2 actors. You can then using the object output execute custom events on demand or read values such as faction or health.
1 question @rancid lagoon
Shoot
either nothing is overlapping the sphere, or the overlapping object is fully contained within the sphere
Begin overlap is often done incorrectly i find
For one. You are not defining anything to overlap anything. So Iโd object 201864 overlaps object 1 or if object 17 overlaps object 1 it still triggers.
Add an if and then either cast if you are looking to check for an object type. Or hard set an actor or set up a public object variable. Then check == and a branch.
2 make sure that both objects you intent to have overlap have โgenerate overlap eventsโ [X]โd. If not nothing will happen.
@patent hornet I believe it will still trigger begin overlap regardless. If itโs able to do so
the shell detects overlaps
W8 im recording my issue
trace starting and ending inside a volume won't hit it
there are also issues with objects already overlapping when you start the game
1 is not his immediate problem, though, as there are no overlaps to filter ๐
instead of recording your issue paste a screenshot of colliision settings of the sphere, and whatever object it was supposed to be overlapping
@polar furnace
i don't want overlap i want learn communicate between them
w8 i finish my gif record
communicate between character and ai controller for character
you know ?
between character and ai controller possessing that character?
yes
Cast<AMyAIController>(GetController())
in bp๐
Cast<AMyAIPawn>(GetPawn())
its the same
both Cast and GetController/GetPawn are exposed
possessed pawn can always get a controller possessing it with GetController
and controller possessing a pawn can always get the pawn with GetPawn
its best if you don't tightly couple the controller to the pawn though
do you mean this?
but Object pin has to be connected
and guessing that's controller
so needs GetPawn output plugged into it
so it inherits from AIController?
y my character inherits from ai
Are you just trying to see if a value is true or false while staying in editor?
you need to set your terminology straight
and what is NPC_BP?
@polar furnace are you just trying to see if the variable is true or false? Thereโs an easier way to do that while in editor.
so if you are trying to access controller from pawn
you do GetController->CastToNPC_AI
if you are trying to access pawn from controller
you do GetPawn->CastToNPC_BP
Press shift+f1. That unlocks your mouse from input. Then click on an actor in the top right list of all actors in the world.
Also be sure to set the variable to public or you wonโt be able to see it when you select that specific character.
This lets you inspect and edit values while in play. I use it quite often to test new weapons for my characters.
If you are trying to have the ai send information to the players character you need to first get the player character in the ai or ai in the player character.
i want access from ai controller to my npc character var
you also shouldn't interpret what you want to do in your own words at this point @polar furnace
Ok let me get this. @polar furnace when the character overlaps the area you want it to set a bool to true on the character that overlaps the area, and when it ends overlapping set the book on the character to false. Is this correct?
yes and i want access this bool via my ai controller
bool is in left side i want access it from right side
not anything else other then GetPawn
Do this. Get owner > cast to ai controller > drag object out > set var
Well. Yes. Cast to npc_ai
i have no idea
entire screen
Whichever has the stuff your doing
@patent hornet im in ai controller
do not pick and choose
can you see use blackboard node?
Donโt cast to in that.
Save the variable there. Less casting.
Use the other to cast to set bool. Just a minor thing I like to do. You donโt have to but I find it easier to debug myself.
Go to the npc_bp and screenshot the event graph and left hand side component list
Wait
Is this in the npc_bp now? (Before component list image)
But thereโs a new set var node.
Send a picture of both blueprints. I need at least the variable list, event graph, and component list.
and other is on my npc_ai
I think I see the issue
Pretty sure there is a cast failing. I need to see the above to figure out where though.
Remove the set node in the ai. Donโt need that
i have some other code so i need this
You need to create a get controller node. Preferable get ai controller if that exists.
Wait
shit, the function is called GetControlledPawn in blueprints
^^^
i do 90% of my work in c++ shrug
Get ai controller would be the other direction for info.
So in ai replace the get owner with getcontrolledpawn and remove the set var0 node. You donโt need that.
It fails cause it is the ai controller, ai canโt have an ai to control it, as far as I know at least. It would work on the bp but thatโs not what your working in. Follow above message ^^^^^
still not sure why the fuck did they do a separate function for BP
as neither is virtual
ty @patent hornet @rancid lagoon
and the BP one just returns GetPawn
๐
Kinda just want to slap my ai event graph in here cause of crazy itโs starting to get even without any actual intelligence.
๐
best use components for heavy lifting
child actor components, they do a lot of my heavy lifting when it comes to breaking down what would be immense slabs of nodes
i don't like those
i mean you can just spawn and/or attach an actor if you have to
and they do cause weird problems every now and then
blerp
have you any idea for my case
i want ai chase my player with some distance from it and right behind of my player
that is in your AI controller? shivers
because at a glance, none of that functionality belongs inside of it
then boy oh boy do i have the node for you
ooo my goodness ๐
you're making a godclass there
what the meaning of goodness btw XD
i dont typically do ai. this is my first attempt at it and i just jam packed the control and actions into one giant pile
and you're already having trouble maintaining it
skin/weaponskin.... that should go into weapon actor itself
shooting/reload... split between a WeaponComponent on Pawn (heavy lifting) and weapon (Particles, Sounds...)
the top section is just wip ai control. it follows the player, tracks their expected position, updates the frequency at which it updates itself, attacks the player, reloads, listens for the player, and determines which player to attack given options
i likely will end up setting up shooting to be run on a child actor, but right now the ai has a handful of unique nodes for shooting as compared to what is being used for the player
basically your Pawn should always know how to implement its actions
the AIController should just determine what action to implement and call a function on the Pawn
anything else is suicide on the long run
no this node is useless for me
i want some nodes
to npc
chase me
but in 200 point behind me
and doesn't allow for any flexibility (as in, what use is your pawn now if you put a different controller on it)
there are no nodes for specialized behavior
oh yes
if you don't match speeds when you are at target distance, it will look weird
i got it
Actually I kinda am addressing interchangeability. Going to have activetasks and a โdifficultyโ value for the ai. This way itโs very fine-tunable and can be randomized between specific values
best approach for it is to write your Pawn as if you are supposed to be able to control it with both AIController and PC
my AI and Player Pawns share 100% of their code
the controllers are different, but even those share a large portion
Yes. This sounds like something to definitely do. As both do perform the same actions.
i also suggest ditching child actors, and just attaching your WeaponActor on a hand socket on the skeleton
There are specific actors with their own implementations for non bullet projectile weapons
your weapon actors should also share a base
there is very little difference (if any) between firing a hitscan and projectile weapon logic
the difference comes after the shot is fired
but aiming, reload, weapon swaps, etc...
its the same
Grenade, drone, c4, flag. Each needs specific implementations.
ah, those
they do have a lot of stuff in common too
how are they selected, displayed on UI, activated, cooldown, resources...
most of the difference comes displaying targeting
which you should compose
and what happens after they are activated
for me, those are ActorComponents spawned at runtime on the Pawn
(as you can select your skills)
im off to bed, gn
Gn
What is an efficient way to tell whether an adverse character has come within range? Right now, I have given each AI Controller a PerceptionComponent, and when OnPerceptionUpdate is triggered, it calls a function that checks what actors are in range and whether they are adverse characters. But that is running every tick, and so it is refreshing the set of characters every tick. Is there a more efficient way?
Not that Iโve found. @livid beacon though what I did is make ai perception trigger less often by default. But that also decreases the rate at which it triggers events, so to compensate for that my ai perception increases its refresh rate depending on their circumstances with a few other neat tools Iโve set up to ensure it doesnโt lose tracking on just about anything I throw at it.
@rancid lagoon Thank you. If this is the way to do it, sounds like that's the way I should do it.
The best way to filter is to cast to whatever class all adverse characters use.
I donโt know if itโs the best way to do it. But I know itโs worked for me so far.
Thanks, that's how I'm doing it to. I just hate having to do it every tick!
I have a question about behaviour trees:
If I have an instance of and object which holds some data that the AI would need to access to implement some behaviour, would I need to unpack this data before putting it on the blackboard or can I put just the object there and access its data directly from the tree?
you'd have to fetch an object pointer
from the BB
then cast it
then access the data
and if its one object inside the BB, you also lose the ability to map the object's nested values via BBKeySelectors
So it would be better to pass directly the data rather than the wrapping object?
depends, if the data is atomic, object is fine
you can also put it on your AIController
as its as easy to access from BT as BB is
it would be a preferable solution in case Controller modifies the data frequently
if on the other hand you're thinking about using a service to update the data inside the object
you should probably split it
and add to BB
I ended up making getter functions and using a service to call them and save the return values on the BB
Seems to work
When a behavior tree finishes, does it broadcast a delegate that I can subscribe to in C++ so I can call another function once the tree has finished?
Or is that something I need to set up in a Task?
Hello, not sure if this is the place to ask, But I'm experimenting a bit with the "Find path to..." nodes, but I'm having some trouble. I want to test the path recalculation/rebuild when the original path is blocked. However in my test the path seems to only rebuild when new physics objects block the path during the first couple of seconds, after that the path stays the same, even when there are objects that are blocking the path. I also tested with removing actors that were blocking the path after they blocked the path for a couple of seconds, but the path stays the same (looks like it goes around invisible obstacles )
Hi!
I'm experimenting with SetSynamicSubtree()and it's not working because it seems there's not instanced trees? am I understanding this right?
The InstanceStack is empty (red square in the picture). Does anyone know if I need to set anything special in the BT to make this work?
The BT is definitely running.
ok, never mind. Just saw what was going on. I was stopping the BT before injecting the new BT in the Dynamic Subtree node. Silly me...
What I don't understand now is that, if the InstanceStack is the stack of instanced nodes of the BT which, in the end, is the nodes that the BT is currently running, how does this work? do I need to be running the branch with the Dynamic Tree Node in order to have it in that list and be able to find it? My idea for this was "select a tree out of a list based on certain conditions, inject it in the main BT and tell the BT that can run that branch"
Does anyone know of an AI tutorial for enemies that rotate around players and strafe such as a professional boxer would do? All I can find is the typical chase player and patrol tutorials
can point you in the direction on how to do it, but not a tutorial
basically, generate an EQS grid around the player
filter anything too close or too far to be considered circling
filter anything that is over X distance away from the enemy (that will prevent it from going through the player to the opposite side)
filter anything unreacahble
if you want them to be able to change the circling direction occasionally, also score locations in front of the enemy higher then those behind it
and score say, locations infront of a player lower
then pick a random point from best 25%
scoring is what eventually gets it to feel right
Thanks. That makes sense theoretically but I struggle with the little finicky things in ue4 behavior trees that make it work. I basically wrote out what you just said on paper but I struggle getting that into a behavior tree correctly. I always wind up with a derpy AI that shakes and twitches all over the place.
you hardly had time to write an EQS generator and filter since i wrote it
EQS testing pawns are great way to visualize the scenario btw
No I was talking in general. lol I'm reading about what you suggested right now.
@patent hornet I'm stuck. I don't know what to do now. It looks right to me but my AI doesn't move all the time unless I'm close to him. Here's what I did. https://i.gyazo.com/1a4179fd65c2223b433a98aca2af557d.png https://i.gyazo.com/c5262a0617020383d93d89cff81b0ea2.png https://i.gyazo.com/7ab6780b8588be62f0002f1be791800b.png Here I just scored the furthest points from "me" or the "ContextPlayer" and also scored the closest points to the AI. That way the AI would stay on the edge of the grid. https://i.gyazo.com/bbd2917989d18760acb938ed437ffa60.jpg
Well I guess I don't really need the first EQS branch. I can just use the second. IDK I got a lot of learning with this stuff lol
How do you turn on this debug option where the spheres show up in-game? I accidentally turned it on and can't turn it back on. It helps me see what's going on. https://i.gyazo.com/444e1901d629ba2c1da822e29af3fcb7.gif
I just want a boss that can move around me and perform different attacks. Kinda like Dark Souls or Legend of Zelda.
also, you enter circling behavior if you're close enough to circle, if not follow
that doesn't use that EQS query @stark zealot
Hey guys, can anyone say me how to attach pawn sensing component to head?
Ey guys I am trying to use a EQS that gets the EQS Template from a blackboard key, so I can change it in runtime instead of hard setting it on the behavior tree. What type of BBKey should I use ?
My behavior tree is only running the left branch once then switching over to the right branch.
There's a difference between true/false and set/not set. implicitly nothing is set on a blackboard until you call SetBlackboardValue on it. After you set it, it stays set forever unless you call clear blackboard value. If you want to use a bool then you should make your own condition that actually checks the value instead of using set/not set.
Is Set will be if the bool is true
Is not set will be if the bool is false
i have wrote complex behaviour trees and fully understand how they work
Ok. I'm still confused as to what I should do. Should I not use a bool?
Anyone know where there are good tutorials for masterkng ai in ue4
Should I follow the unreal live streams? Anyone have experience with following those?
@stark zealot you never set the ObserveMode? to false again so it can never get back into that node.
@pine steeple I just saw your answer, I was out of reach yesterday.
i just inject the bt in
How? Using a decorator or a service? Can't see how you do it in the picture you posted
oooooh... nothing like having a good rest to solve your problems...
Turns out that dynamic injecting from c++ works perfectly fine at any given time. There's a recursive function that iterates through the whole tree. The InstanceStack shows the root nodes from the branches and then the code iterates through all the children until it finds the injection node. Mine was failing because I was trying to inject a BT that is the same as the default tree in the injection node...
Hi, quoting someone from unreal answers
'Consider moving your AI from Blueprints to a Behaviour Tree based solution, even if it's just using Move To. iirc, the behaviour tree Move To node is capable of running the nav query over multiple ticks so the performance impact won't be as drastic.'
is this true?
@pine steeple ?
if you use AI move to but the task version it runs async
behaviour tree doesnt automagically improve performance of the Move To command
Quick question: For air based AI, do you need a nav mesh? I know I have to manually make a pathfinding system, but do I still need the standard nav mesh for the AI to work? It's a space game so the nav volume would have to be huge
you don't need a navmesh, you can handle moving just by shifting the actor locaiton
location
navmesh is if you want to use pathfinding
Cool. How hardcore is the process, do you know of any solid documentation for making flying AI? I looked around and it seems pretty dry for video tutorials reguarding this
@pine steeple thanks for answering btw
Also, should I make the AI a character or pawn OR Default Pawn (has some of the same movement components as character)
@pine steeple do you know any sort of node which disables the perception when my ai is sleeping?
Does anyone know how to make the RunBehaviourDynamic reset to it's default BT?
yeah, I was reading the code and the DefaultBtAsset is used once, when initializing the node. And that's it. Too bad. I'm tempted to write an extension of the BTComponent class to add that function.
you would have to store it
I guess we're not talking about a magical way to get it from the node directly right? more a "you define it in your Enemy/EnemyAI class" right?
I would have expected that, if you pass a nullptr, it would have fall back to the default behavior
@upbeat hearth UEnvQuery is the Object type
i guess there's no (easy) way to get at the filter metadata of EQS?
like the center context of e.g. a circle point generator
@ember river have you seen the free flying ai plug in? It is well commented if you want to check it out
Is there a way to draw the NAV mesh? Im working on a level creator for my project and being able to see the NAV mesh would be helpful
press P
maybe some debug draw setting in navigation system or recast_navmesh
Hm alright
why do you have to test it packaged?
Its going to be an in-game level creator, and having the nav mesh visible would be helpful to whoever is making the level
you can dig through source code to whatever draws it
it might not be the editor module
(which you can't ship)
I found a quick solution, running the console command "show Navigation" shows the nav mesh, it seems to work okay so I'll stick to it for now
is there any way to set sense config (sight, hearing etc) on the fly in AI perception component? For example, changing sight range with time. I cannot find anythng in blueprints that gives access to this array.
hello guys,
i am testing multiplayer game project and i need to know when my game server will make lag .. what is maximum players that the server can handle.
so i created AI system to move NPC as a simulation for players and i spawn 1000 npc on the map to test performance.
i did a profiler test and i found that Movement component needs optimization it takes 24 ms in the gameThread.
my question is does my real player simulation correct ?
and how can i optimize the characterMovement component ?
1000 is a lot
1000 CMCs with 25ms sounds about right
even fortnite struggled with 100
and they did TONS of optimizations
so to get anywhere close to 100 players, a normal solo person would struggle to do in a reasonable frame time.
cmc runs around .2ms give or take
.02*
NavmeshWalking saves a little, but its not for every game
but with advanced movement, that could easily hit around .1ms per player
plus then you have to factor in all other stuff for the game
so to get 16.67ms (60fps) with a lot of characters is quite tricky
24 ms for 1000 CMCs is on the fast side
if they have a skeletal mesh, you reach about 15-20 ms for 100
test with shootergame bots to see how bad it is
@near jetty how's your rewrite of CMC as CMC light going?
@patent hornet yes we can use NavmeshWalking for monsters
let's say I want to make AI character to be an octopus (or a shark or whale). I can't really use BP Character for it, since it doesn't fit standard character's capsule (and standard character movement component might not work for it either). How can I go about making such an AI character without getting into C++ ?
How can I make a actor smoothly move to a coordinate ?
let's say I want to make AI character to be an octopus (or a shark or whale). I can't really use BP Character for it, since it doesn't fit standard character's capsule (and standard character movement component might not work for it either). How can I go about making such an AI character without getting into C++ ?
Blueprints i guess
It will be very difficult to add any custom AI that you would need
how so @fiery sorrel ?
Custom CMC can be done in BP's but you might save a few days/weeks doing it in c++
Same with getting Pawn to a good level to use with all three character classes you mentioned.
You can cheat a lot with AI to get to the same level needed. But if you need to do 3d pathfinding assuming these are swimming, it can be done in blueprints, but you might want more than 20-30fps on high end pcs
I'd probably have a hidden floors with nav mesh for "flying" creatures. This way they walk on nav mesh, but visually look like they are flying. I know, it's sounds like nasty hack ๐
and I don't C++, unfortunately ๐ฆ
so ai using navmesh, is it possible they are checking navmesh all the time, can i set them to not update the path?
like for optimizing?
they are checking it periodically
not every tick
its how they know to go around if you slam the door in their face
@patent hornet is there any variable i could optimize, like i would have 500 agents ?
There is not one thing that can just "make it work" YOu might need to write quite a bit of code to make it work the way you want.
Then you even have to ask your self is 500 AI what my game needs?
With pooling and DummyActor tricks you can make 50 ai seam like 100 or more
if its a full RTS, you might want to try to treat an entire unit as one actor
for pathfinding
if not
you could just pause the AI that players can't see or hear
@lapis cosmos lo to me?
Yes, and nice @ ๐
so what am I supposed to do if I have large maps but navigation just completely messes up if its too big
as in the navmeshbounds thingey
if its too big then ai just gives up
look into nav mesh invokers and turning on dynamic nav mesh
just google open world nav mesh ue4
does anyone know of half-decent vehicles AI tutorial ?
yeah I looked at that stuff but I'm using dynamic nav mesh and it's usually buggy, and nav mesh invokers seem even buggier. though that being said, my main problems seem to be with one enemy that uses AI Move To and it gets the players location for destination, but it keeps just running in tight circles at light speed and going crazy
my other enemies use random reachable point and they work just fine
@waxen junco look into NavInvoker components
its basically an ActorComponent generating a navmesh around the actor in runtime
you don't have to have the entire world covered in navmesh
I just said theyre buggy...
it could always maybe be a problem with the ai move to node
pathfinding issue won't make the character move at "light speed" tho
no its spinning on the spot
like imagine you just spammed A and D thats how theyre moving
hiho!
what class / movement component would I use if I wanted to move a possessed ACharacter on a navmesh over the network? thanks in advance
i did it once with an AIController, but the ACharacter in that case is possessed by a player
what function would I use to move a character on a navmesh target vector?
problem is that, if I want to use the function, the ACharacter needs to be possessed by an AIController
but it's possessed by an APlayerController
use both
thats what we do
our pawn is possessed by the ai controller
but linked to the player controller
thats how we get 8 player co-op using ai movement for the pawn
okay what I do now is:
1.: Spawn Character
2.: Spawn AIController
3.: Character is being possessed by AIController
4.: Save Reference of Character in PlayerController
when the player wants to move a character, he calls a function in the gamestate, requesting the server to move the character via AIController
but what I get now when I request the move isthis:
"No owning connection for actor LanesGameState_0. Function SERVER_RequestMoveHero will not be processed."
yes cause you need to set the owner
player controller doesnt know who its owning
and GameState neeeds a owning connection
right so why dont nav invokers seem to do anything at all
are they somehow disabled by default
Anyone here how to make ai strafe on melee attack?
@waxen junco what does visual logger say for the glitchy pawns?
what
the visual logger
there are lots of tools for debugging AI
the Gameplay Debugger and Visual Logger
can you tell me how to view these
google is your friend, but the gameplay debugger can be accessed by pressing the ' key
visual logger is under developer tools
thanks
I made a pawn called overlord so I could have the player controlling something and still direct AIs it selects and also let it have abilities not tied to a character
ok so I have no idea what Im looking for in this visual logger thing
or if I even have the right thing up
From C++, my AI controller selects a behavior tree and runs it. When the behavior tree ends, I would like to trigger a C++ function in my AIController called OnBehaviorTreeEnds, which takes an EBTNodeResult parameter. Is there a more appropriate way to do this than creating a custom task in the BT that calls the OnBehaviorEnds function?
@waxen junco each controller logs every action that has VA_LOG in it in the visual logger
so you filter the controllers for glitchy pawns
and each block represents something being logged
which window actually is this
Developer>Tools>VisualLogger
you open it, you set it to record and run your game
when you have some data, you stop/pause and examine the logs
ah found it
its basically the first thing i go to for misbehaving AI debug
as it would take me quite abit of time to figure out something like, its not moving because bottom of its capsule is inside the floor any other way
so does this look bad
that looks normal, now you click on the blocks
and you get the logs at that time
you can also see all the BB values at the time
Pathfinding, BT, everything it was doing
I see how it makes some blue shapes on the ground
yeah I think thats the blue shapes right?
but I still dont know how to use this to see why my enemy is just rapidly running left and right on the spot
it will probably take you an hour or two to absorb everything in there
right Im gonna be brave and show a gif of my crappy game
dont ask about the monster design but this is what happens when its literally using ai move to with players location as destination https://gyazo.com/ea9ef12212442914d2fd51f88b7db472
thats actually moving more than normal too
normally it stays mostly in one place just spinning like that
@patent hornet sorry for the ping but idk if this is something youve seen before by any chance
bt?
behavior tree
no, its all in the bp
its just this
wait
do I need the self...
HANG ON
dumb question time - its not trying to run to its own location and the player at the same time is it?
get actor location of what? how are you getting the player
it can't have 2 targets
its on see pawn
i generally find MoveToActor easier to work with
as in AI has its own MoveToTargetActor
that its following at all times
and i just teleport that around
this is really frustrating, it seems everything I try just gives that same stupid result
none of my other enemies have this problem, but they use random reachable point
the thing is I had it working for this enemy a long time ago too
well I think Ive been wasting my time, Im pretty sure its a bug with the size of the navmesh
if its a tiny navmesh it works just fine
yeah it literally has to be tiny
so what the hell do I do about that
well Im lost, nothing is bloody working
THIS IS SO SIMPLE, WHY WONT IT FUCKING WORK
hrmm
I have a weird problem where I set the state to run but when printing it again it prints as Idle
what could cause that?

hi guys, I have a problem with AI-Navigation on a NavMesh:
I essentially want RTS like unit movement behaviour.
I also want a unit to walk around other units when they're blocking a path.
Right now, everythings seems buggy. Units either walk infinitely into other units and block each other, or they cant find a path at all and just jitter around.
Does anyone have any resources for this? thanks in advance
is there a way to watch the navmesh during runtime in PIE? i'd like to see dynamic changes
@tawny steppe not easily
@trail saffron yeah look up ai debugger, you press like ' or something
okay thanks ๐ will do
if I dynamically set
SetCanEverAffectNavigation(true)
do I have to do this on server AND client, like with movement speed? it somehow doesn't seem to work for me
yes
no
navigation is server only
your navmesh needs to be dynamic
else it would never update
okay I think I got it now.
unfortunately there's another problem:
characters seem attracted to each other when walking past one another, lol.
avoidance is turned on
does anyone know why my walking character rotates towards the stationary one?
in some cases it gets extreme, e.g. the character gets almost stuck
okay, it's exactly the same as here:
https://answers.unrealengine.com/questions/284988/ai-is-attracted-by-wall.html
hye not sure this is the best place to write this, but is there a way to compute player path using detour avoidance? pretty much want player to avoid AI without needing to change navmesh and preferably to get player new velocity when avoiding, so what would be a good (and cheap) way to go about it?
hope it makes sense
my ai cant see me through transparent windows tho
anyone knows how to fix that
what are you using for AI to see you?
PawnSensing rn i had the same problem with ai perception
so I've never tried it myself, but afaik ai perception uses AI Sense that allows you to use Sight sense, you can create your own and let AI know what objects are transparent and which not
might need to play with collision profiles too
Can you recommend me any videos or docs to create my own AI Sight?
uh, I can try and google, but you'll probably get the same results as me
this is something tad different but might help https://answers.unrealengine.com/questions/854091/ai-perception-custom-sight-strength-in-c.html
I'm kind a new to ue4 but i heard theres a way we can make our own custom sight in ue4 with c++ like own inherited component
lke a custom ai module
from what I'm seeing UAISenseConfig_Sight inherits from UAISenseConfig so you can create a c++ class that inherits from either and just extend it to what you need
you can find UAISense_Sight under Source->Runtime->AIModule->Classes->Pereception if you want to take a look on what sight config offers now
Also i'm rn on a project if i create a c++ class of chracter it doesnt compile and fails to generate project files
not sure if you can create BP version somehow, I don't really work with BPs
Nah i'm 100% sure it wont work with BP
would think so :)
but yea you know, just spend some time just looking at what UE sight config offers now and how it's implemented
there is a interface your pawn can implement
to provide the sight location
{
GENERATED_IINTERFACE_BODY()
/** Implementation should check whether from given ObserverLocation
* implementer can be seen. If so OutSeenLocation should contain
* first visible location
* Return sight strength for how well the target is seen.
*/
virtual bool CanBeSeenFrom(const FVector& ObserverLocation, FVector& OutSeenLocation, int32& NumberOfLoSChecksPerformed, float& OutSightStrength, const AActor* IgnoreActor = NULL) const
{
NumberOfLoSChecksPerformed = 0;
OutSightStrength = 0;
return false;
}
};```
Does anyone know about a website specializing in game AI? I recall such a site existing, with interviews with industry members, but I forget the website.
@lyric flint probably http://www.gameai.com/
ty
np
though i remember this one with the articles and interviews: http://aigamedev.com
but it's offline ๐ญ
Does anyone else struggle with Behavior Trees? I'm trying to make a "boss" enemy and it just seems like I'm going out of my way to make something I could easily do all in one blueprint. Then all you find on the web related to behavior trees is your default "patrolling" and "hiding" ai so they are as basic as they come.
what are you struggling with
Behaviour trees are simple "execute one thing at a time"
i mean selectors and sequences are pretty easy to understand
I struggle with grasping the blackboard keys and the "setting a value as" stuff. I understand you use for decorators and their conditions but say I have a variable in one Task and then later in another task I want to use that variable. How do I get that variable? It confuses me. I need a better understanding of how to work with the blackboard.
@stark zealot the blackboard let's you share that variable.
Have you seen zoombapups tutorials?
@fallow hound I don't think I've seen those. I'm watching them now. ๐
@stark zealot just watch the WTF is? videos for those
nice and detailed explanation inside of 10 minutes
Ok I got it loaded up too. ๐ About to sponge all this info up.
Ok I watched alot of the videos and I still am not certain how exatly you "set" and "get" the blackboard values. Do the Decorators Set them? And how do you get a blackboard value? For example I have a blackboard varaible called "TargetPlayer" and in one of my services I want to get that value if valid, and get the look at rotation. Then set the AI rotation to that.
How in the wold would this know to get the blackboard value of the same name. Doesn't make sense to me
I'm missing something. Probably a brain ๐
So it looks up a value
Which one?
Whatever key you choose
You are storing the key name in a variable
Note, "target player" is the variable name
NOT the key, the key is in that variable
You set that on the black board
@stark zealot
So it is tricky. Because you have the blackboard, which holds keys and values. And you have variables which can hold key names
But it is useful to be able to store key names in variables. Like imagine a go to task. Go to what? We'll go to "key name", which let's you look up keys to go to
So maybe on the blackboard you have home key, enemy key, friend key
This you can tell any ai "go to enemy" and it will just work, assuming you have an enemy key set
And maybe you have a decorator somewgere updating the key values, so the enemy value is always the closest enemy
I'm not 100% sure I'm following. So the variable of type blackboardKey that I create in a service, task, etc. holds the value? And the Blackboard variable references that?
yeah sort of
the blackboardKey variable doesn't hold the value though
it just holds the name of the key
the blackboard is a big list of keys, and values
So it has to be the same name as the blackboard variable?
the key inside of the variable, yeah
but the name of the variable can be whatever
kind of like
name = "bob"
in this case, bob is the key name
and name is just the blackboardkey variable name
so if I did something like GetBlackboardKeyAsActor(name)
what key is that function going to look for?
bob?
yeah
exactly
which would be a horrible key name ahha
but a better example would be
KeyToGoTo = "Enemy"
GetBlackBoardKeyAsLocation(KeyToGoTo)
which key would that find?
Enemy
yeah
and I could do something like KeyToGoTo = "Home"
KeyToGoTo = "Cover"
KeyToGoTo = "Weapon"
hey all, i currently cast to the base object class of the controlled pawn in a lot of the BT tasks to pass movement variables to it, i thought maybe a reference to it should be cached when the BT starts up, but putting it on the blackboard means i still have to cast to it anyway (since it will just be an object). Is there any obvious way to get this to work, or should i just not worry about casting on execute (which will happen quite a bit for movement nodes)
dont worry about casting
I'm following but I'm not understanding how it works between say two different tasks. So for example: KeyToGoTo has not been set at all. It is merely a blackboard variable. Then in a task I want to get that blackboard variable KeyToGoTo and check if it's valid then MoveTo it.
ahhh so here is an example
so, you can have services, which are kind of like tasks which are running all the time
so I have a service, which is always searching for the nearest cover
it isnt sending the AI to that cover
it is just finding cover, and stashing that location in the blackboard, under the key "Cover"
I have another service which checks if the AI is in firing range of player, if that happens I set a blackboard value to true, under the key "IsInDanger"
now somewhere in the tree, if the AI is in danger, I do a GoToCover task
which doesnt need to find cover
because it just knows to check the value udner the key "Cover"
which I set in a that service beforehand
ahh i think i'm a bit of a goomba. execute is like a beginplay isn't it? my test tasks have just been finishing execute then running again
or am i misunderstanding the relationship between execute and tick in a task
@fallow hound And that value is retrieved from the blackboard by exposing the key and then selecting the blackboard variable in the drop down like this? https://i.gyazo.com/30b8113003dd911a2d618cca17732323.png
yeah so there you have a blackboardKey variable
called Vector
and the drop down lets you choose a key
I think I'm getting a little grasp on it but It's going to take a while to learn how to structure a behavior tree. Meaning what order and what variables will decide things. It seems like I'm doing things backwards or something. I put services where tasks should be and vice -versa.
ahhh
so I think of task like a "do the thing"
and service like a "keep checking this"
but I think right now I have shooting as a sevice
so I have a go to task
and I put a shoot service on it
so the AI shoots and moves
services, tasks, decorators
they are just different tools
in the end you just gotta use them to learn them
I had no idea how BTs worked until after I built a few
I didn't go through the tutorials and come out with this knowledge
I was exactly where you were
Yea I'm trying to make a melee "Boss" type of ai that will switch between "attack mode" and "observe mode" I got it working with a timer service that will switch back and forth but that's as far as I got. https://i.gyazo.com/0eff2c54dcd88c88386ccd69c3a18f78.png
yeah thats a good start
I still haven't got to attacking and attack distance etc
You don't happen to know any tutorials on multidirectional movement for an AI and making it where he faces the player and walks backwards, sideways etc?
so you can use the set focus function
its on the ai controller I think
youll need to do some other stuff with the controller though
like, turn off "orient look in movement direction"
or maybe you turn on get rotation from controller yaw
so, setting the focus makes the AI controller look at the focus object
but to make the ai then turn its character mesh you gotta configure some stuff
id just google "set focus"
Ok thanks that'll get me on the right path. It's funny to me how I can't find anything on that type of enemy ai. The Dark Souls, Zelda type of enemy that circles you and attacks.
Must be hard to make.
Or everyone's making shooters lol
haha
its hard to find ai tuts beyond the absolute basic
which makes sense, ai is so tied into the uniqueness of your game
its hard to make ai tuts for anything but generic stuff
Are Decorators, services and Tasks traditionally done in blueprint? How hard is it to make them in C++?
@tropic ether obvs being c++ its a bit more convulated
i have all my "common" services/decorators/task in c++ (ones that are also shared a lot between monsters)
unique ones are just done in blueprint
Oh, I see. Thanks!
Has anyone dug into this?
https://www.youtube.com/watch?v=1Dm1G6fUuFs
I have a hopefully simple question. In their code, they have an BehaviorTreeEnded function that gets called when a behavior tree ends. That function sets a BehaviorTreeResult variable to an EBTNodeResult::Type that comes from the behavior tree. Then, in the tick, the AIController checks the value of the BehaviorTreeResult variable and if it's anything other than InProgress, it broadcasts a callback that gets a new order and ultimately a new behavior tree. My question is this: Why do they stick the BehaviorTreeResult in the tick rather than simply broadcasting the callback in the BehaviorTreeEnded function? Seems like putting it in the tick creates an unnecessary step each tick, but maybe I'm missing something. Thanks!
The Gameplay Ability System in Unreal Engine allows developers to build powerful abilities for arbitrary games. In this Unreal Fest Europe 2019 talk, Daedali...
How do I apply a movement input to the left or right of an AI current control rotation so it will make my AI circle-strafe (move left/right around my player). Would I add something into the "Chase Player" task or would I need a new task in my behavior tree? https://i.gyazo.com/f22e3b61dfa88f552779a004fd86696e.png
You would have an on tick that activates when the node is called, that does some math and adds a side input plus a move input every tick which will make the ai strafe around. I can dig my strafe code out and screenshot it later if you are still stuck. @stark zealot
Yea that's the part I wasn't sure about how to do.
Ok I'll screenshot it in a little bit - can't boot up just yet