#🤖┃ai-navigation

1 messages · Page 10 of 1

plain monolith
#

so they don't follow the line so closely?

narrow dock
#

Hello, can anyone help me with my AI agents? Thery are basicly skipping my triggers when they are not in view... Its so freaking weird, when i open scene view on second monitor they are working fine..

winged forge
#

How can I stop a NavMeshAgent from automatically applying its desired velocity (ie moving). I want to apply its desired velocity at fixed time intervals (on fixed update) but if I stop the agent with isStoped = true, it no longer calculates it's desired velocity (it's always zero)

#

And is there a better way to perform deterministic agent navigation. Right now my agent's finish at slightly different positions/rotations each time I run my simulation. I assume due to frame rate variation

hollow tapir
winged forge
#

I need to find out when DesiredVelocity is updated.

strange blaze
#

Hi all, i have a 2D game, where a player can "drag" things and these moves may occasion damages. I have a score function based on the total damages inflicted by the enemies.

So i just want to send the Board to the first layer of the Conv Neural Network, and then let the game compute a turn to get the resulting score (to change the DNA of the CNN and the mating probability in accordance to the score)
Since it's a genetic code, i would want to spawn many instances of my game at the same time to accelerate selection.

Are those things possible ?

slim garnet
#

is your big picture to have a reinforcement learning neural network agent to play the game? i think there is a tutorial for that

#

but you might be best off trying to solve the game yourself first, to understand if there is a point to that

plucky moth
#

Hey everyone, does anyone have any idea as to why my agent is reacting to a linker from so far away? i want it to only do the correct jump when its actually on the link or super close

alpine glacier
# winged forge How can I stop a NavMeshAgent from automatically applying its desired velocity (...
private Vector3 desiredVelocity = Vector3.zero;

private void Awake()
{
    agent.updatePosition = false;
    agent.updateRotation = false;
}

private void Update()
{
    agent.nextPosition = transform.position;
    desiredVelocity = agent.desiredVelocity;
}

