Unable to keep characters from overlapping

Hi,

I am trying to stop any character on the playing field from overlapping each other and have tried several methods to do so including the “Separate Objects” and the BOID Movement. Each of these sort of work, but only work when the characters have reached their destination (or with Separate it’s sort of hit and miss), when off the Path Finding function.

When they do hit their destination, they then all move away from each other, but not nicely as in they have massive movement from each other and then when they start moving again to the next point they simply overlap each other and so on.

I can’t seem to find a solution, that keeps the players x amount of pixels from each other when they are moving or when they have stopped. I know on a different gaming engine, if the object is classified as Solid then it sort of creates a boundary between each other. Does Gdevelop have something similar?

I have tried this
image

have tried this, which just results in characters moving fast away from each other and doing weird stuff (like flying off the screen) when stopped.
image

I have tried adding BoidsMovement to the characters, but that does not seem to achieve much either at least until they have stopped, then they tend to separate to different positions, which is good, but does not work whilst they are on a Path.

This is a screen shot of when they are first activated and walking towards point a. No bunching or overlapping and on a path to the point.

This is after a few points and there is still the same amount of characters, but all overlapping.

I have watched a few videos and also tried Groups, but with Groups you can’t really avoid the same group of characters, meaning that move char1 but keep char1 in position does not work and nothing seems to work when they are on a pathfinding mission.

I thought this might be quite a common problem for a lot of games, but cannot seem to find a solution.

Any help would be appreciated.

Thank you

Coming back to the Separate function. It sort of works, but it reacts way to quick.

Here is a video of what happens, on the Path and when they reach their destination.

Hi,

This looks like a common problem, that a lot of people seem to have and one of the suggestions was this.

Now this sort of get’s closer but only really when the pathfinding has stopped and only to one of the characters.

I have tried a lot of different variations and alternatives and it seems what I thought would be part of the standard gaming functions to avoid other characters on the screen is not. Seems a little odd

Any help would be great.

Why not make the character itself an impassable object to pathfinding, so the pathfinding behavior avoids it?

Hi v9um,

Thanks for the feedback. I have tried that and it seems to completely ignore this and when it gets to a point, it then just stops.

Have you checked this post about collisions between instances with pathfinding?

And there’s always the Boids Movement extension that may help:


If those aren’t satisfactory, you could try checking for collision between characters, and when that happens, stop the characters and calculate a new path. It’s not ideal though and may cause a slight slowdown in character movement.

Thanks for all your suggestions. I am retrying the boids movement again and it seems to be working on a very simple trial.

So the BOIDS movement works (sort of) but it’s probably okay and a lot to do along the way and at the end, which is cool. I do notice though that when a player reaches the target and I action something on that player they all do the same action and not just the one which reached the target. I am using a variable assigned to the player as I thought it may have been that.

This is the code for others to look at if it helps.

This is the issue when the char gets to the end and a sample of the BOIDS movement.

Thoughts on why they all do the same thing. Am I using the variable wrong?

I reset the value of the variable back to 0, but I understand it’s not needed in this case.

Thank you all.