AI Following. Advanced version?

Hey guys, i’m trying to create a small pet game and i’m having some trouble thinking of the proper logic to perform the behavior i am trying to emulate.

Just some general idea on what i am trying to do

Assume player is allowed X pets to be spawned at once
When a player spawns a pet, it will spawn within a random area around player (valid area where there are no objects in the way)

I want pets to spawn spaciously near player at first. Never on-top of each-other, and not behind one another as if it where a line.

When pets are following a player they will follow spaciously behind a player…

Here is a small diagram of what i want to kinda perform…

I want the ability to follow behind the player, but if its not needed do not follow behind each pet.

now lets say i walk into a tunnel with only straight line available i’d want the pets to fall in line behind each other

What are your thoughts?

1 Like