#gameplay-ai

1 messages · Page 59 of 1

misty wharf
#

Oh hey, look there's a function called Find Smart Objects in Component, perfect

#

...except no, because all that does is... find smart objects in the actor which owns the component you pass in because this definitely makes sense

#

Also how am I supposed to call this function? Why is this BlueprintPure? Wtf lol

misty wharf
#

Well, so it's not all negative - smart objects does work quite well. It's just... pretty rough around the edges lol

placid halo
#

UNavigationSystemV1 has a OnWorldInitDone and a OnNavigationGenerationFinished. Which one is better to subscribe to after calling ReleaseInitialBuildingLock?

misty wharf
#

Probably depends on what you need the event for. I think world init done probably runs a bit earlier but seems like it might not have all the data available

#

But probably best bet to look at the code and see where those are getting called from so you know it runs at the time you need it

placid halo
#

on a slightly tangential topic, is there a way to save the navmesh with the level?

#

(dynamic navmesh, that is)

fiery field
#

Did the behavior tree decorator "Close Enough" disappear in recent releases ?

#

Woops sorry it might have never existed, I have to create it I guess

pine spindle
#

hello
I got ai pawn (child of APawn). Set auto possessing with my AI controller. Also set Placed in world or spawned rule.
In my BehavirTree i got one custom task, where i call MoveToActorOrLocation task node, but it always fail, ONLY (!) if i spawned pawn in runtime. If i placed pawn in world, everything is fine. Why its happening? Destination loc is same in both cases

hidden topaz
#

Did anyone manage to create an own composite note that works like a switch statement?

misty wharf
#

Tbh the easiest way to go about this would probably be to just use a selector with the nodes under it having a decorator that checks the enum value

hidden topaz
misty wharf
#

What error?

hidden topaz
#

even tho i had the BehaviorTreeEditor in my build.cs

hidden topaz
misty wharf
#

It's possible it requires some other module

hidden topaz
#

yeah thats true

misty wharf
#

it has the BEHAVIORTREEEDITOR_API macro on it, so it should be exposed for extension

hidden topaz
misty wharf
#

Yeah hence what the error was

#

It might point out the exact class it's trying to get instead of BehaviorTreeGraphNode

#

Likely to require at least SlateCore

hidden topaz
#

hm

#

i will check that out

hidden topaz
# misty wharf Yeah hence what the error was

Module.AIExtensionEditor.cpp.obj: Error : LNK2001: unresolved external symbol "public: virtual class UBehaviorTreeGraph * __cdecl UBehaviorTreeGraphNode::GetBehaviorTreeGraph(void)" (?GetBehaviorTreeGraph@UBehaviorTreeGraphNode@@UEAAPEAVUBehaviorTreeGraph@@XZ)

Still no difference

misty wharf
#

Hmm 🤔

#

maybe try adding GraphEditor

#

and the aforementioned SlateCore if you didn't have that yet

hidden topaz
hidden topaz
misty wharf
#

Yeah it shouldn't make any difference for this where it is

#

Do you have BehaviorTree in the deps in addition to BehaviorTreeEditor?

#

Ah sorry actually it might be AIModule which contains the runtime BT stuff

#

so you might need that also if it's not there

hidden topaz
# misty wharf so you might need that also if it's not there
 PublicDependencyModuleNames.AddRange(
            new string[]
            {
                "Core",
                "BehaviorTreeEditor",
                "AIModule",
                "AIGraph",
                "UnrealEd",
                "GraphEditor",
            }
        );

        PrivateDependencyModuleNames.AddRange(
            new string[]
            {
                "CoreUObject",
                "Engine",
                "Slate",
                "SlateCore",
            }
        );
#

thats my file atm

misty wharf
#

I wonder what was it that you needed for those... I'm fairly sure I saw some plugin somewhere extending a custom composite node...

#

Maybe you can extend UBTCompositeNode instead?

hidden topaz
misty wharf
#

Ah right you need the graph node for it then I guess...

hidden topaz
#

mh dangit

#

I really dont know how to continue haha

misty wharf
#

This seems like it should be possible to do...

hidden topaz
#

it should be

#

yeah

#

but i dont get what I am missing

misty wharf
#

Well it just happily built for me lol

hidden topaz
#

bsad ahh whaaat

misty wharf
#
class GAMEJAMREWINDEDITOR_API UTestBTGraphNode : public UBehaviorTreeGraphNode_Composite
{
    GENERATED_BODY()
};
#

I just had this and it compiles just fine

hidden topaz
#
#include "CoreMinimal.h"
#include "BehaviorTreeGraphNode_Composite.h"
#include "BehaviorTreeGraphNode_SwitchOnEnum.generated.h"

/**
 * 
 */
UCLASS()
class AIEXTENSIONEDITOR_API UBehaviorTreeGraphNode_SwitchOnEnum : public UBehaviorTreeGraphNode_Composite
{
    GENERATED_BODY()
};
#

where is the difference

misty wharf
#

The only difference is you aren't using UBehaviorTreeGraphNode_Composite

hidden topaz
#

I am

misty wharf
#

Oh I see you edited, are you using that then?

hidden topaz
#

i have tried both

misty wharf
#

Hmm 🤔

hidden topaz
#

but copied the wrong one

#

haha

misty wharf
#

You aren't trying to do this via livecoding are you

hidden topaz
#

I wouldnt dare

misty wharf
#

ok good lol

hidden topaz
#

which engine version do you have

misty wharf
#
        PublicDependencyModuleNames.AddRange(new string[] { "Core", "Engine", "CoreUObject", "GameplayTags" });
        
        PrivateDependencyModuleNames.AddRange(new string[] { "GameJamRewind", "UnrealEd", "ComponentVisualizers", "GameplayDebugger", "EditorFramework", "AIGraph", "BehaviorTreeEditor" });
#

this is what I have in the editor module deps

#

5.4.2

hidden topaz
hidden topaz
#

nope still the same errors

misty wharf
#

I did notice there was some deprecation added in 5.4 in one of the BT graph classes so it's possible they changed something with it since 5.3... but seems like you would have been able to create custom BT graph nodes before 5.4, surely...

#

And your project is compiling if you change your node to extend UObject?

#

Just to rule out there isn't any other nonsense going on

hidden topaz
misty wharf
#

Well I'm out of ideas what it could be then 🤔

#

Maybe you'd better ask on #cpp, could be there's something weird going on

hidden topaz
hidden topaz
hidden topaz
#

at least some progress

#

now idk what the issue is in 5.3, since i cant switch to 5.4

misty wharf
#

That's weird, could it really be this was impossible before 5.4 lol

#

(without a custom engine build that is)

hidden topaz
#

that would be

#

weird

#

yeah

dense owl
#

Not unheard of

#

Before 5.4 Cooldown didn’t work as intended

misty wharf
#

Yeah I suppose creating fully custom BT nodes might not be that typical of a workflow 🤔

vivid fern
#

in other engines i just write BTs from scratch, so i always end up building custom bt nodes 😄 hopefully this behavior wont bite me with unreal haha

harsh storm
#

I mean, you still can in UE if you want

#

Though I think UE's BT is pretty solid for the most part

vivid fern
#

i think you miss my point

#

i mean making a ton of custom tasks/nodes etc.. since most games will require some unique node types

#

i figure doing those in c++ is probably fine

#

my point anyway, was that making custom bt nodes is pretty common when building a behavior tree, HOW custom i guess can vary, like if you have some way to do loops, sequencers, selectors and various decorator types, most custom nodes will be leaf nodes that execute some behavior specific to your game

harsh storm
#

I think the main custom composite type node that gets added is something for utility ai selection

#

Other than that, leaf nodes do most of what most people need

dense owl
#

Photosynthesis? 🙃

untold quiver
#

I’m trying to research ways to optimize my state trees but not enough users yet. Currently I have anywhere from 13-15 AI in a scene running one of 2 state trees. They all do the same thing except with slightly different data. Currently they are taking up to 5ms of my frame time. Which is crazy since the docs say “Users can create Highly Performant Logic”. I should also add that all of my tasks are written in c++

misty wharf
#

I was playing around with it a while back and it took barely any frame time at all when implemented in C++ even with AI numbers similar to yours

harsh storm
#

I mean, I can have 50 AI with the main issue still being the CMC and not the BT/ST

misty wharf
#

I'm currently working on adding support for my AIs to actually interact with other AIs in similar situations as where the player can interact with them and ugh this is getting so complicated lol

#

Basically they come to a counter and then the player can interact and select some things from a menu and the NPC responds to this with some actions which then continue in this way until finished

#

But I also need to make it so that they can do this with another NPC acting on behalf of the player and the exchange needs to generally look similar to how it looks like when the player goes through it

untold quiver
untold quiver
# misty wharf That's kinda odd tbh, what are the tasks doing?

The task on enter state fetches a spline that is stored on the owning pawn, then basically it requests a move to a point on that spline from mover. The over head must be that I am waiting for a delegate so the state tree has to run through a UObject but I didn’t think it would be that chunky

#

I could on tick compare the pawns location to the target location and keep the task running if it’s not within an acceptance radius to test the cost of a raw task node vs one that is routed through a UObject.

#

Because most of my frame time seems like it was just waiting to complete the task.

misty wharf
#

It doesn't seem like 15 create UObject + wait for delegates would be that costly even if they all hit on the same frame

#

and I'd imagine that particular action probably isn't triggering for all of them exactly at the same time

untold quiver
misty wharf
#

If your ST code is calling into blueprint implemented logic it could incur a penalty

#

But I'm not sure if it still would be quite that large 🤔

untold quiver
misty wharf
#

So what is Insights showing for it?

#

Is it taking 5ms every frame?

untold quiver
#

On average yes. The sum of all of these state trees processing takes up about 4-5ms of frame time. I’ll run some more test tonight when I go into work.

dense owl
untold quiver
dense owl
untold quiver
brave phoenix
#

Hey

#

is it possible to have a a element that execute only 1 time? like a kind of init

#

into a Behavior Tree

dense owl
#

what's an element in this case, a task?

vestal olive
#

What's the point of the dynamic behaviour tree task if the tree has to share the same blackboard?

brave phoenix
brave phoenix
dense owl
# brave phoenix Yes it's a task

I guess? you could have it under a selector that checks for a specific condition which, once set to true never changes back, so at that point it'll always abort over it. But depending on what this "init" is, perhaps it would be best to have it outside the tree?