private void FixedUpdate()
{
    // Now we can move here using the desiredVelocity
    // I usually zero out the y.
    Vector3 velocity = desiredVelocity;
    velocity.y = 0.0f;
    // Add gravity and stuff then apply to you character controller.
}```
stray lagoon
#

Hello @everyone,

Has anyone work on integrating Dialogflow ES with unity before? I need help please

pastel magnet
#

size of object without AI destination target

#

size with AI destination target

#

the scale isnt working properly if this Target is set

#

if you know the solution please @ me

real sonnet
#

🤔 maybe it's setting the z component ?

pastel magnet
#

@real sonnet thanks, it was in my script with z yes

frozen oxide
#

https://youtu.be/G9Otw12OUvE
How can I make the agents form like brackeys did and not collide with each other trying to get to the same point?

Let's see how many NavMesh Agents Unity can handle! That's right, another excuse for making a huge simulation ;)

♥ Support Brackeys on Patreon: http://patreon.com/brackeys/

····················································································

♥ Donate: http://brackeys.com/donate/
♥ Subscribe: http://bit.ly/1kMekJV

● Website: h...

▶ Play video
woven vessel
#

several solutions either if one agent and at x distance from the other it slows down, or you make them leave one after the other. Personally the first and much better

#

can help you i think

undone ore
#

anyone know how to make a enemy shoot at a player in 2d platformer not top down

real sonnet
velvet arrow
#

I am trying to wrap my head around behavior trees. The whole tree should evaluate almost every tick and not be "stuck" in a state. How do I in practice nog "restart" the action? Say if I when I start moving toward an enemy indicate that with showing the path. I only want to do that one and then run until target is reached .

Or is an action locked for as long as it is running state?

alpine glacier
#

@velvet arrow your node has a status, that can be Inactive, Running, Success and Fail.

#

I don't think trees walk the whole thing every time.

#

They keep a list of the running nodes I think.

velvet arrow
alpine glacier
#

Are you implementing your own BT?

#

Making the editor UI is not gonna be fun.

velvet arrow
#

No, looking at Behavior Designer.

alpine glacier
#

Ah I see. I am using NodeCanvas.

#

Yeah, dynamic reevaluation is good for when your nodes have some sort of priority.

velvet arrow
#

Implementing my own feels a bit pointless. I have been trying to decide between NodeCanvas and behavior desigmer

alpine glacier
#

Where if a higher priority is eligible, you want it to interrupt the other ones.

velvet arrow
#

Yes, I mean if I have a patrolling enemy, I want him to abort that if he finds the player for instance

#

How do you find NodeCanvas? Do you happen to do multiplayer as well. That is my biggest "problem" area atm. The ai logic isn't overly complicated, it would probably be manageable with a FSM but still.

alpine glacier
#

I am using it for a prototype rn and I really like it. Making my own nodes is a breeze. I kinda ignore some features like binding reflected properties and methods and using them as is in the graph. I prefer explicit custom nodes and setting the blackboard values from script.

#

Also NodeCanvas has FSMs as well.

#

It supports BT in FSM, BT in BT, FSM in BT and FSM in FSM.

velvet arrow
#

Yeah behavior designer looks more polished for what it does. But having the option for graphical FSM as well is awesome.

alpine glacier
#

As for multiplayer, I don't know. Aren't you supposed to run AI on the server.

velvet arrow
#

Being able to sync the blackboard (multiplayer) and serialize the state(save/load)

#

Yes AI will be run on server.

alpine glacier
#

Then there is no data to sync?

velvet arrow
#

The transforms for positions. Also stuff like target(who is the enemy targeting, what is the enemy doing)

alpine glacier
#

Well, yes, but that's part of the gameplay script.

velvet arrow
#

So the client can present the data in an accurate way, without being in control

#

And react to events

#

I guess I just have to take the plunge and try to implement it, something theorize is too hard :)

#

So you would recommend NodeCanvas

alpine glacier
#

I guess.

velvet arrow
#

:)

#

What are you prototyping?

alpine glacier
#

A top down shooter.

velvet arrow
#

2d?

alpine glacier
#

3d.

velvet arrow
#

Cool

#

I'm curious, how do you handle animations. Do you handle them within the action nodes, have specific ones or totally outside the tree @alpine glacier

alpine glacier
#

I took the principle of "BT states the execution plan, not the execution how to" to heart so nodes don't even contain gameplay logic.

#

All nodes just submit a request to the AI actor and wait for the MoveCompleted event.

#

All my nodes are just a bunch of boilerplate, see?

#

Ah right, animation.

#

Well actual gameplay logic is contained inside these gameplay SpecialMoves.

#

And they just call Animator.CrossfadeInFixedTime(SomeSubstate).

#

This lets you avoid giant spiderwebs of transitions everywhere.

#

AAA games do it the same way.

#

Well, some of them.

#

Instead of every animation substate machine linked to all others you trigger procedural transitions to specific ones from code.

velvet arrow
#

That takes some time to process but sounds really good. Then it is easier to reuse for the player character as wellm

alpine glacier
#

There we go.

#

I timestamped it.

velvet arrow
#

Thank you! Do you happen to have any resource regarding "the execution plan"

alpine glacier
#

It's just something I heard.

#

I don't remember which talk.

#

Let's put it this way.

#

If I turn down the update rate of my AI to 1 time per second.

#

The gameplay will not break.

#

If I change the animator structure and update the gameplay code, the AI tree will not need to be changed.

#

This is my first foray into AI.

velvet arrow
#

Yeah I think I get the principle, I will just need to see if I can find myself some examples . To wrap my head around it

alpine glacier
#

I can give you an example of my test tree.

velvet arrow
#

Yes please

alpine glacier
#

Let's look at the charge to node.

#

It does not trigger animations.

#

It does not run some movement code in update.

#

It states that we need to charge to some position.

#

So it tells the AIActor script hey, this is the position I want you to charge, you handle it.

#

Just gimme an event so I can signal that the node has completed its work.

velvet arrow
#

I see. It feels like it sort of sets the actor to a specific state (charge state, attack state)

alpine glacier
#

My actors are a bit more loose than that.

#

Instead of implementing everything in 1 script, each special move is a separate monobehaviour.

#

I can add the same Charge behaviour to any actor.

#

It might be dumb to people who actually do AI.

velvet arrow
#

And it can have a totally different charge behavior

alpine glacier
#

Cause my special moves basically replicate how BT nodes work.

#

To the point that they have a status, enter, exit and update callbacks haha.

#

But they let me handle special move interruptions on the gameplay side.

velvet arrow
#

That sounds like a statemachine

alpine glacier
#

Well, states are exclusive.

#

My actions are not.

#

And well, state machine has fixed transitions.

velvet arrow
#

I see. I think I might make it a little less flexible but still keep more actor specific logic inside the actor itaelf

alpine glacier
#

I don't have any transitions at all.

#

Well yeah, my system is kinda weird.

#

I just wanna get this done and minimize my annoyance.

velvet arrow
#

Whatever works :)

#

Thank you for your time, got lots to think about :)

alpine glacier
#

Sure.

#

I made it this way cause I have no bloody idea what my AI is gonna do in the game.

#

You can watch Unreal AI tuts for more proper info.

velvet arrow
#

That's a good idea. I will do that

dusk sandal
#

trying to bake the platform as walkable

#

but it doesn't bake for some reason

alpine glacier
#

@dusk sandal is it marked as Navigation Static?

dusk sandal
#

oh

#

no it isn't

#

maybe thats the problem

pure scarab
#

Can anyone introduce me to some basic enemy ai that i could try figure out

nova minnow
#

How do I NavMesh a planet?

paper star
#

How do I clear and rebake a NavMesh via script?

I am making a game that randomly adds or takes walls from the world as you play. It works well for the player since the player uses physics which collides with the walls.

My NavAgent doesn't detect the wall; it uses a NavMesh. When the world changes, he will run through a wall that just appeared or dodge barriers that no longer exist.

paper star
nova minnow
#

Thank you 🌹

jade schooner
# paper star How do I clear and rebake a `NavMesh` via script? I am making a game that rando...
Unity Learn

In this recorded live training session we show how to work with Unity’s Navigation tools at runtime. We will explore the publicly available Components for Runtime NavMesh Building and look at how we can use the provided components to create characters which can navigate dynamic environments and walk on arbitrarily rotated surfaces, including ene...

final coyote
#

Is there a way to fix this issue? I'm clicking on bottom floor but ai goes to upper floor because my clicked point is closer to upper floor I think?

frozen lance
#

maybe somehow check the y value of the click and if its below the y value of the second floor it moves it down to 0 or whatever y the first floor is, as to be nearer?

final coyote
hollow tapir
#

I've gotten myself completely in the weeds trying to figure out how to structure my AI so that different agents can share logic. Can anyone offer some tips on structuring them so that things don't become a mess?

For example, I'd like to have agents that can share logic for things like "Attack Move", but may have different implementations, or even different abilities (perhaps one with vision and hearing, one with only vision). Should the agent's brain contain all the logic, so both agents inherit from the same Brain class and modifies it based on what sensory components are attached? Or should each Brain subclass just override functions that can be called from logic stored external to it?

I'm aware there's no "right" answer, just looking for a starting place that won't leave me feeling like I'm making a mess I'll have to clean up later

alpine glacier
#

And even Unreal tuts don't tell you shit.

visual linden
#

Hello. I’m not sure if this is the right channel for this question, but I am trying to develop a set of behaviors for my game’s “enemy” NPC’s (2d top-down game). I want to create a set of weighted averages to have the NPC determine what it should do in a given situation (right now, the options are to stay idle, chase player, run, and/or alert neighbors). I have attributes like proximity of player, aggression level, and fear level, as well as a modifier to cool down times. But I am not sure how to calculate and weight options, without a lot of if…then statements. Is there a way to optimize choices based on weights and a given scenario?

visual linden
#

I am looking at using the GOAP model (I'm going through a tutorial now at https://www.udemy.com/course/ai_with_goap) but I wonder if this is the best option? Are there other models that might work for this situation? GOAP seems to be designed for modeling interactions in an environment. For my scenario, I think I am looking for something a little simpler. AI that looks at its environment and reacts based on weighted variables. What other options exist for something like this?

hollow tapir
# alpine glacier I thought I had an answer but I still feel like I'm doing something wrong consid...

Lol I appreciate the feeling. I talked to someone smarter than me yesterday and settled on something along the lines of

  • Brain has functions like Move() or Attack() that can be called by whatever logic system (BT, FSM, etc) which can be separate or plugged into the brain.
  • Sensors like Vision or Health are each separate components, the Brain has references to each component.
    Good enough to start with.
hollow tapir
# visual linden I am looking at using the GOAP model (I'm going through a tutorial now at https:...

A behavior tree or state machine would be much simpler to implement, with state machines probably being the simpler of the two as you can just implement it yourself based on a rough conceptual understanding. GOAP and HTN (the more evolved successor to GOAP) are both types of "planning" systems, i.e. for making somewhat longer-term plans.
This is a classic read on behavior trees but note that each node is somewhat more like a "state" than how some behavior tree literature defines nodes (i.e. specific atomic actions). There's a lot of overlap between the two ideas.
An easy way to start would be to just write an update loop for an agent that stands still and attacks enemies, or whatever. Then a different version for the same agent but it only runs away from enemies. Etc. Then write a switch statement so you can toggle which behavior you want at the moment. That's where your "AI" comes in, deciding how and when to switch. You can do it deterministically, randomly, or somewhere in between, but that will give you something to start experimenting with.

sonic rain
# hollow tapir Lol I appreciate the feeling. I talked to someone smarter than me yesterday and ...

That's nice. Having sensors separated and reusable is good. You can even tick those sensors in different frame rates...like "Only update de eyes at every 15 frames", so you can do expensive operations (like raycasting for FoV and overlapping) in a reduced interval, depending on how frequent your AI needs the data to be updated (and depending on the amount of agents and complexity of the sensors to get the data)

Having a Brain is also ok...but I prefer polymorphic and "generic" solutions. I prefer that the FSM or BT will expect some kind of Action, which might have an abstract Execute method. Then you create N actions which inherit from Action, and just implement that Action's specific logic...like ActionChaseEnemy.Execute() would move the entity towards a target, ActionHealSelf.Execute() would use a health pack, etc. So the BT/FSM will just rely on the generic Action, and you can create, plug/unplug new types of Actions as you want. But I prefer this approach being data-driven, so you can just reference different Action assets and that's it, you changed how your AI behaves. Having it all in mono behaviours will make you need those may components on all of your Bots, creating may instances of Brain, which is not very optimal depending on the amount of data that it needs per instance. But it is not bad. It's just per user preference...I always do it data-driven

sonic rain
# visual linden Hello. I’m not sure if this is the right channel for this question, but I am tr...

I want to create a set of weighted averages to have the NPC determine what it should do in a given situation
That's the headline for the Utility Theory model. You have Considerations, which will result in a Score based on some Input, which are inserted into Curves. You re-evaluate these Considerations every tick and score them from best to worst. The Score itself is the utility of that Consideration. It is like:

  • "How useful is it for me to Heal right now?" SCORE: 0.7
  • "How useful is it for me to punch my enemy right now?" SCORE: 0.25
  • Healing gets higher score. Do it

It's not the simplest AI model out there...but yeah, if you want weighted based priorities and decision making, that's it. I'll post here some links of GDC talks on the matter that you can watch in order, if you really wanna go in deep on this:

GDC 2010: https://www.gdcvault.com/play/1012410/Improving-AI-Decision-Modeling-Through
GDC 2012: https://gdcvault.com/play/1015683/Embracing-the-Dark-Art-of
GDC 2013: https://www.gdcvault.com/play/1018040/Architecture-Tricks-Managing-Behaviors-in
GDC 2015: https://www.gdcvault.com/play/1021848/Building-a-Better-Centaur-AI
GDC 2018: https://www.youtube.com/watch?v=TCf1GdRrerw&ab_channel=GDC

#

PS: Utility choice (weighted decisions) can be just part of other AI models no problem...like having a BT, HFSM or GOAP which uses the core idea of scoring, in order to make the decisions and drive through states/branches/whatever

real sonnet
#

Yeah you don't HAVE TO implement Utility theory to benefit from weighted scorers. They are self-sufficient.

alpine glacier
#

@sonic rain how do you separate gameplay from those actions then? Let's say an attack action needs to play an animation and wait for it to end and a bunch of other stuff like changing movement speed, for example.

hollow tapir
# sonic rain That's nice. Having sensors separated and reusable is good. You can even tick th...

Yeah this is kind of what I was getting hung up on. I have a tendency toward pre-optimizing and also making my systems overly generic as if I was going to give them to a designer who's goals I don't know. But I'm the designer! So I end up falling into the trap of spending six months building the perfect system, and then being left with a design that could be implemented by two if statements. For this specifically I realized that (part of) my issue was not having the design nailed down, so I spent a lot of time figuring out behavior trees and then realizing that what I actually need was a planning model, and I was working the problem from the ground up, trying to figure out how my high-level behavior trees will handle atomic actions which shouldn't even be part of them.

The data-driven part specifically is where I got hung up on code structure. The .Execute() would need to have references to what's using it, so I wasn't sure where that should go. Questions like "What happens if you call Move.Execute() on an agent that can't move" and "Am I going to be wasting time doing GetComponent every time I call any function" were really tripping me up. In reality, it's no trouble to just override a few functions for the one or two agent types that will vary slightly from the base class. (In this particular case)

visual linden
alpine glacier
#

Putting those parameters in the tree itself would be bad cause then if you wanna do the same in a different part of the tree, ya gotta duplicate.

#

I ended up having to replicate the actions but on the gameplay side.

#

So I have a MoveToObject action task that just calls AIRequestId requestId = actor.Execute(actor.GetComponent<MoveTo>()).

sonic rain
# alpine glacier <@!140261876779974656> how do you separate gameplay from those actions then? Let...

My actions can perform changes to the game state (i.e moving an agent, attacking, healing, storing a reference to somebody that I wanna chase). I don't couple animation to my AI, nor do I couple specific ways for doing stuff. I do atomic stuff, like micro actions which can perform small (or not always so small) stuff, and I have the other key part of the AI, which are the transitions. The transitions happen only when certain (set of) conditions happen. So the "completeness" of something is defined by "did the things specified by the transition happen?". Then I model the entire behaviour based on that:

  • While in a state, keep doing actions (which doesn't return nothing, they just execute stuff)
  • While in a state, keep checking for the transitions (conditions) which comes from that current state

Letting type-specific components handle everything related to some task is fine too, if I understood what you're doing. But it's less re-usable (IMO), and is way more coupled. It probably ends up depending a lot on that specific entity and task in hand, and that specific game, etc...if a MoveTo fails for some reason, then you'll have to investigate the whole things that MoveTo does, which can be a spaghetti. It is a coder choice, if it suits your case, that's very cool!

I have 4 AI models implemented in the same framework, and they all rely on abstract Action. I made one sample test game (very simple: a guy who picks jewels in the scenario and deliver them into a box), and in all 4 models I used exactly the same Actions. The reusability is nice. But not all project needs that! So in the end it is a matter of choice and not only "correctness". I'm interested in the way that you seem to do your AI, and I think I'll try playing with that too, but so far I'm following that path

alpine glacier
#

I actually made it that way so I can reuse same actions on all AI.

sonic rain
#

Yes it is reusable, I'm just not sure if it ends creating too big/spaghetti dependencies

#

If you create type-specific components to solve a problem in its entirety

#

Doesn't seem to allow for easily changing how a big task needs to be done

#

Seems like it needs to increase and change MoveTo a lot if needed

#

Rather than just re-referencing some atomic actions

#

I might be wrong ofc

alpine glacier
#

Well, there will only be 1 move to. There weill be other behaviours like strafe, follow that impact steering.

#

For example, here's how the charge attack component looks.

#

How would you do it without making a base actor class that supports literally everything?

sonic rain
# hollow tapir Yeah this is kind of what I was getting hung up on. I have a tendency toward pre...

As for referencing:

  • The abstract Execute can have some parameters (if it's data driven, this is mandatory), such as the character itself. So it receives "character" as parameter, and performs stuff on it
  • It can have a Context object which you fulfil with data, or references to components, which are already pre-cached so you don't have to GetComponent frequently
    So it would be a matter of pre-caching, and parametrizing the Execute with the types of data that you need

But yes it can be challenging sometimes to get the data needed...you might here and there have troubles on doing so. I see many devs talking about using Context objects which are passed down the pipeling, etc...but also, it can be a good thing for the AI to not have access to everything, because you know, encapsulation and decoupling is a good thing too

It is also very very common to see AI devs with blackboard systems implemented (a global blackboard for shared data, and a per-entity blackboard for entity-specific data, like that entity's health). Then you get data from the blackboard

So yeah your concern is real and a common thing

sonic rain
# alpine glacier For example, here's how the charge attack component looks.

That look cool. But yeah the way that I usually go for it is not mixing too many systems into one's hand. You have damage, speed and animation, there are at least three systems involved, which can be messy. If your only have 1 of each type of things, that's fine, but what if you have a BullCharge, GoatCharge, LionCharge, etc...it's a big Ctrl+C / Ctrl+V, where each one of the Charge types would have micro-specific changes depending on how an entity can charge somebody, did I understand it correctly?

#

My example is assuming that the ways to Charge would be different

#

A non-optimal case

#

For a large scale game

alpine glacier
#

No. They would use the same component. You'd just set the animation names in the inspector.

sonic rain
#

I don't mean the animation

alpine glacier
#

And the damage and the speed multiplier.

sonic rain
#

Lets say that one will Charge in a straight line, other would Charge in a senoidal movement

#

And other jumps

#

That's a big switch case inside the component, no?

alpine glacier
#

For jumping that'd definitely be a separate component.

#

As for the path shape, sure I could just add an enum dropdown.

sonic rain
#

Yes, so that's the big switch case based on an enum that I personally don't like, but I understand how useful it can be

#

I'm just not sure how it scales for huge projects

alpine glacier
#

Hey, MonHun devs do it so yeet.

sonic rain
#

Interesting

alpine glacier
#

So you would prefer to use a sequence to implement this task?

#

Basically hack it as a visual programming tool?

sonic rain
alpine glacier
#

Uhm it's not broken down.

sonic rain
#

Everything that I'm saying is based on the visual programming tool that I have

alpine glacier
#

But then you'd have to specify the running speed in the tree itself?

sonic rain
# alpine glacier Basically hack it as a visual programming tool?

It is (IMO) the way that desingers can do the job with the coder: by having a sub-set of Actions that can be mounted in any way, compiled into a data asset, run the game. If everything on the AI is 100% defined inside a component, a non-technical designer will not be able to handle it, designers will just say "hey coder, I want THIS. Oh, that went bad...nah, now I want THIS"

#

Which can be a huge waste of time on quick production

#

I'm inspired also by Square Enix' HFSM+BT editor

alpine glacier
#

Hm. But you can't really handle interruptions as gracefully if you code gameplay in the tree.

alpine glacier
#

Let's say you use a sequence and in that sequence you use an action SetTarget. And at the end of the action you put ClearTarget. But if some action higher in the tree interrupts the sequence, you don't get cleanup.

#

You got invalid state.

#

I am using NodeCanvas which has both BT and FSM btw.

sonic rain
#

I do reactive BT

#

Unreal style

#

NodeCanvas seem nice, never used it

#

But I consider, seems very cool

alpine glacier
#

You mean your node graph has an event slot you can connect and hook cleanup up to it?

sonic rain
#

Not necessarily, it's the whole concept which wraps "event driven BTs", the core idea being "cache the Running leaf and re-evaluate only Dynamic Composites, Observed Blackboard Entries" and yes it is possible to do Events. It's a large topic which some of us talked about here: #🤖┃ai-navigation message

Just to be clear, I have things divided into atomic stuff, so I can have my AI editors, so it enforces decoupling/non spaghetti, and helps designers to have the power to change the resulting behaviour, which is the main point that I think that cannot be done with hard-coded behaviours on Components that designers cannot touch, only the coders. It's all atomic, data-driven, zero allocation, leightweight, designers can participate

#

Hey @alpine glacier I have to go, nice talking to you, I will try your approach some time for sure

#

Talk to you later, bye bye!

alpine glacier
#

Alright.

coral oasis
#

Hey, so in order to get the job i applied for i have been given a demo project and one of the tasks is creating bots in a single player game.
So this game is kinda like Aquapark.io and they asked me a build an ai for the bots that some fails to complete the tasks the in game some doesn’t, as if they were not bots but players. Duhh.. :P

The thing is i am not sure how should i make my research about this to create such an ai. I have practiced ai before but those were for games like tic tac toe.
Can anyone let me know what kind of ai mechanics i should use or even some keywords to get me start researching about this?

real sonnet
#

Whatever the AI you always want to implement some kind of handicap. Because once you figured out - or get enough closed to - the perfect version of your algorithm/decision-making system, your bots will unrelentingly perform at 100%.

#

Think about preventing your first person shooter bot from scoring 100% headshots hits

#

Or closer to your tic-tact-toe game, forbid your chess AI to always win in the shorter amount of moves possible

#

Maybe you wanna explore randomness or percent-based modifiers to your equations

#

You can also limit information available in your AI blackboard

#

(making sure your AI is dumb)

coral oasis
#

Thank you i will check it out

terse tulip
#

I'm looking for a way to create an AI with 100 percent accuracy. Well it will always shoot the projectile towards where the player would be based on the velocity.

#

As long as the player doesnt change their velocity they will get hit

paper star
#

How can I lead my AI's shot? I am currently doing newPlayerPosition = player.transform.position + ((Vector3) player.movementInput * speed) but the AI leads it too far and can easily be dodged.

molten sequoia
#

Projectile travel time needs to be accounted for

proven nova
#

anyone here us MoreMountains top down engine

#

'use

near tulip
#

Is there a way of making a navmesh system without baking?

alpine glacier
#

Anybody know if there is a way to bake a navmeshsurface only above a certain height, or within a boundary area?

#

@near tulip you can do runtime navmeshes

keen moon
alpine glacier
#

Thanks a million

clever elm
#

im figuring out behavior trees (self implemented as its just for learning purposes)
currently i want to implement basic
-if sees player, move to player position
-when player is lost, wait some time

  • wander randomly between waypoints

im stuck on the middle part as i cant figure out what kind of nodes i would need to trigger it only once when the player was just lost and not everytime it doesnt see a player
would this even be handled directly via nodes or would i just set a variable when setting the player to null, which the ai can check, wait and then remove that variable, to not trigger the wait behaviour again?

velvet arrow
#

can anyone point me in the right direction. Wanted to see which type of AI could be suitable for this type of game. The goal is simply to push the opponent off the board. And the input(controll) is a force in x,z direction. No ground-breaking neural network, something simple 🙂

clever elm
# velvet arrow I think it can be called using priorities in a sequences. Which can force re-eva...

i tried to wrap my hear around that but still cant see it working
if i have a sequence with:
sees player -> moves to player -> waits
then that would only wait after the move node succeeded
i dont see a way to get it to wait directly after it looses sight of the player as what would fail there is "sees playerr" but i dont want it to wait everytime it doesnt see the player, just directly after loosing sight

velvet arrow
clever elm
velvet arrow
#

sorry I am merely a beginner myself. It depends a bit on the implementation of the behaviour tree itself.
But interrupt or dynamic /priorities is what you should look into

clever elm
#

ok ty

solar monolith
#

Hey guys

#

You ever ran into a problem

#

where you're building a NavMesh, but its never making any progress at all. It just sits there loading forever

#

This is all thats in my scene

gloomy summit
solar monolith
#

Hey guys, I tried creating a new project, and nav mesh baking worked perfectly fine, but the version was 2020.2f.2

#

while in my current project thats 2020.2.7f can't bake nav mesh

alpine glacier
#

why...

#

why is it trying to get through that

#

thats a solid object

#

it doesnt try to get through other solid objects

#

just that specifically

#

now its just infinitely stuck there

#

and thats game breaking

#

because the character is vital for the game to function properly

#

perhaps because it has holes or smth

#

idk

noble fog
#

make sure it is not using old data or an alternative mesh somehow.

#

or agent data changed and mesh not recalculated

alpine glacier
#

i baked it again but it still didnt work

#

idk tbh

#

it has a box collider, should that not be enough

#

i ticked off not walkable and now he appears to be getting around it but im just gonna let it run for a while and see if he gets stuck

#

(he's programmed to randomly wander around the map so if the bug is still there after a while it will happen)

#

i think nav mesh is kinda broken

noble fog
#

Resolving an unexplainable behavior helps re-creating in clean environment, in new scene, for example (with more basic components). Then comparing what went wrong.

alpine glacier
#

i think im just going to reset his destination if his position is the same for longer than 5 seconds or something tbh

#

seems like an easy, lazy fix i can do

noble fog
#

On other hand if you don't fix this, it's likely you'll encounter it again by repeating the same mistake. Mesh should be working fine when configured properly.

alpine glacier
#

hold on a second

#

ok so basically: im stupid, one of his possible destinations was inside the shelf

#

lol

#

i removed the shelf and then he went in that same spot and i was like wait hold on a second

quaint gazelle
#

need some help deciding what kind of AI algorithm I want to use, I want my AI to not be too predictable and be reactive to the environment / player, (i want to have high replayability), not sure if i should go with BT, GOAPs or something else pls @ me

ivory rock
#

how do i make a person that chases u?

brisk oriole
#

Hey guys, i have this script where bots move and stop when the distance between them and the target is 1, problem is its a wave game and the enemies have collision and as soon as any of them collides with each other they all start shaking trying to get past that 1 range barrier 😄
I can post the code just ask I don't wanna overlap any other questions

quaint gazelle
#

is it 3D or 2D @ivory rock

ivory rock
quaint gazelle
# ivory rock 3D

use navmesh agent and then just sync animations to the movement speed

patent mirage
#

How do I make real time navigation for a 2d environment? I have a randomly generated world and I’m struggling to get the enemy to path to the player properly

pearl temple
#

is it possible to recaculate a certain area of a navmesh?

#

for example: I want destroyable trees

#

and I want to update that in the navmesh

#

but I dont wnat to update it completly due to map size

patent mirage
#

As far as I am aware it’s all pre baked and that is my problem too

pearl temple
#

hmm

#

there must be a way

real sonnet
#

@patent mirage @pearl temple

patent mirage
#

Thanks I’ll give it a look 👍

clever elm
pearl temple
#

@clever elm true!

#

that looks right ty

thorn hemlock
#

One of my navmesh obstacles is carving out the navmesh like it should, except that the carving area is larger than I want it to. It seems to be take the carving size from one of the children to this navmesh obstacle, which happens to be a collider. This collider's size fits perfectly with the carving size. But I want it to carve from the navmesh obstacle collider size, not this child collider. Anyone know a fix?

marsh sundial
#

Why is the child collider there then? Child colliders are considered a part of any parent collider

thorn hemlock
#

its a trigger collider, made for detecting when some other objects get near it

#

used for other purposes than 'collision'

#

So it seems that the carving's size is automatically the size of the largest collider of the gameobject, including child colliders..? Any way to turn this off?

marsh sundial
#

All child colliders are combined into the parent collider. I think for this you'll need your trigger on a different object

#

Or at least not below other colliders or rigids in it's hierarchy, otherwise it will be assigned to them

thorn hemlock
#

I was afraid of that. But should be fixable. Thanks for your help

marsh sundial
#

No problem. Yeah it works the way it does so that a "compound collider" can be made from several simple primitive colliders

#

@thorn hemlock you could also try moving the colliders to different layers? May also work, though I'm not 100% sure

thorn hemlock
#

I think the first solution is the one most likely to work. Yeah, i suppose that makes sense, just wish there was an option to disable that.

patent mirage
#

@marsh sundial I like your keyboard

marsh sundial
#

@patent mirage haha, thanks. WASD brand, had it a few years now

muted stump
#

Hey there, how can I make my enemy able to drop heights when pursuing my player?

#

I currently have this set up, whenever the player drops from that ledge, the enemy awkwardly goes back down and around.

pure scarab
#

11 days ago he said this... his computer is just that slow

#

11 days later he will have a witty response to my witty response

muted stump
#

@twilit saddle 🙏

low hill
#

how should i consider scripting an NPC? Is it wisest to hold most of the code in a single script? should i do a separate script for its movement? Same as heath? abilites? I'm just looking for recommended coding practices for NPCs

west orchid
#

hey guys , anyone have an idea on how to make an top down 2d enemy ai move in an area rectangular (minX,minY,maxX,maxY)

alpine glacier
#

ai wont update its path

clever elm
terse tulip
#

I'm currently using a DrawLine to check if my enemy has line of sight of the player in order to move toward them, however it gets stuck in corners sometimes. Is there another way to check for vision, possibly a thicker raycast?

somber blaze
#

sounds like you are looking for boxcast

#

@terse tulip

twilit saddle
crude glacier
#

Does anyone know how NavMeshAgent and NavMeshAgent.areaMask works?

#

I want to change the areaMask via script

dim wagon
#

has anyone implemented utility theory

clever elm
zenith jacinth
#

is there a way to smooth the path of a navmesh agent ?

#

currently its like this but i want it to be a more bezier curve kinda thing

compact tinsel
#

What's a good approach to pathfinding with things like locked doors? For example, there's a bunch of keys, some behind locked doors, and I want to collect all of them in the most efficient way possible. Trying to do a branching kind of A* where it starts a new branch every time there is more than one key available is getting to be a bit of a mess.

alpine glacier
#

What's the biggest size feasible navmesh?

dim wagon
#

I'm not asking just to ask though

#

at the time I was looking for any existing tools based on AnimationCurve that could be used to generate utility scores

#

Behavior Designer has Utility Theory in it as well

#

but I dont like visual scripting

olive urchin
#

Hi all, I'm using NodeCanvas right now for AI to do behavior trees and FSMs. But I feel like it's overly complicated. Even just trying to reuse logic across assets and bind animators and stuff, it's messy.
Am I overthinking it? Should I just be using code or some other framework?
I don't have crazy complex AI needs.

olive urchin
#

yeah nevermind, I'm gunna scrap NodeCanvas and just do this in code

vale egret
#

Does anyone have experience using ML to develop AI and playtest their games?

#

Unfortunately the article is sparse on details

gray comet
#

I'm not sure but I think ML is typically too computationally expensive to actually do anything at runtime. But it's great for stuff that finishes executing at compile time. In my case it's sometimes useful for art production. Surely it can be used for creating data structures like graphs, which can then be used at runtime. but again i am a newbie at it and I'm sure there are many people here who know more. )

#

the article you linked is pretty cool, looks like they got it running great in realtime. i'd like to know more too ))

final coyote
#

Is it safe to add rigidbody and collider to a navmesh agent?

#

Apparently its not, my character went crazy after adding rigidbody...

vale egret
#

My main concern is how to encode the game state and translate the output to a decision

#

Plus how easy it'd be to train

copper current
pure scarab
keen moon
#

I've found six other posts asking the same question with no solutions unfortunately

alpine glacier
#

hey y'all!! i got few questions about AI.. tbh i got many questions cuz i am very new to AI things. First question is, i created a state machine to control my "npc's". I want to make it very simple, find a target, go to a target, attack the target. what are the best practises for it? like, should i use navmesh and agents or should i just go for something else.. im really lost here 😄

chrome surge
#

Wassup, whenever i build a navmesh in code using NavMeshSurfaceVar.buildNavMesh();
the game freezes for a couple of seconds and then my agent freezes

#

and doesnt walk around

surreal fractal
#

@chrome surge If you're doing that in the middle of a frame that doesn't sound surprising. I'm not really familiar with this API, but wouldn't you need to call some Async version?

chrome surge
#

Aha, what wierd about my problem is that, yesterday i launched unity, the day before everything worked fine, but then it started freezing, i changed apsolutely nothing but now its freezing

#

thinking about completely removing all of the nav mesh stuff i have and reinstalling all of it,

surreal fractal
#

Well, I have no idea what might've changed, but if you think about it it's likely that building a structure like that can't be done fast enough for a single frame

chrome surge
#

Yeah maybe, used to work fine but now it just freezes and breaks the agent lmao

surreal fractal
#

Again I'm not sure if that's quite right as I've never used it myself

chrome surge
#

oh ok il check this out

keen moon
chrome surge
#

yeah looking into it rn, im doing that but now when it updates it deletes all of the area of which the agent can walk,

#

i think this also happenened for the buildnavmesh too but atleast it isnt freezing when i do this method

#

its almost like its removing the data

dusk sandal
#

I use navmesh agent to make enemies walk towards the player, when the player is inside a collider they start attacking and I want the stopping distance of the enemies to be there

#

now either they stop too far away or walk inside the player

#

any tips?

chrome surge
#

still havent fixed this issue

#

really aggrevating tbh

alpine glacier
#

@dusk sandal you can update your navmesh target at fixed interval.

#

Let's say every 0.5 seconds or so.

#

Also you can always throw the navmesh agent away and write your own with your own logic for steering.

abstract rampart
#

I'm trying to make my nav mesh spawn not in 0, 0 and its giving me this error

#

How would I fix this with it not spawning in 0, 0

alpine glacier
#

is the free version of a* project worth using

ember hemlock
#

@alpine glacier yes

#

and pro is so so worth it

gilded blade
#

Heya everyone! I'm using A* to attempt to create wandering AI, where the AI will go to a randomly generated position, then when it reaches that one, go to another.

Unfortunately, I'm quite new to A*. I have a simple target system working where the AI will go towards a target, but not to a randomly generated position. Anyone have any ideas?

real sonnet
gilded blade
hollow tapir
# gilded blade I just saw this, and I'm about to see how it goes 😃

Use insideUnitCircle to get a 2d vector as a direction and then just set their destination to (position+direction)*someDistance (or the closest point found in your navigable area). If you use a vector3 for a 2d space, you'll get vectors of random lengths when you discard the 3rd dimension

civic jay
#

I want to develop a AI for a card game do you have docs or exemples ?

granite dawn
civic jay
#

I will try to not copy all 😂

tropic bluff
#
    private void Patroling()
    {
        if (!walkPointSet) SearchWalkPoint();

        if (walkPointSet)
            agent.SetDestination(walkPoint);

        Vector3 distanceToWalkPoint = transform.position - walkPoint;

        //Walkpoint reached
        if (distanceToWalkPoint.magnitude < 1f)
            walkPointSet = false;
        print("Walkpoint is false");

        //Mike's Experimental Code

    }

#

I have this set up, but when the agent reaches its target destination, it just stays where it is. I don't know why

late spoke
#

there has to be an issue with SearchWalkPoint, maybe picking the same destination?

tropic bluff
#

Ill take a look

#
    private void SearchWalkPoint()
    {
        //Calculate random point in range
        float randomZ = Random.Range(-walkPointRange, walkPointRange);
        float randomX = Random.Range(-walkPointRange, walkPointRange);

        walkPoint = new Vector3(transform.position.x + randomX, transform.position.y, transform.position.z + randomZ);

        if (Physics.Raycast(walkPoint, -transform.up, 2f, whatIsGround))
        {
            walkPointSet = true;
        }
    }```
