#gameplay-ai

1 messages ยท Page 54 of 1

dense owl
#

Ikr

#

โ€œI learn by teaching othersโ€ can be a tad problematic sometimes

heady coral
#

Can anyone help me with this

dense owl
#

Sounds like youโ€™re describing a collision issue but ๐Ÿคทโ€โ™‚๏ธ

heady coral
#

The thing is I am trying to create a Cover system Eqs in unreal as you can see in the image using overlap box but when using EQS testing pawn it is also creating points that are colliding with a pawn

#

I only want it to go near world static objects

#

only

dense owl
#

I seem to remember Luthage saying the testing pawn has some issues

#

also no idea what the testing pawnโ€™s collision settings are

#

Either way, try testing differently

heady coral
#

Like how Should I test it differently

dense owl
#

Likeโ€ฆ with a regular pawn

strange needle
#

Is there a way to delete just a single entry in task or transition within a statetree? It has yet to become an issue, but I can see myself needing to remove something I no longer need; Do I just leave the entry blank and hope it's not too much an eyesore? (Because I will)

misty wharf
#

Huh? Isn't that just a regular array editor so you click on the little arrow icon and it should allow deleting it?

white cobalt
#

I have two character classes, with AI perceptrons. The Friendlies and the Virus's. I want them to hear each other, but for some reason they don't sense each other. Why?

#

Here is the code in the Friendlie Character

#

Here is the code for the Virus Character

#

Here is the code for the Friendlie AIController

#

Here is the code for the Virus AIController

#

Ok, I worked on something else, and now their sensing each other, so.

uneven cloud
#

There's a pinned GDC talk that's about picking the right architecture for your project. It also has a table that shows the pros and cons of each one.

I haven't had the time to really look at state trees yet. They aren't ready for production and I'd already decided on our utility/BT hybrid when they came out. From what I've seen, I really don't like it but it's a better option for those that can't grasp the concept of a BT.

uneven cloud
uneven cloud
olive prism
#

Thanksss!!!

#

I'm going to look at this documentation, I didn't know it existed.

uneven cloud
#

No. You'd have a BT task that gets all the attacks from the pawn and picks the best one. Then another BT task to execute it. Though tutorials would never get that "advanced" ๐Ÿคฃ

white cobalt
#

Ok, I am very frustrated right now. I have these two character classes, Friendlies and Viruses. They make noise. I make them play sound at location. I want them to hear each other. When the viruses hear the friendlies, they go to the noise the friendlie made. I am stumped. I am struggling with the behavior tree. When the Virus hears the Friendlie, they go to the sound location. I can't get the blackboard value to update.

crystal sequoia
#

Sorry to necro this old thread but to you have any idea why this is off by default, is it very expensive for some non-obvious reason? It seems like expected behavior for this to fire and quite confusing that it requires a project setting. it also seems like something that should fire reasonably infrequently if you have a reasonable max age and thus not something I'd expect to be a performance hog. I find the event useful, but want to make sure there isn't some major hidden cost to turning it on.

uneven cloud
dense owl
dense owl
uneven cloud
uneven cloud
vernal oasis
#

state tree question: how does hierarchy work with transitions?

for example, imagine I have a state "attack" that runs until my AI character gets a retreat signal from an external coordinator. within attack there are multiple sub-states to position the character, do the attacking logic, etc.

is it sufficient for me to put the "transition out of this state when I receive the event 'retreat'" at the parent "attack" state or does this need to be put into each child state of "attack" as well?

hybrid niche
#

im trying to make my ai go through doors and im unsure how

floral compass
vernal oasis
hybrid niche
#

im trying to make a horror game and i want the monster to hear chase roam and open doors would anyone have a yt tutorial on any of those things

floral compass
hybrid niche
floral compass
# hybrid niche im a bit new to this could u explaing chase/roam and open doors

In BehaviorTrees you have the "MoveTo" node.
With Roam you'll just pick random points in your level around the character and use the MoveTo node to move there.
With Chase you'll pick the player's position and use the MoveTo node to move there.

"Open doors" can be implemented in multiple ways, off the top of my head I'd just play an animation on the monster, give the animation a notify and play an "open" animation on the door when the notify is triggered

#

But all of those are tightly linked to Behavior Trees (or state trees if you prefer)

velvet yacht
#

can i call btt within another btt

floral compass
#

Can? Maybe
Should? Doubt it

velvet yacht
#

i want when the ai can't chase anymore to do something else, not sure what the best way to do this is

dense owl
#

Thereโ€™s nothing wrong with running subtrees, if done right

velvet yacht
#

because when it finishes execute, it just gets stuck in a loop when player is unreachable

#

do i need to use a decorator or something?

floral compass
dense owl
velvet yacht
#

so any suggestions on what the best way to handle this is? i kinda figured something out but the behaviour tree is conflicting as the player is in sight, but unreachable, so it keeps aborting and starting again

floral compass
# velvet yacht do i need to use a decorator or something?
velvet yacht
#

Thanks, I will have a read

floral compass
#

It depends heavily on how you're setting the target location in your blackboard

velvet yacht
#

i just feed a reference to player in the aic

#

blackboard then stores the variable and i use it

misty wharf
#

Also be wary of repeated looping of a node that finishes immediately - this can have a noticeable impact on performance, but maybe it's not so bad when it doesn't have to search through multiple nodes for it

floral compass
velvet yacht
#

could do decorator target is not set but tbh it's not working and also it's giving me a headache

floral compass
#

You have to conditionally unset the target, then MoveTo's observer will abort it

misty wharf
#

I mean the decorator failing would abort the MoveTo node so I'm not quite sure why it wouldn't work like that

#

I seem to never have any actual usecase for the parallel node so just curious lol

floral compass
floral compass
#

The execution, yeah, but not the task doing the movement

misty wharf
#

I'm fairly sure it should, if aborting the MoveTo BT node doesn't abort the task that seems like a rather strange oversight

floral compass
#

I mean I can try it

misty wharf
#

I guess it's possible it might not, but at that point personally I feel like I would rather make a new MoveTo node that handles it correctly :)

floral compass
#

Too much work for me ๐Ÿ˜›

misty wharf
#

heh

floral compass
#

I'll try it later though and report back

misty wharf
#

Also regarding the perf thing - I had a scenario in my code where an idle AI was repeatedly just going back to its "do nothing" BT branch which was effectively just a node that did absolutely nothing

#

I had a bunch of them idling in the level and they all kept looping into the idle node over and over again

#

I was doing some profiling in Insights, and the "BT Search" cost was quite high - I replaced the do nothing node with a Wait that had some random time on it, and it immediately got rid of the BT Search cost in the frame almost entirely

#

But in my case it would've gone through at least a few other possible branches during the search, so the cost of the search would probably have been higher than in a loop where it just has that one node and nothing else to consider

dreamy surge
#

For some reason my AI gets stuck in attack mode and the simple node isn't making it work

uncut rune
#

I'm doing ''ai'' with behavioral trees for my units in rts game. It's gonna be quite simple thing, like if player click on enemy, it sets it on target and as long as the unit has target set I want the unit to follow > check distance > attack etc. So now what I'm brainstorming is, because I have Units that can be both, ran by player and ran by computer or by 2nd player (mutliplayer game).
The question is about general approach.
Should I create universal AI for unit, and then everyone can use it in the same way (it's kind of like I'm creating a way how the combat between units looks like, when they retreat, when they engage, when they are idle etc.)

Or should I create different AI for the player, different AI for the enemy and different ai for the 2nd player? Or I will be actually able to use the universal AI for general behavior of all units, and then maybe I could make ''computer'' ai a little bit harder / different than the ''universal one", so you know, it looks like pc is trying to do something better from time to time.

uncut rune
#

Is there a big difference in the base in DetourCrowd and NormalAi?

uneven cloud
misty wharf
uncut rune
misty wharf
uncut rune
#

And If I could ask, i'm thinking about future already, but are things like, let's say I want for my warriors to have mechanic, that every 1 hit they gain stack of bersker, which gives them 5% boost of dps etc. There is max set of stacks, and also if they don't attack in some amount of time, they lose the stack.
Is this a mechanic I should create in just blueprint (maybe as component?), or this is something I should create with behavioral trees?

#

or I will want for the archer to every 3 hits, deal aoe dmg at the target where it shots, for example

uneven cloud
uneven cloud
uncut rune
#

but If I'm doing 'attacks' on behavioral tree I can give info to the unit that it actually hit so I can count how many hits it made? and mind it that these are units, so it's not a 1 character.

#

I guess this I can somehow solve, so nvm.

uncut rune
#

More details or like perfect example how I want the gameplay to look like?

floral compass
#

@uncut rune I'm not an expert at all, but maybe my setup will give you some hints or inspiration on what you could do:
My BehaviorTrees don't really contain any logic in terms of animation, or gameplay rules or whatever. All they do is request movement using MoveTo and then activate an ability (GAS) that may or may not be available.
This is the same thing my player is doing: requesting movement via input and activating abilities via GAS.

Then your behaviors become very generic "commands" and the AI is agnostic of how exactly it is supposed to do something, but only needs to care what to do and when to do it. This means that whatever your player can do, your AI can do, too. Varying AI enemies is then just a question of tweaking variables on BTs or injecting new subtrees.

Attached is a very simple "Go to target and pick it up" behavior in my project as an example. The AI moves to a target actor, activates its "PickUp" ability (which is exactly the same ability the player is using) and then handles success/failure accordingly.