brave phoenix
dense owl
brave phoenix
#

And the first things i would like to do is to sent the Tree to the Actor Ai to be able to manipulate it, but that's something that i only need to do once.

brave phoenix
dense owl
brave phoenix
# dense owl 5th pin or so

will start with the one from Unreal Engine itself. I have learn with some tutorial first, but let's start with the official this time

#

mmm, in fact it was the video where i learn the AI

dense owl
#

That’s the one I’m talking about

brave phoenix
#

i remember the example

vestal olive
brave phoenix
vestal olive
#

either way - I wouldn't be worrying about optimization at that level if you're just starting out with ai

brave phoenix
#

what i will do will probably need to be optimised, it was just to learn some little trick to work with that things. You may face strong use case when you work on something big. but for small things, you don't have and you start to implement bad things in fact.

#

So for example, the first things i did, was to sent the BTT to the Pawn... like that i can control the BTT inside the Pawn. Is it something that we need to do or not? hahah 😄

#

because i have some limitation inside that Task, so i try to go outside the task itself

#

i gave an example earlier

#

That was my task

#

i notice after test that my bind is done each time it's called.

#

but i would like the IA to handle that task only when the other actor send the signal

#

I was thinking, instead of checking all the time if i can do the task, let's the other tell me when i can do the task

#

but i'm bringing the check outside the task, into the pawn itself.

vestal olive
#

decorators are what you want to use for checking if you can perform a task right?

#

not 100% I follow what you want to do or are doing

brave phoenix
#

is the decorator a node?

vestal olive
#

it's a core part of behaviour trees - I suggest you look up some youtube videos on behaviour trees, I reccomend the video series by Ali Elzoheiry, specifically the smart AI series

brave phoenix
#

no Timeline available inside a task?

vestal olive
#

Not sure, using delays, timelines and time based checks inside a task would make me nervous, generally I'd be either using the wait task for something that explicitly needed an ai to wait or I'd be using function callbacks, notifies from animations, event based etc

#

you could have the timeline on your pawn, trigger it with a task, bind an event dispatcher which calls when the timeline completes and return running until it does

#

but that's basically a scuffed wait task

misty wharf
#

Timelines are actor components so they are only available in actors

#

But yeah having that sorta logic in the pawn is probably a decent idea with the event dispatchers. I have a lot of those kinds of BT tasks that wait for some event from the pawn

uneven cloud
vestal olive
uneven cloud
# vestal olive You disagree that decorators are important to behaviour trees?

Where did you even get that from what I said? Look at what I am replying to. It's not a good plan to send the tree to the actor and manipulate it. The blackboard is what should be used to data drive the BT.

It's also a bad idea to add an init task to the BT. Initialization should happen in the controller or the pawn.

The example task you shared is also not a good idea as it returns immediately without waiting for the event.

wraith robin
#

Anyone have experience with NavMesh resolution and NavModifier Volumes?

I have a multi floor building and while NavAreas work correctly and only change the area the volume touches, resolution seems to project on every floor.

Moving NavModifier Volume on z-axis has no effect.

TLDR: How to make nav mesh resolution on nav modifier volume only affect tiles/areas it touches and not affect every floor?

harsh storm
#

<@&213101288538374145>

vestal olive
glacial minnow
#

Can anyone tell me why this was not triggered?
Is it specific to C++?

frigid fable
#

could anyone show how I can setup a one way path for AI so they can only exit an area but not reenter

misty wharf
#

You could do that at least via navlinks

#

If you wall the area such that only the navlinks are valid paths out of it, you can make the links traversable only in one direction

frigid fable
uneven cloud
glacial minnow
plucky hearth
vivid fern
#

the one you didnt notice

misty wharf
#

Discord's really good at telling users about new features when you always learn about them only after you see someone use it... like since when do they have polls? :P

bold crest
#

how the hell are we supposed to compare ai for starcraft against the sims 😅

spring ocean
#

Im having issues with the StateTree, when i'm using the StateTreeComponent as a schema everything works fine, but when i change it to the StateTree AI, none of my tasks get called kinda looks like the whole thing doesnt get inited

misty wharf
#

and it's on an AI controller?

#

Never heard of the ai variant of the state tree comp until now tbh, guess it must've been added in 5.4 or something? But based on a quick look at the source code for it it doesn't seem to require anything particularly special beyond those two things I mentioned

spring ocean
#

Im doing everything as the source code says

#

It just doesnt wont to work :/

misty wharf
#

Are you getting an error or it just doesn't run any of the states?

spring ocean
misty wharf
#

Check in the Output Log and also Visual Logger if there's anything

spring ocean
misty wharf
#

What about in Visual Logger? Is it outputting anything at all relating to the state tree?

misty wharf
#

You would probably have to start breakpointing the engine code then to see if anything is happening

#

Usually the Visual Logger has at least something to indicate that the ST started even if it gets stuck (typically global tasks can cause this)

#

One thing that can cause it to get stuck is if you're trying to access data that isn't available

spring ocean
#

Alright, will keep it in mind ty :>

#

Could just use the normal state tree tbh cuz that one works

#

but will try to figure it out

#

could be engine bug or some

misty wharf
#

as in, if you use LinkExternalData to something that's not there, iirc this can cause it to silently not do anything

spring ocean
#

Just using one task that prints just to see if it executes

#

Whole tree is empty

misty wharf
#

Yeah I'd breakpoint the st component and see what it's actually doing then 🤔

#

Tbh I can't really tell what is the use of the ai component anyway, seems to barely do nothing that the regular st comp isn't doing

spring ocean
#

I think thats it

#

I could ofc just get the controller from the pawn actor but i spend whole day trying to make ai component to work i might as well spend few more hours : P

misty wharf
#

Heh

#

You can also get those via LinkExternalData directly in tasks if you write them in C++

#

Iirc there was a fairly straightforward way to extend the external data with custom stuff also if you wanted to link to more things

spring ocean
#

I got it

#

It's so stupid lmao

spring ocean
misty wharf
#

Ohh, I thought that would only occur if it's with LinkExternalData 🤔

#

I take it it works if you run it from onpossessed?

spring ocean
#

Im suprised that epic overlooked it in QA

#

It's kinda of no brainer

misty wharf
#

Yeah there's a lot of random things like this in the ST where you just have to know

#

It will silenty just not do anything or otherwise just behaves in weird ways and you just gotta know what could be causing it

spring ocean
#

Not even a log man ;--;

#

anyway ty for the advise appracie it :>

misty wharf
#

np, I spent a lot of time trying to figure out a lot of these random kinks in there also lol

spring ocean
#

Well you'll prob here from me soon then : P

misty wharf
#

TIL Task Wait Delay will happily sit in your BT task graph and won't give you any errors or warnings

#

Meanwhile it will do absolutely nothing whatsoever

#

You have to actually expand the node, and fill in the task owner as the owner controller of the BT task - then it will correctly do what you would expect it to do :P

ruby granite
#

if i start my level with an enemy already there, it works fine

#

but if i use other methods to spawn in the actor, even though it looks like the behavior tree is firing ok, they just stand there

ruby granite
#

i have narrowed it down to this

#

find random point is returning false

ruby granite
#

nope

#

the MOVE TO node is returning false

ruby granite
#

despite the vector returning right

#

the patrol locations are being updated

#

but the move to patrol location node just returns false

vivid fern
#

is the blackboard key that holds the location updated with the vector?

ruby granite
#

yeah

ruby granite
#

if i set the node to self actor it passes fine and goes to the next sequence node

#

but vector just COMPLETLEY breaks it

#

this STILL doesnt work

dense owl
#

You want to send your pawn to 0,0,0?

ruby granite
#

because nothing else was working either

dense owl
#

Depending on your level it could be above or below the navmesh

ruby granite
#

well forward vector didnt work, random point didnt work, i even made it follow MY location and nothing is working

ruby granite
dense owl
#

Use visual logger to debug AI

ruby granite
dense owl
#

Tools -> Debug

ruby granite
#

ty

#

i did get this after one test

dense owl
#

Pending kill means getting destroyed

#

Could be a diff issue tho, see if there are any red frames on the AIController category

ruby granite
vivid fern
#

also agree, move to world origin sounds like a bad plan, preferrably you move to a place you know has navmesh under it

ruby granite
#

i re hooked it up to my full bp

#

(still does the same thing even if i connect both ends of the branch to the simple vector forward)

#

also i noticed something

#

im not that bad i promise lmao

#

just forgot to connect

dense owl
#

Vis log saying path is invalid. Try placing something in the level where the navmesh is/will be, copy its location vector and use that as goal for testing

ruby granite
#

theres multiple navmeshes

#

every room is its own seperate entity that the generator picks from

#

by entity i mean like they are thier own entire levels

#

ahhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh

#

so i think

#

its trying to move to a spot thats in a completley different level

vivid fern
#

i was about to say i dont really like "random position in radius" because its way too simple.. you could pick anything, it could be right next to where you are, or across the map on some other elevation.. usually you want more rules about position picking than that

#

same with your fail case, it can generate points right next to or directly on where you are standing

#

or it could generate a position through a wall

ruby granite
#

then i can adjust the algorithm from something simple and for debugging to something actually good

vivid fern
#

the fact it doesnt work currently says to me you should probably just implement something at least a tiny bit more sophisticated heh

ruby granite
#

also, its random REACHABLE point in radius, so it wont pick a point that it wouldnt be able to walk to

#

well the problem isnt the location itself

vivid fern
#

and yet its not reachable x_x

ruby granite
#

its the navmesh being completley wrong

#

the location its trying to get to is in a different level

vivid fern
#

you arent passing navdata .. i havent used this node, but wonder if that matters 😄

ruby granite
#

i dont think it does, the tutorial i was following didnt use it

#

because the actual moving is being done by the move to node in my tree

#

which runs on the nav mesh

vivid fern
#

looks like GetRandomReachablePointInRadius defaults to the main navdata if you leave the feild empty btw

#

so i guess is there connected navmesh

ruby granite
ruby granite
#

the red dot is the spot the ai is trying to get to

vivid fern
#

i mean sounds like maybe it has to do with level boundaries then

#

isolate the random position to the level you're in

ruby granite
#

idk how to do that

#

what i think is happening is because of the way its set up, they are picking a spot on the nav mesh, and then the nav mesh says no im not actually here, im in this other level

#

ive fakin quantum entangled my nav mesh hellnaw

visual dawn
#