#

I have this set up for searchwalkpoint

late spoke
#

I believe that raycast should be inverted, you want it to set walkPointSet true when it doesn't hit something

tropic bluff
#

oh, should I just change it to walkPointSet = false then?

late spoke
#

no add a ! before the raycast

tropic bluff
#

ohh okay thank you

#

Nope same problem as I had before actually

late spoke
#

oh I now see what they raycast is for

tropic bluff
#

Yeah

#

I can put in the whole script if that helps

#

like the movement bit

#

The main problem that I need to fix is that I need it to identify that it's not moving anymore, therefore, find a new waypoint

#

but the way i have it set up isnt doing that for some reason

late spoke
#

so it works once, but thats it?

tropic bluff
#

correct

late spoke
#

Only thing I would suggest is manually setting the walkpoint for testing

tropic bluff
#

Mkay, will do

late spoke
#

or throw a bunch of debug logs on it to see exactly what is happening

tropic bluff
#

So changing it manually works fine

#

SO I just need to find a way to change it when it stops moving

#

Is there a way to calculate the velocity of the gameobject/rigidbody? I've tried rigidbody.velocity.magnitude but it doesnt compute

late spoke
#

so its an issue with SearchWalkPoint

tropic bluff
#

I believe so

#

It works fine the first time, but once it reaches its destination, it doesnt calculate a new one