uneven cloud
uneven cloud
uneven cloud
uncut rune
floral compass
uneven cloud
floral compass
uneven cloud
floral compass
uneven cloud
floral compass
uneven cloud
# floral compass What would be optimal then?

It's optimal to have the task that triggers the ability to also wait for it to end. Then use the abort functionality of the BT task to cancel the ability. If you are using BPs it's the Receive Abort event.

floral compass
olive prism
#

What is a good way to make my AI start blocking attacks?

dense owl
lament bramble
#

How can I integrate the Wrestling part into the Enemy Behavior Tree like this. I had Animation. Thank for helps

celest python
#

man that looks painful af lol

#

this is more than BT though

#

this is basically A-B sync between two animations where code checks for a specific input

harsh storm
#

And I am doing it in a MP context ๐Ÿ˜ญ

#

Still haven't gotten it right.

#

This is RE3 remake btw Eren

celest python
#

didnt know it had remake too

uneven cloud
uneven cloud
harsh storm
lament bramble
#

thank you, i'm learning it

celest python
#

as long as desync kept within 0.2ms which always happens

#

cant you get away with server being a bit ahead of server

#

either way, god of these things are vori

#

might wanna ask him when you see him around but its very rarely he visits slackers anymore ๐Ÿ˜„

olive prism
#

Hello
Currently, I have a small combat system, which what it does is that when viewed with the Sight sensor, the AIController changes the character's state to Attacking; When this happens, he basically hits and strafes for 1 second.

There is something I'm seeing that is wrong, the Attack and Strafe occur because I can't execute anything else since I don't have the enum at any value that the Behavior tree can take

It is highly recommended (According to what I read and I think I understood) that this has its own state and the logic of when to execute these things from the same AIController is handled, right?

I want to make sure I have understood correctly some things that I didn't understand completely well before.

dark warren
#

Anyone an idea why my AI fails to reach this selected actor?

crystal hatch
dark warren
#

The Simple AI Move to always return aborted but for no reason. I even added it to a blanck character and just called it on begin play once to test it

#

Navmesh is shown like this in the debugger

crystal hatch
#