is it me ,or there is really no indebt Ai resosurce for learning

misty wharf
#

There isn't

visual dawn
#

thats sad

misty wharf
#

It's a very complex topic so I think it's kinda hard to have a very indepth guide for it

#

Especially as the requirements of how it should work vary based on how the game and its mechanics work

misty wharf
#

Ugh, why does the blackboard decorator still not support gameplay tags lol

#

I had some legacy stuff in my BTs from back when gameplay tags weren't supported by BBs, so handled it with just a Name field and some custom decorators... but BB's have supported gameplay tags for a good while now, and the Blackboard decorator still thinks they are names...

#

There's literally no good builtin way to compare a gameplay tag in a BB field :P

#

Not that it's hard to make your own decorator for it but come on Epic

harsh storm
#

They're just like any other actor. If you want to pool them, you can.

#

I typically don't though.

olive prism
#

Hello, a question, I made a service that determines what state my character has to be in, between Strafe, Attacking and Roll, I would like it to return to the attacking state after making 1 roll.

What is the correct way to do this?

I know I don't have to do a task for this because it's not good to use the BT as a state machine, so I don't know how to do it.

harsh storm
vivid fern
#

so most of it is how to string together nodes to represent the logic you want to create

#

mostly you are gonna write your own leaf nodes for stuff specific to your game, and no one can really tell you what that will look like.. but like the same kind of rules apply to any part of game making "break the problem down into a series of less complex steps" then build up your tree from those steps

olive prism
#

Check the AiPercepcion Age

glacial minnow
vivid fern
#

does it stop maybe because the position its trying to reach is no longer on navmesh?

#

what happens if you make the space way bigger ?

uneven cloud
#

No it's not worth pooling controllers. If you pool the pawn, the controller is automatically pooled with it.

#

That's completely unnecessary

#

Yes, it's more common to define it on the pawn

harsh storm
#

I got the PR merged to officially deprecate the PawnSensing component Luthage!

#

5.7 I'm straight deleting it.

#

No more new tutorials using it gosh dang it!

uneven cloud
#

That's going to break a lot of projects

dense owl
#

it'll just change the questions from "why isn't pawn sensing working for me" to "where is pawn sensing?"

harsh storm
dense owl
#

and 5.7 is at least another year out prly

harsh storm
#

5.5, it'll finally be "officially" deprecated though.

dense owl
#

no huge loss imo

harsh storm
dense owl
#

projects that still use it likely haven't upgraded for other reasons

#

What else is there besides AIPerception?

harsh storm
#

Oh, why do you think it'll break a lot of projects when I remove it in 5.7?

uneven cloud
#

I'm not saying don't do it, just be prepared for that

harsh storm
#

I'd rather point people to the only perception component than explain why their tutorial taught them incorrectly.

#

Now we can just be, "its outdated"

vivid fern
#

fwiw i didnt know there was a pawn sensing 😄

harsh storm
#

Good

#

As it should be.

bold crest
#

I am using a behavior tree 'Move To' task on a blackboard actor key to get an AI to chase a player. However, the AI slows down as it gets close to the player. How can I get the AI to run into the player without slowing?

vivid fern
#

What are you trying to do

bold crest
#

I want the AI to try to trigger an overlap without slowing down

vivid fern
#

I feel like move to probably specifically avoids this case. Usually you dont want to bump into a target actor. And in truth you likely want to transition to a different action once you are close enough to your target

#

Like I see a world where you move to target then execute an ability that handles this

open swift
#

can i skip a test on a generator in an EQS query based on query params?

uneven cloud
uneven cloud
open swift
hardy shuttle
#

What do you think about StateTrees?
I think I'd want to go for a more state-to-state transition for animation and states
The only thing I'm worried about is that UE's StateTrees still seem to be not ready to use (not production ready)?
Is it still worth using right now?

terse panther
visual dawn
celest python
#

I dont know if ST is production ready, last time I seriously focused on AI in unreal was early 2023

vivid fern
#

my view is probably skewed tho, i've been an AI engineer in games for 17 years 😛

#

a lot of it is about what the game needs which isnt so much tied to engine as it is working your way through the needs of the game

#

and the ability to break down problems into smaller components

#

so maybe what you should be looking for are high level game ai concepts and ways to apply those to your project, lots of GDC talks and stuff out there that talk about some studios processes is more useful i think.. tho i guess on some level you need to implement in engine but thus far ime lots of the docs out there and reading engine code in UE has been pretty good for my purposes... like i dont have tons of UE experience, but i have a lot of high level experience with game ai in general, and have implemented from scratch a lot of what i see in UE, but in other engines.. so its mostly about applying that in a way that UE likes... because like i was saying earlier, UE does do lots of the common stuff for you out of the box, so mostly its about extending that for your needs.. new behavior nodes, designing your blackboard and trees, how to process and track targets that get sensed, moving the pawn around, etc

and that stuff is mostly game specific and dictated by the needs of your project, so .. its not super easy to tell you what to do in some kind of generalized tutorial..

Thats why being able to break up your tasks into smaller easy to understand and implement chunks is useful, and thats just a skill useful across the board, its not limited to AI.

uneven cloud
steel moat
#

I placed my character is behind the AI but inside its sight radius, My Ai generates random points to move so when I enter the play mode and if generated point is in the direction of the target it faces that direction and sees the player but sometimes it goes in another direction even when it sees the player and sometimes it looks like the head wants to see the player but the legs dont and they go away in another direction and I get stimulus sense like this from on target Perception updated event. Im having a hard time figure this out does anyone know about this?

#

and the result is always random and sometimes its alternate

steel moat
#

Fixed this, i forgot to use SetFocalPoint function.

sullen plume
#

I want the AI to be able to open the door if need be, instead of ignoring it entirely. All it ogtta do is call "interact" on the door actor to open it.

#

i need to setup like nodes or smth in front and behind the door so the ai will pathfind to that if its faster, open the door, and go thru the door

harsh storm
#

Nav link

vivid fern
#

^^

pliant fog
#

hello devs , i am new to state trees , and i wanted to make a bull that will select a point around the player (when debugging the point i get good points) and then move to that point and plays a buff animation , will add a charging attack from that point to the player later but for now my bull is not moving or doing anything seems to be only finding points

the logic for finiding point is in the second image
and i am passing this point to the next state which is move to that point but i don't know why it's acting like this

also would be great if there a way to debug it at runtime like behaviour tree to see where the ai mind is at

the move to location is simple ai move to and i hook the location got from the find

hardy shuttle
#

Why did he compare distance by squaring them? I don't think distance can be negative so I'm not sure what's the benefits?

open swift
#

Dist sq avoids doing a square root operation which is “expensive” (relative to not doing it).

hardy shuttle
vivid fern
#

i fyou take just the length of a vector its the sqrt

open swift
#

When you calculate distance, you end up with distance squared and have to get the square root. If you use distance squared, it just skips that last step

vivid fern
#

quadratic equation and all that

#

rule of thumb is you should just always do square distance checks

#

there's no real reason not to

#

at least workingin code, i cant say if there's any added cost for bp nodes hah

hardy shuttle
#

Ah, gotcha
Thanks for the clarification

vivid fern
#

might not matter as one off operations mind you, but if you are iterating over something, or iterating over stuff in a tick.. its an expensive math op you can skip

#

and i find, distance checks can happen quite often for AI, so easier to just have the habit imo haha

steel moat
#

is there anyway to turn the AI perception debug on begin play?

#

like what the console command for it?

dense owl
#

Then use the numpad keys as directed

steel moat
#

oh

#

thats the console command?

dense owl
steel moat
#

ik the shortcut

#

i wanted console command, i need to check something on the first frame but i cant

dense owl
#

ah ic. Dunno if there is one but why not just use visual logger

#

Your eyes can’t record 1 frame anyways

#

Not sure what the gameplay debugger can show you in one frame anyways, it takes a second to register iirc

steel moat
#

It doesnt call any perception events when AI goes out of sight

vivid fern
#

if you set the option luthage talked about you get the forgotten event

steel moat
#

its in 5.3

#

im using 5.0

vivid fern
#

you could always manage your own target tracking

steel moat
#
#

this the bug im facing

vivid fern
#

you know when a target is detected, and you know what actors are currently percieved

#

so you can do your own tracking to cull the currently percieved targets when picking one

steel moat
#

im doing that, the issue sometimes i dont get the callback of the perception events player gets out of sight

steel moat
misty wharf
#

I kinda get the feeling that if you have forget enabled it won't immediately forget the seen actors even if they go out of sight

#

and that's why you aren't getting those events

steel moat
#

the age of stimulus is 0.1

misty wharf
#

but I've not used it more than looked at it superficially in passing so I'm not sure, all I know is that this is a very common issue with people who use the forget functionality

steel moat
#

and forget is disabled

vivid fern
#

i havent had any issues with forget fwiw

#

i get forget when the sense timeout happens as expected

steel moat
vivid fern
#

yeah

#

i mean this doesnt apply to you due to version but i get the forget time out and the sense that forgot

#

then i use those events to update blackboard keys and shift into a different part of the tree

steel moat
#

TwT is this a bug in 5.0?

#

and they solved it in 5.3?

vivid fern
#

doesnt look like 5.0 has the event?

steel moat
#

i searched the source codes

vivid fern
#

im on 5.4 and i can set a call back on forgotten

#

i do it all in code tho, my target management

steel moat
#

.

dense owl
vivid fern
#

dunno if its bp or c++ only i use c++ for it tho

dense owl
#

target forgotten is not cpp only

steel moat
#

i checked the github onTargetForgotten was added in 5.3

dense owl
#

Idk, I seem to recall using it in 5.1 but I could’ve hallucinated it

vivid fern
#

ultimately i wonder if im gonna end up writing my own perception stuff instead of using ai perception heh

steel moat
dense owl
vivid fern
#

nodnod eqs is pretty nice

#

if not from scratch ill probably end up writing target management on top of it instead heh

steel moat
misty wharf
dense owl
vivid fern
#

i honestly havent had firing problems with my ai senses events at all

#

i should try in a multi target env

#

i should set up teams for that x_x

steel moat
#

yall lucky...never having any problems with ai senses

#

my ai is like a rebellious brat

dense owl
steel moat
#

also i did multi target and target switching on distance and other factors

#

worked well for me

vivid fern
misty wharf
vivid fern
#

i tend to build my ai such that it doesnt really require instant reaction to anything.. i let events eventually change the blackboard state, and then the tree reacts to that