late spoke
#

is the random range large enough? if its 1 or less it'll keep giving locations less that 1f away and have to check again

#

also what is the issue with rigidbody.velocity.magnitude?

tropic bluff
#

I have the WalkPointRange at 10, i've tried at 30, 80, and 100, and it all works fine

#

Ill show you in a sec but

#
        Vector3 distanceToWalkPoint = transform.position - walkPoint;

        //Walkpoint reached
        if (distanceToWalkPoint.magnitude <= 1.0f)
            walkPointSet = false;```
#

I have this, is it maybe the fact that it's trying to get 1 magnitude value out of a Vector3 value?

#

Like there's 3 values, and it's trying to return one

late spoke
#

no magnitude gets the total length of the vector

tropic bluff
#

Okay

#

Hang on

late spoke
#

I would just use Vector3.distance(a,b) btw

tropic bluff
#

rigidbody.velocity.magnitude returns:
Error CS0246: The type or namespace name could not be found?
&
"rigidbody.velocity" in explicit interface declaration is not an interface

#

how would I use that? Like where would I replace it

late spoke
#

are you literally typing rigidbody or the cached rigidbody field?

tropic bluff
#

uhh

#

rigidbody

late spoke
#

you need to make a field for Rigidbody rb; and use GetComponent<Rigidbody>() in awake

tropic bluff
#

ohhh thank you

late spoke
#

or make it public and manually set it in the inspector

tropic bluff
#

mkay! ill try that and see if it works

#

thanks for your help so far

late spoke
#

no problem

#

basically you need to tell it specifically which rigidbody you want to know the velocity of

#

I'm curious to see the movement code now

tropic bluff
#

ill show you once im finished with this bit

#

Okay, so I got it so that when the velocity is below 1, it finds a new one, but the problem is now that, since it starts at 0, it constantly is finding new ones and trying to move towards them

late spoke
#

how are you moving the rigidbody? unless you use Rigidbody.MovePosition it won't update the velocity of the rigidbody

tropic bluff
#
    private void Patroling()
    {
        if (!walkPointSet) SearchWalkPoint();

        if (walkPointSet)
            agent.SetDestination(walkPoint);

        Vector3 distanceToWalkPoint = transform.position - walkPoint;

        //Walkpoint reached
       if (distanceToWalkPoint.magnitude <= 1.0f)
          walkPointSet = false;

        //Mike's RB Code
       if (rb.velocity.magnitude <= 0.3f)        
       {
          print("rb.velocity.magnitude is lower than 1");
       }

    }
    private void SearchWalkPoint()
    {
        //Calculate random point in range
        float randomZ = Random.Range(-walkPointRange, walkPointRange);
        float randomX = Random.Range(-walkPointRange, walkPointRange);

        walkPoint = new Vector3(transform.position.x + randomX, transform.position.y, transform.position.z + randomZ);

        if (Physics.Raycast(walkPoint, -transform.up, 2f, whatIsGround))
            walkPointSet = true;
    }```
#

This is the movement code

late spoke
#

I need to see how the actual character moves

tropic bluff
#

I can show a video hold on

late spoke
#

I assume agent.SetDestination() is in charge of that

tropic bluff
#

Oh wait u mean the code lol hang on

late spoke
#

yeah sorry lol

tropic bluff
#

no worries

#
          agent.SetDestination(walkPoint);```
#

Yeah this line

#

this is for an enemy ai btw, just to be clear

late spoke
#

can you show me the code for that?

tropic bluff
#

wdym?

#

That's the code that moves it

#

I think

#

lemme look again

late spoke
#

in visual studio right click on SetDestination and click goto definition

tropic bluff
#
public bool SetDestination(Vector3 target);```
#

this?

late spoke
#

I'm just confused because I don't see any code that actually moves the enemy

#

are you using some asset to handle character movement?

tropic bluff
#

it's using the navmeshagent, so the agent's destination is set to the walkpoint which automatically moves it

late spoke
#

oh okay

#

I'm not too experienced with navmesh, but you said it worked fine when you manually set the destination

tropic bluff
#

correct

#

im just trying to find a way to set it to false once it reaches it

#

would there be a way to determine if it has reached the walkpoint?

late spoke
#

put debug.log messages on everything and see what is happening

tropic bluff
#

alright

#

I think ill call it a night for now, you really have been helpful. It's getting late for me so ill sleep on it and come back once i am ready again

#

ill try some other methods but thank you so much!

late spoke
#

like if (distanceToWalkPoint.magnitude <= 1.0f) walkPointSet = false; Debug.log(distanceToWalkPoint.magnitude); Debug.log(walkPointSet);

#

no problem, good luck

viral ledge
#

Anyone have experience with nav mesh surface? I'm trying to solve a problem where building my nav mesh results in flat areas under hills being navigable. We're building dirt paths by clipping in thin cubes of dirt at the bottom of hills. Hoping there's an alternative to "carving" each path by hand.

keen moon
#

we're using it in our current project & it's great

#

I should mention that the PointInTriangle function it uses to determine which areas not to 'clean' doesn't actually work in all scenarios, so I swapped it out for this

