Replicate using boids behavior

Hi everyone,
I’m modifying my project by eliminating pathfinding to replace it with boids behavior, I’m looking for a way to replace this part of code.
I need to understand how to make the enemy wander around the map without a specific point and then stop him for 2 seconds and then start again.
This is what I used with the pathfinding behavior:

I used idle tracker to set the waiting enemy variable, in this case I think a timer is needed.
any ideas to simulate this

Sorry for my insistence but does anyone know how to move enemies randomly using the boids behavior?

Do you just want them to move from point A to point B? Or are there obstacles the nemici should avoid?

hi mr men,
let’s say that I’m interested in moving from point A to point B but if you can take the obstacles into consideration it would be even better.
I would like to avoid using pathfinding and handle everything with boids behavior

You can use move to a position or an object and you can avoid a position or object.

This uses the cursor but you could assign a random

This uses object variables to randomly pick an enemy and assign a random target.
For testing, I used the mouse but you could use a timer and either set them all or some or 1 at a time.

You could use both Pathfinding and Boids:

  • Use an invisible object with pathfinding
  • Make Boids follow this invisible object
1 Like

let’s say it works even if the player’s movement remains cumbersome at times, I’m probably inserting something wrong.
what I want to happen is for the enemies to scout around the map and then stop for 2-3 seconds and then start again.
please help me solve this problem it is very important that it works correctly

The boids actions need to run on every frame otherwise they go away on their own. It can avoid points or the center point of an object. I don’t know if that approach would work for a wall even if you put multiple copies along the entire edge. They tend to want to smoothly avoid objects by sort of flying around them in large circles. I honestly don’t understand the weighing.

If you want them to stay within an area then the random numbers would need to pick numbers further away from the edges to allow for the objects to their large slow turns. It needs a sort of margin to allow for the large turns.

The separate objects action seems to work although it pushes them away a bit harshly compared to their normal smooth turns.

This also works. If the objects go above or below a number it forces them to move away from that position by like 100 pixels. Again, I have no clue about weight and it’s not thoroughly tested.
This follows the cursor.

1 Like

I’ve been trying to find a solution for a few days but with no positive results… I think I have to give up.
There doesn’t seem to be a way to automatically turn enemies around without a target to follow unless you use pathfinding which makes the game heavier when there are many enemies in play

For me, the boids behavior has always been too erratic. It seems better for things like flocks of birds. Things that don’t require a lot of precision.

Path finding can be intense. You can reduce the load by only moving objects on screen or nearby or selectively. You could add longer pauses or fewer characters moving at a time. They could take turns. A bunch of different characters moving a few at a time would look better than 1 character that was always moving.

I wish you luck.

1 Like

I return to this post again… I think I have found the solution to my problem as suggested by @davy.

I created some invisible objects with pathfinding behavior that move around the map and are chased by enemies.
just one last question how can I give a different timer value for each enemy so they don’t all stop at the same time
thanks guys and sorry so much