dense owl
vivid fern
#

i feel like that all can happen over many frames

dense owl
#

True, but you prly have a lot more control via cpp

vivid fern
#

true, and also ive been doing this a hot minute x_x not a ton of UE experience but i have built all this kinda stuff from scratch before

#

i kinda miss my code only trees haha

dense owl
#

Could always use STs, they’re oriented more like code 😁

vivid fern
#

yeah looking at the code i dont immediately see a place where the events wouldnt fire

#

hah i could, when i made a some mass demos earlier in the year i used state trees to drive behavior on individuals in a group

#

it worked pretty well? i didnt do anything super sophisticated tho, mostly they ran toward things or away from things, or used smart objects

#

and nav mesh x_x

dense owl
#

I miss fiddling with AI, my current project has very limited use for it

vivid fern
#

cant update? x_x

#

delegate's there in 5.2

#

the only thought i have otherwise is to regularly evaluate your percieved targets and send an event or call a function when an actor is forgotten by the timeout

steel moat
steel moat
uneven cloud
misty wharf
#

That's the entire reason "successfully sensed" exists on the stimulus struct

uneven cloud
misty wharf
#

Huh, I wonder if that triggers with the forget settings tweaked because it sure would explain why folks with that always have problems with it

#

It definitely sends an event every time sight is lost in my projects

uneven cloud
#

It doesn't in any of my projects until I make an engine change.

misty wharf
#

And you're not changing any of the forget settings?

uneven cloud
#

Nope

misty wharf
#

That's... extremely strange lol

steel moat
steel moat
#

its not possible currently....still thanks for the suggesstion i will use that next time

spring jetty
#

Hey any idea what is the max value these two can be ? I don't seem to get any valid grid when I increase these two(seems like 1024 is the max already). I am looking for a way to find navigable points using this method when the Player is in the air but 1024 is too low for that.

misty wharf
#

If your querier is standing on the navmesh then 1024 should be more than enough

#

(unless your querier is enormously huge)

vivid fern
#

yeah senses without the forget option out of the box arent super useful when tracking stuff that drops off

#

so you have to do something to track that

spring jetty
misty wharf
#

Huh, that's odd

hardy shuttle
misty wharf
#

there's no other difference

hardy shuttle
#

Hm, I see
Since my AI is pretty simply I probably don't even need a custom AI Controller so I would use just State Tree

misty wharf
#

I guess it could be slightly more convenient to use the AI one if you run the state tree in your AI controller... But if you run it in a non-ai controller, then it wouldn't work

#

It mostly depends on whether your AI controller has any properties you might want to access or perhaps functions you might want to call from the tree

#

You can access it via LinkExternalData even with the non-AI component but it's just a bit more of a hassle

hardy shuttle
misty wharf
#

Yeah, since it assumes the owning actor is an AI controller

hardy shuttle
#

In that case, I definitely want State Tree Non-AI
Cause then you can have hundreds of ST_ files, but just need to use one AI Controller
Instead of having hundreds of ST_ files and AI Controllers for each type of Pawn

misty wharf
#

I'm not sure why you would need hundreds of AI controllers for it 🤔

hardy shuttle
misty wharf
#

Ah, yeah I guess that could be a problem if it can't be set

vivid fern
#

i feel like you should be able to set a state tree

#

might need to write code tho

misty wharf
#

Right? The new AI systems all seem to have these kinds of bizarre omissions :P

#

At least Smart Objects are slowly gaining the features that felt like should've been there since the start

vivid fern
#

smart objects worked for me with mass and state trees last i used it

#

it was pretty neat hah

median socket
#

The thing I struggled the most with with SO:s last I tried (which was a while back and I never did super thorough digging) was creating good transitions for actors when the BT aborted their SO usage.

#

So for instance an actor sitting down until something else happened in the BT (from an Observer Abort for instance), at which point I would have liked them to stand up before moving on in the tree.

#

Most demos I've seen always end up doing a simple montage that plays and then ends quickly, and never needs to consider states that "stick".

vivid fern
#

i feel like the BT shouldnt abort in those cases, and instead it should request an exit from the Smart object and wait for that to complete then abort

median socket
#

It probably comes down to a misunderstanding on my part of BT:s in general. We use it in a pretty basic capacity.

#

I envisioned something simple like this

#

Of course with a few more nodes sequenced

#

But I realize it might not in line with the design of BT

vivid fern
#

UE's variant is a bit weird from traditional trees, and it makes sense why they chose what they did, but its definitely a departure

#

yeah you have to really consider if something should be aborting stuff lower on the selector or not, and like i feel this can be counter to what you might want in the tree design

#

in a more traditional tree structure, boolean checks like these decorators tend not to be decorators, and instead are just regular leaf nodes that return success/fail based on the bool

#

and thats a bit more flexible

#

you could totally write a node that does this fwiw haha

median socket
#

true enough! I might do some trial and error at some point!

#

thanks for the advise!

wispy zinc
#

I am trying to implement AI, it works fine when I drag and drop the character into the scene. But now that I spawn it using C++, it all works fine except for the Move to. I have checked everything but I can't tell what's wrong. Any help is appreciated

dense owl
#

But seeing as there’s an AIController showing above that one, assuming it’s the right one, you’ll need to debug using visual logger to find out for sure what’s going on

sterile ridge
#

Anyone have any resources on how the npc system was developed in games like half life 2? Im looking through the source engine source code but Im wondering if someone has already done some analysis on the code base and could share their findings.

vivid fern
#

what are you trying to learn out of curiosity?

sterile ridge
#

Im building a source inspired game engine thats faithful to the technology of the era. Im going so far as to use the same compression algorithms and shaders and other various technical limitations of the time. This includes ai complexity and animation. Theres a lot of cool behavior from games like half life 2, such as if you stare at an npc they will look at you and then eventually look away out of awkwardness. Other games like FEAR already have their ai systems documented a lot online but I cant find anything for the half life games.

harsh storm
#

Half life was just a FSM

sterile ridge
#

Im looking for more detailed technical analysis like this: https://www.gamedevs.org/uploads/three-states-plan-ai-of-fear.pdf
For example it talks about the various behaviors some enemies have and the strategies they implement. In the half life 2 code, I see stuff like

//-----------------------------------------------------------------------------
// Am I in safe place from my enemy?
//-----------------------------------------------------------------------------
bool CAI_FearBehavior::IsInASafePlace()
{
    // No safe place in mind.
    if( !m_SafePlaceMoveMonitor.IsMarkSet() )
        return false;

    // I have a safe place, but I'm not there.
    if( m_SafePlaceMoveMonitor.TargetMoved(GetOuter()) )
        return false;

    return true;
}

Theres a lot of states and a lot of design decisions, I dont want to read all the code. Im just wondering if theres some compiled resource that lays all this stuff out already.

#

theres an entire system for deciding safe places, such as marking places as unsafe so that other npcs know not to go there

uneven cloud
uneven cloud
vivid fern
#

yep yep pretty straight forward

#

i more meant that to get the behavior right for this case, thats what they would have to do in order to abort the smart object properly

#

definitely there is a time and place for blackboard decorators and aborting sub branches of the tree with them

uneven cloud
#

How you set it up is that the BT does abort, but it doesn't finish the abort until using the smart object has completed

vivid fern
#

nodnod i havent looked at all the decorators, and imsure writing your own is pretty useful too for stuff your game does specifically

uneven cloud
#

This has nothing to do with decorators.

#

Like I said, it's about setting up the BT Task to wait for using the smart object to complete

#

Observer abort triggers -> smart object is notified to be cancelled -> BT task waits for completion -> smart object behavior triggers a get up animation -> BT task gets notified when animation is done -> BT task finishes abort

vivid fern
#

i wasnt being specific about this case.

#

sorry mind was just wandering on stuff i hadnt really looked at yet since i havent had a need

#

basically having an inner monologue out loud on "yeah there's a bunch of stuff ill eventually have to look at" hah

regal drift
#

How do i adjust how close the Pathfinding points are to the edge of navmesh? I have tested just increase the AgentRadius and some other values, i don't se the waypoints getting affected. i am using the FindPathAsync function working with MassEntity. The blue dots are waypoints.

I have a naive solution to this problem, but i would like to be able to adjust the edge distance on a navmesh.

obtuse dome
#

Are there docs that cover more on how behavior trees handle blackboard updates / interrupts? If I update any blackboard key, does it rerun all decorators between root & current node to see if an interrupt is needed? Or does it only rerun decorators if the blackboard key is in a Blackboard Based Condition decorator? (I'm guessing not since you can make your own decorators and Unreal wouldn't be able to keep track of which blackboard keys impact control flow vs which are just dumb data)? Or does it rerun all decorators period? E.g. if I am at the rightmost side of the graph, setting some blackboard dumb data key, will it rerun all of the decorators to the left to figure out if the state changed? Is there any special behavior where updates from within a task won't trigger a reevaluation of decorators? I want to make sure when I'm updating blackboard keys that don't affect control flow that I'm not triggering unnecessary work. E.g. if I have a blackboard key that I use just to hand of data from one node in a sequence to another, setting it shouldn't ever run decorators again since updating that blackboard key will never affect them

misty wharf
#

If you look at BTDecorator_BlackboardBase it uses BlackboardComp->RegisterObserver

obtuse dome
#

How does that work then for a custom blueprint decorator that manually calls Get Blackboard Value as Enum in Perform Condition Check AI rather than Blackboard Based Condition? If it were C++ I could call RegisterObserver in my own decorator, but I don't think that's exposed to blueprints

#

Ah, I see, it looks like if you add a BlackboardKeySelector variable it will automatically be observed based on the variable name

#

but if you make a BlackboardKeySelector at runtime to read a random data blackboard key, it won't ever get observed

#

Thanks!

thin spoke
#

How to make the engine take altitude into account and put waypoints for NavMesh on elevations?
On the screen - the light line is the navigation path that goes through the elevation. It is necessary to create intermediate points on the surface of the elevation.

karmic storm
#

hi ihave the issue that the ai always runs the player event on server altough the target should be a client

wary ivy
#

it is a simplified representation of the terrain

#

chances are the navmesh is flat there as well

plucky hearth
#

Whate are the differences between HFSM and BT ?
isnt a BT just a HFSM in visual scripting?
or in other words, isnt a HFSM a BT in code?
cant grasp the real difference
in which case it would be better one or the other