{
    var plane = new Plane(v1, v2, v3);
    if (plane.GetDistanceToPoint(p) > 0.001f)
    {
        return false;
    }
    var tN = plane.normal;

    plane.SetNormalAndPosition(Vector3.Cross((v2 - v1).normalized, tN), v1);
    if (plane.GetSide(p))
    {
        return false;
    }

    plane.SetNormalAndPosition(Vector3.Cross((v3 - v2).normalized, tN), v2);
    if (plane.GetSide(p))
    {
        return false;
    }

    plane.SetNormalAndPosition(Vector3.Cross((v1 - v3).normalized, tN), v3);
    if (plane.GetSide(p))
    {
        return false;
    }

    return true;
}```
probably not the fastest way to do it but fixed the problems I was having
vale egret
#

Hey guys. I've worked with MiniMax in the past but never MCTS. I'm now understanding it for the first time and I'm a bit surprised by how it works. It seems pretty imprecise for how popular it is. Does anyone with experience know how to tell when it should be used over the former?

#

The branching factor for my game is pretty high but a lot of the branches don't yield impactful results. This is why I looked into MCTS in the first place.

blazing garden
#

Anyone ever get 'Failed to create agent because it is not close enough to the NavMesh'?

molten sequoia
#

Yea it's not uncommon. Make sure it's on a navmesh when the agent is enabled and that the scale of your world is not too far off from 1 meter = 1 unit

blazing garden
#

thanks @molten sequoia how do i check my world space? sorry new to this..

molten sequoia
#

The 3D object cube is 1 unit big in all directions

#

If a dog in your world is massively bigger or smaller than that, your units might be a bit bonkers

blazing garden
#

a cube looks fine.. the weird thing is my other navagent works fine.. guess i'll just keep my mushroom guy with same movements as a worlf until i figure this out, any other tips? @molten sequoia

#

when you say on a nav mesh, you mean position the gameobject on my baked floor right?

molten sequoia
#

Yes

blazing garden
#

ah got it working.. seems like the base offset needed to be changed, it was up in the air rather than on the ground 🙂

#

thanks so much!

rigid imp
#

hey so I have a problem with my AI enemies: when the player is on a section of the navmesh that is not accessible to the AI, it stops moving or behaves weirdly. I want them to move as close as they can and so that I can eventually make them jump or drop down.

molten sequoia
#

Generally you should at least get a partial path

#

If the navigation system panics, you could try first calling the whatever methods snaps to the navmesh and navigating to that

rigid imp
#

I think I may have solved it by changing some settings in the navmesh baker

#

nope, nevermind

#

it seems like the problem only occurs with multiple enemies for some reason

#

if there's only one, it works perfectly

forest wing
#

Hi all im using raycast over an enemy and i have my player and all is suppost to be working perfectly

#

but my enemys are not following the player.

#

Anyone has time to check it out?

#

but my enemys are not following the player.

copper current
pure scarab
dusk sandal
#

Im trying to bake a navmesh agent but why doesn't my new map getting baked?

zealous mantle
#

@sleek jacinth Don't crosspost.

silver pulsar
#

Hello everyone, do you know if there are some tutorials about ml-agent with self play?? Because i don't understand how it works with teams...
And what kind of information does Ray perception sensor 3D gives for observation?

crimson oxide
#

Hi, is it possible to manually move a navmesh agent's perceived position to where the object's transform currently is? I'm trying to do a jump animation using DOTween with a navmesh agent, but if the agent jumps past this gap, he snaps back to where he last left off, even though I'm using agent.nextposition and setting it equal to his end destination.

Is this even possible?

#

The agent also does the same even if there is a navmesh link between the gap. It seems to not want to cross it at all.

tranquil granite
#

Hey, does anyone have a picture of a very large behavior tree I can use for reference? I don't need read what it actually does, I just want a picture of a huge tree

turbid panther
#

Have anyone tried making a smooth agent transition between neighboring navmesh chunks over navmesh links ?
Even with very short navmesh links (.0002 units) the transition is still snappy. Just 1 or 2 frames, but still noticeable.

alpine glacier
#

what would be the best way to make a path finding ai in a random generated world

gilded blade
#

Heya everyone! Using A* on a top down grid map, and I'm struggling to figure out why some navigational areas appear in walls, despite them having been set as an obstacle?

The only way to fix itself is to set the node size to 1 (instead of 0.5), but doing that makes the entrance unable to be accessed. Any ideas?

wooden pawn
#

hi all

#

Guys, please tell me how can I make automatic people so that they can walk by themselves?

#

2d isometric

long spade
#

um i trying to make enemy that shoot u in 3d game plz help

signal ledge
#

Can anyone recommend me a free "library/framework" with the GOAP implementation?
I've found some of them over git/unity store, but wanted to check if anyone can recommend a good one

half violet
#

Has anyone setup A* that makes use of memory instead of world information?
Something like:
Agent stores its own walkableGraph and they update portions of the graph with what they can currently see.

#

The intent being that if a wall is created outside of their view, they would create a bad path and follow it until they see the new wall and update their walkableGraph.

dim wagon
hushed heath
#

I want to learn how to create bots for games in Unity. Does anyone have any idea about this topic?

half violet
#

Depends on your goal.
A method that I like is behaviors and goals.
Actually kinda similar to ecs model.
There is a common goal that the behaviours operate on.
So the goal (component) could be a weighted list with various behaviours (systems) that alter the current weights.
Then you have a final system reads the goal and acts to accomplish it.

molten sequoia
#

IIRC you can tell it create a navmesh within a radius of the agent

half violet
#

I haven't done pathfinding in unity before, so maybe?
do you know how it handles navigating to a point outside of that radius?

#

because I would like the agent to still path smartly around what it thinks is there

molten sequoia
#

No idea. Haven't used Unity pathfinding for a while.

turbid panther
#

You can manually control what to use as source geometry to build a navmesh at runtime, but I'm pretty sure it won't scale all that well

half violet
#

Yea ... I'm probably going to have to set it up manually instead of using something that is prepackaged.

finite thistle
#

This game object has no colliders, but this maroon box seems to register as a collider when baking nav meshes

#

Does anyone know where this could be coming from?

finite thistle
#

Okay, I fixed that issue by using render meshes, but now the agent will stop at the end of each navmesh, instead of moving to the next one, even though they're connected

#

Okay, so the problem was simply that the height of difference in navmesh height was too great. problem solved lol

wooden pawn
#

Hello everyone who can suggest a good A * lesson for 2D games isometric
I couldn't find anything for 2D

granite dawn
#

Can anyone suggest a complete pathway for creating AI in unity from beginner to expert for everything like Car AI , shooter ai , zombie ai etc (no money and time issues)

alpine glacier
#

What are my best option for using behaviour tree inside unity?

copper current
pure scarab
dusty acorn
#

Hi all, I am getting this issue with NavmeshAgent.remainingdistance on all my agents. Im using the remainingdistance to stop within a certain distance, but my check always triggers immediately because I always get a first hit of 0, before it then proceeds to the correct distance. I'm getting around this currently by skipping the first reading but its a bit annoying and surely can't be usual practice.

pure scarab
vocal valve
#

is it possible to make a navmesh agent move toward a point while NOT forcely facing it towards it?

kindred whale
#

You make him go to the point and into the update lookat the point you want to

#

There is probably a better solution :x

lone tundra
#

That's what I do too.

mental rampart
green bolt
#

Can I use the NavMesh System so my Object moves in a grid instead of simply "walking"?

mental rampart
green bolt
#

I have my movement done already. But I need the AI to move in a grid and not with speed and acceleration and stuff like that

mental rampart
gilded trail
#

Hi guys, is anyone noticing the NavAgent seem to move a lot faster on android built?

thick minnow
#

hi! is it possible to save a navmesh to a prefab room that can be instantiated?

echo brook
#

How performant is the real-time navmesh stuff?

#

Been thinking of using the real-time navmesh to make a large AI physics-based snake avoid getting stuck on itself by using the real time nav mesh to make it see it's own body as an obstacle

#

but was have a really large navmesh on our game and I'm not sure how performant it would be to do the cutout stuff on it to cut the snakes body out of the navmesh

keen moon
#

from my experience navmesh obstacles are quite performant, if that's what you're referring to

vale egret
#

Hey guys is minmax ai a common use case for dots?

#

It's a bottlenexk for my strategy game and I was wondering if ecs would help

karmic moth
#

Gentlemens, a question about the implementation of the behavior tree. I saw two options, a simple and understandable for me uses ordinary links to execute related nodes, the second option is built on a stack. In this case, the stack is filled / cleared every tick. What are the pros of 2, does it just work faster or is it needed for some additional functionality?

light saffron
stone owl
#

I believe scene cam is diff to player cam

#

you won't have to worry about that in a build

twilit saddle
#

Confusingly enough - you can preview frustum culling by opening the Occlusion Culling visualization window.

alpine glacier
#

Hello, I'm struggling trying to have a collider work on a object that has a navmeshAgent on it, wondering if anywaone knows of any bug related

#

have to point out that I'm not using internal calls (on collisioEnter/exit etc.. ), I'm doing an overlapsphere and untile I don't add a navmeshagent to the object I'm able to detect the collision

#

collider doesn't work no matter what, tried with trigger on/off, multiple size/type, on the same GO as the navmeshAgent and on a child... but nothing, if agent is On, I don't get a collision

#

if it is Off all works (already checked layers/tags/physics menu) done a gizmo on the collider (spehere/box) and the position size are right

#

...forgot to add... a rigidbody (kinetic or not) doesnt make a difference, also disabling the navmeshAgent at runtime has odd results, sometime the collision is detected, sometime not

stone owl
alpine glacier
#

@alpine glacier yeah that's a good point

alpine glacier
#

Solved, Colliders monobehavior transform position is not updated when physics is off,

thorn hemlock
#

Anyone know how to fix this navmesh issue? I have some colliders that follow the door frame, but it covers the entire mesh instead of making a hole in the middle.

molten sequoia
#

I imagine you tweaked agent radius and height to rule those out?

thorn hemlock
#

No, but im experimenting with it now and it doesnt seem to do the trick..

keen moon
copper current
pure scarab
alpine glacier
#

If still doesn't work, you could try playing around with the voxel of the navmesh, it may affects the results, just a guess I'm not a specialist

steady merlin
#

So i got kinda the influence calculation but i wonder how i can make it without Vector2.distance because that makes no sense with walking range e.g. so how do i iterate though it? And how can i add a threshold so the enemies wouldnt take over the influence map? Function Frequenzy is 1Hz. The Influencemap got a list with his upto 4 neighbours

public void CalculateInfluence(ref InfluenceMap influenceMap, Transform[] enemyAgentPosition, Transform[] alliedAgentPosition)
   {
       foreach (InfluenceNode node in influenceMap._influenceNodeGrid)
       {
           float inf = 0;

           foreach (Transform t in enemyAgentPosition) inf -= 1 / Mathf.Sqrt((1 + Vector2.Distance(t.position, node._Position)));
           foreach (Transform t in alliedAgentPosition) inf += 1 / Mathf.Sqrt((1 + Vector2.Distance(t.position, node._Position)));

           node._Influence += inf;
           Mathf.Clamp(node._Influence, -1, 1);
           
           if (inf < minInf) minInf = inf;
           if (inf > maxInf) maxInf = inf;
       }

       map = influenceMap;
   }
alpine glacier
#

in my enemy script, I have the communication method. which is used for communication between two enemies when there in range of each other.

my problem is that when enemy A detected player enemy B won't stop chasing the player even when the player is out of chasing range.

here's the code: https://pastebin.com/kTbgG6Ur

light saffron
# steady merlin So i got kinda the influence calculation but i wonder how i can make it without ...

I don't understand your question but since i did influence map without distance a while ago using cellular automata (i think) here it is https://forum.unity.com/threads/using-asyncgpureadback-to-compute-influence-map-with-a-compute-shader.539487/

#

(Based on someone else's work)

river wolf
#

Do we discuss ML too here ?

keen moon
river wolf
keen moon
#

😂 np

slow anvil
#

hello guys anyone used the minimax algorithm down here please ?

delicate light
#

hey guys, having a weird behavior with the AI Planner. In the decision controller, when sending one of the objects as a parameter for the callback function, the gameobject is null

#

this doesn't happen eveytime, and the objects for sure exist in the scene

#

has this happened to anyone else?

sonic mortar
#

Anyone try NodeCanvas or Behaviour Designer? I'm hoping to upgrade my AI's FSM to a behaviour tree but I can't seem to decide between the two

rancid bane
#

Anyone here have much experience with A* Pathfinding? im looking for a way for my enemies to ignore the player if they are outside the enemies pathfinding grid

proud wigeon
#

Which component is the AI one?

molten sequoia
#

@proud wigeon Unity doesn't come with mature AI solutions beyond navigation. Actual decision making AI is something you need to build.

thorn hemlock
#

I have a pretty large Navmesh Surface that bakes, and I want to bake in runtime pretty often. Is there a way for me only to bake a section of the navmesh surface, instead of all of it? I've tried separating it into multiple navmesh surfaces, but they all cover the same area despite trying to have them cover different square'd chunks.

keen moon
# thorn hemlock I have a pretty large Navmesh Surface that bakes, and I want to bake in runtime ...

I had pretty much this exact same issue recently
The problem with splitting up a navmesh surface is that your agents won't be able to move between the different surfaces without off-mesh links/navmesh links, which in my case wasn't ideal
I ended up using NavMeshSurface.UpdateNavMesh(), since only updates tiles that have changed (https://github.com/Unity-Technologies/NavMeshComponents/issues/95#issuecomment-419983756). It was really slow for me at first but after a bit of digging I discovered that setting both NavMeshSurface.ignoreNavMeshAgent & NavMeshSurface.ignoreNavMeshObstacle to false improved its speed to the point where I could call it as often as I wanted with very little impact on performance. Playing around with the surface's Voxel Size & Tile Size properties also seemed to help.
If that doesn't do the trick, in 2020.1+ there's a NavMeshBuildSettings property called preserveTilesOutsideBounds which when true will only update tiles that are completely within the current bounds of your surface (https://github.com/Unity-Technologies/NavMeshComponents/issues/95#issuecomment-609466521)

thorn hemlock
keen moon
halcyon latch
#

is there a way to bake objects while the game is running through a script

molten sequoia
#

Bake navmesh? Yea should be doable since NavmeshComponents do it

marble rose
#

this is currently the code im using for AI wandering

#

Its a bit to random, and results in frequent bumping into walls and the enemy is... not convincing

molten sequoia
#

The first thing to consider would probably be predefined paths. If creating predefined paths isn't feasible (large/open world), some sort of steering based on navigation edges should make the behaviour a bit more believable

steady merlin
#

I need your help - so i got kinda a influence map (2D Grid) but it dont use the Obstacles? So how do i need to iterate though my nodes to archive it. Because rn i only using Vector2.Distance for the Influence calculation but thats wrong.

Somebody any tutorials or something

sinful matrix
#

;

stark stirrup
#

Hello. I have the following problem: I have a bunch of NavMeshAgents that are following the player. The problem is that since they all follow the same path, the player can just run circles around the level with the enemies following it. Not very interesting.
I want the enemies to take different paths to the player, possibly flanking him.

#

My idea here would be for all enemies to have an area around them that increases the navigation cost, meaning there is an incentive for all not to follow the same path

#

From what I'm seeing, the only way to do this is to constantly being rebuilding the NavMesh right?

sinful matrix
#

Does anyone know how to fix this

#

when i activate my animation it just makes it stuck in the ground

#

pls help

molten sequoia
#

Looks like a default humanoid pose. I would double check that the animation data matches with the bone setup

sinful matrix
#

ok

molten sequoia
#

@sinful matrix Don't crosspost questions to multiple channels.

sinful matrix
#

ok

clever elm
#

Looking into planning algorithms, what is out there beside goap and htn and commonly used?

regal prawn
#

Hello, I'm currently creating a complexe behaved enemy drone, but my only one script begins to being pretty fat, so I'm thinking about using behaviour tree, I heard that they're pretty efficient, but I lack of knowledge about how to code it

#

I have more than 25 functions on it, I have to create a script for almost each of them ?

light saffron
#

Panda BT is even easier to use

marble rose
#

anyone know of any really good tutorials on how to have enemy navigation/patrolling?

regal prawn
#

Oh thanks for the response

#

And also, where can I report an issue

#

When I try to gizmo a point obtained by NavMesh.SamplePosition my editor shut down

regal prawn
marble rose
#

Im using some code for basic navigation where they just walk around at random positions but its super super broken

#

i tried making it so they went to multiple set points of invisible cubes but they broke after like 5 seconds

regal prawn
#

My script select a random point in range, use sample position on it, check if the path is available and check is there are obstacles around it at a given range

marble rose
#

more advanced than mine

#

mine just goes "you want me to move at a random position in a 20 meter radius alright"

regal prawn
#

It's still not very natural

marble rose
#

then gets stuck in like a ton of spots

regal prawn
#

Do you use setdestination ?

marble rose
#

let me see

regal prawn
#

With a correctly baked navmesh there is no way to being blocked in a simple situation

marble rose
#

lol its probably not correctly baked

regal prawn
#

The path calculated will just not allow it

#

Check the layers

#

And stuff like it

marble rose
#

public static Vector3 RandomNavSphere(Vector3 origin, float dist, int layermask)
{
Vector3 randDirection = Random.insideUnitSphere * dist;

    randDirection += origin;

    NavMeshHit navHit;

    NavMesh.SamplePosition(randDirection, out navHit, dist, layermask);

    return navHit.position;
#

i think this is what generates the random location

regal prawn
#

This is more or less my searchDestination func

marble rose
#

my navmesh is all over the place lol

regal prawn
#

Oh this is some complex terrain

#

I don't know level designing yet

#

You should precisely set your layers

#

And sometimes the navMesh clips just a little bit inside meshes

marble rose
#

all those holes are because of trees or bushes

regal prawn
#

Try to raise it just for checking if everything is good

marble rose
#

im not sure how to disable the holes from the bushes

regal prawn
#

Idk either, I only practice on super cuby terrain

marble rose
#

tbh for this project i kinda want to just work on it even though its a class project

regal prawn
#

Oh I see

marble rose
#

just wanna make things work like i want to

#

the ai being goofy is probably the worst issue

regal prawn
#

For my wander/patroll, I want my agent to smoothly move around a point, any idea to how create a function to do it ?

marble rose
#

oh thats what i was trying to do

#

before

regal prawn
#

AI is the first thing I worked on on my project

#

I want to do it for my patroll points, and then change it then and then

#

Like a hybrid behaviour

#

It would be a good start

marble rose
#

huh

#

why that delete

#

guess ill send a pic

regal prawn
#

But the orbit-around a point will be also useful for combat

marble rose
#

this is the sample code i was trying to use

regal prawn
#

You use a point list patrolling ?

halcyon latch
#

is it possible to bake a navmesh while inside a game

#

through a script

soft nova
#

So I'm using calculate path for my navmesh agent to move along (normal method moves too weirdly) but the navmesh points hug the very edge of any object they go around causing my agent to get stuck. Whether it's ignoring the agent radius or what. Any Idea for a fix?

light saffron
foggy tiger
#

Can someone help me with navmesh?

#

i copied this video but all the enemy does it follow when in range. otherwise its static

#

if there are any Unity wizards that can help that would be appreciated

frank crypt
#

How do you guys feel about AI "cheating"? in the sense that they get extra info that the player wouldn't have access to? obviously in a goal to make the ai more competitive to the player.

#

could be wall hacks for fps's, stat details for rpgs (along with exact damage calculation after rng), better stats for sports games, etc

fossil meteor
#

I don't see why the AI wouldn't be aware of the players position at all times

#

or an RPG Enemy not aware of the stats of the character

light saffron
fossil orbit
#

Sometimes it just bad, like instead of making the AI more challenging, it just ends up making the player frustrated, the rubberbanding in NFS series is a good(in a bad way) example of this.

surreal fractal
#

Mario Kart too. And most fighting games read inputs. It sucks because you feel like you're either punished for getting better, or at the very least not rewarded for it. But it depends on whether it's obvious or feels like they're cheating, and how much too. I assume most AI is cheating somewhat.

zealous sand
regal prawn
#

Hello, I'm currently trying to build a behaviour tree, and I want my agent to randomly search a point on the navMesh he's currently on, this function works perfectly but it needs very often than one frame to find the point, as it tries random points then check if it is valid, and then returns success.

But I'm blocking at the part where I want the agent to find a valid point after a certain delay, I wrote a timer node and put it and the point search in a sequence, but it will allow the point search to occur only once, so it will probably fail to find a valid point, so my question is, there is way to reset a timer node only with the success of another node ?

#

(I feel like a need to ask help here to have my brain working full speed at the troubleshooting, since seven minutes I figured that I just have to incorporate the timer system inside the node I wanted to be timed, this is still a little dirty as a tweak so if someone have a cleaner and more versatile approach, please give a hint, it'll probably help other people as well)

frank crypt
#

so i am new to unity, but listening to your first problem: "but it needs very often than one frame to find the point" made me think of the solution i often use in programming, if something takes longer than you expect/need it to, run the code earlier and save the value and call to the value when needed 😄

I once programmed a matchmaker for a specific game, and it took very long to accurately find a good match, so my solution was to run the matchmaker code while the previous battle was occuring, giving the matchmaker the time it needed to appear instant

elder summit
#

can anyone help me?

#

i want to make the path under the box walkable

#

im using A* pathfinding Arongranberg

upbeat hatch
elder summit
#

Oh how do I use layered grid graph?

#

Found it

#

Wait wtf it doesn't exist on the free version

#

Dang

#

Is there a way to use Rigidbody physics to move an enemy with NavMeshAgent

elder summit
#

figure it out

#

rb.AddForce(NavAgent.desiredVelocity)

marble rose
#

does anyone know why the scale is removed when game starts

sharp cave
#

Hey guys i'm struggling with this piece of AI code about steering behaviors for wall avoidance. Notice that my agent keep hugging the wall despite adding a force which is supposed to repel him from the wall using the hit point normal. I have attached a gif and some code. Does anybody see what I am doing wrong?
The bulk of the work is done in WallRepulsionSteeringBehaviour.cs
https://gist.github.com/OliPerraul/0b6e870f988f474a80d56a5dde3f98d4
Thanks

upbeat hatch
marble rose
#

ah i fixed it by now

upbeat hatch
#

Alright, that's good 😄

winged hatch
#

Hello, i am trying to do an A.I but i am having problems, i get these messages, and it cant run the A.I correctly, these are the messages: 1.- Couldn't connect to trainer on port 5004 using API version 1.4.0. Will perform inference instead.

#

2.-Unexpected exception when trying to initialize communication: System.IO.IOException: Error loading native library

polar compass
winged hatch
#

Oh sorry, i have the gym mlagents and mlagentsenvs, python, pip, the mlagent package and pyth, sorry i dont remember the exact name of pyth. Do i need to install something more? Also i'm using unity 2020.2.7f

polar compass
#

Which errors are you getting in the Unity client?

small current
#

Im getting this error with AI Planner

#

i get that error for all actions with that trait

#

and this error once

#
[22:24:34:473] ArgumentException: A component with type:BuffFireFixupReference [B] has not been added to the entity.
Unity.Entities.EntityComponentStore.AssertEntityHasComponent (Unity.Entities.Entity entity, Unity.Entities.ComponentType componentType) (at Library/PackageCache/com.unity.entities@0.16.0-preview.21/Unity.Entities/EntityComponentStoreDebug.cs:280)
Unity.Entities.EntityComponentStore.AssertEntityHasComponent (Unity.Entities.Entity entity, System.Int32 componentType) (at Library/PackageCache/com.unity.entities@0.16.0-preview.21/Unity.Entities/EntityComponentStoreDebug.cs:286)
Unity.Entities.EntityDataAccess.GetBuffer[T] (Unity.Entities.Entity entity, Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle safety, Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle arrayInvalidationSafety) (at Library/PackageCache/com.unity.entities@0.16.0-preview.21/Unity.Entities/EntityDataAccess.cs:1070)
Unity.Entities.EntityManager.GetBuffer[T] (Unity.Entities.Entity entity) (at Library/PackageCache/com.unity.entities@0.16.0-preview.21/Unity.Entities/EntityManagerAccessComponentData.cs:313)
Unity.Entities.ExclusiveEntityTransaction.GetBuffer[T] (Unity.Entities.Entity entity) (at Library/PackageCache/com.unity.entities@0.16.0-preview.21/Unity.Entities/ExclusiveEntityTransaction.cs:127)
Generated.AI.Planner.Plans.Balance.ActionScheduler+PlaybackECB.Execute () (at Packages/generated.ai.planner.plans/Generated.AI.Planner.Plans/Balance/ActionScheduler.cs:62)
Unity.Jobs.IJobExtensions+JobStruct`1[T].Execute (T& data, System.IntPtr additionalPtr, System.IntPtr bufferRangePatchData, Unity.Jobs.LowLevel.Unsafe.JobRanges& ranges, System.Int32 jobIndex) (at <6a104889781c465ca00c12d0953583e2>:0)
small current
#

