#gameplay-ai

1 messages · Page 154 of 1

lyric flint
#

??

#

i'm confused then how this is meant to work

pine steeple
#

Each ghost instantiates (creates) its own copy of the above Behaviour tree, and runs it independatly. It is not one BT instance for all ghosts.

lyric flint
#

right so the method I am using should work fine then

pine steeple
#

yes if your branches are set correctly

lyric flint
#

oh way hang on

#

does the AI do same thing it does with BT with the BB aswell

#

or do they share the BB ??

pine steeple
#

they dont share the BB

lyric flint
#

so they do same as BT

#

create there own copy

#

bassically at game start the AI passing in it's own Enum Values

pine steeple
#

show us where you set the keys

lyric flint
#

so we begin that image above in the AI Child

#

The AI Child set the value here which is passed into the AIC setup

#

The AIC then takes in the values and send them to the set of blackboard kays

#

That sets them here

#

Then the decorators make sure each Ghost only runs "it's Branch"

#

The Pink Ghost Runs fine with this

#

Red Ghost no work

#

Yet it's value is correctly set here

#

if I remove the specific Branch for the Pink Ghost the BT runs fine for next Ghost along

#

It's like the BT won't run unless the most Left option is allowing when it runs the scatter

misty wharf
#

It looks like you're using a sequence

#

if the blackboard decorator for the enum doesn't pass, it counts as the node failing

#

which means that the sequence entirely aborts because that's what sequences do - they only execute nodes until one of them fails

#

a selector node would be probably work better in this instance, since a selector will keep executing nodes until one of them succeeds

lyric flint
#

yep thats fixed it

#

sometimes the 3rd eye on the situation helps alot

lyric flint
#

so Finish Sussces - would move onto next instruction in the sequence but not marked as success

#

or would move on to the next sequence so got up to first selecter then back down ??

#

then finish abort sends it straight to root to retry complete again ??

misty wharf
#

Finish Success and Finish Abort? You mean in a BT Task?

lyric flint
#

yeah

misty wharf
#

Finish Abort is used with the abort event only, it should not be used for the normal execute events

#

the Finish Execute node's success flag just controls whether the node counts as success or failure

lyric flint
#

so if i say have AI Move to and the fail

alpine hatch
#

Been banging my head on AI issue for a while figured I would reach out. I have some back melee ranged AI that I would like to try’s to swarm around the player. I think maybe 5-6 would circle the player nicely. Then after that they could kinda just line up or what not since there wouldn’t be any space. I have been playing around with the detour crowd controller and EQS but I can’t seem to get a good result at all. Wondering if anyone could share an approach or any ideas to get me kickstarted.

lyric flint
#

lets say I want it to go to next thing on selector above not go back to root I would use finish execute not success

#

but if I wanted it to say go back to root to come back down I would finish abort like forcufilly go to root and retry ??

misty wharf
#

It would probably be best to not try using your tasks to control what happens in the tree in this fashion

#

The success flag should indicate whether your task completed successfully or not

#

and if you need something to happen depending on success or failure, you can do it using the appropriate BT nodes like wrapping it in a selector, or using a force success decorator, etc.

mossy nexus
#

but like, isn't each ghost behavior fairly unique? you can consolidate similar behaviors in subtrees and build up unique trees per ghost with said subtrees

lyric flint
#

so chase / Red aggressive / Pink Predict for example

#

all have goals of catching the player but different ways of doing it so red is simple get actor location and move to player. Pink is predict there location go to location hoping to meet them there

mossy nexus
lyric flint
#

tbh thats what i was palnning to do

#

each ghost has it's own tree but all use same BB

alpine hatch
# mossy nexus have you looked into RVO?

I enabled it on the AI character movement component. But it didn’t correct the issue really… lots of jitter and extreme slow down when pathing around each other at times.

lyric flint
#

but for some reason i ended up doing this with decorators controlling flow of which ghost can do which branches

mossy nexus
lyric flint
mossy nexus
mossy nexus
lyric flint
#

they do thats what was mentioned further above

mossy nexus
#

but you can use RunBehavior of the static kind to add subtrees

lyric flint
#

they all have there own copies of the one I set

mossy nexus
#

but that's just one tree

#

whereas I'm saying 4 different trees

#

with some similar behavior

#

e.g. when a ghost gets killed is the same for all ghosts

lyric flint
#

well the killing of ghosts so far haven't sorted

#

but i am close to begin implementing that tbf which is simple code in it self as literally it's a destroy of actor pretty much with maybe a call to ghost manager that it's died

mossy nexus
#

so here's my take: each ghost has unique active behavior, that is part of their respective tree. the remaining ghost behaviors can be classified as common ghost behaviors that can made into subtrees shared between all ghosts

lyric flint
#

is there a way to tell the pathing to never allow the ghost to turn and go back on it self ??

mossy nexus
#

so IMO the work is to separate what is common behavior and what is unique behavior

lyric flint
#

i may implement tbf

mossy nexus
lyric flint
#

that's fine

#

bassically I looked up the Ghost and there movment is so they never turn reverse

#

they will always path in the Forward direct but if they wish will make left turns to be able to come back on itself

mossy nexus
#

so IMO I'd save the previous navigation query's direction and when doing the next navigation query, ensure that it cannot go against the previous direction

alpine hatch
# mossy nexus that's all I have for this. I generally think this is a design problem before it...

I agree. Pretty new to behavior trees but I understand The components (services, queries, tasks etc…) I was trying

Query (Area around player)
Move to that location
Move to player from that location.

Seems like I need to make a queue around the player that could assign slots to enemies but that gets a little confusing when I think about the player moving. Also not sure where these things should be housed in the BT framework.

mossy nexus
#

so the AI director has each AI register themselves to it when they spawn

#

and from there, the director can give high level directions for what the AI is supposed to do

#

for instance, create formations around player etc.

lyric flint
#

oh yeah

#

Movement Result

mossy nexus
lyric flint
#

i'm not use EQS tbf

#

just the find reachable point and then AI Move To

alpine hatch
mossy nexus
mossy nexus
#

I would also generally be careful with using any of the given AI stuff as most of the implementation seems half assed at best

#

I've created a custom perception system (that links AIs to the director as well)

#

and use BTs with custom tasks and decorators

lyric flint
#

hmmm

#

wondering now how would i take the old location and the new location and work out if that would cause AI to turn 180 as it were ?

alpine hatch
mossy nexus
lyric flint
#

forward vector ??

#

where would that be pulled from

mossy nexus
# alpine hatch So I wouldn’t be stating Behavior Trees. The director would be micro managing ea...

each AI has its own behaviors. the director doesn't care about how each AI behaves. the direction gives high level instructions for complex behavior. for instance when one AI doesn't have sufficient information to do something. like in the case of formation, the AI director knows the formation, and delegates each position of the formation to different AI. none of the AI know anything but their own location they have to move towards

lyric flint
#

got it

#

So at this point

#

the target is coming from the location the get reachable point has found

mossy nexus
#

use GetActorForwardVector for the second pin

lyric flint
#

So that

mossy nexus
#

well or you could say get owner actor

lyric flint
#

oh haha

#

either would work you think

#

or would be safer just to do get owning actor

#

so as this is on BT task it won't allow owning actor

#

but this method still grabs the right method so should be all good

mossy nexus
#

blackboard values can be null for whatever reason

lyric flint
#

well at game start the actual ghost set there actor refs etc

mossy nexus
#

if owner actor is null, the tree won't run in the first place

lyric flint
#

so there will be a link

mossy nexus
#

yes but if something flushes that

#

the fact that it can be flushed in the first place even

#

I always use owner actor

#

for self

lyric flint
#

I can do that but to get that node i've had to untick the thing that only shows node that should be shown

mossy nexus
# lyric flint

you can get owner actor from OnActivation and save it as a variable

lyric flint
#

not seeing that node

mossy nexus
#

you have to override it

lyric flint
#

oh nevermind stupid me

#

controller pawn is what your refering to on the recieve execute

mossy nexus
#

yeah it depends on the node

#

there's receive activation and receive execute

lyric flint
#

Not from what I'm seeing here

#

the Recieve Execute AI passing through the ref of actor running the tree

mossy nexus
#

if it's a task you'll have receive execute

lyric flint
#

so should work

mossy nexus
#

if it's a service you'll have receive activation

lyric flint
#

well that answers that then haha

#

it's task this

#

so if I say if DOT is nearly Equal to 1 with error tol ____ = True I can allow it to proceed

mossy nexus
#

-1

lyric flint
#

Right that should be all good

alpine hatch
mossy nexus
#

if you imagine a circle with radius 1 around your actor, the dot product takes the projections of two vectors onto that circle and tells you how far they are apart. if it's 1, then they are the same. if it's 0, then they are orthogonal. if it's -1 they are opposite