plucky hearth
harsh storm
#

Which is just a FSM

#

Wrapped around another FSM

#

Same problems apply, just at different scopes.

plucky hearth
#

I made a "Tekken" kind of ai with BT
I am trying to understand in which other types of games, or features of same game, would be better a FSM/HFSM
and GOAP

harsh storm
#

Go through the talk that is the 7th pinned post

plucky hearth
harsh storm
#

Sure

plucky hearth
median socket
#

The biggest problem I remember having though, is finding out from where to request an exit from the smart object.

#

If I should try to manually call EndBehavior on the definition, and if so -- how to get it from the claim -- or if there is some preferred way through the subsystem to request an exit.

#

(pic is just nonsense, attempts to find relevant nodes)

#

The communication between the BTTask and the Behavior I suppose is the part I don't understand.

uneven cloud
uneven cloud
misty wharf
#

I'm testing the BT based gameplay behaviors in some of my new AI stuff... it's actually kinda workable if your "base" logic doesn't use a BT since it's completely useless to trigger the smart object's BT from another BT since it can't return to where it was

#

It really seems to be missing some basic features like actually setting the smart object into the blackboard for the gameplayb behavior's BT... but you can do that up front yourself before you trigger the behavior, just feels like something that should've been done out of the box

#

But beyond that it seems to work alright

karmic storm
median socket
#

For instance, this node (which I assume is quite commonly used) doesn't really return the behavior (nor, as far as I can see, any good way to retrieve it).

#

I assume I could create a new task in C++ which emulates that functionality, which would allow me to retrieve the behavior proper and store it in the BB for later.

#

I could also, as I've actually done previously, create a new subclass of GameplayBehavior, which reports itself being used to the Avatar using it, via an interface. Then the avatar could be in charge of storing and cancelling the behavior. This method feels a bit convoluted to me.

#

Maybe I shouldn't be using that MoveToAndUseSmartObject... node to begin with?

#

Sorry, I feel a bit lost in all these systems! There are so many moving parts I don't really know where to begin, lest I risk ending up with a really convoluted solution.

obtuse dome
#

I created a custom BT task to run subtrees without the vanilla limitation that they have to use the same blackboard as the source tree (kind of neuters subtrees since no matter how granular you make your BTs, you still need to use a monolithic blackboard). That said, there are a lot of different ways tasks can get interrupted/end, so although the task appears to be working, I'm worried I might have missed an edge case. Is this sufficient state management for the task? https://pastebin.com/eQGD3HUK

misty wharf
median socket
#

Yeah, I'm sitting in C++ right now trying to figure it out!

misty wharf
#

I'd probably just copy the moveto+use SO AITask and change it so it does what you want :)

median socket
#

Still, there's a lot of moving parts here too. I'm looking at the FindAndUseGameplayBehaviorSmartObject node for reference.

#

It spawns a new internal AITask too (UAITask_UseGameplayBehaviorSmartObject), which does own the GameplayBehavior pointer.

#

So the main thing I'm trying to figure out now is how to chain the abort gracefully.

#

I suppose I'd want the AbortTask of the FindAndUseGameplayBehaviorSmartObject (subclass) to abort its internal UAITask_UseGameplayBehaviorSmartObject (subclass) task, which would in turn somehow request its GameplayBehavior to exit, wait for that to complete (I suppose I must subclass GameplayBehavior to add a delegate for that)... then sort of pop back up the chain of aborting!

misty wharf
#

I mean like Luthage suggested can't you just abort the gameplay behavior?

#

Also looking at the code for FindAndUseGameplayBehaviorSmartObject, it seems if you AbortTask() it that cancels the behavior also

median socket
#

I don't think it does.

#

Lemme check again

misty wharf
#

Oh wait sorry I was looking at the BT version lol

median socket
#
FBTUseSOTaskMemory* MyMemory = reinterpret_cast<FBTUseSOTaskMemory*>(NodeMemory);
    if (UAITask_UseGameplayBehaviorSmartObject* UseSOTask = MyMemory->TaskInstance.Get())
    {
        UseSOTask->ExternalCancel();
        MyMemory->TaskInstance.Reset();
    }
misty wharf
#

Wait yeah that's the BT version and thats' what it does, no?

median socket
#

It calls ExternalCancel which sadly doesn't exit the behavior gracefully, I think it just ends up calling OnDestroy or something

misty wharf
#

🤔

median socket
#

At least doing it that way doesn't end up calling BehaviorFinished (or whatever the event is called) on the behavior

#

So the "standing up" montage doesn't end up playing

#

That was the part that annoyed me a bit! Feels like it should logically do that?

misty wharf
#

Yeah

#

I've not yet had to do anything with SOs that would need to actively abort

#

But yeah calling AbortBehavior or EndBehavior is what I'd try first (neither of those are BP-exposed)

median socket
#

For now I've hackily merged the functionality of the StopGameplayBehavior and the FindAndUseGameplayBehaviorSmartObject nodes to at least stop my robots from sliding around in a sitting pose.

misty wharf
#

Oh wait it does have K2 versions of those but yeah

median socket
#

I should be able to figure out a better solution with some trial and error

#

Yeah it does!

#

But they're not really useful outside the definition since you can't really access the Behavior from outside itself (in Blueprint).

#

In C++ it certainly seems easier, now I just have to untangle some extra AITask sorcery to figure out how to gracefully abort the whole package.

misty wharf
#

You could have the custom aitask node expose the behavior it creates

#

For example via using a OneParam multicast delegate

median socket
#

Yeah, right now I've just created some extra difficulty for myself because I'm subclassing FindAndUseGameplayBehaviorSmartObject which also does a MoveTo.

#

If I started with the regular task which is self-contained (no owning tasks) it would be easier to figure out.

#

I might do that.

#

Altering the ExternalCancel() method in UAITask_UseGameplayBehaviorSmartObject to call Abort() instead of simply EndTask() seems like it would do the trick.

#

Thanks for the advise and ideas by the way! This sure is a good opportunity to learn some more about AI/BTTasks...

median socket
#

Yes, okay, it's on track to working as I want it now! Thanks for all the help. I think the AI system is a little freaky to get into with its bazillion module dependencies, mysterious node memory system, task ownership, and what-not -- but somehow it managed to resolve itself quite quickly once I started copying some code :)

supple sequoia
#

Hi, does anyone here use the "Learning Agents" plugin?

#

I get the following error from a clean install of 5.4, and trying the Learning Agents Tutorial.

haughty edge
#

Hey guys! I'm trying to call TestPath() on another thread but sometimes it crashes the engine with getTileAndPolyByRefUnsafe() returning a nullptr dtPoly. Can anyone tell me if there's things I should check before called TestPath() on another thread?
Right now I am trying to mimic the structure of PerformAsyncQuerie() like using graph task with EGameThreads::BackgroundThreadPriority.

olive prism
#

Hello, a question, in your AIs, how handle the block state?

uneven cloud
olive prism
# uneven cloud What do you mean by the block state?

Yes, I just did something simple, it is a decorator that looks at the variable of my class called "blocking", and I modify that variable according to the number of hits that the Ai received and a random probability

#

Very simple, but functional hahah

uneven cloud
#

Why are you using a RPC? Server RPCs don't work for NPCs as they are server owned actors and don't have an owning client. Also the AI only exists on the server.

olive prism
uneven cloud
uneven cloud
olive prism
#

what is GAS?

#

If i used that, i dont know what is that and why i use it hahaha

hardy sable
#

Hey, I asked on multiplayer but didn't get a reply so I'll ask here. How is ai handled in multiplayer settings? Is it entirely server based, or for example can the target location the ai is walking towards be adjusted on the client to account for latency, e.g. walking towards a clients character, but the client has moved on the client's session.

#

Or hypothetically if something only exists on a client machine, and you want an ai to react to it.

hardy sable
uneven cloud
hardy sable
#

So this info wouldn't have to be sent to the server

uneven cloud
hardy sable
#

OK, good to know

uneven cloud
hardy sable
#

Yeah. I wasn't sure if unreal did some client side ai adjustments, so that's why I was asking

rigid tulip
#

Is there a solution for navmesh walking in multiplayer?
I just tested it in 5.4.2 fresh project and it's still broken (sloped ground, client)

zealous maple
#

Is there anything like Begin Play for BTTasks? Or how would I best do and store a cast?

#

I want to cast to my enemy base and get certain variables.

misty wharf
#

