Traffic Jam

So I know I've posted about this a couple times but I'm not making any headway.

My enemy character is either solid or not. Fair enough,. When they aren't solid they overlap and go right through the player. When the y are solid they run into each other and get stuck.

I'm looking for some sort of algorithm I can use so that they will stop when they run into the player, won't overlap, and can move around each other. I've tried making them stop when they collide with each other and bump the other enemy out of the way, I've tried speeding them up on their path but they still either enter a traffic jam or fly across the screen. I'd post some code, but frankly, I don't have an ything that works well enough to post. I basically have some player characters and the enemy brains that float towards the other side of the screen.
 

NightFrost

Member
Sounds like you're wanting pathfinding with dynamic collision avoidance. Good solutions to this, I'm afraid, are not simple. At basic level, it means enemies need to be aware of their desired movement direction and all the obstacles nearby (including fellow enemies), then decide which way to move. One thing you could look into is Steering Behaviors - but guides generally expect you to understand basic vector math.
 
K

Kanugane

Guest
I'd personally would experiment with place_meeting function and collisions. It won't be an easy one but at least, it could put you on a right path of solving this issue.
 
Got the link and watched it. He cuts out at the end and explains Steering Behaviors but not avoidance,. There aren't any follow up videos.
 
Top