Move Objects Without Colliding

king javo

Member
The goal here is to have 11 or so objects move into a circle, but without colliding and appear as though objects are moving as humans with slightly different speeds and paths.

Anyone know have any code or logic that move objects to points in a realistic manner without colliding and without using physics?

Thanks in advance! :)

 

samspade

Member
The goal here is to have 11 or so objects move into a circle, but without colliding and appear as though objects are moving as humans with slightly different speeds and paths.

Anyone know have any code or logic that move objects to points in a realistic manner without colliding and without using physics?

Thanks in advance! :)
Steering behaviors would be one way. Unfortunately they are relatively complicated and not really natively supported in GM which means you need to either find or create scripts. Here's a forum post with a lot of details on it and scripts. https://forum.yoyogames.com/index.p...i-system-everyone-needs-for-their-game.23370/

The concepts of steering behaviors can also be used to create some simpler steering behaviorsesq type movement but that's really situation specific and you're honestly better offer trying to understand how steering behaviors work in general.

If you want a more complete tutorial you could watch this series (but it's in java I believe):

 

NightFrost

Member
Steering behaviors might be a little overkill if just a single effect is required. The video linked series is very good explanation however and I used it to write my own SB script library. Since it is vector maths it would be a good idea to have some vector scripts too; I wrote my own just to use with the SBs, it made things much easier to code than trying to convert all the vector stuff into coordinate-based math all the time.

If everything else fails, you could just give the objects predefined paths to follow. No reason to write lots of pathing/collision code if you don't need it anywhere else in the project.
 

king javo

Member
Steering behaviors might be a little overkill if just a single effect is required. The video linked series is very good explanation however and I used it to write my own SB script library. Since it is vector maths it would be a good idea to have some vector scripts too; I wrote my own just to use with the SBs, it made things much easier to code than trying to convert all the vector stuff into coordinate-based math all the time.

If everything else fails, you could just give the objects predefined paths to follow. No reason to write lots of pathing/collision code if you don't need it anywhere else in the project.
That would be great, but thinking about how to apply it doesn't sound that easy. So I'm making an American Football game in a top down perspective. When the play is dead, I want the offense and defense to huddle and not get stuck along the way. When I use mp_potential_step, no matter what settings I try it doesn't work very well for some reason. It works fine when I allow the players to overlap using the below code, but I'd prefer to not have players clip through each other.



BTW, anyone know how to resize these IMG links... too darn big! :)
 
Last edited:

samspade

Member
That would be great, but thinking about how to apply it doesn't sound that easy. So I'm making an American Football game in a top down perspective. When the play is dead, I want the offense and defense to huddle and not get stuck along the way. When I use mp_potential_step, no matter what settings I try it doesn't work very well for some reason. It works fine when I allow the players to overlap using the below code, but I'd prefer to not have players clip through each other.



BTW, anyone know how to resize these IMG links... too darn big! :)
I do think steering behaviors would be great for this. As I said they're moderately complicated to learn, but if you want to create a game with a bunch of objects moving around and paying attention to each other not bumping into each other and being generally aware of their surroundings, there aren't going to be that many simple solutions that look good. These are all the exact behaviors steering behaviors were written to do.
 
Top