Although generally there's not much of a reason to do so unless it's just for convenience (eg. so you don't need to keep dragging the pin everywhere)

misty wharf
#

Anyone know of a good way to do an EQS which gets points like this, but wouldn't return points so close to the edge?

#

As you can see the points on the left are basically exactly on the edge of the surface below them and I'd rather they would not be there

autumn fog
#

Hi everyone! Is there a way to have the AI move to nodes use a custom pathfinding? I built a grid system and a custom grid based A* pathfinding. Currently I am testing the pathfinding based on player position and destination location, and it works. But I would like to add this on the enemy/ai and allow the ai to move to locations using this pathfinding. basically some way to override the default pathfinding
(im using blueprints)

bright girder
#

Wondering if anybody can help me debug this flickering issue.

Game is multiplayer and I am using AI move the player's units, the player assigns a target, which sets a state (enum) on the controlled unit, and the BT does a thing based on the unit's state & target. In my BTT, I set that enum to a value that invalidates the "Move" sequence after successful movement.

I am specifically having issues with AI movement. Sometimes my unit's position will flicker to what appears to be the target's location. This is only for about one frame or so and I cannot replicate 100% of the time.

I thought it was maybe my animations or some server sync issue, but I unplugged all of that logic the flicker still happens. I also swapped out my custom BTT with a vanilla "Move to" and the flicker still happens.

Attaching a video, it happens fast but you can see the unit's HP bar flicker a few times whenever the unit attempts to move.

Any ideas on how to pinpoint the root cause, or what I can try differently?

copper glacier
bright girder
# copper glacier If you have the BTT debugging during this, does it look like it jumps around the...

No odd skips in the debugging from what I can tell and the tree does not appear to be stuck. It will abort the branch, as expected. I've just tried disconnecting the sister branch and the logic jumps back to the BT root, but still flicker on the unit.

And yeah, I've expanded to acceptance radius to the point where no movement would be required, yet still flicker (sometimes). I also played around with adding a Wait between tasks, but no luck.

copper glacier
#

So for some reason, rotate to BB entry does not work properly (I have UseControllerRotationYaw unchecked, Use Controller Desired Rotation on, and Orient mesh off), when I execute the move to, the enemy moves in the direction and looks in the direction of its target. But then when it moves onto the next branch of the behavior tree, it is not looking directly at the target. So when it does it's attack, it misses, and then just sits there attacking air.

If I hover over the Rotate To Face BB entry node during execution, it does say that the FocalPoint location is invalid but googling finds nothing excepts for a post on vehicle nav mesh, as part of the source code there.

The thing I want it to focus on, is just a subclassed Actor, is there some specific component the actor needs in order for the rotation task to properly work?

#

Okay, so documentation sayd I need to have UseControllerRotationYaw on, so I changed that (bad forum post said to have it off), and that did fix it half-way. They now face, but now it looks like the MoveTo and the Rotate are fighting each other, and so the mesh just quickly glitches back and forth

uneven cloud
bright girder
carmine urchin
#

Does anyone know why my AI is rotating like this ? Seems like it is an Avoidance problem, but i'm already using Detour Crowd Controller

distant citrus
#

Hey all!

I have a custom UStateTreeComponent attached to my character.

I also have a custom UStateTreeComponentSchema. I have a State Tree asset in blueprints that derives from this custom schema.

If I attempt to use this custom UStateTreeComponentSchema in my UStateTreeComponent State Tree however, I am unable to. Only when I use only the original UStateTreeComponentSchema am I able to actually use it in the UStateTreetComponent.

Any idea why? Thanks!

Solved... solution:

For whatever reason, a State Tree Component will only accept the one kind of default schema within Blueprints. The work-around that I developed is to simply override the State Tree Component's InitializeComponent function like so:

{
    StateTreeRef.SetStateTree(StateTreeToUse);
    Super::InitializeComponent();
}

The variable StateTreeToUse is just UStateTree* StrateTreeToUse = nullptr declared right on the custom State Tree Component - works great, the logic works.

vague hollow
#

is there any way to get rid of this warning ? (nothing breaking but just annoying) https://forums.unrealengine.com/t/state-tree-bug/1848143

Epic Developer Community Forums

Hello, i found this bug when i added Parameter in state tree and then removed it, now gives me this warning every single time character with this state tree is spawned. LogStateTree: Warning: Parameters for ‘ST_TricksterTest’ stored in StateTreeReference were auto-fixed to be usable at runtime.

hidden nexus
misty wharf
hidden nexus
misty wharf
hidden nexus
#

But the problem is that it's gaining sight immediately, and there is a projectile but it's destroyed. So I would at least expect it to see me, lose me, and then see me again. And that too, not immediately

uncut rune
uncut rune
# carmine urchin 0 collision

Try to make visible all the collision spheres boxes or even mesh that you have on the unit and check if they are not creating some friction with each other.

uncut rune
# carmine urchin 0 collision

but I actually realized it's similiar in my game now that I tested it, so I also would like to hear how to fix that, my guess would be to create some kind of extra local avoidance for each unit with linetraces and checking if it hits something, but that's way over my level yet

hidden nexus
obtuse dome
#

If I want to copy the value of a blackboard key from one blackboard to another, it's fairly straightforward if I know the type:

if (keySelector.SelectedKeyType == UBlackboardKeyType_Object::StaticClass())
{
    UObject* o = SourceBlackboardComponent->GetValue<UBlackboardKeyType_Object>(sourceKeySelector.GetSelectedKeyID());
    DestinationBlackboardComponent->SetValue<UBlackboardKeyType_Object>(destKeySelector.GetSelectedKeyID(), o);
}

but if I want to generally copy any arbitrary type (after I've verified that source type == destination type), it seems much harder. The only way to do that seems to be CopyValues on UBlackboardKeyType, but it's protected, so I have to go through a really roundabout way to use it:

#
static uint8* GetKeyRawData(UBlackboardComponent& blackboard, const FBlackboardKeySelector& keySelector)
{
    const FBlackboardEntry* key = blackboard.GetBlackboardAsset()->GetKey(keySelector.GetSelectedKeyID());
    const uint16 DataOffset = key->KeyType->HasInstance() ? sizeof(FBlackboardInstancedKeyMemory) : 0;
    return blackboard.GetKeyRawData(keySelector.GetSelectedKeyID()) + DataOffset;
}

class UWorkAroundBadUnrealApi : public UBlackboardKeyType
{
public:
    void CopyData(UBlackboardComponent& OwnerComp, uint8* MemoryBlock, const UBlackboardKeyType* SourceKeyOb, const uint8* SourceBlock)
    {
        CopyValues(OwnerComp, MemoryBlock, SourceKeyOb, SourceBlock);
    }
};

uint8* RawData = GetKeyRawData(*DestinationBlackboardComponent, destKeySelector);
uint8* SourceData = GetKeyRawData(*SourceBlackboardComponent->GetBlackboardComponent(), sourceKeySelector);
const FBlackboardEntry* key = DestinationBlackboardComponent->GetBlackboardAsset()->GetKey(destKeySelector.GetSelectedKeyID());
const FBlackboardEntry* sourceKey = SourceBlackboardComponent->GetBlackboardAsset()->GetKey(sourceKeySelector.GetSelectedKeyID());

reinterpret_cast<UWorkAroundBadUnrealApi*>(key->KeyType.Get())->CopyData(*DestinationBlackboardComponent, RawData, sourceKey->KeyType, SourceData);
#

Is that really the best way to generically copy data from one key to another?

fathom sun
#

Hello, I had a custom solution to make my AI to get out of stuck situations, but since I've switched from Walking to NavWalking it stopped working.

When I was using regular walking in CMC, the characters were sliding along a collision of an obstacle to achieve their target, but with NavWalking they simply stop moving if they have anything in front of them like. On the screenshot you can see the potential movement of the top enemy, but it can't start moving as it's slightly touching the other character, note the yellow area. As I said, if using walking, it would've simply slide a little bit upwards.

Is it possible to have something similar when using NavWalking?

#

The cyan spheres are the AiMoveTo targets

uneven cloud
potent loom
#

usually you motion warp in the attack so that it doesn't penetrate to begin with

hidden nexus
uneven cloud
hidden nexus
#

I've also looked at the code, and it really doesn't.

#

Can you post the code?

harsh storm
#

I'll post it 🥳

hidden nexus
# harsh storm

Got lawyered, lol. I must have missed something while debugging because I swear that that's not what I saw.

Regardless, that doesn't explain the behavior I saw in-engine: The sight debug moved independently of the pawn. And the only thing that solved it is overriding that function.

dense owl
#

It looks like your viewpoint == nullptr 🙃

hidden nexus
uneven cloud
vivid fern
#

yeah that kinda thing is nice once you have some animations in there and you can really see the telegraphing of the actor's head turns and stuff

visual dawn
#

sorry isnt the ai perception component meant to me on the ai controller itself

#

?

#

please any documents on the best practices to follow when implementing artificial intelligence

vivid fern
#

thats where mine is

#

in fact you get it from the AIController

vivid fern
#

probably best to be more specific? best practices for what exactly

misty wharf
#

(there's also a few bits on behavior trees and state trees in there)

dense owl
#

Gotta love these dumb fire questions

hallow compass
#

is there somewhere a BT and ST pros & cons ?
i find it very hard to find what would fit the best and whats the most "optimized" and "modular"

harsh storm
#

They are different paradigms for different purposes

#

Check out the 2nd pinned post where Luthage covers BT vs a State Machine. It is short and sweet.

#

ST is pretty much a State Machine

visual dawn
#

i see in some instances black board keys are implemnted as int 32 on the controller class on cpp

#

logical?

misty wharf
#

Huh? Where did you see that?

visual dawn
#

uint8 sorry

#

i mixed the variable type

misty wharf
#

Yeah I mean where's that?

visual dawn
#

in an ai tutorila i got online

#

lol

misty wharf
#

I mean you said "in the controller class in cpp" so I'm not sure what you're referring to

visual dawn
misty wharf
#

🤔

#

I've never seen those used so not sure what that's for

harsh storm
#

Look custom to me

#

Like, just how someone wanted to do it

misty wharf
#

Looks like you can look up stuff from the BB based on the key ID but yeah still never seen it used in this way

visual dawn
#

uhmm its like storing the refrence to the bp black board key in cpp to be able to set them from codes i guess

misty wharf
#

Yeah it's probably intended to avoid having to hardcode the key names in more than one place

visual dawn
#

right!!!!!

misty wharf
#

...not that it still makes that much sense because you could just declare them as FName properties on the class

#

but I guess if it works ¯_(ツ)_/¯

visual dawn
harsh storm
#

I just have mine in a namespace with inline FName's

#
namespace BBKeyNames
{
    inline FName TargetActor = FName("TargetActor");
}

So something like this

#

To reference it, it is BBKeyNames::TargetActor

visual dawn
#

nice coding practice

#

i still doubt it is the use case

#

let me show you an example of what iy is used for\

harsh storm
#

Already not a fan

visual dawn
#

the person still made a raw string

harsh storm
#

And it looks like they're potentially doing a state machine inside of the BT

visual dawn
visual dawn
visual dawn
harsh storm
#

Yes

visual dawn
#

named BBkeynames

misty wharf
harsh storm
visual dawn
#

this guy is funny how is your dog

harsh storm
#

Fine

visual dawn
#

my regards

open swift
#

I wrote a test that scores locations based on how close they are to the locations other enemies have already chosen to move to, but i'm not really sure why it isn't working.

for (FEnvQueryInstance::ItemIterator It(this, QueryInstance); It; ++It)
{
  const FVector Location = GetItemLocation(QueryInstance, It.GetIndex());
  const float Score = GameState->GetScorePenaltyForLocation(OwnerActor, Location);
  It.SetScore(TestPurpose, FilterType, Score, MinThresholdValue, MaxThresholdValue);
}

is this gist of it (that's in RunTest), it's returning values between 0 and 3 right now, and I have it set to Inverse Linear, but it doesn't appear to really be doing anything to keep enemies from pathing to the same spots.

Any ideas?

#

I have not written an EQS test before so i have no idea if that score value needs to be normalized somehow, or how to make the weight of this test higher than other tests

keen crow
#

can it be that UNavigationSystemV1::GetPathLength is broken in 5.3? for example, it returns me 1.35m when actually there's 7m of straight distance between 2 actors 🤔

crimson thicket
#

guys bp ai or c++ ai?

open swift
uneven cloud
open swift
#

i basically keep track of where all enemies in combat are moving to at any given time, and if you pass in a location it will basically pass back a number representing how many other enemies' goal locations are close to that location weighted by distance

uneven cloud
#

Uh whatever for?

open swift
#

so that enemies dont stand inside of each other when they're attacking the same target

#

unless theres nowhere else to stand

uneven cloud
#

Is it used for anything other than the EQS?

open swift
#

not at the moment, but at work we have a similar thing that we use for making enemies flank so i figured having it somewhere i could easily access (not necessarily this score, but just the values for where enemies are pathing to) might be handy in the future

uneven cloud
#

That would never pass a code review at any studio I've worked at

open swift
#

why

uneven cloud
#

The game state isn't a dumping ground of "random things I don't know where to put it." And "might be handy in the future" isn't a good excuse for it.

open swift
#

where would you put it

harsh storm
#

The answer is always subsystems

#

Make a world subsystem that is only on the server and put stuff there.

open swift
#

making an entire subsystem for 1 tmap's worth of data and a helper function or two to access it seems like overkill no?

harsh storm
#

Any rejection of subsystems is heresy!

uneven cloud
#

In the EQS test until it is needed somewhere else. Then a world subsystem.

#

KISS

harsh storm
#

(I wasn't following the convo entirely. I just know the answer is always subsystems)

uneven cloud
#

You don't need to make a subsystem just for that. It's tracking AI locations, so it's typical to have an AI agent manager (subsystem) to track the AI and manage AI LOD.

harsh storm
#

I call mine AIDirector so it makes me feel as smort as L4D, but in reality, it just holds AI stuff

uneven cloud
#

Though, I disagree that you should be tracking their move to location just for this EQS test. KISS

#

Keeping things simple (KISS) will help you to not over engineer your code.

uneven cloud
#

I've been promised twice now that I'd get to make an AI director and both times dropped.

harsh storm
#

Except for you, it's probably higher up telling you and then dropping it. For me, I am the higher up 😅

uneven cloud
#

One of them had the designer tell me that the enemies should just "know where to go"

harsh storm
#

Wow, really? Easy. GetAllActorsOfClass<APlayerCharacter>()

#

lol

uneven cloud
#

No. The entire map populated with enemies and they just know how to disperse

harsh storm
#

So many follow up questions

uneven cloud
#

So did I. No answers were given though. That project was a shit show

#

The other one they gave to a different engineer, because design didn't think AI was important in that system. I ended up building the spawning systems though. Then they dropped it for base spawns, which completely went against the game pitch.

#

Designers are the worst

harsh storm
#

Maybe the design had to change?

#

🤷

uneven cloud
#

They never really tried it

harsh storm
#

Maybe too many excel sheets?

uneven cloud
#

Didn't make excel sheets either

harsh storm
#

Google docs????

#

What did they do? Brainstorm in a meeting room?

uneven cloud
#

We still only had one enemy type after 2 years, because design couldn't get their shit together and design any.

harsh storm
open swift
#

i am still very early in working on AI so it would probably make sense to go ahead and just make an AI subsystem for this kind of stuff

harsh storm
#

I have like 9 designs, but only about 3 or 4 implemented.

uneven cloud
#

So they couldn't test the spawning systems. Which not only could spawn enemies, but props too.

uneven cloud
harsh storm
#

Soooooo you're saying I can be a designer for AAA

uneven cloud
#

If they let you into the toxic boys club of bros who don't actually do their job

#

I'm not at all salty today

harsh storm
#

Didn't pick up on that at all. Nope.

dense owl
#

Although I can see AI Director being higher than AI Architect, the latter just sounds better to me. Lead AI Architect with a Director pay and responsibilities would be even cooler

coral mesa
#

how do you add your detour agent to detour avoidance system??
I don't necessarily want to break stuffs without knowing things properly

vivid fern
uneven cloud
vivid fern
#

definitely

#

i usually make terrilby colored alternates and then be like "well you guys can figure out that part" haha

#

i have also been itching for a kind of AI director to help flesh out encounters

steel moat
#

I have a basic patrol AI generating random points and moving to that location using behaviour tree, im trying to add a wheel turn animation to the AI so i need to know when AI is turning in which direction. AI pawn is not from chaos vehicle its derived from Character class

misty wharf
steel moat
#

the rotation is coming from the AI controller itself

#

and Attach controller to pawn is true

#

also orient rotation to movement

misty wharf
#

It doesn't matter where it is and what's what. Find where the values are you need and read them

coral mesa
coral mesa
#

regardless i will try something in the meanwhile. Thanks a lot!

misty wharf
#

I've not used Mass so can't really say how that would work

vivid fern
#

iirc the mass avoidance stuff is more or less adding a repelling vector to the entity movement that pushes them away from neighbors

coral mesa
coral mesa
#

whats exact difference between RVO that CMC uses and Crowd Manager?

uneven cloud
coral mesa
misty wharf
vivid fern
#

is this something that could be solved by ensuring the npcs dont go to the "roughly" same position? aka being smarter about destination picking

#

less similar destinations would mean fewer similar pathing results and a lower chance of bunching

#

there would still be need for some amount of avoidance, but it would be less obvious (and probably look better) if they didnt bunch and all go to similar places

#

i guess partly im wondering what the greater context is

keen crow
#

Sorry to bring up old stuff, but today after fixing some bugs I found out the same perpetual stream of suspending/resuming branch actions. However NPCs seem to be working fine. So is this something to worry about? And what does this suspending/resuming branch actions mean?

dense owl
keen crow
rancid mural
#

For something with a number of enemies on the smaller side and no complexity outside of how they engage the player when the player arrives, like a survival horror or a Soulslike, what approach to AI do people think makes the most sense?

Behavior trees, state trees, just script 'em in BP (is that one ever correct, or is it just 'good enough' sometimes), etc? Or would it just be whatever is easiest for me to wrap my head around, they can all do it fine?

I saw someone saying here once that BTs would suck for something like a Soulslike boss, but I didn't/don't really get them enough to know why someone would have that opinion or if it's accurate.

obtuse dome
#

old_man_yells_at_unreal come on, why is UBehaviorTreeComponent::OnTaskFinished not virtual. Am I going to have to fork UE source just to check when a behavior tree finishes a latent abort?

#

new code review policy pls
if (!private) { check(isVirtual()); }

dense owl
#

“We understand why you are requesting this PR but we will not be implementing it anyways”

misty wharf
#

I was always wondering about this but felt like it didn't despite the API looking like it did lol

obtuse dome
#

Yeah, it has to for parallel tasks

#

and you can also get it to happen with your own C++ tasks

#

just return EBTNodeResult::InProgress; in AbortTask

misty wharf
#

The BP API for Receive Abort where you have to call Finish Abort at the end seems like that would allow latent aborts also

obtuse dome
#

well, I guess tick will have to suffice for now since I don't want to go through the trouble of forking yet. And for some reason bNotifyTick keeps getting reset unless set in the ctor, even if it's an instanced node, so I guess I will have to run tick always * numbe of AIs and not just once an abort is triggered

misty wharf
#

By the way as it sounds like you've been digging in the BT APIs, have you noticed if there's some way to serialize/unserialize the BT state itself?

#

For purposes such as saving the game

obtuse dome
#

Wouldn't you store your state in a blackboard and serialize its values?

misty wharf
#

Well I mean the actual node execution state. If your BT is in a particular node state and you save your game, it seems it ideally would be possible to put it back into that state

obtuse dome
#

You can access node memory, but you might run into blockers traversing all of them / setting them in the middle of tree execution

#

not worth the trouble IMO

#

Are you going to save animation state / exact physics state of all objects too?

misty wharf
#

Yeah, I was looking into it a while back and it seemed like the answer was "no", but someone was here at some point and said that you can just run it through serialize and it would do that but I never had the time to confirm it myself so not sure if it does that or not

#

And yeah, it does seem like it could be problematic in more ways than just that

#

ugh savegames

#

lol

#

It kinda seems the entire BT architecture of your game needs to be designed in such a way that if you need the AI to be able to load back into whatever it was doing, the BT can do it based on the AI/BB data or something which feels like a bit of a hassle

obtuse dome
#

Honestly, I see BTs as a toy feature in vanilla Unreal. Unless you have very minimal AI in your game, they just don't scale. A global, monolithic behavior tree is unshippable in real games. There are plenty of games like The Division that have these monster BTs, but those are the same teams that dig themselves into a hole where oh no we can't ship our game it's gonna take 5 more years because of tech debt tech debt we gotta refactor everything & the game gets cancelled if they're a smaller company or it eats up the lion's share of the engineering budget in AAA games. This should have been one of the foremost problems any dev tools PM / designer was thinking of when planning BTs for UE. But what do we get? Some hacked up Run Behavior node that copypastes nodes from one tree into another without distinct state. You may be able to split out subtrees, but how useful is that when all of the state you need for monster BTs like The Division's is forced into the same blackboard? And within a day of trying to make anything useful in BTs it's clear that Blueprint's async support needs a lot of work too. The frustrating part is it's actually not that hard to add proper subtrees with their own state (that's what I've been poking around in BT source code for). AI Controllers and tasks are already compatible with multiple blackboards & multiple behavior trees on the same AI controller, so you don't need any major engine/AI module changes. The footprint of proper subtrees actually looks like it's less than that stack-based copypaste tree implementation they've jammed into BTs currently, so all of this headache for nothing

misty wharf
#

AI Controllers and tasks are already compatible
Are they really? There are a lot of assumptions in the codebase about BrainComponent, or at least it looked like that last time I was poking around there

#

I'm using BTs for NPC AI in my projects, one is a shooter and one is a video rental store simulator - seems to work alright without any particular issues tbh

#

the rental store sim has more complex state in the BT which may be part of the reason why saving is a hassle on that one... the shooter just lets the enemy AI reset because it doesn't matter :P

obtuse dome
misty wharf
#

Ah, interesting

#

I was considering running a ST and a BT together and it seemed like the existing architecture in there was kinda getting in the way, but maybe not if that's how it works

fallow sequoia
#

Hey, anyone's know where I could learn or what programs I should use for make a physics animation with AI like this? https://youtu.be/1kV-rZZw50Q I saw this video, but the ASE seems deprecated using Isaac Gym.

Or maybe with procedural animations I could archieve something like this?

Thanks ^^

❤️ Check out Weights & Biases and sign up for a free demo here: https://wandb.com/papers
❤️ Their mentioned post is available here (thank you Soumik!): http://wandb.me/ASE

📝 The paper "ASE: Large-Scale Reusable Adversarial Skill Embeddings for Physically Simulated Characters" is available here:
https://nv-tlabs.github.io/ASE/

📝 Our material s...

▶ Play video
fathom sun
#

Hello, is it possible to create a series of navmeshes that can be swapped on runtime? I have a few layouts for my map, and I would like to not dynamically compute the navmesh when the world state changes, but to use one that I bake prior to playtime

vivid fern
# obtuse dome Honestly, I see BTs as a toy feature in vanilla Unreal. Unless you have _very_ m...

TBH in truth, behavior trees dont need to be very big or complex. You dont need to simulate reality with them... if your tree has gone super deep or super wide, something is wrong in the design of the AI from a gameplay mechanics perspective.

I have messed with the division AI a bit (explored its code base and tree structures) And while this screen shot looks ridiculous, working in it actually wasnt as ridiculous as it seems, yes its entirely too complicated imo for what it delivered, but you also dont know the context as to why it got that way 😛 .. Anyway the thing they dont tell you in this pic is this is an old screen shot used to be ridiculous. Lots of these nodes are things like math or function calls or similar, and a lot of these nodes are wrapped into sub trees and function macros.. This image is a FULLY expanded view of every atomic piece of the tree. In reality its broken up into a few different nested subtrees, each pretty understandable about its purpose, and each reused..

Fwiw the division (both of them) are 10 year projects iirc 😛 but the fruits of that labor is the tech which is used on a good chunk of games now, both divisions, a south park game, the star fox ubisoft game, avatar, the new upcoming starwars, etc etc.. but ubisoft runs pretty long project cycles for some of its properties.

Anyway its not perfect because what tool is, but also its not terrible either.

vivid fern
#

design your trees to recover from just blackboard data

misty wharf
#

Yeah that's probably ideally what you would do, it just gets pretty clunky if you have complicated logic there

#

But it may be that my BTs are currently a little bit too state machine -style. As an example, a customer has a sequence of actions where it 1) finds a queue 2) queues 3) waits for a certain event 4) speaks/animates 5) performs some actions 6) waits for another event 7) Performs some other actions...