Can AI Planner be used without DOTS or how can i fix this?

lyric moth
#

ai, maybe you can help me!
im making a 2d rts game and I want some of my tiles to be resource tiles, ala red alert, where you can path over them but a collector unit can gather it.
Whats an efficent way for the collector to tell which tiles are resources vs just any other tile?

winged relic
# lyric moth ai, maybe you can help me! im making a 2d rts game and I want some of my tiles t...

depends on a few factors, personally I prefer a dictionary where key is the tile coordinate and value is relative to a resource. If it's a small map you could use an array or assuming you have a visual element to indicate resources at the tile. That game object could be used, just do a ray cast or sphere check that your in range with your collector against the object.
Many ways to handle this that's just a few ideas.

small current
# small current Can AI Planner be used without DOTS or how can i fix this?

Or would it be better to go overkill and learn ML Agents, or maybe just code my own AI? A multilayer perceptron should be enough and ive already coded a multilayer perceptron visualization tool in unity once, so making one wouldnt be too hard, the reason to use ML Agents would be because ML Agents unlike AI Planner seems to be Unitys Posterchild, so theres alot more documentation and resources and support for it than for AI Planner, which everytime ive tried to use it has just been a broken mess that doesn't really work

carmine robin
#

using A* for the first time and i have no idea how to change the target to make the seeker follow a gameobject with a target instead of just a transform i insert. i looked it up but i cant find anything so can anyone help me?

#

oh nvm it's being explained in this brackeys vid lol

orchid crypt
orchid crypt
#

sorry I found some mistakes myself I will send the update when I fix it

grave beacon
#

Is there a way to use NavMeshAgent with the Job system?

orchid crypt
valid totem
#

Your code is indecipherable. What on earth are