Again, look at vis log [VisualLogger] (what you're showing on the screen is the gameplay debugger, not the same thing). But by what you do show I can already tell you either have different navmeshs settings in the project settings and in the map itself, and/or you have multiple SupportedAgents and the AI agent in question question is using the "large one" and the goal location fails to project to navmesh (which will be explicitly mentioned as the failure reason in VisLog).

dark warren
#

Yeah I have different agents for AI and vehicles. How can I change the agents assignment? What I found was it's using the radius to determine the agent but apparently it's not working ?!

crystal hatch
#

It should "pick the best match" so something that's equal or larger than given agent's radius (and other parameters to a lesser degree). Make sure the navmesh you'd like this agent to use has the AgentRadius equal or larger than the actual agent collision radius. There's also a way to indicate a specific navmesh to use when requesting paths, but I don't remember how to use it ๐Ÿ˜„ And I don't think it's exposed to BP, in case that's what you're using.

dark warren
#

It actually is the working when I change the values. But not expected. The Character Agent has a Radius of 40 and the navmesh was set to 40 and it did not work.
Setting navmesh to 50 and still nothing. Setting it to 75 and it 'works' But still can't climb a slope

velvet yacht
#

i know this is quite broad but does anyone know why my on perception updated event is not triggering? I set everything up correctly :/

#

got a stimuli on player, got sight set on player stimuli and ai stimuli, enabled stimuli, set default stimuli on enemy , everything :/

#

even debugging looks good and everything set but event is not detecting the player

floral compass
velvet yacht
#

in English please? ๐Ÿ˜„

floral compass
velvet yacht
#

oh

floral compass
#

Would be good to see which one you're using and how you hook into it

velvet yacht
#

I tried both, but I am trying to get On Perception Updated (AIPerception) to work primarily

#

I did try target perception, same thing, no joy

#

obviously this is a testing mess

#

but regardless doesn't work

floral compass
#

And you have the sense configured in your AIPerceptionComponent?

velvet yacht
#

Yes

floral compass
#

How about detection by affiliation?

velvet yacht
#

and ai controller is set up in the enemy bp

velvet yacht
#

this is on my character bp

#

not sure if that's what you mean

floral compass
#

You might wanna checkmark all of the boxes in "Detection by Affiliation" too

#

In the sight config

velvet yacht
#

That's it.

#

Done.

#

Sorted.

floral compass
#

Neat

velvet yacht
#

๐Ÿ˜„ ๐Ÿ˜„ ๐Ÿ˜„

#

Thanks @floral compass

floral compass
#

Happens too often, not sure why they're all disabled by default. Or at least they could have the category uncollapsed by default.

velvet yacht
olive prism
#

Is it okay to use BTS in this way? Within the BTS what I do is define with a series of things whether I should attack or strafe

velvet yacht
#

Why not use decorators?

olive prism
#

I never understood how to know when to use decorators and when to use services

floral compass
velvet yacht
#

I prep some of my data in the AIController beginplay or even within certain tasks, is that bad practice? I don't really use BTSs

olive prism
#

i make this only for test and works well

floral compass
floral compass
#

It pretty much always boils down to this:
Decorator: Conditions
Service: Writing to blackboard
Task: Executing some logic

olive prism
velvet yacht
#

@floral compass i write to blackboard using tasks/the controller bp, instead of services. Most of the tutorials I've seen never really use it, is that bad?

#

sorry i meant tasks

misty wharf
#

One particular feature decorators have is that they can control the flow of the graph execution, although in custom BP decorators you can't really affect it, just in C++

floral compass
misty wharf
#

Services are also useful for doing stuff like "guards", although you could do those as decorators also I suppose - basically ensuring that certain logic always runs when entering and/or exiting certain branches of the BT

dry ore
#

General good practice to avoid using too much Booleanโ€™s and replace them where possible with float values

#

?

#

If value > or< do whatever ?

floral compass
velvet yacht
#

Here is an example of a workflow I've done

floral compass
velvet yacht
#

Obviously find reachable gets random point in radius and sets value as vector in blackboard.

floral compass
# velvet yacht

I guess it's alright? Though I don't know why you wouldn't want that as a service instead which gives you the added benefit to configure when the service executes: OnBecomeRelevant, CeaseRelevant or on Tick

#

This also forces you to always prepend a sequence node before you can use that, no?

velvet yacht
#

Yes

#

I guess I should start looking into services soon

#

It clutters up my BT

floral compass
#

I mean I have the exact same functionality as a Service node, I can send you the C++ code for it if ya like

velvet yacht
#

I am a rookie in C++, I mainly use blueprints unfortunately, but thanks anyways ๐Ÿ™‚

floral compass
#

Sure!

olive prism
floral compass
# olive prism Which of these should I use if I want to switch between attack and strafe with s...

Which of these should I use if I want to switch between attack and strafe with some calculations like hits received, maximum health amount, etc?
You're trying to do like 5 things at once, you should break it down and implement step by step:

calculations like hits received, maximum health amount
Calculating something and writing it to blackboard makes this a...?

I want to switch between attack and strafe
Switch is synonymous with conditional which makes this a...?

olive prism
#

Calculating something and writing it to blackboard makes this a...?

Service? ๐Ÿค“

Switch is synonymous with conditional which makes this a...?

Decorator

#

I don't understand, so for what I want to do, should I do the reasoning and find out if it does the strafe or the attack from a service and then change states with a decorator?

floral compass
#

That being said, BTs are not really suitable to implement state machine logic
Depending on the planned complexity you might want to try something else there

olive prism
#

Do you recommend using State Machine and not Behavior tree?

floral compass
#

It depends ๐Ÿ˜„

#

I use both

#

But keep them separate

olive prism
#

Everything always depends on something hahahaha

misty wharf
#

I wish they made it easier to combine state trees and behavior trees but nope

floral compass
crystal hatch
olive prism
#

I don't want my AI to do anything more than Attack, defend, strafe and patrol, I think it's something quite simple, I will continue using the Behavior tree, if at any time I feel stuck I will try to use the State Tree

floral compass
misty wharf
# crystal hatch How would you want that to work?

Well to be fair I haven't thought about it that much, but it feels like there are situations where you want to have a state machine that gets triggered via a BT, or you want to have a state machine which runs different BT's

olive prism
#

Thanks for all the help mugenmelon

floral compass
olive prism
#

I just have to see what events to use in the service and in the decorator to be able to make the system

#

Can I use tick on both? I really didn't like the tick at all.

floral compass
misty wharf
#

For example I have kind of stateful AI logic where certain behavior trees run based on the task the NPC has. I also trigger things like putting the NPC into a conversation/interaction mode from the behavior tree, which is a more of a state machine

crystal hatch
misty wharf
floral compass
misty wharf
floral compass
#

Depending on the answer the state machine goes somewhere else

crystal hatch
misty wharf
misty wharf
crystal hatch
misty wharf
#

Interesting, is this somewhere in engine or would I need to look at those demo projects?

crystal hatch
misty wharf
#

Thanks, I'll have to check that out

floral compass
#

Speaking of @crystal hatch , do you think the UHTNBrainComponent will ever get some love? ๐Ÿ˜›

crystal hatch
#

I don't think so. I'm off to other things (#mass) while no one else on the team seems to be interested in picking it up. There's also no internal need, so it would be a hobby project, and I have plenty of nicer ones ๐Ÿ˜„ Then again, who knows. If there was a PR improving our HTN I'd definitelly consider it ๐Ÿ˜„

olive prism
#

I have this in a reception activation AI in my service, I am making the greater the difference between the maximum life and the current life, returning a percentage with a fairly simple algorithm, but I should use a decorator to change between the states , and not from the service, right?

misty wharf
#

Services cannot control the BT graph flow so yes you need a decorator if you want something to change which BT branch runs

harsh storm
harsh storm
olive prism
#

With this

#

Is it wrong to handle it like this? Should I use a decorator yes or yes?

misty wharf
#

I don't think it really matters that much which one you use if it works and does what you want

#

The only real difference between services and decorators is that decorators can directly influence which BT node is active (eg. they can abort trees or loop trees or whatever)

#

Otherwise they are more or less the same in terms of what they can do

olive prism
#

Oki

#

Thanks

floral compass
lunar dragon
#

Hello everybody!
I also have a problem with the animals (I have the ones from the "AnimX: Forest Animals" marketplace), namely the animals do not move in unreal 5.4 (my project was made on unreal 5.3 and they worked perfectly).
Does anyone have any idea what the problem could be?

Thank you!

olive prism
#

So that it stays in strafe for a period of 1 to 2 seconds and then attacks the same target again only if it is still valid (if it does not stop being seen)

floral compass
olive prism
floral compass
# olive prism How could I do it? Without delay?

A quick fix would be to use the Wait task in conjunction with your desired behavior
After the wait task is over you could change the state from within your BT without your AIController needing to get involved

Alternatively it would be possible to do something with latent tasks, but possibly requires C++

floral compass
floral compass
#

What you've sketched there will strafe, then stop and do nothing for 1-2 seconds, and then attack

ebon zenith
#

so any one knows if Mass is still being actively developed?

misty wharf
#

Yes

#

One of the AI devs literally said so a bit earlier today lol

floral compass
# olive prism Yes

Instead you would need a simple parallel node:
Left side is your Strafe sequence
Right side you would Wait 1-2s -> Clear "PointOfInterest" from blackboard (this aborts the MoveTo) -> Attack

ebon zenith
#

welp, guess I didn't scroll enough today, thanks for the info.

olive prism
floral compass
olive prism
olive prism
#

The Blackboard is from Controlled pawn or the Owner Controller? think

#

I think is from Controller

floral compass
#

Controller usually owns the blackboard, yes

olive prism
#

Yeeeeeey

#

Im learning

olive prism
floral compass
# olive prism

Well first off you're using a selector, not a simple parallel

olive prism
#

Oh

#

I never used that

#

I'm going to read what it's about

floral compass
#

Second you've implemented what I've told you not to implement before ๐Ÿ˜„

What you've sketched there will strafe, then stop and do nothing for 1-2 seconds, and then attack

olive prism
#

And what is the Main task?

#

I can't put the sequence as if it were the main task, but I don't know what task to put as the main one, I suppose that the sequence with everything from the EQS would have to go in the parallel connection

#

and the attacking have a invalid abort setting

floral compass
#

You can plug in just your MoveTo, like this

#

I use MoveTo towards a target actor and then conditionally clear the TargetActor to cancel the MoveTo

olive prism
#

The parallel part is not executed, only the main task

#

I think it is because it never finishes executing because the point of interest is generated in the parallel part

#

I don't know if my assumption is wrong

floral compass
#

Wait I'll sketch it out for ya

olive prism
#

oki thanks

floral compass
#

Like this
The simple parallel will execute the MoveTo AND the wait until either:

  • You've reached the PointOfInterest
  • Wait 1.2s is done
    After which you can go to your attacking state
#

Trying to model state in BTs is always a pain

olive prism
#

Oki thanks

#

Last question, what is "Set state to attacking"?

#

I dont have a task for this

floral compass
#

Also make sure to have "Observer aborts" checked on the move to.

floral compass
olive prism
#

Yes

#

With calling a function in my Controller

#

But, now, this function is called from the service in the top of the BT

#

I now, the service not is for that, the service is for change blackboard values

#

but, i dont know implement service + decorator

floral compass
#

Oh how does the service decide whether you should attack or strafe?

olive prism
#

Obtain the max hp, the current hp, substract that

#

Divide this in 40% and compare with a random number in the 1 to 100

#

if the random number is in the range of the number selected:

floral compass
#

I guess that works? Then you don't need to explicitly set the attack state
I thought the whole point was that you want to Strafe for 1-2 seconds and then attack

olive prism
olive prism
#

That works yes

#

But i use timers for that

#

And that's not so good, is it?

floral compass
#

It's not optimal

#

You're outsourcing part of your behavior outside of the behavior tree

#

But if it works for you it works for you!
I can imagine it getting complex after a while tho!

olive prism
#

Yes hahahaha

#

Thanks mugenmelon

#

Really thanks

floral compass
#

Sure no problem

lyric flint
#

Does anyone have advice on adding hysteresis to EQS queries?

For example, I have an EQS query for target selection, but it bounces back and forth too quickly in certain situations. I would like to add some logic to prevent this -- potentially, I want to say only choose target if you have a score greater than 1.x times the previous target's score. Is there a way to do this without manually tracking the previous target's score via a Blackboard and using a custom EQS filter test?

harsh storm
#

It shouldn't be bouncing back and forth. Are you using this as a service or something?

#

Target selection should be a Task imo, and then the next task would be to do something with what is found.

lyric flint
#

It could be either (but assuming it's a task), and it will still happen. For example, in my ranged combat behavior tree the sequence could be: choose target, then fire weapon. If it selects a new target each time it fires, it looks like it's bouncing back and forth too much.

harsh storm
#

So, you can store the previous value wherever you want, but then you also have to consider a way to "forget" that previous value.

#

But if you want some kind of history, that is custom territory as far as I know. Not like it is too difficult to do mind you. Heck, it could literally just be a value on the AI Controller.

lyric flint
#

Yeah, that makes sense. Thank you!

harsh storm
#

Store it in the BB, store it in the AIC, store it in the task memory. Just overall, there needs to be some way to track the history.

#

And make sure to have logic to handle cases where it needs to be zeroed out entirely

#

It'd be weird if it got stuck on like 100, and no one can get that high again until they're in the AI's face

#

So maybe a service that will zero it out when the nodes cease becoming relevant or something. But then you have to handle the cases where they should still be attacking, and then the sequence completes, so the BT reevaluates - thus firing the service's OnCeaseRelevent function

#

So, just think about that kind of stuff.

uncut rune
#

Hmm, any ideas why this enemy guy cannot see me? Did I forget to change something in settings ?

dense owl
uncut rune
#

this is AIC_Enemy and it's assigned to that Actor (Enemy)

dense owl
uncut rune
#

I don't know what is stimuli source?

dense owl
#

assuming you followed the usual setup of disabling all pawns as sources, your target's bp needs a stimuli source component added

uncut rune
#

I don't remember disabling anything on pawns or something like that

upbeat kite
#

Hi! I want to change the move speed for my bot when it enters a specific NavArea. Could anyone help me? NavArea defines a specific type of surface, such as water or sand.

uncut rune
dense owl
uncut rune
# dense owl you should probably watch the pinned video on AI Perception and Behaviour Trees,...

I'm watching one series now and I'm trying to kind of implement it into the game I want to have. It isn't too much different but in the tutorial there is like 1 player which is you, and the other player which is enemy so it's simplier than when I have 10 units and who should do what etc. After I finish one series I will check it out for sure. And If you are talking about behavioral trees I watched this series already.

uncut rune
#

ok, i will check it out for sure

dense owl
#

but if you're doing AI with Blueprints that's a good start

uncut rune
#

I'm doing with both bp + bt

#

should I not touch bt? ๐Ÿ˜„

dense owl
#

I didn't say that

#

I was talking about the series

#

if you're watching anything other than those 2, you shold probably scrap it

#

lots of trash "tutorials" out there

uncut rune
#

I mean it's only 1 video with 26min, always good to listen

#

I found actually really good one

#

from Ali Elizohery maybe you know

#

In this Unreal Engine Game development Tutorial you will learn the following:

  • AI Perception: How to setup the AI Perception component
  • Sight: How to get the enemy to attack when seeing the player
  • Sound: How to get the enemy to go investigate a location where sound came from
  • Damage: How to get the enemy to respond to getting damaged and at...
โ–ถ Play video
dense owl
#

haven't seen it, but I'll take epic official ones over randoms any day ๐Ÿ˜„

uncut rune
#

but I feel like it's easier when you have kind of 1 enemy to track, than to 10+ units

#

idk, still confused on tpic ๐Ÿ˜„

#

i'm on the right track, but still long to go, and i'm getting confused because someone said I should actually make my rts unit behavor only in the blueprints, but I find behavioral trees actually kind of nice, but maybe I don't really need this for the units? Where I think I could use them is to create good ai monsters / enemy etc. ? not sure where to use what yet ๐Ÿ˜„

dense owl
#

or some form of AI system beyond just AI Controller basic stuff

uncut rune
#

you know, right now I'm trying to just focus on making units behavior which is basically attack coroutine (attack, wait for cooldown, check distance of target) and something like if have target then do coroutine, if not have target then idle, and the way to feed target to the unit is either it get's into collision with enemy (detection range = sphere colision), or when a player sets target with right mouse click.
I'm thinking about doing the attack coroutine inside behavioral trees and the rest I think I could do in bp, but then I found about these senses, which could be maybe better to use than sphere colission etc.

dense owl
uncut rune
#

yes

#

sorry, changed to bp

dense owl
#

Ah I c typo haha

uncut rune
#

yeah ๐Ÿ˜„

strange needle
#

So I'm mapping out my project and need a little advice on StateTree structure.
My characters are intended to use the same AI, but are driven by needs and goals created from a suite of parameters that will, hopefully, organically sesperate a human from a horse.
This will probably get pretty messy in a single state tree, but it doesn't look like I can nest statetrees each other, only replace them entirely at runtime, and that presents a challenge in passing state data to the new tree; is that a better practice or should I use one huge tree and deal with how long it might get?

floral compass
strange needle
misty wharf
#

fwiw 5.4 includes the ability to have subtree assets

floral compass
strange needle
misty wharf
#

Yeah probably would also wait, it seems to have a lot of random issues

strange needle
# floral compass That sounds off to me, could you explain?

I don't have a way to transition to another state from another tree. I can think of some ways to buffer data via the AIC to shuffle around the root, but I'd prefer going directly to states to avoid unforseen complications with that method

floral compass
strange needle
floral compass
#

Oh, gotcha, didn't catch that
Subtrees are the only "solution" for now until 5.4 is stable

strange needle
#

Splitting each character's status (we'll simplify it into idle and alert, for now) into separate trees will be much easier to debug, but what if I want them to go from trying to find and drink water to immediately fleeing to safety in the alert tree?

#

I was just going to use a new "root" for each status

#

I've worked with behavior in DECORATE for 15 years. I'm not afraid of a long list of states huntercool

#

... But I do like my code to be readable; so 5.4 it is

#

Thankfully I can work with my current implementation and split it up easily enough in a few months. If not: well that's just more experience, then

floral compass
strange needle
#

Aye, but doing that every time I need to cross states is fairly rigid. At least when hotswapping the ai tree on the character

floral compass
#

If you want to trigger it via event (which it sounds like you do) you'd just send a state tree event

#

But true enough would take a bit of implementing to switch the tree and send the event

strange needle
#

I'll keep that in mind. I'll try a few implementations as I grow the library of tasks these little brats need. They thankfully just run around and scream about where they saw the player and avoid their location history for pathfinding.

#

Presently, at least. I'm making a mountain of a project for myself and I'm ready to hurt.

floral compass
#

That's the spirit!

strange needle
#

Also events buffering state changes will be easy to swap for 5.4's subtrees. Just gotta go through every transition. slugwhat

uneven cloud
uneven cloud
uneven cloud
floral compass
floral compass
# uneven cloud Yes.

Back when I implemented that tree such a service seemed too specific for me, so I opted for a more composable (?) approach
Also considering that I want to add further conditions but would hate having to adjust the service all the time

#

Or having to add new services for this

upbeat kite
uneven cloud
olive prism
floral compass
uneven cloud
# upbeat kite I just searched for something in the UPathFollowingComponent, but unfortunately,...

The function is SetMoveSegment. It's been years since I've done it (we no longer use recast), but this post has the instructions: https://forums.unrealengine.com/t/navlink-and-making-ai-jump/3154/4

Epic Developer Community Forums

A proper C++ solution would involve following steps: Implement a new Navigation Area class - you do that by deriving from [FONT=Lucida Console]UNavArea. Letโ€™s call it [FONT=Lucida Console]UNavArea_Jump Define a โ€œjump flagโ€ - the implementation details donโ€™t really matter, but a enum would work best here. Set the โ€œjump flagโ€ in [FONT=Lucida C...

foggy moth
#

I have a level that i've made - stupid simple with a landscape + navMeshBoundsVolume to cover it.
I have AI thati'm instructing to AIMoveTo - and when i am playing IN This level specifically - things work fine and the AI moves....

if I Load the level via OpenLevel(levelInQuestion) - then the AI will fail this task.... how can I debug this?

#

the AI Controller IS VALID at this call in both scenarios

narrow python
#

Hi. I'm trying to add nav agents and engine gives this message.
In a world partitioned map, changing this property changes the partitioning of actors.
For the change to take effect on partitioning, actors needs to be resaved.
Run the WorldPartitionResaveActorsBuilder to update the whole map.
Whats that?

#

Also i want to know how these Navigation agents work and if i can achieve better results if i use them. Now i'm adding agent and bots stop moving.

patent hornet
#

there is a world partition documentation

#

it has WP commandlets at the bottom

#

run the one for resaving

#

agents are only worth it if you have bots of drastically different sizes, unreal will decide which NavProperty goes into which agent

#

you can get the same size but different nav behavior with navigation filters and modifiers

narrow python
patent hornet
#

iirc you can't

#

if you have a dog and an elephant, the engine will make them different agents, if you have 2

#

if you have a dog and a wolf, they will be the same

narrow python
# patent hornet iirc you can't

Is there tutorial that explains how to set up agents and what it variable means? I created 2 additional agents, put new navmesh volume and choosen new agent as supported (with different color). Nav plane don't appear. Whats i'm doing wrong?

uneven cloud
# narrow python Is there tutorial that explains how to set up agents and what it variable means?...

You don't need multiple volumes, unless you have distinct areas for navigation. You should delete the recast actor(s) and rebuild paths.

The navigation system picks the best nav data for a character's agent settings. By default it takes the capsule radius and half height. The supported agent settings MUST be > than those values. So if you have an agent that is 20 radius and 80 half height, the agent settings have to be at least 21 and 81.

wise sluice
# misty wharf fwiw 5.4 includes the ability to have subtree assets

In our company we managed to do subtree ourself and so far so good, but we hope subtree will bring new features with StateTree that we don't have
That's indeed pretty handy for organizing stuff and debugging

Note : in our subtree, send an event to the main tree, propagates the event on the whole tree hierarchy

floral compass
lunar dragon
#

Hello everybody!
I also have a problem with the animals (I have the ones from the "AnimX: Forest Animals" marketplace), namely the animals do not move in unreal 5.4 (my project was made on unreal 5.3 and they worked perfectly).
Does anyone have any idea what the problem could be?

Thank you!

misty wharf
hearty niche
#

why does my navmesh disappear in runtime ? I built my navmesh but as soon as I play I get a navmesh needs to be rebuilt warning.

olive prism
#

Hello, is there any way to know what state my character is in? I want it to execute a montage when receiving damage only if its blackboard state is in Attacking, but I don't know if that data can be received from my BP_BaseEnemy

narrow python
uncut rune
hybrid niche
#

how would i make it so if an ai touches something they get telported

dapper crest
#

Question about decorators. If I check for a condition and Observer Aborts is set to None, I guess it's only being executed once before whatever was below the selector is completed? I'm asking because I want to have add some randomness to a decision where 80% of the time it goes down one path and 20% down the other, but if the condition is continuously being checked that would cause flipflopping.

misty wharf
uncut rune
dim lynx
#

hi

#

my AI goes around in circles looking for a path

#

I use Detour Crowd AIController

#

I don't know if this is the reason, but at the beginning there was a regular AIController, now I changed the parent to DetourCrowdAIController

uncut rune
# hybrid niche how would i make it so if an ai touches something they get telported
  1. Create Event Overlap on the box.
  2. Add event dispatcher OnOverlapTeleport (input OtherActor and Hit)
  3. Call that event at the end of Eventoverlap.
  4. On the player bind to that event and specify what it will do in the player blue print (so after triggers, set location of player to be random in radius for example)
  5. When player gets in contact with the box, it will trigger the event and will teleport.
dapper crest
dim lynx
#

this only happens in a group

lunar dragon
#

Hello!
My animals don't move on unreal 5.4

#

I tried navmesh regeneration but it didn't work

misty wharf
#

Check in Visual Logger what output it gives

#

It usually shows more info on why stuff is failing to navigate

lunar dragon
misty wharf
#

Tools->Debug

lunar dragon
lunar dragon
misty wharf
#

Yes that seems quite likely

lunar dragon
uncut rune
uncut rune
misty wharf
# lunar dragon How can I fix this?

Difficult to say, you need to debug what the point is they're trying to navigate from. If these actors are in your level, I would start just by wiggling the actors and resaving and trying again, it could just be some weird corruption in the map.

lunar dragon
misty wharf
#

Is it the one you added that's moving?

lunar dragon
misty wharf
#

Yeah try wiggling the others, feels like that might fix it in that case

#

Or you might just need to remove and replace them

lunar dragon
lunar dragon
verbal shore
#

Anyone noticed a crash upon enabling Gameplay Debugger to debug AI behaviors while running a State Tree with a subtree?

lunar dragon
uneven cloud
uneven cloud
uncut rune
#

Yeah, if you set it to observe value changes of the key, If you change the key and its set to abort, it will abort what it is doing.

uneven cloud
uncut rune
#

you might also want to have some ''states'' that are not possible to be aborted ๐Ÿ™‚

floral compass
dapper crest
uneven cloud
# floral compass Then I must've done it wrong?

Did you implement the observer abort or are you inheriting from the blackboard based decorator? If it's the latter, it's because your blackboard key is set to self which that's what it's binding to by default. So it'll only abort if the self actor changes.

I don't understand why you are sending the self BB key at all. You can always get the controller and the pawn.

uncut rune
#

If you change this, and you have observer abort self, THEN if you change target, it will actually abort (because value of blackboard was changed)

#

In the future it would be better to have States of what is doing for example
AttackState
PassiveState
InvestigatingState which are all set by the blackboard key

#

and when you change blackboard key the tree will abort and look for other

olive prism
#

Hi

I have a basic combat system, I would like to add a system that every x time my AI makes a special attack

Can it be done this way?

Should I calculate when to launch that attack in a Service? and if I do it in a service, I change the value of a variable in my AiController and then I execute that montage with a Task (That has a decorator that looks at the boolean that changes the service) that calls an event in my EnemyBaseAi

I thought about doing it this way, is it well thought out?

dense owl
#

GAS might be better

uncut rune
#

There is built in cooldown Decorator which you might want to use

olive prism
uncut rune
#

You could set the cooldown-float variable with service which will handle the behavior you want

#

or you can write your own way to calculate time and also change it in service

#

and yeah you would change the value in aicontroller and execute montage with task

floral compass
uncut rune
uneven cloud
uncut rune
#

I would call to change the states from the BP which would also change blackboard key so it runs the behavior I want. Why it's bad?

floral compass
uneven cloud
uncut rune
uneven cloud
olive prism
uneven cloud
olive prism
olive prism
#

F... State machine?

uneven cloud
uncut rune
floral compass
# uneven cloud The decorator only observes the value of the variable Blackboard Key, which you ...

But I don't want it to observe a different actor

The decorator should execute a query on SelfActor
The MoveTo towards TargetActor should be either:

  1. Aborted if the decorator's query on SelfActor fails
  2. Switched to a different TargetActor if TargetActor changes

I really don't see how this can work other than a simple parallel.
I could use the TargetActor in the EquipmentQuery decorator, but that would still require a simple parallel to update TargetActor and also I wouldn't be able to run queries on actors other than the AI possessed pawn.

uncut rune
#

So in what situation do you need to abort that tree?

uneven cloud
uneven cloud
uncut rune
# uneven cloud You are trying to force a behavior tree into acting like a completely different ...

I still don't really understand my mistake. I should not change the value of blackboard key from AIController based on what is happening around my ai? For example:
Did my ai sight sense see something? HandleAttack -> Set Blackboard value as Attacking and do Behavior Tree, if lose target, then go back to passive state which is standing in place or patrolling?
or
Did my ai hearing sense hear something? HandleInvestigating > Set Blackboard value as Investigating and do behavior tree where it goes to the location of the noise and checks.

uneven cloud
floral compass
uncut rune
uneven cloud
uneven cloud
uncut rune
#

I will try to read it 3 times more

floral compass
#

The decorator should execute a query on SelfActor
The MoveTo towards TargetActor should be either:

Aborted if the decorator's query on SelfActor fails
Switched to a different TargetActor if TargetActor changes
uneven cloud
floral compass
uneven cloud
uneven cloud
floral compass
uneven cloud
uncut rune
# uneven cloud A lot of tutorials give really terrible advice.

Can you then explain to me how should I approach for example when I want the unit to Attack (follow target, hit target, cooldown, follow, hit when cooldown over etc) without switching states for example when they have target or not? I would set the target with mouse click, and set target null by clicking on ''ground'' for example. If it's that simple behavior, should I even bother with BTs. And then there would be also sense that if unit sees enemy, it will set state to Attacking and follow, hit target, cooldown etc. )

#

Like on this example give me perfect solution that you would go and how to implement this mechanic.

uneven cloud
uncut rune
#

I would really appreciate it you could also put it in your own words. Do you mean that I should just avoid ''states'' and focus on making the tree don't rely on setting states, but rather on for example doing something if has target, and something else if has no target?

#

So in perfect word we should try to achieve the behavior we want without using states at all costs?

#

even if it's something simple like 3 states?

uneven cloud
#

I'm not going to design your AI for you. I get paid a lot of money to do that professionally.

floral compass
uncut rune
#

Someone here asked how to set blackboard values

#

the KeyName needs to be exactly the same name as you named Key in your blackboard

uneven cloud
#

If you are in the BT, you should use a blackboard key selector instead of hard coding the key name.

dreamy surge
#

why doesnt my decatoror show up I made a isinmelleRange bool but It wont show

uncut rune
#

I think you made a task not a decorator

queen socket
#

Hello everyone, currently trying to implement my own custom UNavMovementComponent in CPP.

ABaseCharacter::ABaseCharacter(const FObjectInitializer& ObjectInitializer)
    : Super(ObjectInitializer.SetDefaultSubobjectClass<UBaseNavMovementComponent>(
        ACharacter::CharacterMovementComponentName))
{
    NLOG(-1, "Custom ABaseCharacter Constructor Called");
    InitializeComponents();
}

'Custom ABaseCharacter Constructor Called' is being logged.

UBaseNavMovementComponent is my custom UNavMovementComponent, and still the AI doesn't use it. Doesn't seem the constructor is being called, no log is being output:

UBaseNavMovementComponent::UBaseNavMovementComponent()
{
    // Set this component to be initialized when the game starts, and to be ticked every frame.  You can turn these features
    // off to improve performance if you don't need them.
    PrimaryComponentTick.bCanEverTick = true;

    NLOG(-1, "CONSTRUCTOR");
}

Any ideas or tutorials on implementing a custom UNavMovementComponent?

uneven cloud
astral mist
#

hey! I'm currently making a game where i need to analyse live video from a camera. I already implemented the video input but i can't figure out how to analyse the video. I'm using blueprints. To be more precise, I need to detect golf balls and track their movements in a short laps of time. any ideas or suggestions?

queen socket
dense owl
#

Havok ๐Ÿ™‚

uneven cloud
faint junco
#

I have this "traphole" that I want AI to be able to walk into, is it possible to make AI think this is normal flat ground and try to walk over it?

patent hornet
#

put a mesh over it for it to generate nav, then remove it when something steps onto it

#

(it doesn't have to be visible)

misty gale
#

Inverted face? ๐Ÿ˜„

#

Not sure if navmesh cares about that

uncut rune
steel moat
#

How to change the value of wait Task in behaviour tree on run time?? i searched the forums and found something called "Wait Blackboard time" but thats a blueprint node how to get that in c++??

narrow python
#

Found good tutorial for recast, this should be pinned. https://www.youtube.com/watch?v=II5agHlxUe4
But that was for ue4. Now there is resolutions, what are they doing?
How to get rid of gray deleted recast? It annoys me ๐Ÿ˜‚

Optimize your NavMesh with the Recast Object and Fix common NavMesh Problems like bald spots and the NavMesh clipping through geometry. Also get an explanation of each setting including Region Partitioning, Layer Partitioning, Tile Size, Cell Size, Cells per Tile Side, Cell Height, Agent Radius, Agent Height, Agent Max Slope, Agent Max Step Heig...

โ–ถ Play video
#

Also what these checkboxes do in agent settings? Does it mean i can do jumps without links? Swim/fly?

misty wharf
#

I don't think it means the agent can somehow go across mesh boundaries without a link though, at least not by using the normal navigation methods

uncut rune
#

Hmm, what is the difference if I use OnPerceptionUpdate inside AIC_OfMyUnit instead using it inside Actor?

signal olive
#

So is there an up-to-date GOAP AI framework that works with UE5?

misty wharf
uncut rune
misty wharf
#

No I mean if you have the perception component in your pawn you will get a warning in the output log that it's not intended to be there and it should be in the controller instead

#

(It didn't use to do that in earlier versions of UE so I guess a lot of people had theirs in the pawn)

#

Unclear why they made it work in both the pawn and controller if it was intended to be in the controller :P

uncut rune
#

hmm because I'm watching official tutorial about AI

#

and he is doing that inside BP_Thirdpersoncharacter

#

instead in the AIC_ThirdPersonCharacter

misty wharf
#

Which tutorial is that?

uncut rune
misty wharf
#

Classic Epic quality documentation I guess...

#

Although to be fair that looks like a pretty old tutorial from how that UI looks like

uncut rune
misty wharf
#

So maybe they hadn't decided it should be in the controller at the time

uncut rune
#

so what raised my eyebrows was that then he casts to the AIC XD

#

and i was like wait what ๐Ÿ˜„

misty wharf
#

Yeah

uncut rune
#

like, why not do it inside AIC then since it's on every character that you want it to be, right?

#

it's like componentso every ''unit'' has it ๐Ÿ˜„

#

and the other tutorial i was watching before did everything in AIC and then it made sense there

misty wharf
#

Yeah, it seems it's intended to be in the controller as of UE5 or so, so best to just put it there

#

I had some old projects where it was in the pawn because for some reason I had put it there, and when I migrated them it just started logging lots of warnings about it

uncut rune
#

ok, maybe he will actually put it later into AIC or something like that

#

thanks for claryfiyng ๐Ÿ˜„

harsh storm
signal olive
harsh storm
#

And it is well worth the price

#

It literally saves you months of work

#

It also very regularly goes on sale

#

I wouldn't consider $300 expensive. Unless you're looking at your own time worth like $0.50 an hour.

signal olive
#

Well it's $500 AUD

#

But yeah, fair enough.

harsh storm
#

Slap it on your wishlist, wait for the next sale. Very regularly goes on a 50% sale.

signal olive
#

Oh, neat, I'll keep that in mind, thanks.

#

Utility AI is the other AI framework I'm considering, but HTN looks good enough for my purposes and the way the plugin is doing it looks more intuitive than behaviour trees

#

Granted, a lot of AI systems use utility on some level rather than governing the entire system

cyan sigil
#

Hello. What's the best way to have a behavior tree branch or re-evaluate based on a Delegate/Event? I need a character's Move task to be interrupted if they take damage.

deep bramble
strange needle
#

This is my understanding of the systems in UE5; I think this is a decent way to break down my critters, but I'm open to suggestions before I'm a year in and tearing my hair out restructuring. slugwhat

misty gale
#

Imo anyways

#

I have to spend a decent amount of time learning it aswell, along with realizing its quirks compared to doing ones own solution

#

(Where i only realize it when i port it to my next never released project)

harsh storm
#

Time only ever flows in one direction.

floral compass
misty gale
floral compass
narrow python
#

Me again with agents. What i'm doing wrong. This wheel bot should use his agent, but he using other agent.
1 pic my agents, 2 pic bot nav data, 3 pic in game debug.

misty wharf
#

Anyone implement influence maps in UE? Any pointers? ๐Ÿค”

cyan sigil
misty wharf
#

Updating some systems in my game atm and one of them is like a "dirtiness" thing where NPC's are affected by how dirty some part of the map is... and this kinda feels like maybe it should be an influence map (dirtiness map)

cyan sigil
#

Essentially, I need to abort a branch if a particular event happens, and then if the branch fails due to that event I have to run some extra code.

deep bramble
cyan sigil
#

If I run a sub tree, does the node always return Success or does it return the actual result of the sub tree?

floral compass
strange needle
#

Regarding the AI controller and its pawn: where should the statetree and navigation logic go; the actor or the controller? Let's assume this controller only ever controls one NPC until it's destroyed.

#

I have the logic on the controller for now but I'm not sure if that will cause difficulty later

floral compass
#

By default the AI controller has a PathFollowingComponent that handles navigation, not sure why you have any choice here?
And assuming that you mean to use your StateTree for AI it should go on the AI controller as well.

strange needle
#

Excellent! Thank you.

velvet yacht
#

do decorator orders matter?

keen crow
#

are brain messages for BT tasks guaranteed to be processed in immediate next frame after calling BrainComponent::HandleAIMessage? I think I observe that this is actually not the case and brain message can be delivered to BT task like 20-30 frames later ๐Ÿค”

velvet yacht
#

also is there a node for 'can you reach this'

floral compass
misty wharf
cyan sigil
#

I have an usual setup happening and I'm curious how to deal with it.

  1. I have my character performing a long move.
  2. If they take damage during the move I want them to stop that branch of the behavior tree and run some additional code/tasks.
  3. If the move ends for any other reason I do not run the additional code/tasks.
  4. Damage is tracked via a Delegate and does not leave a record.
#

My current setup is a custom decorator that subscribes to the event while active and ends itself when it fails, running code if it is marked as Damage Occurred. However, I find myself wanting to do more and more elaborate tasks, to the point it doesn't make sense to bake them all into one decorator.

#

Question is how to get the damage task to last for the duration of a single execution of the tree.

#

Hmm, maybe I can make a separate service that sets a flag on the blackboard while active and removes the flag when the service ends?

narrow python
# cyan sigil I have an usual setup happening and I'm curious how to deal with it. 1. I have m...

Make your custom move task, make it so it fails if your pawn takes damage,
you can from pawn access ai controller by "Get controller" node then "Cast To Your Custom Controller" (3rd pic), and from controller set bb value. Add BT in "Begin Play" with "Run Behavior Tree" in ai controller. Set values you need with "Get Blackboard" node.
Put it first into selector. If it fails it goes to second task in selector which is your additional code. If move task success it skips additional code.

cyan sigil
#

Problem is that the move task can fail for multiple reasons, such as no path available

narrow python
#

BT is old thing and didn't get updated much. Also it performs one task per tick, wich makes it hard to do tick movement.

astral mist
#

I'm making an ai object detection in ue5, I'm trying to detect specific objects by shape and color. How can I achieve that?

narrow python
astral mist
#

kinda. I'm importing a video and try to detect object in that

#

so shape, color. need to detect a white sphere to be precise

cyan sigil
#

@astral mist Are you able to mark if the object is white or spherical before playtime?

#

Or do they need to be able to look at any arbitrary actor and decide if it's a white sphere

astral mist
#

but it will be the only white spherical object in scene

#

so pretty easy

cyan sigil
#

Oh okay. So you want them to find a specific object?

#

You can use GameplayTags for that.

astral mist
#

yeah

astral mist
cyan sigil
#

They are a feature where you can give an arbitrary object arbitrary labels.

astral mist
#

and then ai detect those arbitrary labels and at the same time, detect the object

narrow python
cyan sigil
#

So a human decides if something is a white sphere, tags the object as a white sphere, then the AI can check if the tag is present

#

The human does the decision making at Edit time

astral mist
#

oh

#

so it need a manual selection

#

?

narrow python
narrow python
# astral mist yeah

Its one video, or its different videos where white sphere different each time?

astral mist
#

different videos, but the same one at the same time. Live video recorded and played in slowmotion each time

#

i already made that part

narrow python
#

So sphere appears at same time each video. Variable position/size?

astral mist
#

White spheres ( golfballs ) appears at the same time at the same place on each video. it just need to be tracked through the slowmotion video so it first need to be detected (So it can be tracked )

narrow python
#

Looks like you need some kind of image recognition, i didn't worked with that so i can't give advise in this.
But if your videos are pre made and there is limited amount of them there what i would do.
I would create ball tracker from timeline, timeline can contain 2 curve that represent ball position. Curves will be set manually for each vid.
For bot need to create datatable, with struct that contains video number and link to tracker actor with timeline.
It should work like this: Playing video 3, bot takes 3 and finds tracker link in datatable, in tracker it looks on timeline and get coordinates of ball.

astral mist
#

huhร 

#

interesting

#

but since it is coming from live video, i don't think it'll work

narrow python
#

So videos are not premade and you need some image recognition. Can't help there ๐Ÿ˜ฆ

astral mist
#

aight

#

i'll give feedback on that one

astral mist
#

if it can help, the upright spool would be the golfball on the tee/grass and i need to get the game to say "Oh! this looks like a golfball, Let's detect it's next movements"

#

what it really sees without the "detection range"

#

Is it possible to get The color of an object from a picture?

#

because a slowmotion video could be analysed frame by frame to get the movement of the "color"

deep grove
#

I think you'd get better answers in another channel this is mostly AI for games fwi

#

We unfortunately don't have a computer vision channel which is more what you are looking for

uneven cloud
#

There are lots of resources on computer vision. Just need to Google.

deep grove
#

Yep though I wouldn't think they should use unreal for that unless it's a really specific use case lol

astral mist
#

for the small update, I think i can identify the golf ball by analysing each pixels of every frame fith loops and arrays so it can say if there is a golf ball in range, or no.

floral compass
#

Can anyone confirm if StateTrees in 5.4 are still limited to a depth of 8 even with nested/linked tree assets?

misty wharf
#

It had such an arbitrary sounding limit to it? That's awkward

#

I'm also curious if 5.4 fixes the property binding bug which caused an error every time you tried binding to a nested property in eg. an actor, I think it only worked without errors in the context actor which made it difficult to use outputs from tasks

floral compass
#

Yep, and get this: if you use subtrees and linked states they also count. So you can link 4 states deep at max.

floral compass
misty wharf
#

Oh really, never ran into anything else with state trees thankfully

#

That's not great it's gonna take them until 5.5 to fix such a fundamental issue...

floral compass
#

Other than that there are also issues with using BP structs for property types. Those will crash your editor. Native structs only.
Also issues with binding elements of an array.

#

Definitely needs some more time in the oven

misty wharf
#

Sounds like it. BP structs in general are not recommended for anything anyway, they are a fun way to cause corruption and other issues if you ever change them at all

#

At most I'd consider using them for something that's only gonna be used in very limited capacity as a helper/utility maybe

floral compass
#

Huh, good to know. I'll definitely avoid them.

oak bridge
#

Hello, I have a 3D sidescrolling platform game and I need a drone AI that follows you on on bottom-up and left-right directions (not in depth since its 3d i also move in depth), how do I make the AI path, I mean on floor i use navmesh to say here he can walk but on vertical axis how can he avoid obstacles and understand a path to follow even to reach player etc...

#

Sorry for bad drawing but its the best with mouse hahahah, basically the red are the walls and yellow are the floor on the left part of the image, the purple arrows means that the player just can move also in depth in that sense and the camera is looking on the front only.
So player can follow those stairs and platforms to go on the next floor but the drone (the little green thing) checks for you and I want him to follow on 3d space each floor too but avoiding obstacles, any idea?

stiff gale
#

How do you make ai chop trees? Do you use smart objects?

vivid basalt
#

Hi, does anyone know if nav mesh could possibly effect AI perception?

vivid basalt
#

i'm having this weird issue, where my ai character cannot see the player character on one side of a broken bridge, while it could see on the other side..

misty wharf
#

The gameplay debugger's perception mode should show you the linetraces the perception system attempts to do which should hopefully give you some insight

vivid basalt
misty wharf
#

Yeah I mean if it isn't detecting the player then it isn't going to run that function

#

There's some geometry blocking the trace on the sight channel (iirc visibility by default)

#

Meshes attached to the NPC or player can also block it if I remember correctly

olive prism
#

Hi! If I have to kill my AI, what is the most recommended? Handle things from the AI COtroller or with tasks on my BT? With a decorator, check that the life is not 0 or less and then execute the task

Maybe I'm not looking to destroy it, I just want to make it disappear for a while and then rearrange it with everything started again, thus saving me the kill and spawn of the actors

misty wharf
#

If you're handling hp-related things in the BT already then it could make sense to handle it there, but if you're handling logic related to that elsewhere, it might make sense to do elsewhere

vivid basalt
#

thank you!

pseudo solstice
#

hey!

I have this simple EQS query, which I'm using to spawn some pick-up items at the beginning of a level.

Now my issue is, that this query often spawns these items suuuper close to walls.

I'd like to make filter our items that are close to other meshes. Is this possible?

Example: If the given point is within 50 units of a wall, filter it out.

neat hatch
#

my ai for some reason does not respond to the nav links

#

this is the node setup

neat hatch
#

right, so Ai MoveTo does not work with nav links

midnight scroll
#

I'm trying to use a dynamic set of subtrees via RunBehaviorDynamic. But I'm also to let the tree wait for a short time at the end of the tree before restarting. Is there any way to abort the wait if the dynamic node has a valid behavior asset set? Not looking forward to maintaining an extra variable to manage it in a custom decorator. :/

floral compass
midnight scroll
#

Yeah.. Eh. Could be worse.

nimble smelt
#

I've got a function on my AI Pawn which basically forces it to detect a target. I use this for when the AI is responding to the player tripping a security system, EG they step on a laser so a missile gets launched, the missile should just immediately be detecting them. But it doesn't work, and I can't figure out why.

#

I've also tried moving the test portion of that into a separate event, which I'm calling on a 1-tick timer in case perception isn't instant. Still no dice.

dim lynx
#

I would like to constantly check if the player is overlapping the box, but only if the AI โ€‹โ€‹sees player

#

print string "ssss" is only called when the AI โ€‹โ€‹sees the player for the first time, not when his position changes

#

i need to use Event Tick, ir can it be done by using AIPerception

narrow python
neat hatch
#

the problem is that the ai doesn't even go near that ledge

#

it doesn't move at all

#

cause the destination is on that lower platform

narrow python
neat hatch
#

already using them

#

with pathfinding disabled

nimble smelt
dim lynx
#

is there some event that is triggered every time the player changes position within the AI's line of sight?

velvet yacht
#

i really have no idea how to do this, it feels like a dead end

floral compass
velvet yacht
#

what is the proper way to get an ai to turn away from you, as whenever i try to do this, the on sight perception makes it focus back on the player, and those are conflicting

#

i mean i focus on sight and i defocus on whether player is reachable is not, if not, defocus.

#

so the ai is stuck in an endless loop of focus defocus focus defocus when i'm not reachable, but in sight.

#

I would really appreciate it if anyone could help point me in the right direction with this. Thanks.

nimble smelt
#

So it's like:

  • Tick 0: Pawn created, ForceTargetDetection called, reporting damage event. Target is not being perceived yet.
  • Tick 1: Target is not being perceived yet
  • Tick 2: Target perceived
floral compass
nimble smelt
#

Frankly I'm not surprised at all that sending an AISense event and then checking for perception that same tick encounters a race condition or odd behavior. I am a little surprised it takes two ticks to report the perception, instead of being aware of it next tick.

#

(Also I feel it's important to point out, I'm testing all this with my player pawn SUPER far away from the spawned AI pawn, so there is no chance that it's actually picking up the player through a different sense)

velvet yacht
#

maybe that's why? lol

floral compass
#

Keep in mind that there are 2 components at work here, AI perception of the AI and the StimSource, might be worth debugging both

nimble smelt
#

Remember the ForceTarget function just looks like this

#

There's no stim source component for a damage event, is there?

floral compass
#

There is a config for it

#

But it also doesn't tick so I might be wrong

nimble smelt
#

nah, I added that to my player pawn and it doesn't change anything

misty wharf
#

Tbh for "forced" targets I would just bypass perception entirely unless there's some reason to go through it

floral compass
#

Huh, guess that's for proximity stuff

velvet yacht
#

does anyone have any idea how i can handle my enemy having conflicting focus / defocus statements? ๐Ÿ˜ฆ

nimble smelt
floral compass
nimble smelt
velvet yacht
#

so i think what would fix my issue if the focus node had a - on complete

#

as the BT tasks move too fast

#

and the enemy doesn't have time to rotate fully

#

before the next task kicks in

#

any idea how to slow this down / wait for task, without using timers?

floral compass
#

So

#

Question

#

Do you want your AI to actively turn 180ยฐ and leave once it perceives the player, or do you want it to just ignore the player and do whatever it happens to be doing at that moment? Those two are different

velvet yacht
#

So what I want to happen is, when player is out of range, the enemy turns 180 and leaves.

#

That's it. Really. But the issue is that the enemy does not turn fast enough.

#

So he sees the player, and turns back, and freezes.

#

As he is now stuck between turning 180 and leaving and turning 180 and focusing on player.

floral compass
#

So rubberbanding, right? So you can kite the enemy until a certain range is exceeded upon which the enemy returns to patrol or whatever?

velvet yacht
#

โ™ป๏ธ

harsh storm
#

Put a service on the task that is rotating the AI, on activation, turn off the sight, on deactivation, enable it.

velvet yacht
#

Which is causing me problems as once out of range and enemy tries to leave, the enemy sight kicks in and basically makes the enemy continue attacking

#

Even though I am telling it to leave.

floral compass
velvet yacht
#

I am aware that I am asking it to both leave and stay at the same time, but the ideal fix would be that upon a 180 sucessful turn, the enemy can no longer see the player and runs away

floral compass
#

What do you have set for peripheral vision?

velvet yacht
#

but during the turn, on the next tick, the enemy sees the player just as it's about to turn 180 fully

#

so it goes into an endless cycle of trying to turn, seeing the player, turning to the player, etc

velvet yacht
#

if I wouldve been able to use delays, a one second delay, as you can imagine, fixes the issue.

#

But I don't want to use delays, so it seems like I hit a dead end.

#

I cannot check when focus is complete, I also cannot delay. How can I tell when the enemy AI completed the turn?

floral compass
#

Another relatively easy kinda custom fix would be to track a grace period to each sensed actor, such that you will only re-sense the actor after the grace period expired

#

You do get an "unsense", right?

#

Or is it permanently sensing?

velvet yacht
#

as it might see other players inside the reachable area it should seek instead

floral compass
#

No, not blind, just ignoring that single actor.

#

All others are still fair game

#

You'd track grace periods per sensed actor

velvet yacht
#

okay, I will look into grace periods

velvet yacht
floral compass
#

So a naive thing would look like:

TMap<TObjectPtr<AActor>, float> GracePeriods;
velvet yacht
#

Do you, by any chance, have the native code for the Focus node?

#

I want to understand how it works

floral compass
#

Why would I have it? ๐Ÿ˜„

harsh storm
uneven cloud
uneven cloud
uneven cloud
uneven cloud
velvet yacht
#

so the issue is when out of range and looking at player, the AI is stuck.

uneven cloud
velvet yacht
#

Through behaviour trees

#

and the focus defocus node

#

using ai perception

uneven cloud
#

Show how you are doing it

velvet yacht
#

Changes state on BT to 'Attack'

floral compass
#

Inb4 another scolding about state machines in BTs

velvet yacht
#

What ?

floral compass
#

You'll see ๐Ÿ˜›

velvet yacht
uneven cloud
# velvet yacht

Here's a perfect example of why forcing a BT to act like a FSM doesn't work. Because you aren't using the priority of the BT, fixing this is harder.

You are setting the attack state whenever the perception is updated. Regardless of anything else happening.

velvet yacht
#

I am not familiar with the jargon, I've never heard of FSM ๐Ÿ˜…

uneven cloud
#

Finate State Machine

velvet yacht
#

I tried Googling it but I'm only able to find tutorials, are you recommending I use state machines instead of BT?

uneven cloud
#

No. I'm saying you shouldn't force your BT to act like a FSM.

velvet yacht
velvet yacht
uneven cloud
#

Because you are forcing "states" you need to add logic for changing the state to take into account your turning problems.

floral compass
floral compass
# velvet yacht Speak plain ๐Ÿ˜ญ

Basically, BehaviorTrees model "fallback" behavior. You try the far left branch first, if that fails you fallback to the next one.
Your use case has no such static priority. It's not like your "Passive" branch always has higher priority than your "Attack" branch, right? So far clear?

narrow python
velvet yacht
#

Yeah but since it's to the left it's technically higher priority

#

So it will execute from left to right, based on the state

uneven cloud
#

No. It will only execute based on the state.

velvet yacht
#

okay but the state itself will execute left to right

#

that's why there's the little numbers next to it

#

to denote priority

#

right? ๐Ÿ˜„

#

or I guess, order, same thing in my head

uneven cloud
#

Yes, but it'll never go into a different branch without your external logic.

velvet yacht
#

Okay well fair enough but how can I remodel my current 'model' to account for the turning timeframes and stuff?

#

It's difficult for me to even phrase the question you see, I've been trying to sort it out for days

harsh storm
#

It's because you don't understand the language

uneven cloud
#

So if you want to keep this bad structure, you have to change your state transition logic to not go into attacking if X is true.

velvet yacht
#

what is a better structure? state machines?

harsh storm
#

And going through the pinned resource about AI. So you can establish a language to communicate in

harsh storm
#

The Introduction to AI course and the Flame Retardant AI talk

velvet yacht
#

this guy that seemed like a genius used bt so i jsut copied his tutorial and made some amendments

harsh storm
#

You don't know what a genius actually is with BT, so everyone is going to seem like it as long as they try to speak with authority

uneven cloud
#

Well his tutorial is clearly not good.

floral compass
#

Nothing wrong with BTs though
Just need to know the pitfalls

velvet yacht
#

Ali Ezoheiry

Software Engineer, educator, game developer, gamer, and content creator

#

He made a whole series on AI, and seems knowledgeable enough to teach, and somehow made an entire boss battle using behaviour trees

#

I haven't implemented the more advanced boss battle features as they were not needed for me, so currently I am just trying to work on my own version of a basic AI using behaviour trees, and I have been stuck on what appears to be a simple issue for days ๐Ÿ˜ญ

velvet yacht
#

It seemed like the right move forward, and I like having everything in one place, making sense, and with decorators and services providing so much functionality, I thought I would be able to make a very basic AI using BTs, it seems that I was wrong ๐Ÿ˜ฆ

velvet yacht
floral compass
# velvet yacht https://youtu.be/-t3PbGRazKg?si=12Zcfyy_rj_RJYjy

Either he has a lot of experience in doing it wrong, or it's just a very basic tutorial and he didn't want to complicate it for beginners and maybe fixes the problems later on? I've only looked into it shortly but the 2nd video he starts implementing states in his BT

#

Never understood the point of trying to "shield" beginners from complexity

#

Well, I guess YouTube clicks would be one such point

velvet yacht
#

And that is what the process of learning is, right? First you learn the alphabet, then you learn how to write, then you write poems.

#

Imagine telling a baby that they must write a 3000 word essay by end of play tomorrow

#

That's you guys talking to me right now ๐Ÿ˜ญ

floral compass
#

No, don't misunderstand, nothing wrong with doing it wrong!

floral compass
#

But you learned how to ride the tricycle and now want to go on a mountainbike track ๐Ÿ˜„

velvet yacht
#

Ali's tutorial is my tricycle lol

#

I just want to adjust the wheels a bit

#

but it's all falling apart

floral compass
#

You'll have to upgrade to a mountainbike first!

uneven cloud
floral compass
#

The pinned stuff by Bobby Anguelov is a good place to study

#

Have you watched those?

velvet yacht
#

I know, I've been trying to, I think I get the basics? Like, sorta can make a moving / attacking guy in BTs

#

But anything more complex I would struggle

velvet yacht
uneven cloud
uneven cloud
velvet yacht
#

oof

#

this is why game dev is so difficult, so many conflicting opinions

#

๐Ÿค•

uneven cloud
#

Bobby is not good for beginners

velvet yacht
#

Okay I looked through his video it looks like a 2 hour study session about how AI works

#

And since I am not completely new to Unreal, it might be useful?

velvet yacht
#

Seems like average first year game dev course stuff imo, which is nice cause I can't afford going to uni

floral compass
velvet yacht
#

So it appears to me that @uneven cloud is not a fan of Behaviour Trees and would much rather program AI into blueprints directly

#

Just scrolling through pinned posts

nimble smelt
#

Ever find something your AI is doing and it's like "wait, why"
My missile pawn does this inexplicable little zigzag right as it's about to reach its target and I cannot wait to figure out what is happening here

uneven cloud
velvet yacht
floral compass
#

There is no one-stop solution to complex AI

velvet yacht
#

maybe I'm misinterpreting but since I have no knowledge of state machines I assume it's like a Blueprint collab with AI

uneven cloud
velvet yacht
#

Right right, perhaps worth looking into it

nimble smelt
#

BTs are something a lot of people misuse, but that doesn't mean they aren't useful

uneven cloud
#

It's how to use the systems, not write AI with Blueprints.

velvet yacht
#

What tutorial do you reccomend for me to watch to get a better understanding of just what I need to know for now

uneven cloud
#

The AI with Blueprints course on the learning library

velvet yacht
#

Oki

uneven cloud
uneven cloud
#

Haha

velvet yacht
harsh storm
#

Vast majority of my tutorials are in Godot. And no - I don't use my web experience as a position of authority.

celest nebula
#

Really wish commenting in the behavior tree graph had more space - and if there was a better way to select all nodes in a subtree

olive prism
#

can i modify a blackboard value on my enemy base character?

olive prism
#

I have this decorator in my BT, this BTD check my BB bool called "IsSpecialAttack".

In a service, i've a little algorithm for generate a random number, if the number is equal or less of my porcentage, the bb bool IsSpecialAttack change the value to true, but the Selector never entry in my left side, what is the mistake on this?

uneven cloud
#

Why does the random need to be updated on an interval?

obsidian igloo
#

curious if anyone knows, im working on a custom rigid body movement component for pawns, and I was wondering how I can get my movement input system to work with Unreals navigation and movement system. I am using C++. for example If I use AIMoveTo I was hoping perhaps a few function overrides or something would allow my input system to work with it.

uneven cloud
obsidian igloo
steel moat
#

I wanted a custom acceptance radius in the MoveTo Task, i created a child class of the MoveTo Task and im overriding the PerformMoveTask to Set the Acceptance Radius but whenever i start the game it sets acceptance radius as 0 and then it takes the defined radius.....how can i make it so that it updates the user defined radius as soon as the game begins

floral compass
#

Isn't AcceptanceRadius exposed in the BT editor?

dense owl
floral compass
#

That not it at the top?

dense owl
#

Mb if you were talking about default values

floral compass
#

Ooh, that was the question, now I understand

#

I thought we're talking about initializing it

dense owl
floral compass
#

๐Ÿ˜„

steel moat
floral compass
#

Paste some code

steel moat
#
EBTNodeResult::Type UBTTask_CustomMoveTo::PerformMoveTask(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory)
{
    if(AAIController* AIC = Cast<AAIController>(OwnerComp.GetAIOwner()))
    {
        if (ATurretBase* pawn = Cast<ATurretBase>(AIC->GetPawn()))
        {
            AcceptableRadius = pawn->AcceptableRadius;
            return Super::PerformMoveTask(OwnerComp, NodeMemory);
        }
        return Super::PerformMoveTask(OwnerComp, NodeMemory);

    }
    return Super::PerformMoveTask(OwnerComp, NodeMemory);

}
#

Idk if its the right way to do it

floral compass
#

Well there is your problem

#

Hold on

steel moat
#

hmm?

floral compass
#

Oh, well nevermind, I thought the AcceptablRadius gets overwritten in the Super:: call again but I just checked and that doesn't seem to be the case

#

I'll see if I find something

#

I think I misread your question, so let me clarify this part:

whenever i start the game it sets acceptance radius as 0 and then it takes the defined radius
You want the radius of the actor to immediately take effect on BeginPlay?

#

And that is not happening right now, right?

steel moat
#

yes

#

actually sometimes it does and sometimes it doesnt

floral compass
#

Hmm

#

Sounds off. Can you debug and confirm it's related to the BT task and not how you're setting the variable?

steel moat
floral compass
#

Does your Pawn exist when that node is reached? Is the pawn actually a child of ATurretBase?

floral compass
#

Because the behavior you described sounds like what would happen if this evaluates to false:

if (ATurretBase* pawn = Cast<ATurretBase>(AIC->GetPawn()))
steel moat
narrow python
#

I want to add option for ai to manually specify what navigation agent it should use. Where to look for it in code? I made my changed path following component in c++, but i didn't look at how navigation works yet, may be someone did. I asking because you can't make two agent with same size but different walking properties. And i think there should be option to manually correct anything automatic.

haughty tide
#

Is there an async move to task that can succeed directly if path exists towards the target key ? It appears that default MoveTo is considered in progress until goal is reached.

stable falcon
#

Hi guys, do anyone know any tutorials or resource on how to implement GOAP(Goal Oriented Action Planning) in unreal engine, thanks.

jaunty cairn
#

guys I made a Enemy AI,but I dont know how can I change his Chase Run Speed?

misty wharf
olive prism
#

When the variable is false, the special attack branch is executed, but I only want it to be executed only when it is true

misty wharf
olive prism
#

Yes, i have an Inversed option but the same thing happens to me, the special attack is always executed and never the basic attack

olive prism
#

I found a way to do it, it is without using a BTD, it is using a blackboard type decorator and putting the value of the boolean, when it checks the value of that boolean if it is true it executes that tree for me, is it okay to do it this way?

misty wharf
#

Sure, if it works it's fine. Although to me it seems like it should work via the custom decorator also

olive prism
misty wharf
#

That seems like the only thing that could be going wrong with it ๐Ÿค”

olive prism
#

I tried it, and the strange thing is that it never prints anything

#

As if the function is not executed

misty wharf
#

Did you put the print before or after the cast

#

because if you put it after the cast in the success branch it kinda sounds like the cast is failing

olive prism
#

I added it after but it seems strange to me to think that the cast could fail when the object is provided to me by the same function

misty wharf
#

The cast will fail if the actor is of a different class

#

It's always best to verify things like that if it behaves in unexpected ways instead of assuming it's correct

dark warren
#

How do I get the nav mesh closer to objects? The distance is to big for my characters and changing the cell size as no impact

misty wharf
#

This should be affected by the agent capsule radius

#

Note that your actors can go all the way to the edge of the mesh, so that the actor's origin is at the edge

#

so their capsule will be outside the bounds of the navmesh at that point

dense owl
#

Thereโ€™s also making custom agents

dark warren
dense owl
#

Make custom agents in project settings

nimble smelt
#

I've got this AI right now that's either patrolling or pursuing, depending on whether it's detected a target. I want to add a new mode to it, where it just sits and waits until it detects a target. If it loses the target, then it starts patrolling, it never goes back to waiting.

#

I know I could do this by having a new blackboard var that's like an "is waiting" bool, but that seems clumsy. Is there a way to make a BT branch that can't be re-entered like this?