#

In this, 1 and 2 are something it could check from its state (eg. am I already in a queue) and skip, but it doesn't really keep state on whether it already did 4 and 5 because they're part of that particular sequence, etc.

#

A lot of this would have to be moved into some kind of internal state enum or tag so that it could return to the appropriate step and at that point it feels kinda like duplicating logic/rules

vivid fern
#

Tbh things are weird about unreal's bts. Im not totally sold on it ahha but yeah in the case of sequencing and waiting on events that does complicate it

#

Behavior trees are kind of interesting in that you can do a lot of things in them, but its hard to decide where to draw the line

#

Because a lot of things about them can also be done in other ways

oblique basin
# vivid fern TBH in truth, behavior trees dont need to be very big or complex. You dont need ...

Yeah I was about to write something similar. Ultimately it's a game design decision but I've had some pretty involved AI in games easily encapsulated in several BTs you can swap out at runtime and managed by a state machine. Any data you need to restore a state can be saved in a game object and accessed when booting up the state machine. That said, if that doesn't seem viable in your case, there are other good options provided by the engine.

ripe cove
#

is there some kind of special setting that allows ais to walk on slopes
i have a problem where mine jsut stops when its near sairs and stops chasing me

crimson thicket
#

how can i check ai path blocked objects in cpp