lyric flint
#

right so

mossy nexus
lyric flint
#

i've put in a Not

mossy nexus
#

yep

lyric flint
#

so it flips to use true as I prefer that aswell tbf

mossy nexus
#

it's much more readable as the "intended" way

#

even if both are used

lyric flint
#

true

#

Does the AI have any limitations?

mossy nexus
#

no it's completely limitless

lyric flint
#

I'm coming from Unity and was just wondering if AI has any limitations

#

ok thanks

mossy nexus
#

that's why we put in the bAllowSentience bool

#

it's our only weapon

#

no of course the AI is limited

#

but you'll need to specify your question

lyric flint
#

Basically I planned out a scene in a game where the player rushes towards a door, it slams shut, and the ai teleports behind it, and then walks towards the player, basically im asking if its possible to switch between teleporting and walking whenever

mossy nexus
#

sure

crimson galleon
#

Yeah thats possible. Those sound like states and behavior trees are fsm

mossy nexus
#

the AI doesn't care about that

#

or put differently

#

as long as the AI exists, and it has a behavior assigned to it, will execute that behavior

#

it doesn't matter if the AI is in a closet or on the moon

lyric flint
#

Ok more specific question

#

How can I create a "cutscene" to tell the ai what to do and WHEN to do it?

#

I don't want the ai just to do things out of order

mossy nexus
#

if you're making a cutscene you're not looking at AI

lyric flint
#

ah

mossy nexus
#

you're looking at animations

lyric flint
#

oh ok

#

i thought cutscenes had ai

mossy nexus
#

a cutscene is scripted behavior

#

AI is unscripted behavior

lyric flint
#

ah ok thanks

#

sorry im coming from unity xD

mossy nexus
#

I mean

#

this doesn't have anything to do with the engine

#

I can't imagine setting up AI to do cutscenes in any engine

#

that's just asking for trouble

lyric flint
#

🤦 so you mean to tell me, I've been coding an ai system in C# JUST for a cutscene

#

when in actuallity I could just use tweening and stuff

mossy nexus
#

yes

lyric flint
#

I feel stupid

mossy nexus
#

ah dont worry about it

ocean wren
#

Timothy: Unity has a cinematics editor toolset you know?

#

explicitly for cutscenes and the like

#

As does unreal

#

In Unity its called CineMachine, in Unreal its called Sequencer

lyric flint
#

is there a way to force something to re-run the EQS if it is seen by the Player

mossy nexus
#

isn't there a task for EQS queries?

#

I might be wrong

lyric flint
#

so like the Ghosts are in frightened mode, they see player I want essentially the ability to say from MyAIC player is seen re-run EQS and move to new location

mossy nexus
#

well like I said I don't use EQS so I'm not much help here

lyric flint
#

yeah I have it at the moment but it dosen't run like it won't force run if it's value becomes try it will work like another task

#

anyone good at EQS would i generate the location points around Player or around the quierer so the Ai ??

crimson galleon
#

there is an EQS query task, it will fire once based on the EQS defined parameters, this sounds like it does not get called multiple times though, and that would be based on the conditions which tell it to perform again or not

lyric flint
#

it's there as a service so technically in this case it would be firing reapetly until obvs that brance itself stops getting called

winged grail
# alpine hatch Been banging my head on AI issue for a while figured I would reach out. I have ...

Hey, I ended up banging my head against that for quite a while in the past. The general logic for the method I'm currently using goes something like this:

EQS to find units with gameplay tag of enemy faction within range (tests for closer distance and dot product with distance given priority);
Search through each enemy and see if they are already engaged (each unit has an array, currently I allow up to 4 units to be added to the array, however, I sort through each unit the EQS returns to prioritize unengaged enemies and avoid unnecessary clumping);
If not engaged unit is found, break the for loop, add yourself to the engaged unit array and set that unit as your "TargetEnemy";
Use EQS to generate a circle around the Target Enemy (EQS tests for overlap with pawns, number of points determines the number of potential places the AI can go to which also helps to avoid overlap), set point as Target Location;
Move to TargetLocation while monitoring the overlap point to see if someone else arrives first;
If either the engaged unit or moving to target location fail out, then EQS around TargetEnemy and create a much wider circle of possible locations around TargetEnemy, move their and enter an AwaitingEngagment sequence which waits and periodically re-runs the "search for enemy" task.

I don't know if that's optimal or helpful, but I don't have clumping anymore which is nice.

crimson galleon
# lyric flint

that looks like they will sort of move, but on the next check, move somewhere else and so on. since the repeating service time is so short, i dont imagine they actually move much but just sort of wobbly indeterminately. is this correct? I dont recall reading how exactly they are behaving.

lyric flint
#

so when they are in that branch

crimson galleon
#

in normal Pacman, the Ai return to their "home domain" which is one of the four quadrants of the map, one for each ai

lyric flint
#

so that's what I've now implemented , everything I have seen it's to centre. but the frightned state EQS is working wierd

crimson galleon
#

working wierd?

lyric flint
#

SO when the EQS runs they are moving to locations but dosen't seem to be the right and if I email the trace thing I can come into there view but they don't react say rethink there position and turn elsewhere

crimson galleon
#

alright, thanks, was gunna ask to see the eqs setup. So what are you feeding in as the Context? Querier would be the owner of this BT

lyric flint
#

the querycontext is get player character as well, so would i be correct in saying the points generate around me

crimson galleon
#

ah ok

#

yes, the eqs will appear around the player in world

#

im not 100% but im guessing the eqs will look for the furthest point from the player?

#

it's a bit annoying when using a context object, but if you change it to querier and test the look of the eqs using the eqs pawn, it should show the query

lyric flint
#

yeah at the moment it tried to do that

crimson galleon
#

hope that's not vague, im seeing how much query gets thrown around

lyric flint
crimson galleon
#

great, alright thanks again, this helps me understand whats working right and whats not

lyric flint
#

awsome, it seems the distance is working

#

it favours greater away but the trace of can see seems bit weird

crimson galleon
#

this eqs looks right, assumable when its the player that gets it too, maybe debug while playing to double check, so it does come back to the eqs service being run

lyric flint
#

hmmm i did try to debug but it didn't really help, let me try again

crimson galleon
#

yeah, its not the smoothest when playing. i notice if you press ' after a few seconds it doesnt really show

#

i typically work with one ai so i can see the bt and then press ' right away

lyric flint
#

well it's more so the debug only appears when looking through camera

#

like camera player will look through

crimson galleon
#

ah yeah, the eqs pawn shows the eqs works

#

but to test in game is to make sure the player was found

#

be sure to set that back on the eqs query obviously

#

brb

lyric flint
#

i just tried it's a bit touch an go if i'm honest

lyric flint
#

just watched someone play the game and when in danger mode they just random move around don't actually try stay away from player and also it seems the danger mode is just so you can eat them nothing more it seems

#

obvs theres boost of points along with it

crimson galleon
#

gotta run for now, but if i can, i remember a thorough breakdown of pac man that i found years ago which described the enemies in great detail, ill see if i can find it

lyric flint
#

i have found something tbf which provide a lot of help it's transalting it into UE4 which some bits I'm getting caught on

#

but yeah still happy to look at it

crimson galleon
#

"Frightened mode is unique because the ghosts do not have a specific target tile while in this mode."

#

doesn't look like there is a section on Frightened, but searching "fright" shows up all the details

cobalt palm
#

Hello,

I am having this issue where the sequence on the far right runs before the "Compare Blackboard entries" fails which is THEN supposed to run the sequence on the right.

#

repost

crimson galleon
mossy nexus
#

this is the order they run in

#

you cannot change the order

#

but you can change the nodes

crimson galleon
mossy nexus
#

sorry yes

cobalt palm
#

I am not changing the order. I would like the middle branch to loop until 2 entries are equal, then it continues on to the right branch.

mossy nexus
#

and tbh the compare BB entries is so bad of a decorator I had to make my own

cobalt palm
mossy nexus
#

the force success is useless here

cobalt palm
#

The force success is needed so that when the sequence runs, it doesnt restart the whole BT after it finishes.

mossy nexus
#

so how you imagine that works? that it runs once, and the next time forces its way through?

cobalt palm
# mossy nexus so how you imagine that works? that it runs once, and the next time forces its w...

It runs the first branch (InitializeMaxVariable), then it goes to the middle branch where it will loop infinetly allowing the AI to continue moving to different shelves. After each shelf, the index is increased, and once the Index and Max Shelves entries are equal, the decorator will fail. However, by this failing, the entire bt is restarted, so a force success was added so that although it is failing, it will still run the last branch.

mossy nexus
#

