Tag Info

New answers tagged

0

Actually the order of execution in my question was wrong. When a task terminates, if it immediately awake its parent pushing it in front of the queue the depth first order is respected. Here's how the queue status is supposed to be just after leaf_A task terminates: S1(running), P1(suspended),leaf_C(running) | [leaf_A(completed)] When leaf_A ...


0

There are a lot of ways to move something between two points. Want it to go in a straight line at a constant velocity? Then you might want to consider simple linear interpolation. // Gives you a value that linearly interpolates between the start and end. // t is an interpolation parameter between 0 and 1. When t = 0, the position is // at the stat. When t = ...


0

position += velocity * DeltaTime * speed; This is a better way of calculating the position. this way your movement wont slow down on framerate drops, because you take into account the time elapsed between the last Update call, if it was longer than usual (low fps) you move more distance. The code you have simply keeps increasing the position and never ...


0

I use this simple script I whipped up to get mobs to follow on the X axis (but you could easily add a couple of lines to include Y axis as well because it already calculates that distance I just don't use it because I'm building a side scroller) I just created these functions in a MobAIMovement script and then called TotDistance from the Update function. ...


1

I've seen some people address this by having AI mark the path they plan to walk on as more expensive for other AI. This has the effect of some avoidance between agents but since it isn't time aware (the future path is more expensive always, not just when the agent will be there in the future) it can make some odd behavior if it is too strong of an effect. ...


1

You have: void Chase () { Vector3 targetDirection = target.position - transform.position; transform.position += targetDirection * moveSpeed * Time.deltaTime; } One problem is that your targetDirection is not normalized but rather has magnitude equal to the distance between the objects. By multiplying this unnormalized vector to determine the ...


0

here is the alpha-beta algorithm definition: Alpha–beta pruning is a search algorithm that seeks to decrease the number of nodes that are evaluated by the minimax algorithm in its search tree. It is an adversarial search algorithm used commonly for machine playing of two-player games (Tic-tac-toe, Chess, Go, etc.). It stops completely evaluating a move when ...


1

I thought this was a good solution for a similar problem, from a question (and answer) by me here on SO. Abilities here are essentially AI if they are tickable. I have a runnable that just runs through all Actors and their abilities and tries to tick() them. interface for manipulating abilities: public interface ActorAbility { // doesn't work, but ...


2

One simple way of doing it could be to make a few alternate versions of the script and have different AI profiles for the enemies (just give them a random one when created). This way you could have one type that goes straight ahead like you have now, but also others that try to get the player by curving right or left. Maybe even one that makes some random ...



Top 50 recent answers are included