visual dawn
#

Hey guys

#

Am having. A minor issue

#

I want my ai to aim and walk but it doesn’t transition

#

And the variables change as soopose

#

It either runs

#

Or aims

#

Sometimes I want it to do both

#

When close to enemy any idea

vivid fern
#

you need to provide more context than that

#

what do your trees look like? how does aim work in your game, etc etc

visual dawn
#

Ok I’ll do so

obtuse dome
obtuse dome
#

If you mean find the specific objects blocking the path, then I don't think it keeps track of that. Looking at the source it just keeps track of the AI's past positions and flags as blocked if it hasn't moved sufficient distance

crimson thicket
obtuse dome
#

I'm not sure what you mean. There's no such thing as an AObject. Do you mean AActor? Then there's no way since that's not how Unreal keeps track of whether a path is blocked or not (it checks distance travelled as mentioned earlier, not anything related to other objects)

dense owl
#

Perhaps you mean UObject .^

vivid fern
#

what is the end result you are after?

tired field
vivid fern
#

this is the ai in the division

#

which uses snowdrop

vivid fern
#

I've actually played with that tree a bit when i worked on the division 2 tho, but most of my tasking was else where on that project

tired field
vivid fern
#

not explained here, is that they actually wrapped every enemy ai archetype into one tree (they had a separate one for the civilian NPCs).. so there's a lot going on here but most AI only use a fraction of the tree at a time

misty wharf
#

It looks pretty cursed still lol

#

I hope there was tooling to search the tree... UE's has some for that but not as much as I'd like

vivid fern
#

agree, its far too big imo for what it delivered

#

yeah it was pretty searchable and stuff collapsed into subtrees and stuff

#

easy to get around, but yeah they did this huge amount of complexity, and the ai doesnt really feel that sophisticated in game, at least not any more than other loot shooters imo

#

they could have definitely done less and gotten just as far

cerulean loom
#

hey guys, there is an AoE visualization for players in Albion Online, I want to do the same thing for AI to make it avoid this area. So I created a NavModifierVolume with a custom shape(cuz AoE can be with any shape possible) by using Pen in Brush Editing Mode, and got the result that I needed: AI avoids this area and still can walk on it. But I don`t know how to spawn the NavModifierVolume that I created(and is it even possible), maybe you know how to solve this problem or can give me a better way to create this area

elfin hinge
#

Hi, for EQS has anyone find out best way for AI to avoid taking points that already been taken by other AIs?
I can see how it can be done in couple ways, but maybe there's a good way that anyone from experience can suggest?

open swift
#

Shouldn't need to spawn a whole actor just for that, you just need to store a vector somewhere and check distance against it.

misty wharf
misty wharf
#

Haha no worries

elfin hinge
open swift
#

you could do it the opposite way where the AI just tell the manager what their target locations are

#

i just use a TMap<AActor*, FVector>

vivid fern
#

in past games i've had a "claiming" system.. basically ai claims a spot or tile or area or whatever, and then when other ai are picking a destination those locations are denied.. once an AI finds a good destination, they claim it.. once they change destinations they release it

open swift
#

yeah essentially that. depending on how strict you want to be you either filter out claimed locations entirely, or just score them poorly compared to unclaimed locations

vivid fern
#

yeah tbh ai dont have to be the only ones that claim spots either

elfin hinge
#

Sounds good, thanks

dense owl
vivid fern
#

probably, except smart objects boviously dictate a behavior right, play some animation, face some direction, etc

#

this just says "this space is unavailable" or "undesireable"

#

i use the pattern in a few places haha i use it to help pick positions around a target .. positions would be some off set from the target, and groups of ai could claim a spot around their enemey to prevent crowding and control how they move around between those points.. similarly, a token system to decide how many simultaneous incoming attacks or how much dps can be incoming to a single target, claiming a token lets you attack, finishing an attack releases the token, etc etc

#

lots of claiming and releasing going on 😄

ruby frost
#

Hello, i am very new and trying to make an Ai Move with a Behavior tree, i have a topdown project
I have an enemy with type of Character that uses the AiController i have created
i have an object with type of Actor that is the target
the behavior tree seems to be working as far as i can tell, and the blueprint in the controller is this, and the string is printed so it should work ?

dense owl
vivid fern
#

yep yep

#

if i were to be doing that in unreal i'd probably start there

dense owl
ruby frost
dense owl
vivid fern
#

should probably also show your tree

#

does that get actor actually get the right actor?

ruby frost
ruby frost
vivid fern
#

it shouldnt blink once the move to has a valid patha nd navigation stuff

#

it should have a steady highlight for the duration of the move

#

sounds to me like the moveto is failing so your destination is probably invalid or cant be pathed to

dense owl
#

May want to also put a decorator on that selector, currently it can only go left branch

vivid fern
#

do you have a navmesh setup?

ruby frost
vivid fern
#

in your map

ruby frost
ruby frost
dense owl
copper glacier
#

What is the best way to get an enemy character to rotate to face a BB Entry? The Rotate To Face BB Entry doesn't seem to work for me (in debugging I get "Focal Point: Invalid location")

I have a BT where if the enemy is not in range, it will move towards the target. Once in range it will attack, but if the target moves (but stays in range), the pawn will not rotate to face them, so the attack looks strange (and in the case of melee attacks, misses completely).

I can add a custom task to rotate, but then the character just slides around, while the MoveTo properly rotates with animation (but then of course moves).

glacial minnow
plush cargo
#

I have been stuck on AI for so long.
Is there anything on the marketplace that is good enough to be recommended?

misty wharf
#

I'm not sure if anything on the marketplace will magically solve all your AI problems tbh

plush cargo
#

for now atleast

misty wharf
#

What's the problem with doing that? You can make a behavior tree for example which moves and does attacks or whatever

#

I've seen some combat AI things on the marketplace which I guess could simplify it if it does what you want, but that seems it would largely depend on how your game works

plush cargo
#

This is why i'm looking at marketplace assets. To focus on high level decisions. I know what behaviour tree and state tree can offer but they require me to spend hours i need elsewhere.
Question about recommendations was mostly if there is anything popular and working.

#

I am ofcourse scouring the marketplace as we speak ;D

misty wharf
#

I've noticed folks don't usually have much luck with getting recs for stuff, I think a lot of it is just so niche. Hard to imagine how I would even integrate someone else's AI into mine :)

misty wharf
#

I have a situation like this - I have an item on the table and I'd like my NPC to move as close to it as possible. However, in this situation, the closest navmesh point seems to be on the right side near the arrow... and if the NPC is on the left side, it would make more sense for it to go to the spot marked with the X instead

#

Any suggestions on how that might be done? Projecting the point to the navmesh ends up on the right side because it's closer... the only solution I can think of is using EQS to create a bunch of points around the item, and then scoring them by distance to item and distance to npc

misty wharf
#

...also this, once again, for like the hundredth time, exposes the biggest weakness in EQS...