child1.WXA = ParentA.WXA;
child1.WXB = ParentA.WXB;
child1.BXX = ParentB.BXX;```
If you want people to code check for you, you need to follow some sort of coding standards. Which means descriptive names for variables, comment your code, use standard C# naming conventions.
orchid crypt
#

oh

#

these are the w values in the AI's neural network

valid totem
#

Maybe that's something you could.... search for? Instead of tagging me to tell me you don't know something that is very easy to find online!

orchid crypt
grave beacon
noble fog
#

@orchid crypt Please don't spam the channel.

rich jungle
#

Hey. I am new to creating ais so I'm hoping I can get some help. I'm trying to create zombies and I use navmeshagent.Destination. But this makes all zombies go in the same direction till they turn to a clusters of zombies. How can I make them space out. While still making the player their target. Only clustering when wanting to attack

lyric moth
#

@winged relic i went with an overlap circle and it seems to have accomplished everything I need. Didn't realize the solution would be so straight forward

alpine glacier
winged relic
# rich jungle Please an answer 🤧

You don't want the player to be their target until player is withing a certain distance.
You need to plan and add some behaviors, things like patrol area, guard, or wander aimless over all the world. Attack is another behavior when criteria are met
Decide what they should be doing and then look into how to implement 😉

molten sequoia
#

I imagine David meant entities bunching together while in the attack state

fossil orbit
#

maybe some kind of flocking behavior could do the trick, choose a 'zombie leader' which leads the flock to the player

stark sage
#

are there any AI behavior assets worth buying or should I program my own?

cloud siren
#

Well it depends, do you want to code it?

lost wadi
#

anyone seen/or is watching Bracys tutorial for a RPG game

vernal bough
#

When using A* Pathing Project, how do I add a new Layer to the obstacle mask?

molten sequoia
#

It might be using the Unity layers?

vernal bough
spare grove
#

somebody with experience in navmesh 2d? (NavMeshPlus)
because works fine but if i need setdestinatation only changing the axis y, the agent stucks and move so slowly

sour summit
#

Hi. I am trying to implement NPC AI where they take decisions based on "emotions". Like each NPC will have fear, confidence scores etc.

Is a stronger enemy nearby? Increase fear.
Is an ally nearby? Increase confidence.

So then the NPC shouldn't attack the strong enemy because it's scared of that, but when it gets together with an ally its confidence will increase and it will team up to attack.

I want to research more on this. Is there a technical word for this kind of game AI? Googling for "emotion based game AI" isn't returning expected results.

orchid marsh
#

I think it was something like state-based?

#

nope, cant google that either

real sonnet
marsh drift
real sonnet
#

Nope

marsh drift
#

or just not many people there

#

having some very weird ML problems that cant find docs about xD

real sonnet
#

Give them time to respond

marsh drift
#

alright

sour summit
real sonnet
#

It's a step above. It's another way of thinking.

#

But it's not so complicated. THe nightmare can be when you try to balance things, because it can lead to emergent behaviour, which can be tricky to anticipate, because well it is emergent :p

sour summit
#

Well my goal is emergent behavior as I am trying to make a sandbox experience (like Mount and Blade). So that's a plus for me :P

#

Thanks for the help. I had heard of utility ai but I didn't know it was based on scores like I wanted

real sonnet
#

Yes it scores Considerations (what you called "emotions", but can be broaden to smthg else) to pick Actions, based on the Context you provide to your agent. Very powerful, but at it's core it's just scoring equations :p

#

I recommend the work of Dave Mark and Kevin Dill. They made a bunch of interesting GDC talks you can find online

sour summit
#

Thanks. I am looking at their GDC talks now

marsh drift
#

is neural AI even worth using in practical games or not yet?

#

like lets say a quake 3 style game

real sonnet
#

I'd say it depends a lot on your project

#

Usually you need massive amount of data for your neural nets, so if your game is not out yet, how do you gather data ? That's smthg to consider

#

Might work for early access otherwise you can get stuck in an infinite loop where your can't release the game until you finish AI but you can't finish AI until your game is released and has lot of players 😛

#

You can still have an AI that learns from the players, I think that's interesting to have

marsh drift
#

Oh? you can still teach the AI on a release project?

#

Thought it would need python cmd to be running and such

real sonnet
#

Yeah, Blizzard did it for its Alpha-thing, but they spent insame amount of money with server costs, can you ?

marsh drift
#

👀

real sonnet
#

I've seen web & mobile games have their agent continuously learn after the first training

#

Was with tensorflow if I remember well

marsh drift
#

yeah still waiting for htem to wake up xD

#

still need to ask why my damn observable goals get removed when i start teaching my AI 🤔

#

still quite a lot of funky stuff going on when trying to build ML agents, but at least its not as painful as several years ago

real sonnet
#

Yeah last time I checked they already had plenty sample project on the official unity github. Can't find your answer there ?

marsh drift
#

their examples have static amount of goals and normally just one target, too

#

and i already skimped through their github tutorials, plus watched one on youtube that seemed competent enough twice

#

nothing i saw there about my problem

real sonnet
#

:/ I'm sure people will see your message in the next 24/48 h 🙂

marsh drift
#

hope so haha

#

not exactly free on time this month

marsh drift
foggy tiger
#

Does anyone know how i can make the impoirted animated monster i just got work? i added my enemy script to it and it roams and follows but the animation doesnt

stark sage
foggy tiger
#

im new but its got a controller

#

idk what i have to do to make it work

#

@stark sage

stark sage
#

it says none under controller

#

click the circle to the right of the input box

azure crow
#

having a issue with navmesh offmeshlinks overlapping that when the character jumps from one destination to another rapidly

#

when I am moving from another position while there leaping there

azure crow
#

nver mind I fixed it

civic raptor
#

Hello! I am making a game in which I need some enemy car AI (its a racing game). So I would be grateful if anyone could dm me or ping me with some code for a simple car ai

wind crypt
#

Hello, having a issue in navmesh has path to go for destination but my agent is going a side where obstacle are there is not path to reach target but still it's going there.

raw tiger
#

What happen to a AI trying to go a point outside of nav mesh? AI buged ? Rip ?

golden kettle
#

Not really unity specific but does anyone here have any experience with Utility based AI approaches?

#

as im struggling to wrap my head around use cases for lets say "should attack" as almost all documentation so far is based on the notion of you knowing health, distance to target etc.
However what if you have 10 targets, how do you express the singular "should attack" when really it may be different depending on all the targets, also how do you decide which target to ACTUALLY attack if you do decide to attack etc.

#

as in my specific scenario its like a turn based strat game, so the unit can move X squares, use Y ability on Z target. However really to be able to know what end action to go with I need to know each of these 3 things, but to know where to move and what ability to use I need to know the target, and same with any of them and im really struggling to find out how to handle these chicken and egg problems

real sonnet
#

You used the "decide" keyword a lot, as in you're looking for a decision making algo. And that's exactly what UAI is. So you would have a target selector, which would evaluate each targets you memorised in the agent context and score them towards "the best target" to pick, eventually resulting in one winner or none. Store the best desired target back in the agent context memory. When you have one, your decision graph now has all input necessary to decide which action to execute

#

Does that help ?

golden kettle
#

sorry had a meeting let me read

#

yeah so thats what I expeced you score each enemy individually but it seemed like a more dynamic thing, and everything written about was fairly up front and set in stone.

I am unsure on the correct terms but you have an action of some kind "attack", "heal", "hide" etc and then the values which are used to derive the utility, but I wasn't sure how to express "should target unit N" as really I guess the thing you are querying is the target viability so you could make a class or something up front which acts as that but it doesn't seem to fit as an "action" of sorts so from an architectural perspective not sure where it fits into it all.

#

so as you say I can score each enemies distance, and/or their health so I know the lowest HP enemy and closest enemy etc, but this feels like aspects that effect the core decision making process, but if as you say you just run through all of these checks and store results somewhere as like a blackboard or some context that others can hook into I guess it makes more sense

real sonnet
#

You can also have some kind of composite/recursive scorers if that helps handle this special cases but that can also complicate things

#

or you can have actions with Options, thatdo handle their own best option selection logic

#

are you using an existing solution or implementing your own ?

golden kettle
#

implementing my own, its not unity specific its just generic c# atm

#

this is one thing I liked about the utility approach it seemed fairly simple to model:
stimuli/values + weighting_function = utility

real sonnet
#

yep, scorers can be as simple as equations

golden kettle
#

so I could just model each possible action/need and provide the required values/weightings etc

#

its just I couldnt align this mentality with how I would actually use it in the strat world, as it seemed I needed to get loads of contextual information first before I could decide on actions. Like all main examples use how far away a target is to indicate what you should do, but in the real world you have N targets all varying distances away

#

and in my use case you can only move X amount and have N abilities all with their own ranges etc

#

so I needed a way to factor in all the possible bits of information to come up with the best scoring for outcomes, i.e no point checking if I should attack if no one is in range, or 3 enemies are all possible targets but are resistant/low health/can counter etc

#

tbh its not going to be as complex as I say there, but it was just when I do these checks, as it feels a bit like chess AI where you do every possible move for N turns to see what gave best score, then go with that move

real sonnet
#

UAI is reactive, I would only go evaluating with the info the agent knows right now in its current context. The system is reactive enough to update behaviour as the situation evolves

#

in my opinion anyway 🙂

golden kettle
#

yes I agree its only supposed to action on the here and now, but I knowing what target is a good target requires a few different checks, i.e how far, how much hp, can they attack me etc

#

and I guess that always needs to be scanned constantly and updated as you need to know this to correctly weight the other bits

#

also do you know of any good open source implementations of something like this (not fussed if its engine agnostic or unity specific)

#

I found crystal AI but it seemed dead

real sonnet
#

did you implement different refresh rates for multiple parts of the brain ? You can have some reflex system that exec every seconds, but the enemy scanning once every 10 seconds for examples, allows some performance savings and can be justified by some tunnel-vision-action-committing :p

#

I loved the one from apex game tools, but they seem out of business. They released their framework open-source I think its LGPL now

golden kettle
#

I havent implemented any of this yet, I just am at the point where I need to implement something so was looking at approaches. I would probably just scan every time a turn is started though

#

oh are they? they did quite a few things like pathfinding/ai etc from what I remember

real sonnet
golden kettle
#

sorry yeah its a really simple 2d turn based thing, but its mainly an example project but needs some basic AI

real sonnet
golden kettle
#

same sort of thing with the uFrame guy, made some great libs but not enough sales

real sonnet
#

Back to your question, other than the apex guys implementation, for UAI i love the work from Dave Mark and Kevin Dill, not really an open-source repo but you can find lot of their GDC talks online. Then also I learned a lot from the Game AI Pro books, which are a collection of papers you can find at some places online (they are expensive but web version is free)

golden kettle
#

ah thanks

#

it seemed like there would be a few popular open source libs for this as the basic paradigm seems simple and it doesnt really need much of an editor, you could get some benefit from using unity animation curves for activation function style functions or something, but other than that its pretty much all just code stuff, I also like how you can pretty much treat it as readonly and have it in another thread just whirring away whenever needed

real sonnet
#

Exactly

golden kettle
#

but as this is kinda just an example project for some open source libs im not trying to go too crazy in depth on it all 😄

real sonnet
#

100% agree. Then I love GOAP for higher level planning, but didnt have time yet to try to mix both, would be my dream-AI 🙂

golden kettle
#

yeah I looked into GOAP as well, as I have done FSMs and BTs plenty of times and they were fine but needed a LOT of guidance, GOAP was nice as you could just give it a set of actions and it could kinda pathfind its way to a result

#

but still felt like it needed more steering and control that utility which seems to be able to scale REALLY well

#

but the double edged sword of emergent behaviour is a benefit and a worry 😄

real sonnet
#

Yeah maybe just scorers equations would be enough for 2d turn-based, eventually some additionnal classes to bundle a light decision-making framework. So other people or modders don't do dumb things. But Don't 100% listen to me. I'm the kind of feature-creep guy who shoots flies with bazookas

golden kettle
#

well once I get the basic "example" version done I plan to put it into unity and actually make a real game of some sort with it

#

as atm its actually run through Blazor (As the series was on view separation and how your game can run anywhere)

real sonnet
#

I mean that's how I see it

#

it could be dumb

golden kettle
#

well atm it just picks a random target and attacks, so anything is better than that 😄

languid meteor
#

My NavMeshAgent AI is stuttering on the X-Axis when following the player (setting the destination in Update)
My Rigidbody is Kinematic as well. It's also not because of my camera, I do these calculations in LateUpdate. Any ideas?

stark bronze
#

Anyone know of any good ways to get NavMeshAgents to detect a ledge to either climb up or down it to get to a new navmesh area? I've been stuck with this problem for a while.

winged relic
# golden kettle well atm it just picks a random target and attacks, so anything is better than t...

Just a suggestion of something to look into, Influence Maps. I'm writing a TBS in my spare time and was struggling with how to get my AI to do certain things, however I wrote my own A* pathfinding which allows me to use the influence maps for avoidance, spotting weak areas in defense etc. They tie in nicely with score based decision making too imo.
I must look into this "Utility AI" stuff as I'm just rolling my own at the moment, lots of trial and error. best of luck 😉

golden kettle
#

They mention these in the arena net gdc talk on heart of thorns

#

My disconnect is more around how you handle these different aspects of the data, like every talk so far has mentioned targets/enemies, but the action or example phases always only factor in a single enemy

#

So as we discussed before at some point you need to go through all enemies and get some contextual info like check how far they are from you, check how much agro they have, check if you can actually hit them etc. However that information can only really be factored in if it is a 0-1 value

#

I am not sure if it's basically scoring this data, saving it. Then multiplying all enemy scores together to be used within the "should attack" action

#

As you don't know if you should attack without knowing all the stuff I mention above, but you may not even need to check if you are going to heal or something.

winged relic
#

influence maps can contain lots of data, I have a few some tell me of my "attack" strength at a given area so it helps with unit coordination, often stored as color values but it could equally be data in an array. They are very versatile and useful it's just getting into how to use them at the start, then let your imagination run wild with the possibilities.

winged relic
#

I'll give a rough outline of how I do mine, basically each unit has a "memory" of units nearby so it knows when seen and basic info like range, attack, vision distance. When the intermittent scan runs it checks against this for changes, after x turns if not seen and not a building it gets removed. This saves altering the influence maps all the time, be this good or bad practice 🤷‍♂️ it makes sense to me 😛
This information is passed onto a "commander" who collates this info into influence maps. This means your AI knows that at a given spot on the map the enemy can attack with X value. It's not single target data, it's handling all threats at once. Which is then used in support of deciding which unit to attack, you still have to grab a list of enemy units within range and iterate over them to decide which is a viable target. But you have information to hand of the bigger picture not just the single enemy you are analyzing.
I'm just a noob though, poking at it when I have time and motivation. My a.i. is still evolving as I'm learning, hopefully for the better but without influence maps I struggle to think how to handle all this information in a quick efficient meaning full way. It ties in nicely with a score based approach to decision making. They have been used in games since the 90's especially TBS and RTS type games, but finding good information on them is still difficult 😉

golden kettle
#

Yeah I mean ultimately it's going to be querying the same sort of thing it's just as you say where it gets stored. Utility AI talks don't really address this as they just talk about inputs but ultimately this information needs to be available in calculations so I can probably just store it on each objects blackboard or something nearby units and their scores. I just seems a real crucial part of the Utility AI puzzle but is never explicitly talked about

real sonnet
#

You put whatever you want in your agent Context

#

UAI is a decision-making pattern

#

the sensor parts are often on Unity side

#

That is if you see your AI as a SENSE/THINK/ACT sytem

#

In your case you want to go a into a little more depth for your targets classification, one way to do it is handling it as a decision to be done by the AI, but sure you can detect threat level through influence map 🙂

golden kettle
#

The context though normally would be singular vars right?

#

And also the data about the enemies needs to be processed somewhere, so I can derive some meaningful metrics from the enemies, so if we agree we just throw an entry for every enemy into the context/blackboard for each agent, then in not sure entirely which bit is in charge of keeping it up to date, as that's another unclear bit.

#

I get that at arbitrary intervals or triggers you reassess the values of things to keep the weights up to date. Then the Actions use those weights to derive best outcome. However it's not clear which part architecturally speaking manages this, or if its just up to you as the dev to have some ad hoc process which keeps it up to date.

#

As so far the terms and jobs seem to be:

Value - a numerical non clamped representation of something, I. E ammo, health, distance

Modifier/Function/Reasoners - the graph function which is applied to values to get a normalised output

Considerations/axis - The actual weighted values that are output for each input in an action via the functions

Actions - The high level thing that the agent could do which exposes the weight based on its inputs

#

However it's never mentioned (or I missed it) where the input values are maintained from at arbitrary periods

real sonnet
#

You can store any data Type in your contexts/blackboards. Maybe you think only about scalars because you want to keep it to simple equations I guess 🤔 But as a matter of fact, your qualifiers can compute a final score based on complex data types and/or even variables from multiple sources before you normalise these values for your Function.
For the updating phase of the contexts, your AI system can either be totally unaware of it (in Unity the sensor part is often done with Unity specific ways like Raycasts, trigger zones, and such; but don't HAVE TO: can be as simple as distance checks) or as we saw in your example, you can apply some AI decisions during the scanning process (this will result obviously in different knowledge for each agent). From the AI point of view, in the former case the Context is read-only, in the latter it can write some parts of it.

split wagon
#

any good path finding algorithms?

stark sage
split wagon
stark sage
golden kettle
#

@real sonnet all makes sense, given I'm already using rx it seems like some of this can be represented as computed collections which could just be rebuilt externally

#

Thanks again for your advice

wind crypt
#

Hello everyone , I am stuck to find 2 different path for same destination is it possible ? if possible then suggest me something to solve this issue.

#

i am using UnityNavMesh system

trail lagoon
#

I wanna make a simple NPC that is friendly to the player and just walks around the scene, but I have no clue how to start. Can anyone help me please?

desert thicket
#

Hey! I'm a new to coding I have a question about how to get a wandering AI to get information of things it notices

I do a checkSphere to find things of interest which it does let me know it has notices something but I have no idea how to actually get information from what it noticed is there a command I can't find? or is using checkSphere the incorrect method?

real sonnet
real sonnet
sour shard
#

guys, I am using a NavMeshAgent on two characters, and I have a NavMeshObstacle. The problem is, that I want the NavMeshObstacle to be avoided only by one of the characters, and I want the other character to ignore the respective NavMeshObstacle. How would I do that?

sonic rain
# golden kettle as im struggling to wrap my head around use cases for lets say "should attack" a...

@golden kettle I'm sorry for resurrecting your post 2 days later, I don't check here frequently so only now I could see it
I would like to share my knowledge as I finished my first Utility Theory AI with visual editor this week and I also stumbled on this exact same question

Many nice things have been said already by other users, regarding having an extra layer of sensoring, and that sensoring might be decoupled to the UT decisions making itself...rather, you just sensor the field from time to time and have the UAI to use that info
This is very good and is how I like to express/think about AI, and the sample game that I have made with my AI editor uses exactly this approach...at every X seconds, it analyses the enemies and finds the one which has higher threat level. Stores its relevant info into the Agent's blackboard and the UT just uses this data when needing to attack

Now, even though I used this approach, I still pretend to explore what you asked about, which I call as "contextual decision making", meaning decisions that has to be done one or more times, depending on the amount of something. This "something" can be an enemy, it can be a place, it can be collectibles on the field, etc. I want to try it because Dave Mark himself exemplified a "per Target" scenario which would be "the same action, scored many times, varying the target"...IN the UT, not somewhere else (as far as I understood)! Here is a screenshot of the moment where he mentions it

alpine glacier
#

look into baritone maybe for A*?

#

it would be easy to port as it's java and C# is java based no? Or am I just being stupid

sonic rain
# golden kettle as im struggling to wrap my head around use cases for lets say "should attack" a...

Now, if I really decide to try to add it to my solution, it would probably be something like this:

  • My UT editor is inspired by another Dave Mark's presentation where he mentions that these "actions" or "considerations" can be dynamic...i.e you could add/remove them, during runtime, depending on the current game state. IIRC, he exemplifies it with a character which goes inside a "bar" and doesn't need anymore to think about fighting, but rather just socializing
  • As I created it based on this possibility of dynamic adding/removal, my system has what I call a Consideration. It is pre-defined during edit time, the possible considerations, and added to a dynamic list. These are then scored, etc
  • I can, then, create multiple Considerations at runtime, each one having a specific Target as part of the parameter, where the Targets would be "discovered" in runtime. Create N instances of that Consideration, varying the target, add it to the Considerations list, score them, and so on

Now, I'm unfortunately not sure if this will work, if it will be possible too expensive/obscure, but this will be my starting point, some day. So my answer to your question would be that your "considerations" doesn't need to be fixed and unchangeable. Take care with allocations ofc. But I might be following the wrong lead, I can't say right now for sure

sonic rain
# golden kettle as im struggling to wrap my head around use cases for lets say "should attack" a...

Just to finish, you asked for some open source UAI, and I have this one starred: https://github.com/apoch/curvature
It's Curvature, IIRC it was done by Mike Lewis, the guy who does the talk with Dave Mark about the UAI in Guild Wars
He even answered some interesting questions on the "issues" tab on that repo
Also, both Mike an Dave seems to be, perhaps, reachable

In case you're interested, here is Mark Dave's on Youtube, talking a little bit about Influence Maps: https://www.youtube.com/watch?v=6RGquWxNock

#

Wish you best of luck with your implementation

crimson bay
#

Is coding ai hard?

golden kettle
#

Depends on what type of ai you use

#

Implementation and using an approach require different mindsets, like you could implement fsms but make a hash of designing with them

#

@sonic rain thanks for all the info, I've already seen all the gdc bits and skim read the book on maths in games by Mark. I have started to implement it but I've kinda given it a sort of ecs style twist where the considerations are like components and and the actions are like groups, so I just have the considerations use observables to indicate their refresh trigger and then the Actions don't actually do anything and just look at a set of considerations and expose the highest one (or all of them if you want) then that relays onto an external handler so it's all separated

#

It may be garbage, but will see how it pans out, as its not using an editor its hard to really plot the curves well but will see how it pans out as it seems like rx could be really useful in notifying of changes and handling triggers and dependencies between conditions

sonic rain
#

That seems like a very interesting approach 🙂

#

Let me know if it goes public someday

#

😛

fallen nest
#

Has anyone attempted to create a Local Avoidance algorithm? Trying to create an algorithm that avoids other agents and knows how to go around an obstacle using feelers in all directions, but figuring how to weight the options so that it chooses the best direction around the obstacle

golden kettle
#

I think Arons A* has that, but its only in pro version

errant quail
#

How to make an ai that can score

golden kettle
#

Thats a bit too big of a question, break it down some more @errant quail

#

I have a pong game and I need to make some AI to try to beat the player, can anyone advise on types of AI that may be useful here

Something like that, or you will get no answers, but for AI in games you have:

  • FSM (state machines, each state runs through actions and transitions to another)
  • BTs (trees of behavioural nodes that each do something and pass on/end)
  • GOAP (like pathfinding for goals, quite difficult to comprehend)
  • Utility AI (lots of isolated weights on how good something is to do)
  • Bespoke (whatever you want, probably will have weightings of some kind and fuzzy logic)
errant quail
#

Well i want my ai to score goals

#

Like put the ball into the goalpost

#

@golden kettle

#

So what should i learn?

golden kettle
#

again its not as simple as just telling you "go use X" all that your game AI/Logic will do is call a method on your entity/in game stuff, so do you have functions in place to kick a ball or whatever?

errant quail
golden kettle
#

so I assume you want it to know if a ball is likely to score and if so move towards it(?)

#

so you would probably want to check how far the ball is away and what direction it is, then have your defender move towards it

#

or at least get in the line between the ball and the goal

errant quail
#

So what should i learn do to this staffs

#

Fsm?

golden kettle
#

each type of AI can do what you want its just how you want to control the AI.

#

FSM is probably the easiest of them to start out with and well documented

#

Unity already has tools that let you do this stuff visually like Playmaker/Nodecanvas etc

#

but if you want to write your own just make a simple console app somewhere (not even in unity) look at an FSM tutorial and build the states, transitions etc and then make an entity go from Idle to Eating or something when they get hungry:

public int State = States.IDLE;
errant quail
#

Oh oky that means i have to search fsm in youtube to do my work

golden kettle
#

then its literally just 3 ints for the states in a static class or enum or something, then have a value for hunger or something

#

yes, there is no way to do this without learning something

errant quail
#

Oh oky thanks a lot mate

golden kettle
#

if you do not want to learn how to IMPLEMENT an fsm/BT/GOAP system then look on unity asset store for pre-made tool that has it, then just use that

#

like you can get a free version of NodeCanvas I think

#

cant remember

#

but that has an FSM/BT thing

errant quail
#

Nah i what to learn

#

So the best is Fsm?

golden kettle
#

probably other tools that are free that do the implementing for you, then you just need to use the tool to check for the variables (hunger/distance from target/health) etc and then drive an action (run away, kick ball)

#

no no

#

its hard to say which is best

#

they all have pros and cons

#

FSMs are easiest to kinda conceptualize and implement/use

#

BTs are easier to use imo but harder to implement

errant quail
#

What do u use?

golden kettle
#

varies

#

historically BTs, right now im attempting Utility AI, tried FSMs before with some success

#

only one I have not tried is GOAP

errant quail
#

Can give me a tutorial link for dis

golden kettle
#

there isnt a single link

#

you are gonna have to google them buddy

#

just google "writing an FSM in C#"

#

it cant go wrong

errant quail
#

Oky Thanks a lot for ur time

#

Oh last qustion

#

Whats nav mash?

#

@golden kettle

golden kettle
#

NavMesh is unity's built in pathfinding system

#

so you can generate a path from A -> B with it then follow it or use some pre made controllers to follow it etc

errant quail
#

Oh ok

golden kettle
#

If you are not a dev, or are only planning to learn enough dev to get by to do stuff in unity I would advocate just getting tools off asset store/open source that do what you want and learning them

#

as devving your own stuff can take ages and thats just to get something that works, you then likely need editor bits to make it useful to work with and its a lot of effort

errant quail
#

Well my plan is to make some basic games in unity then move to unreal

#

Maybe

earnest latch
errant quail
#

But i like Programming

#

And a youtuber gave me dis plan

earnest latch
# errant quail But i like Programming

Blueprints is still programming, just visually. It's mainly for learning their API without all boilerplate like UHT (Unreal header tool) and pointers getting in the way. If you are not a programmer by trade or school, C++ can be quite a mouthful, coupled with UHT it's quite complex.

#

Nearly everything you learn in Unity will be irrelevant in UE. Some concept translate over, but not a lot.

errant quail
#

Really maybe uae is not for me

#

Can i make AAA games in unity

zealous mantle
#

Sure, if you think you're capable of doing what studios with over 100 people take years to do.

earnest latch
golden kettle
#

Yeah making games is hard, its more than just coding

#

its art, animation, environmental design, game mechanics, tooling, optimisations etc

#

even indie devs require multiple disciplines, but to be fair unity (and other engines) help you a lot. As you could go and spend a few £££ on the asset store, buy some decent models, pre made animations, some level geom, even some procedural terrain generators etc and come up with a basic world pretty rapidly that looks pretty good

#

So you can make games that LOOK AAA in unity, but its down to you as an individual if you have the skill to pull all the bits together and make it fun. Not all games need to be AAA, look at flappy birds, was a commercial success and was pretty much a tutorial app

errant quail
#

🆗 🆗 🆗

sour summit
#

Hi. I am stumped on a very simple problem. I want an agent to compare its own strength against a potential target.

Let's say the agent's strength is 0.5. What kind of function do I write so that the agent likes to choose weaker targets ie strength below 0.5, and dislikes stronger enemies ie strength above 0.5?

#

Using utility based system

#

Sigmoid function?

sour summit
#

I thinking of this -

Threat = 1 / 1 + e^-(agentStrength - targetStrength)

Basically something like this.

Any suggestions?

fallen nest
#

Really just want an AI that weighs different directions, but can't figure out a good way of weighing each direction because it usually ends up getting stuck somewhere

#

The way it's suppose to work is that it avoids certain vectors, aka the collidable areas, as well as avoiding the wrong direction, like going opposite to the target. The way I've been doing it is through dot products, but the issue is if there's a direction that the AI needs to take that goes away from the target to be able, it doesn't work because the dot product is out weighted by a bad direction that has a better weight value because it has a higher dot product.

golden kettle