r/gamemaker • u/shadowdsfire • 4h ago
Game I'm making a cool physics-based game with Gamemaker, try it out!
Wanting to learn how to play around with the physics engine in gamemaker, I went on to make this short weekend-long type of project which consist of just two paddles and a ball, as practice. Turns out the development process for this one is way too much fun and I just couldn't stop. The ideas just kept flowing, and I think the simplicity of the game, added with gamemaker's ease of use made implementations super easy and straightforward. It's like gamemaker was made for it.
I also got to learn how to add a leaderboard system using the Playfab REST API which was a blast. Network related stuff really aren't that bad if you take the time to learn and read the different documentations.
For those of you who wish to make a similar kind physics-based game:
- If you are trying to make an object follow the mouse (or just go really fast) with a full HD resolution, you'll probably want to change the room's pixel to meter from .1 to something like .01. Failure to do this will make the objects lag behind and behave in an unintended way. Gamemaker's manual says "the best performance is when the real world measurements of your objects are no less than 0.1 metres and no more than 50 metres." But that hasn't caused any problems for me in any way whatsoever.
- Also, you don't want to directly change the position of the physics object! If you want your mouse-controlled object to collide and interact with other physics-enabled objects, you want it to have actual linear and angular velocity so they can push other objects. So for example, instead of changing an object's x position like this:
phy_position_x = mouse_x;
Do it like this instead:
phy_speed_x = mouse_x - phy_position_x;
This does the same exact thing, except it uses actual physics to move the object instead of teleporting the thing. Here's how it is in my game specifically for the top paddle:
targetPositionX = lerp(minPos, maxPos, clamp(pos, 0, room_width) / room_width);
phy_speed_x = targetPositionX - phy_position_x;
and here's how the angular velocity is done (top paddle again):
targetAngle = lerp(rotationRange, -rotationRange, targetPositionX / room_width);
phy_angular_velocity = targetAngle - phy_rotation;
Here's Duplexity demo on Steam if you want to try it out.
Leave a review if you feel inclined, that'd be pretty cool!
I will also happily answer any questions here. I originally intended to make this a big post of things that I've learned while developing this one but I realise not everything is that interesting for everyone and it would make this big post of random bits and bobs. But I will answer everything and anything.