if it fails it continues without restarting the BT

#

it's only on success it restarts

cobalt palm
mossy nexus
#

all the composite nodes work the same

#

the difference is selector needs 1 child to succeed

#

sequence needs all children to succeed

#

and simple parallel succeeds with its main task completion

cobalt palm
#

So what should I do differently to get this to work properly?

mossy nexus
#

remove force success, make your own decorator instead of compare BB entries

simple crest
#

no idea what your ai is supposed to do but seems to me like it should be selecting to either find a shelf or find a register, not sequencing them one after the other

cobalt palm
simple crest
#

the ai goes to the register if it has satisfied some criteria that means it should go to the register

mossy nexus
#

keep in mind your root node is a sequence so all 3 nodes have to succeed in order for it to be a success

simple crest
#

and the ai goes to the shelves if it should go to the shelves (high priority/checks first)

#

in fact i would probably have going to the register as a higher priority

#

going to the shelves is the fallback behavior

#

but can make either way work

mossy nexus
#

I mean I'm not going to dictate design

#

maybe it's a bad store AI

#

designed for a worse customer experience

mossy nexus
#

and lead it to the promise land

cobalt palm
#

I am still confused. Sorry, dont work with BTs often.

In theory this should work. After initializing some variables, the ai goes to a shelf and will keep going to a different shelf until the index is = to the max amount of shelves. It then will go on to the register.

#

So I dont see why its not working.

mossy nexus
#

I would put the initialize values outside of the main sequence you're running

#

and slap decorator on top only to do that IF the values haven't been initialized

mossy nexus
cobalt palm
mossy nexus
#

you aren't forced to use the built in ones

#

I'm telling you this especially for compare BBEntries because it is not great

winged grail
#

Just curious if anyone else has encountered this and what their approach is: when I want to use a simple parallel node in a behaviour tree to update a movement location I always run into this situation where I need to get the location before entering the simple parallel (otherwise the MoveTo fails and the parallel aborts). However, in order for the simple parallel to work properly I can't have a "Finish Execute" in the node that finds the location to go to. So I end up needing two identical versions of the task that finds the movement location, one with a "Finish Execute" and one without. Am I just missing something obvious?

cobalt palm
mossy nexus
lyric flint
#

guys blackboard can't take multiple values can it ??

mossy nexus
lyric flint
#

yeah

mossy nexus
#

no you need to wrap that in an object

#

or put it elsewhere

lyric flint
#

so i want an array of location

#

the array location would be for when the Ghost go to there corners they do a patrol as it were

#

could i have the specific AI_child have it's patrol path points and then pull them into a task on BT maybe ??

mossy nexus
#

I'd say keep the points external and load them in, in a task, as needed

#

I have a more complex setup for this

lyric flint
#

so the task has the points not the BB

mossy nexus
#

which would probably take a while to explain

#

and would be completely over engineered for pacman

#

lol

lyric flint
#

I can do the task thing I would just have specific task for the 4 corners

#

just wondered

mossy nexus
#

the task doesn't know about world locations

lyric flint
#

plus the patrol points would be hardcoded for now so

mossy nexus
#

yeah exactly

lyric flint
#

i can give it vector for know places

mossy nexus
#

but I mean

#

... it's pacman

#

it doesn't get more complex

lyric flint
#

exacly haha

mossy nexus
#

I have shit like an AI director that collects and distributes roles to AI. each role has a set of points

#

but that would be way overkill to do

lyric flint
#

yeah I could do simple version of that technicallt

#

at game run time I tell AI Director to give the spawn AI there patrol points. Only thing I would need is how would I grab the right AI spawned for the points to be given

#

I could loop through all actors and match up the actor name with the locations it should have possibly

mossy nexus
#

the idea behind the AI director is that the AIs self register to it

lyric flint
#

I can do that

#

I would leave empty array and on play the AI calls to Director says am I in the list if yes then woop. If not then I add myself

mossy nexus
#

let the director figure that out

#

that's not the AI's responsibility

lyric flint
#

true true

mossy nexus
#

the AI just has to say "hey I'm here"

#

and possibly "I am of this type"

lyric flint
#

well I can pass in the actor saying Hi

mossy nexus
#

exactly

lyric flint
#

then check the actor saying hi within AI dorector are you in my list

#

how would i distinquish between wierd naming

mossy nexus
#

what do you mean?

lyric flint
#

so I've found that the Ghost are not named simply so they may not be for example just

#

AIGhost_BlinkyRed

#

but might be AIGhost_BlinkyRed_03

#

or am I overthinking something

#

??

mossy nexus
#

I would say give the ghosts an enum in this case for each name

#

doesn't need to be massively complex

#

it's just pacman

lyric flint
#

and then have the individual ghost have the defualt set to it's name

mossy nexus
#

not pacman 2077

lyric flint
#

trust me i just wanna see if I can for once make something to level of playable etc, not releasing

simple crest
#

@cobalt palm
get rid of force success
change sequence to selector
AI should consider going to a register to buy things (or whatever it's doing) as a higher priority task than browsing for stuff on shelves
use a decorator on the go to register actions/subtree which only enters if the AI has visited enough shelves, and set it to abort lower priority tasks

mossy nexus
#

I think your scoping has been reasonable all this time

#

which is rare

lyric flint
#

my plan is once tings work etc switch things up so it's not Pacman but something else that won't be so much copy of something else

#

haha why ?

mossy nexus
#

why what?

simple crest
#

the only way to learn anything fast is to make a 1000 player MMO with multiple interlinking servers across the globe (and one server physically located on the moon)

cobalt palm
mossy nexus
simple crest
cobalt palm
simple crest
#

and you can set up the BT so that if some condition for any higher priority tasks suddenly are present, they can kick that low priority task out of action and take over

#

the difference is that you can use "my way" with any AI, including yours. you can't, however, easily set up "your way" for anything except your specific use case. what if you decide you want to add the ability for an AI to just randomly wander the store in between picking shelves to visit, a lower priority task? it'd be easier if you could just add it onto the right and tighten up the conditions a little for going into the higher priority actions.

#

it's just a mindset you'll pick up for BT's as you use them more tbh

cobalt palm
mossy nexus
#

so two things

#

first, when you run the game, it's always wise to have the BT in a separate window so you can debug it easy, and you can see where it's going

#

second, the BT thread iterates over every node, and subnode in order

#

which means that if you have a condition before an infinite loop, that condition will have to be true for the loop to start, AND for it to continue

#

keep an eye on the order of your elements, it's written into the BT

lyric flint
#

i'm then taking the array and looping through taking the actor in the array grabbing it's GhostType Enum

#

and then setting the PatroPoints but it never seems like there actually being set

mossy nexus
#

and how are you distributing them?

lyric flint
#

so the AIDirector knows where all the Patrol Points are as in there vectors these are in Arrays

#

Like so

mossy nexus
#

how about this

#

in your behavior tree

lyric flint
#

then as it loops through it takes the actor matches up its Enum then set the PatrolPoints on that specific actor

#

with the points from the ones the AI Director feeds to it

mossy nexus
#

request point requests the next point for the AI to move to

lyric flint
#

yeah

mossy nexus
#

the AI doesn't need to know where that point came from

lyric flint
#

just where it is assentially

mossy nexus
#

not evne

#

just wher eit needs to go

lyric flint
#

yeah so the Vector essentially

mossy nexus
#

exactly

#

so it gets the vector. moves there. waits. requests a new vector

#

loop ad libitum

lyric flint
#

the requests could be sent to Ai Director which could keep track of the index it is on

mossy nexus
#

now you're getting it

lyric flint
#

and increment

#

so all I need is a ref to the AI Director to call the right function

mossy nexus
#

the AI should already have a reference to the AI director as they register themselves to it

lyric flint
#

oh yeah

#

now how would i do this

#

i can get controlled pawn awsome

mossy nexus
#

I don't know how you built your AI director

lyric flint
#

could i case to base AI pawn that they all derive from or would it need to be specific to that relevent actor?

mossy nexus
#

mine is a subsystem

#

but I guess yours is an actor? maybe? I don't know

lyric flint
#

actor in the work

#

world

mossy nexus
#

yeah

#

makes sense

#

if you do dabble in cpp I would recommend a subsystem for this

#

makes it ever so much easier

lyric flint
#

hmmm maybe in the future hahaha C++ and me have never met

mossy nexus
#

I assume you have been doing programming before?

lyric flint
#

but i am aware alot of things are much easier defo loads of BB people start out then move over to C++

mossy nexus
#

BB?

#

oh BP?

lyric flint
#

never C++ etc prob UE4 is first time i have in visual way got around of programming

#

maybe not in methods everyone would agree on

#

and yeah BP

mossy nexus
#

but you've done other programming?

lyric flint
#

don't believe so

mossy nexus
#

welp, you seem to have a natural aptitude for it

lyric flint
#

??

mossy nexus
#

I thought you'd been doing this for a while

lyric flint
#

ohh haha

#

fair enough

#

tbf when not working I do spend a lot of time in front of my PC normally with UE4 open or taking in other peoples Devlog on there games. End of day it's all knowldge

fallen otter
#

is there a simple way in eqs to put weight on a location behind the target?

crimson galleon
#

So it can turn around? Invert the score

simple crest
#

either increase score based on distance from the querier or increase score based on dot product result of target's forward direction and direction from the target to the candidate point

stuck comet
#

My decorator is fail, but the Behaviour Tree won't execute the next node (Right Hand Side)

#

any idea why is that?

tranquil marsh
#

if bb condition failed when moveto is still active, it waits until it returns with success or failure before switching nodes

#

you wanna abort branch on decorator fail

rough spruce
#

anyone have any recommendations on the best way to create multiple AI classes? not sure if I need multiple controllers and behavior trees for each or if there is a more efficient way of doing things. I'm working on creating some AI that patrol on path points while others are more melee free roaming, etc.

stuck comet
#

but still it wont abort

stuck comet
rough spruce
#

@stuck comet what do you mean by parameters? I'm not sure I see anywhere in the blackboard to modify the blackboard keys

stuck comet
#

of course you can add as many key as you want

#

and change the value of the BB_Key

crimson galleon
# rough spruce anyone have any recommendations on the best way to create multiple AI classes? n...

it could be the same AI since, in bp at least, you can set the behavior tree when spawned (there a node for this). The consideration in doing so is to make sure both behaviors can be affected by the code of the AIC. Most logic may best be done in the task/services for this reason. This can work with perception and there will be some back and forth between the AIC and BT. And these BT can use the same BB because you tell each BT which BB to look at.

rough spruce
#

oh awesome, thank you both!

dapper spear
#

Hi. any tips on improving the walk-run animation to be in sync with the movement speed. It seems that I am playing by eye what movement speed a certain animation is ok.

mossy nexus
storm zephyr
#

hello, i'm using a smart link to detect when an AI should open a closed door (which has the navlink obstacle), but after that i want to give the control back to the normal path following so i use PathComp->FinishUsingCustomLink(LinkComp); after detecting that the navlink is being use, but he still remains locked in the nav link for a couple of seconds. how can i tell him to ignore the navlink?

#

another approach of fixing this could be to have a way to tell the current path to be recalculated

stuck comet
#

anyone know how to use FAIDataProvider for vector

#

or how to use FAIDataproviderStructValue

silent cove
#

Is there an easy way to clear Blackboard keys without knowing the number of keys in the Blackboard?

pine steeple
#

@storm zephyr i had the same issue

storm zephyr
#

glad i'm not alone 😅 do you happen to find a way to fix it?

pine steeple
#

i did

#

gimme sec

#

C++ or bp?

#

@storm zephyr void ASolsticeAIControllerBase::InvalidatePathWhilstLinking() { UPathFollowingComponent* const FollowingComponent = Cast<UPathFollowingComponent>(GetPathFollowingComponent()); if (FollowingComponent && FollowingComponent->GetPath().IsValid()) { FollowingComponent->GetPath()->Invalidate(); } }

storm zephyr
#

thanks i'll get it a try 😄

#

@pine steeple did you call that function after the FinishUsingCustomLink?

pine steeple
#

yes

storm zephyr
#

i assume that invalidates the path and makes the move to task recalculate it again without using the navlink

pine steeple
#

yes

tepid spindle
#

Hello, i have a problem with to make not stacking mobs, how i can solve this problem?

#

I'm using behavior tree and Eqs but dont now how to customize them

prisma prism
#

Hello collective mind 🙂
I am trying to learn AI for characters in UE4. While I am familiar with VFX in UE4 ai is something foreign to me and I'd like to change that.
I'd like to make a quick prototype where a player plays fetch with an NPC pet. I have no idea even where to start.
I'd appreciate any pointers as to how is the easiest way to achieve this.

ocean wren
#

AIController derived class on the Pet

#

add a behaviour tree to the pet

#

or rather, run the pets behaviour tree in the blueprint

#

have a blackboard with a actor variable for the player and one for the fetch toy

#

maybe have a BB value for the distance between the player and the fetch toy

#

if the distance > some threshold value (also in BB), then run fetch sequence, otherwise run "return to player" and "idle" sequence in turn

#

might want BB value for the "have toy" status

#

fetch toy sequence goes to position of toy, runs pickup toy animation, then sets "have toy" in BB

#

have toy BB entry being true, causes "return toy" behaviour to be highest priority

#

stuff like that 🙂

simple crest
#

TBH though: find and work through a couple tutorials first

ocean wren
#

Yep 🙂

prisma prism
#

@ocean wren thank you for the seudo steps. This is exactly what I wanted before going and doing a bunch of tutorials.

#

@simple crest yes, that is my next step is do tutorials. Any in particular that you have found useful for AI behaviour?

winged grail
mossy nexus
mossy nexus
ocean wren
#

CE: I guess that is part of the behaviour spec you'd want to work out beforehand..

#

Normally a dog would probably just look at you funny 🙂

simple crest
#

@prisma prism the pins probably have some decent starter material? not sure otherwise sorry. note that most implementations for BT's are similar across engines, so any generic learning resource on them would help you get started or help better your understanding of how to work with them in general

polar crown
#

Hello i have a system on my ai that chases the player. i want that to trigger only when it overlaps with a certain collision sphere on the enemy. I think i have it set up but its not working. any ideas?

#

i used to have the enemy follow the player regardless of there they are. They are still doing this and not following the overlap event

mossy nexus
#

are you using behavior trees?

polar crown
#

i am not no

#

using AI moveto

mossy nexus
#

do you have navmesh?

polar crown
#

yeah i have a navmesh, they currently chase me by default

zinc notch
#

Hello, I'm having a weird issue that I'm not sure how to go about fixing
I'm trying to make an AI using a BT that will chase the player, until they get to a certain range and then attack the player, thought it would be simple.
My issue is, the BT runs fine until it gets to the point that it should switch from chasing to attacking. I use a service to check if the player is in range, the service seems to run, the bool changes, the ai stop chasing you, but it seems to go straight through the sequence node and the just sits on the first task in the sequence, no matter which task I put first.

#

This is my BT right now

#

This is my isPlayerInAttackRange service

#

Here is to my sendtolocation task, I've tried all manor of differenct versions of this. The normal moveto, BTAI move to, changing this one, setting up different finish events

#

Here is my get player location

#

Here is where my BT gets stuck, after getting in range, the bool changes, showing that the service fired and has worked, and then it goes through the sequence, past the service and just stops there, forever

zinc notch
#

Okay, it would appear setting observer aborts to none, on everything seems to make it all work, I need to learn what the different observer aborts actually do because it's clearly not what I thought

mossy nexus
winged grail
# zinc notch Hello, I'm having a weird issue that I'm not sure how to go about fixing I'm try...

Hey, a couple random thoughts (I might be wrong if you've laid it out this way intentionally):

  1. Your isPlayerInAttackRange service never sets the bool back to false, so if it returns true once it will always be true.

  2. Your isPlayerInAttackRange is using receive activation, I can't remember if this is accurate, but I feel like receive activation calls the service once when the node is activated (maybe I'm wrong, I just know I've significant trouble with services when not running my events through the tick A.I. event).

Not sure if either of those will address the problem but it might help.

zinc notch
#

So the issue that stopped it from working was the observer abort was basically stopping everything when that happened, and I think stopping a tree with a move to in it starts getting funky. Also, the IsPlayerInAttackRange was correctly setup, with the output bool being set to the result of the lower than or equal too, but in my messy attempts to test and fix I ended up trying different ways to see if that was the issue and forgot to change it back.
Lastly your point about the isPlayerInAttackRange being fired once, seems to be correct this isn't an issue for my move to tree, which is fired every like 0.2 seconds. But this will be an issue for my strafing braches and others that are only called once... I didn't think of this so thank you for the heads up 😄

urban wadi
#

Anyone know why after unpossessing my AI does not work on Clientside but works on listen server

mossy nexus
stuck comet
#

anyone know how to make movement between 2 actor that "Move to Actor" each other smooth ?

urban wadi
#

@stuck comet so how would you achieve this?

stuck comet
#

for example if you want to to unpossess some pawn by using Input

urban wadi
#

@stuck comet i want to unpossess the ai after the death animation plays

stuck comet
#

then you dont need RPC

#

just use AnimNotify

quick sluice
#

Hello. I've got a very strange problem. I have a PlayerShip that I'm making AI for. If the player hasn't selected a location the vector is at 0,0,0. A service reads out the player vector and sets it in TargetLocation. Now when I try to find out if the player set a target the ship just disappears. If I add the first branch in the execution the ship disappears... any ideas?

misty wharf
#

I don't think this service affects the ship disappearing

#

Or rather, the combination of the position with whatever else the ship does is what causes it to happen

#

so it's kinda hard to say just based on this :)

quick sluice
#

It dispears just by adding that node.

#

But I understand it can be everything

#

But thanks for your help anyway

misty wharf
#

What does the ship do with the position?

quick sluice
#

It calculates a pth

#

path

#

the AI service

#

the ship doesn't do anything with the position

misty wharf
#

So nothing moves the ship or does anything else?

quick sluice
#

It does, there is an AI Task that adds a steering force to the next waypoint

#

Ill try remove that

#

and try again

misty wharf
#

My guess is that the calculation is wrong and the ship gets launched into the direction and that's why it disappears :)

quick sluice
#

Yeah could be

misty wharf
#

You can try seeing if the ship is still visible in the world outliner once it disappears, you can then detach from the player pawn and doubleclick the ship to see where it is on the map

quick sluice
#

Yup you were right

#

IT's in the add force thing

#

Thanks I can go further debugging now!

misty wharf
#

np

storm zephyr
#

@pine steeple i tried your code but it still does the same thing, did i do anything wrong?

void ADoor::OnSmartLinkReached(UNavLinkCustomComponent* LinkComp, UObject* PathingAgent, const FVector& DestPoint)
{
    UPathFollowingComponent* PathComp = Cast<UPathFollowingComponent>(PathingAgent);
    
    if (PathComp != nullptr)
    {
        PathComp->FinishUsingCustomLink(LinkComp);

        const FNavPathSharedPtr Path = PathComp->GetPath();

        if(Path.IsValid())
        {
            Path->Invalidate();
        }
    }
}
pine steeple
#

PathingAgent is not a path comp..

#

is it?

#

so it will be nullptr

storm zephyr
#

it is

#

i know that path invalidate runs

#

i've debug it

pine steeple
#

i mean it works for me so not sure

storm zephyr
pine steeple
#

not without debugging with breakpoints and visual debugger

storm zephyr
#

no problem, i'll take a look at it, just wanted to see if you could spot something wrong with the code that i missed

pine steeple
#

no i cant :/

storm zephyr
#

thanks anyway 🙂

misty wharf
#

One of the things that mildly annoys me about the pathing stuff with smart links is how do you use pathfinding within the smart link without invalidating any movement

#

I seem to recall if you do another move request, say to pathfind through the smart link, then it effectively aborts/ends any previous ones - so if you had say a BT Task asking the character to move somewhere... that has now failed because you tried to pathfind through a smart link

sage flint
#

Hello!
Is there any tutorials/useful articles on writing custom EQS tests? I want to filter out actors based on their attitude (ETeamAttitude)

stuck comet
#

anyone know why my AI sometimes trip over like that

misty wharf
sage flint
#

Yeah, that's what I'm trying to do rn

mossy nexus
stuck comet
#

LOL

stuck comet
mossy nexus
#

not at all

stuck comet
#

im using RVO,

mossy nexus
#

are you debugging your behavior tree?

stuck comet
#

i dont think it has to do with behaviour tree

#

look like because of RVO

mossy nexus
#

well it might

#

where do you request new locations for AI?

stuck comet
#

in my behaviour tree i use MoveToActor

#

ah i see

#

yeah you are correct

#

the problem is my behaviour tree

#

because after the target actor is dead, i put it below map

#

z axis -2000.0f

mossy nexus
#

oh lol

stuck comet
#

3 hour debugging for silly mistake

mossy nexus
#

we've all been there

#

at least it's hopefully fixed now 🙂

stuck comet
#

it should be

dark briar
#

Started learning and experimenting with AI perception. Anyone knows what exactly AI Team sense does?

misty wharf
#

It seems to broadcast the event to every AI which belongs to the team indicated in the event

#

but I'm not really sure what the intended usage is, because the event doesn't seem to carry any useful information.. it just has a field for AActor* Enemy

dark briar
#

So basically it just returns actors that belongs to the same team in the map? In the Documentation it says that it notifies when the "same team is close by". But I'm confused because i don't see any parameters related to that

misty wharf
#

As far as I can tell if you broadcast a AISense_Team event with the team set as TeamA (for example), it just sends the event to all AI's in that team

#

it carries a bunch of data like the position of who sent it and such, and an actor ref to "Enemy", but that's pretty much it, so I have no idea how it's intended to be used :D

#

Oh yeah it does check for range between target and you as well

#

the code for it is pretty simple

dark briar
#

ohh ok.. I'll take a look at the code. I want my enemies to stop colliding with each other's path. i am hoping that this will help

misty wharf
#

It might not.. you'd probably need to look into avoidance

dark briar
#

avoidance? can you tell me more about that? also to add more context, I have an EQS generated around the player and the enemies stands on it's respective weighted location. but right now, they are bumping into each other. so wanted to fix that issue

misty wharf
#

rvo avoidance and crowd avoidance are the options which are built into the engine

#

but I don't know if they will solve that specific problem, they're more about just avoiding colliding into actors when moving about

dark briar
#

ok, i'll look into that as well but i guess i have to write my own ai logic to try to avoid each others path as much as possible.

#

thanks for the information. saved my time 🙂

mossy nexus
dark briar
dark briar
molten cairn
#

how would I proceed to make NPC say something when they see the player, but make them not say it at the same time? How could I make only one say it instead of all if they detect the player at the same time?

mossy nexus
#

AI director or sound channels

#

sound channels probably the more correct solution in this case

crimson galleon
molten cairn
#

i think AI Director/Manager seems like the best way but how exactly?

mossy nexus
#

for decision making - absolutely

#

but sound should have its own sound architecture propagate correctly, regardless of AI

molten cairn
mossy nexus
#

digital sound has channels

molten cairn
celest python
#

I don't know much about sounds in engines, but wouldn't a simple sound/dialogue queue system work for his/her case? @mossy nexus

mossy nexus
#

but the idea is that you either have a sound queue and or a sound channel for NPC voicing, and if that channel is in use, the sounds either queue up or get removed based on priority or sound type etc.

#

so if it's a low priority sound like a bark, only a single sound would be used

#

but if it's game critical dialogue, there would be a queue

mossy nexus
#

along with a dialogue engine

#

I guess really it's an audio director at the end of the day

#

but w/e

celest python
#

Hmm, it looks like a nice thing. I guess not necessary for my project but still it made me curious about the 'sound channels' you mentioned. Maybe I'll look for it in the future

mossy nexus
#

also to be clear, this is for actual audio, which is separate for "physical" sounds, that the AI can react to

molten cairn
mossy nexus
#

the audio manager should decide yes

#

or director

#

w/e

molten cairn
#

and then play the audio at the NPCs location from that manager?

mossy nexus
#

IMO the best way to do it is to have a wrapped sound object that contains the sound + auxiliary data like the speaker, location, direction, and physical sound attributes like radius and allegiance etc.

#

then when the sound plays, the audio director could play the correct audio, as well as notify the AI director of any physical sound

#

although one could argue that the notify should happen on the sound object itself, but I guess it's up to how you do your architecture

molten cairn
mossy nexus
#

and the audio manager decides what to play when

#

you'd have different channels for different kinds of sounds, based on sound hardware

#

so NPCs or conversation would be one, ambient sounds would be one, music would be one etc.

#

basically a way to layer audio

#

but we're way beyond the scope of this channel. IMO you should ask #audio

molten cairn
mossy nexus
#

yep

#

so you don't play two pieces of music at the same time

#

etc.

#

two pieces of dialogue

#

or that one piece of dialogue can override and silence another

#

stuff like that

molten cairn
#

alright yeah makes sense…that’s my goal for now…thanks a lot, appreciate it.

mossy nexus
#

makes me think I should expand my perception system a bit. right now I have EyeComponents that are glorified scene components because I can't always guarantee that eyes on an AI will be where you'd expect them to be (especially for non human AI). I should probably make an EarComponent and SpeakingComponent as well

pine steeple
#

i used sockets

#

and ensured all ai had the same sockets..

#

cheaper than scene comps

molten cairn
#

uhh sorry if this is a stupid question but how do I get the controlled pawn location from an EQS blueprint

mossy nexus
pine steeple
#

no but you query them from the mesh (static/skeletal)

#

then i do traces from that

mossy nexus
#

sure but that requires everything to be setup at a mesh level

pine steeple
#

yeah but thats easy

mossy nexus
#

and to be fair the components can be discarded at runtime for their transforms

pine steeple
#

we use the eye sockets/eye bones for other things also (in the animation)

#

so it just makes sense to use those

mossy nexus
#

sure

#

I think generally for something more humanoid it's fine

#

but I'm dealing exceedingly with composite actors that aren't just a single mesh

#

so this kind of disjointed approach doesn't lend itself well to a single skeletal mesh, let alone static mesh

crimson galleon
molten cairn
crimson galleon
#

the EQS returns the successfully chosen node, as far as accessing it in bp i dont know

#

the link above may help, but I think most applications of EQS pairs with BT instead of BP

misty wharf
#

EQS in BP's is easy. You use the Run EQS node, which returns an EQS query. The query has an event dispatcher you bind to

#

You can then get the result via the event, and get it either as locations or actors

molten cairn
#

oh I found out how, thanks!

rotund charm
#

Does anyone if the AI sight/perception stuff takes into account the light level? Is there any way of debugging what the AI controllers "see"?

mossy nexus
#

as for what AIs see: I don't know that there's any better way than "printing" the vision.

rotund charm
mossy nexus
#

sure. debug cones, values for alertness, targets being sensed. the whole shebang

#

or I shouldn't get ahead of myself. I use debug cones because they pertain to how I do perception

#

but I don't know what the perception requirements are for your project

rotund charm
mossy nexus
#

I think I'd do a cursory search for light level based AI too if I were you. those approaches were the ones I found, but perhaps we're in a different time now where other approaches have been discovered

uncut rune
#

Hey guys, so I recently stumbled upon a very subtle bug in the AI sight perception system. On very rare occasions, the sight perception system will trigger that it successfully sensed a stimuli source (in my case the player) even though the source is nowhere near the bounds of the sight cone. This sometimes happens even when the source is blocked by multiple meshes from the AI character's view. This seems to happen rarely and I couldn't spot a pattern to it. It just happened randomly so it was almost impossible to debug. I ended up implementing my own custom sight perception, but I'm wondering if anybody else had experienced this anomaly as well? \

simple crest
# rotund charm It's a 2D stealth proto with v basic guards patrolling around. We want to have j...

I've always wondered how Thief 1/2 did it. my thinking has always been that I would figure out some way to build a scoring system for every light... light's score goes from 1 to 0 as a sample point moves from bright to dim regions of light's coverage. A system would constantly track which lights are near the player and add up their scores to the player's position (also scoring zero if there is no LOS from the light to some point representing where the player is, e.g. linetrace to the player's location a bit above floor height)

Other way I wonder if Thief did it is by precomputing an entire map and building something that looks like a navmesh, overtop of a normal navmesh (navigable area), with each polygon having an assigned total brightness level. That idea doesn't work well with dynamic lighting though.

crimson galleon
# simple crest I've always wondered how Thief 1/2 did it. my thinking has always been that I wo...

The engine Thief runs on, aptly named Dark Engine, was built from its core to pay attention to light calcs. The engine did not age well and could not scale for higher resolutions. Innovative for its time, the lighting calculations are impressive compared to other engines of the same time. It would calculate lighting intensity on the player if the light is marked as "dynamic" essentially a fully mobile light in Unreal. When Thief 4 was developed, using Unreal, it did not implement the same accurate lighting calcs, instead it was zone and triggered based along with some watered-down ray cast checks. The dev process demanded more of the lighting that the engine could not naturally support.

simple crest
#

is that a quote from a website or something? it doesn't really have any useful info

#

(I know the Dark Engine more or less used the light value of the floor you were standing on)

#

(and yeah thief 3/4 were asstastic worldstar )

crimson galleon
#

yeah, best info i could find since the only way to know the tech is to get the game (its free now!) and crack open the engine.

grizzled bolt
#

How I have been doing AI sight with light is my player has a float var (Visibility), and the light sources in my level have their own colliders for detecting overlapping. If player overlaps with the collider, do traces to a specific socket on the Player, if hit then simply do some calculation and increase the var. If there are multiple overlapping colliders, select the highest value. Then in my AI sight code, I simply check if the variable is > certain threshold

#

Worked pretty well for me so far

ocean wren
#

The way you'd do the "light" stuff these days, is to render to texture from the lights point of view using the current light shadow map depth texture and render the character from the lights viewpoint doing a depth test, the pixels that aren't blocked by other geometry are the pixels the light can "see" from its point of view, so the proportion of those pixels are the amount of light the character is in (direct lighting at least)

#

most cheap implementations just raycast from character capsule to the lights

#

or raycast from points on the character to the light (using different points on the character over time to give some stochastic value to it)

#

light level would then be "percentage of recent light raycast hits"

mossy nexus
mossy nexus
#

also let's never forget the Russian version of Thief, Stalker 🙌

#

(which had fantastic AI, when not buggy)

ocean wren
#

Thing is, for current AAA engines at least, you already have depth values from shadow casting lights, because thats how they compute shadowing (using shadow maps), so as long as you can grab the shadow map for each light, you can do the proper per-pixel lighting calc

simple crest
ocean wren
#

Was thief lighting entirely dynamic or was it based on lightmaps?

#

Ah yeah, it was dynamic because they had the water arrows right 🙂

simple crest
#

I don't think thief had any moving lights but stuff could change during gameplay yeah

ocean wren
#

Well, might as well do a better job than a worse one, it wouldn't change the behaviour, just look more convincingly "right"

#

Hm, so you could use lightmaps baked for on/off versions and store those.. then sample from the nearby lightmaps for approximate illumination values in space

#

OR, I guess you could do some light probes and pre-bake those like we do for irradiance caching in UE (pre volumetric lightmaps at least)

#

In current UE4 builds, you could use sampling of the volumetric lightmap and just increase the voxel density to get approximate lighting values in 3D space

#

or read the shadow maps 🙂

#

Modern render pipelines are freakishly powerful 🙂

#

And sadly devoid of artistry 😉

misty wharf
#

I think there's a big warning label on the function which lets you read from render targets and such about how it's very slow so makes me wonder how some of these would be done

#

I mean it's not slow enough to immediately be a problem but still

ocean wren
#

slow to transfer from GPU to CPU, so you could do a compute shader to actually compute the light value

#

do it all on GPU

misty wharf
#

I wonder if that requires a source build of the engine

#

:P

ocean wren
#

You'd do it by downsampling so you'd just have a low res version of the shadowmap etc.

misty wharf
#

I've seen one or two articles about compute shaders but it seems like another of these things which is rather poorly documented and at least I would have no clue how to do that lol

ocean wren
#

Well, its like anything in UE, its hard until you know it 🙂

misty wharf
#

lol I guess so

ocean wren
#

We know its possible, so its just a matter of willpower

mossy nexus
#

I quit Looking Glass for a time; during my absence hardware acceleration support was added. (I came back and added support for colored lighting in the lighting generator and maybe the surface cache or something.)

simple crest
#

most important quote But I don't know if we shipped with this or using the "check the lightmap value on the floor", which I seem to recall we at least considered using for the player's visiblity to guards (to avoid players being tricked/confused by places that appeared to casual inspection to being in shadow).

#

😄

#

that's definitely what they did, I remember hiding in super bright places just with dark floors

#

and that quote highlights what I was talking about earlier, where in some cases stuff being "made better" or more accurately etc. can result in worse gameplay

ocean wren
#

Yeah, makes sense for the time, lightmaps were pretty defacto and sampling from them was a simple matter

foggy folio
#

Hi guys, Found a really good video from a Square Enix AI dev https://www.youtube.com/watch?v=BV2GTGbSjq8&t=2426s
Unfortunately, it's only in Japanese, It will be great if anyone can help me out with translating this into English. Ping me personally we can discuss further on this. If anyone is interested

ocean wren
#

I saw the original presentation in english if that helps

#

One of the sqeenix guys did a talk at either the aiGameDev.com conference or Nucl.ai conf (it changed its name)

foggy folio
#

Really? Can you give me a link?

ocean wren
#

sadly not, Alex let the site die, so the videos aren't available anymore

foggy folio
#

damn me 😦

ocean wren
#

yeah, was an amazing resource, but I think he got a bit bored of doing game AI for so many years 🙂

foggy folio
#

Currently working on Enemy AI on a hack n slash game. Its so hard to find relevant information on EQS. Everything i find its just so basic

ocean wren
#

Yeah, the TLDR from the talk was basically "we use EQS a lot" 🙂

foggy folio
#

@ocean wren Yeah i know, that's what i wanted to know 😦
Let me know if you have any other resources which can help my situation here. That will be so great

ocean wren
#

have you tried the automated subtitles 🙂

foggy folio
#

I tried that. its straight garbage

ocean wren
#

Yeah, it really is 🙂

#

The thing I remembered most from the presentation, was that they did a lot of layered eqs queries.. so lots of dot products to weight specific points and lots of distance values latered on top.

#

You can kind of see that in the "DOT" video.. dot product to select an attack quadrant, another test to determine proximity to player, another to bias towards the outer selection etc.

#

So they got that sort of spiralling quality using changes in the dot product biasing

foggy folio
#

Yeah i figured that by presentation images. but thanks for your help 😄

ocean wren
#

the next bit is just running subtrees inside the main behaviour tree

#

Is there a specific bit you're interested in? or is just the EQS stuff in general?

#

I forgot about that utility stuff 🙂 hahaha.. I do the same kind of thing 🙂

mossy nexus
#

and water arrows?

#

dual lightmaps?

ocean wren
#

bake different lightmaps

mossy nexus
#

seems weird

ocean wren
#

yeah, they weren't like movable lights right? so you could just calculate multiple lightmaps

mossy nexus
#

true I suppose

ocean wren
#

I mean UE4 has that now right.. with the lighting scenarios

#

We used it on Ground Branch for day/night versions of the ship level etc.

mossy nexus
#

tbh I was thinking about seeing if one could do a prerender of a navmesh style mesh and use that as a layer for light attenuation

#

might be cheaper than texture lookups

ocean wren
#

Well, the textures were likely in main mem anyway, so lookup was likely just a hash value lookup into a lightmap set

mossy nexus
#

that was back in the day

#

I meant for now

ocean wren
#

I'd have thought with modern UE you could just sample the volumetric lightmap for it

mossy nexus
#

assuming no support for compute shaders

#

isn't that still texture lookup?

#

or is it the same case of it being in memory?

ocean wren
#

No idea on that one.. but they're already sampling from it for dynamic mesh lighting anyway, so I suspect it'd be fast enough for this

mossy nexus
#

I suppose

ocean wren
#

As with all UE, you'd have to try it out 🙂

surreal fable
#

Hey guys! Just a quick and potentially very noob question about EQS: Is running a simple EQS "Find safest movement direction for AI" a bad idea for performance? this would be running every .5 seconds and basically just returns 8 items representing a potential move direction (I then score those locations for what is the safest/ is least threatened by enemy factors in the AI blueprint)

ocean wren
#

No, thats fine

surreal fable
#

ah fantastic! Thanks for the info 🙂

ocean wren
#

If you're concerned, just profile it 🙂 i doubt you'll see anything with that kind of workload

uncut rune
#

Is there a way to force an AI to recalculate its current path? 🤔

molten cairn
#

why does the eqs return false even if it's traceable to the player?

crimson galleon
molten cairn
#

well when I try to use this node, regardless if I put it on Filter Only, it still returns places on the grid that are visible by the player. Its not that it's entirely not working, its just really unreliable @crimson galleon

molten cairn
molten cairn
crimson galleon
#

thank you, is this the only thing in your EQS?

molten cairn
molten cairn
#

so it creates a grid and looks for points not visible to the player

crimson galleon
#

i think you need a scoring of some kind, no?

#

and do you see the line trace happening in game with it succeeding?

#

you may also want to try turning off bool match, though i think that will ignore blockers

molten cairn
molten cairn
crimson galleon
#

this might be better to perform as a service rather than EQS, is there something that EQS offers that a bp or cpp line trace wont?

molten cairn
#

its quick to set up

crimson galleon
#

haha, well its not great to debug

molten cairn
#

true, but what I noticed is that the eqs linetrace is not accurate either

crimson galleon
#

you could do a line trace in the service, set the bb key, send that to the EQS so the AI can navigate to an area nearby or something of that

#

ive not tried the line trace method with EQS, though i think thats because im using ai perception

molten cairn
#

any ideas

crimson galleon
#

just one

#

its more of a study to concept though

#

and i dont recall the time code, but cover AI is discussed

#

probably around or after half way if i had to guess

molten cairn
crimson galleon
#

is it safe to assume that a line trace will be cheaper than an EQS query, in a case where both are ran every 0.5 seconds?

foggy folio
ocean wren
#

EQS can run line traces.. so not much in it.

#

If you're having trouble with EQS Queries, look at the EQS Query Pawn, which allows you to debug them

molten cairn
#

can u write eqs tests in blueprint?

misty wharf
#

I think there's a EnvQuery Test BlueprintBase or something like this in the all classes list when creating new BP's

#

Oh sorry

#

generators have that bp base class

misty wharf
#

tests do not

molten cairn
#

yeah that’s what i meant

#

so there is no way to do eqs tests in bp?

misty wharf
#

Don't think so

#

It's fairly simple to do in C++ though, you can pretty much just copypaste one of the existing ones as a base and just modify it to suit your needs

molten cairn
#

yeah I wanted to keep my project BP only but there’s no way around C++ i guess

misty wharf
#

Yeah there's no reason to avoid it :)

mossy nexus
#

if you're doing AI cpp is necessary

#

also you want to have access to subsystems

crimson galleon
crimson galleon
# molten cairn yes, I just checked that myself. A line trace uses around half the cpu time of a...

thanks for checking as well, I know zoombapup said that line traces can be done in EQS, so maybe this is a pointless question. Just curious what kind of overhead EQS has. I suppose it depends on what it does, like a grid search and such. Just trying to decide if an EQS would be light enough for 10+ AI to use to check things that a line trace may be able to solve instead at the same interval. I guess the only way is to test it.

ocean wren
#

So the point of EQS is that it does all of the functions, like line traces and angle checks and proximity checks etc, but it does it a few items at a time and over multiple frames, so its basically timesliced and therefore a bit more tweakable performance wise.

crimson galleon
#

that's very good to know! I read some conflicting points that EQS runs on a separate thread, but then someone else said it was on the same thread. Maybe this is the confusion of the idea.

ocean wren
#

Yeah, I dont remember it doing any threading, just did a measurement of time cost and exited once the cost reached a certain threshold, with it resuming the next frame etc.

misty wharf
#

^yeah this is how it works afaik, the costs are configurable

crimson galleon
#

Cpp configurable only?

misty wharf
#

I think it's in ini files

crimson galleon
#

Oooo

#

Thats better news for me

#

Thanks for the info zomg, zoom and cascade

molten cairn
#

i still haven’t found any reliable way to create cover points…so what I tried is to make a grid, get only points overlapping with cover at a certain height and checking if visible by player but somehow it still doesn’t work. The Agent either doesn’t go to the point even if it’s set as winner, or the EQS chooses a point which is visible to the player. I tried everything but nothing seems to be working. Any suggestions?

winged grail
ocean wren
#

Have you tried debugging the EQS query with the EQS Query pawn?

molten cairn
winged grail
#

I don't know if you've had a look at that, but I've seen it mentioned a few times, and I believe there is a github project if you wanted to mess around with it and get some ideas.

ocean wren
#

Are you sure? I used it a fair bit without a player active.. but its been a while

molten cairn
ocean wren
#

might have to run in simulation mode

molten cairn
ocean wren
#

So use another pawn for the context

#

and just check the logic of the query

#

basically, give it a different query context which returns a target pawn or something.. and check that you;ve got your scoring and generation right

#

Thats how I use it

winged grail
#

Quick example of what I think zoombapup is saying (I use the same method for testing EQS queries).

#

Let's me set whatever I want as an EQS target and makes debugging super easy.

ocean wren
#

Preach 🙂

molten cairn
#

alright, I just did this. It seems to work showing the debug points but the tracing is still way off…some points without cover are green as if it’s hidden by something but it’s literally not

ocean wren
#

Are you sure its tracing to/from where you expect?

molten cairn
#

yes definitely cus I even see it working. It’s just inaccurate and unreliable

molten cairn
#

they are so unreliable

winged grail
molten cairn
crimson galleon
#

iirc, death stranding would line trace from the AI and from cover points that the AI found to determine if they were in cover or to validate cover

winged grail
#

Does anyone else encounter an engine freeze when binding the "number of points" in an EQS "On Circle" call? As soon as I go to edit the value in my EQS Pawn the editor locks up (just tested in a fresh project).

mossy nexus
#

if no, it's probably an ensure

winged grail
#

No I wasn't, I was just running straight from the .uproject, but I just launched via Visual Studio and got the same behaviour.

simple crest
#

what does "locks up" mean though

#

do you have to ctrl alt del kill UE4Editor?

ocean wren
#

Have you tried it in an empty test scene and added test colliders to that?

winged grail
#

I'm using UE5 right now so it's possible it's a bug there, I'll try to troubleshoot it some more tomorrow but was just curious if anyone had encountered it.

ocean wren
#

I'd not use UE5 yet

simple crest
#

i'm sure they can grease their way through it

ocean wren
#

It's bound to be a trainwreck for a while though bugs wise.. I mean UE4 isn't the most stable platform anyway.

simple crest
#

but... their name... their name!

ocean wren
#

I was trying to ignore that 🙂

#

Wouldn't it be amazing if you could just grease bugs away 😉 lubricated programming 🙂

winged grail
#

Lmao, sometimes you’ve just gotta slide into the situation and hope you can grease the wheels enough to make things work.

#

Also, I appreciate the advice re: the engine, but I’m a loooong way away from any type of actual release and I’ve done a large amount of the legwork so far in UE4.

coral mesa
#

Blueprint Runtime Error: "Accessed None trying to read property CallFunc_FindPathToLocationSynchronously_ReturnValue". Blueprint: HorseBP Function: Execute Ubergraph Horse BP Graph: EventGraph Node: Set Path Points
Why UE4 always throws out this error everytime I try to pathfind?

molten cairn
ocean wren
#

Given how many have used EQS and had it work, I suspect the latter. But the main question is how to debug it. Have you tried looking at the EQS code to see what values its using in the C++? If you're having an issue with this, then I'd break out the debugger and step the EQS code to see whats going on.

#

It doesn't do anything fancy with line traces. If line traces are failing, you've got something weird going on.

simple crest
#

Sounds like line traces weren't given a start/end height or weren't set to ignore the player pawn or something

ocean wren
#

yeah, something weird

spring inlet
#

is there anything built in unreal which could be used for fish AI movement?

ocean wren
#

No

#

If you want a longer answer... "hell no"

spring inlet
#

ok, i got a actor component for that which does it, but it's kinda wonky -.-

#

so guess i'll have to fix it

ocean wren
#

sounds about right

#

steering behaviours work well for fish

#

just make sure to keep them in an octree and only steer against nearest neighbours in the tree, multithread it and you're good to go

spring inlet
#

yea the problem that script has is that the fish sometimes swim outside of my aquarium 😄

ocean wren
#

fish will do that you know.. if the aquarium is made out of imaginary glass 🙂

#

seriously though, this is a pretty simple problem to resolve with optimized steering. I'd even be tempted to do a particle-system-only version these days

#

given niagara has decently programmable stuff

spring inlet
#

well, it's weird they escape even tho they are in an enclosed box of collision boxes

#

xD

#

fricking fishys

ocean wren
#

Always better with chips I find

#

and a little bit of salt and vinegar

#

Maybe they are ghost fish?

spring inlet
#

nah, figured out the fish had only blockdynamic collision

ocean wren
#

not block fish collision? I see, well there's your problem

#

easy fix

misty gale
#

Opposing force the closer to the bounds they are

ocean wren
#

yep, steer away fishies, steer away!

spring inlet
#

yea that fish movement component does a lot of line traces to predict collision, not sure if theres a better way

misty gale
#

We made some niagara system for our fish cages,

#

Not very ai like tho

spring inlet
#

the niagra particles kinda drift away when they hit a collision?

misty gale
#

Then again 200k fish dont go well with ai

spring inlet
#

yea, i'm using like 10-20 fishes

ocean wren
#

you should be able to get a few million going really

misty gale
#

Luckily our pen is circular :p

#

True, but then they look super crowded

ocean wren
#

yeah, no need to do it, other than because 🙂

#

niagara is definitely the way though

misty gale
#

The pen is only ~40 odd meter radius

ocean wren
#

plenty for a few million tadpoles

misty gale
#

My gfx maxed at 1.5m :(

#

Or maybe the particle did.. dunno, started going slow

#

Luckily i only need a fraction of that for my actual game project. Was thinking GOAP for the AI

ocean wren
#

goap for fish? that's a touch overkill

#

I doubt they have very complex plans 🙂

#

Goap is VERY old now btw.. most people prefer HTN planners these days.

misty gale
#

Not doing fish for the game :p

ocean wren
#

and HTN planners are pretty old school too

misty gale
#

If its good flexible and fits my need, age doesnt concern me that much :p

ocean wren
#

well, me neither, but if there's a better approach I prefer to use it

simple crest
#

whatabout utility ai shrug

ocean wren
#

I like utility for some things.. but I don't like the idea of using it for everything

#

lots of redundant computation going on with utility really

misty gale
#

Reading about it htn sounds very close to goap tho

ocean wren
#

Well, Goap is a planner.. there's a lot of replanning if your plan gets out of date

#

Utility is simpler, in that it basically always replans 🙂

simple crest
#

goap is quite a bit more complex IMHO

#

for often very little benefit (definitely does depend on the specific use case, these are all different tools for sure)

ocean wren
#

yeah, I mean they're both pretty simple in reality, but GOAP has a lot more problems with dynamic environments if you have any real complexity of decisions

#

I just prefer HTN approaches for the planner methods.. just feels simpler

#

I mean GOAP was out of date about 10-15 years ago 🙂

simple crest
#

I don't really think I have any redundant computation going on with my utility AI ... I mean, unless two totally separate decisions happen to use the exact same scoring criteria just by chance

#

but I don't think the frankenstein I came up with exactly matches many common articles on it

ocean wren
#

well, to be responsive you have to have access to the data to score the decisions, so in order to test the decision utility you have to run the computations, even if they're discarded

misty gale
#

Doubt mine will be considered advanced by any stretch of it either , so complexity should be close to 0 i think

#

Altho as you say, alot of replanning when the plan is old

#

And for 1500 actors that could in worst case be quite often

ocean wren
#

most games plans don't last very long in reality

#

if you're doing 1500 actors, it'd make sense to aggregate some decisions, or use sparse sampling or something..

simple crest
#

1500 AI is going to be too many for any common complex solution tbh, that's approaching full custom everything territory in more ways than one

ocean wren
#

I guess it depends what the 1500 is meant to do

misty gale
#

Yeah i think that part is gonna be the most challenging , but yet again, it should be fairly simple decisions, seen isolated atleast

ocean wren
#

I mean if you can shove it all in a compute shader, 1500 should be relatively trivial computation wise

misty gale
#

But then again, anything x 1500 can get expensive

#

Yeah thatd be great

ocean wren
#

yeah, you need to optimize for your use case with 1500 of anything in UE 🙂

misty gale
#

Im planning for 1500 ,

#

To give myself some headroom

#

Actualy use probably limits around 500

#

The things itll do is simple really. Doing chores, reacting to a few external factors, and a few internal ones

#

Chop tree, move tree, sleep when tired etc etc

simple crest
#

I guess I actually don't really know much about HTN technically, I should learn about it while I'm on the throne sometime. I'm just running my utility scoring on a separate thread right now, which just means the AI takes a frame or two to update their running actions when the world changes. but yeah, I agree if you have 30 decisions then they might all have to run some complex maff and it feels kind of like there should be a smarter way to cull

ocean wren
#

Well, for that kind of decision, you can just have it take a while to resolve a plan, so you're not tied to "fully realtime reactions" right?

misty gale
#

Exactly

#

The only realtime i got is player overrides

simple crest
#

500 is still tough just for character movement even aside from AI lol

ocean wren
#

I doubt it'd make any difference how you choose to do it, goap, htn, utility, bt would all work

misty gale
#

I got that part covered

ocean wren
#

well, yeah, the CMC is the culprit there right

misty gale
#

Not using cmc at all

ocean wren
#

sod all to do with AI 🙂

misty gale
#

Im planning on using vertex animated instanced meshes

ocean wren
#

good plan

#

those are fun to play with

#

there's that Epic livestream where they did like RTS units using it.. fun stuff

#

mind you, they used niagara for theirs

misty gale
#

Yeah was about to say

mossy nexus
#

can you show your behavior tree?

pseudo drum
#

yea

#

u remember the tag game right?

mossy nexus
#

I don't really, but just show me the BT

pseudo drum
mossy nexus
#

which part are you testing?

pseudo drum
#

the get actor position

mossy nexus
#

ok I don't think the decorators are set up correctly

pseudo drum
mossy nexus
#

your order is also incorrect

#

highest priority is leftmost

#

in this case all you really need is the IsActorIt

pseudo drum
#

ok ill take out the other condition tree

mossy nexus
#

the path where the actor is "it" should be the highest priority

pseudo drum
#

well i need the other condition so i can have my actor move around until it sees another

#

i swapped the two

#

so whats wrong with the decorators

mossy nexus
#

think about this

#

you only need decorators if you want more paths to be different from the lowest priority path

#

the lowest priority path doesn't need decorators

#

it will happen automatically by virtue of all the other paths failing

#

that's the fundamental idea behind the behavior tree

#

in this case, there are probably two paths

#

either an AI is "it", or they are not "it"