• Advertisement
Sign in to follow this  
  • entries
    2
  • comments
    12
  • views
    446

Day 1 - Do not use physics engines for platformers

697 views

Yesterday was all about working out a basic platforming engine, and by god is it harder than it looks. (The themes I'm going for is assassination and chain reactions)

First I wanted to use Game Maker's physics engine to do the work of going up slopes, the character was a rigid body box with rotations disabled.
I had made a platformer using the physics engine before and I thought it could work, however I quickly learned that was a bad idea.

If you're going to use a physics engine for a platformer, you have to realize that, in order to make the game the way you want it to, you will have to circumvent certain physics features and almost entirely take the physics out of the physics engine. My character did walk nicely over the terrain, however when met with slopes he moved slower. For the physics engine this was normal, but from a gameplay standpoint this wasn't fun.

I soon found articles online telling you not to use physics engines for platformers, so I wrote the platforming from scratch instead, using some handy youtube tutorials to lay the foundation.
There were some problems with the code in the youtube examples that I had to fix, such as the character getting stuck or jumping to some far off location when meeting a vertical wall and moving the opposite direction. There were other problems when it came to implementing ladders, so I had to figure out how to get that to work the way I wanted it to as well.

Since the game is going to have a (possibly optional, as in you can go hard or quiet) stealth element, I added a visualisation for the sound emissions in the level. If you walk around, it shows you how far that sound reaches, and if you sneak it obviously gets smaller.

Don't mind the ugly ladders and lack of ladder climbing animation, that's obviously still planned. The ladders are going to be almost as thin as the player so the snapping to the ladder won't be as obvious.

I also have some story planned out and my idea is to release this game as a 'demo' where you play some sample levels without the whole story.

One small problem I have is I don't know how to implement chain reactions yet, but I think I know how to with the 'loud' aspect if you decide not to play stealthily.

 



6 Comments


Recommended Comments

I like the sound of this game.

BTW I have tried and failed to implement my own platforming character controller that handles slopes twice in the past and have still never succeeded to get something that I am 100% happy with. Gratz on getting something working *at all* let alone in day!

Share this comment


Link to comment
Just now, dmatter said:

I like the sound of this game.

BTW I have tried and failed to implement my own platforming character controller that handles slopes twice in the past and have still never succeeded to get something that I am 100% happy with. Gratz on getting something working *at all* let alone in day!

Thanks dmatter :) Slopes are indeed a pain :\ I played your winning game from last competition, this is my first week of awesome so yeah.. I see you as like the biggest friendly competition :P

Share this comment


Link to comment
1 hour ago, dmatter said:

I like the sound of this game.

BTW I have tried and failed to implement my own platforming character controller that handles slopes twice in the past and have still never succeeded to get something that I am 100% happy with. Gratz on getting something working *at all* let alone in day!

One approach I've seen that seems to be a common thing with GameMaker on the tigsource forums (Zach Bell popularized this over there, I think?) is that if you hit an obstacle while moving sideways, try moving it up as well as sideways and rechecking the collision. Hrm. I think most of the stuff I've seen was only moving one pixel at a time (pixel-art stuff, so 60 pixels-per-second is fairly fast) but you could maybe extend this to more normal graphics (binary search?) without being *too* expensive.

Dunno if that's helpful, but thought I'd mention it...

Share this comment


Link to comment

I don't know that "don't use physics engines for platformers" is good general advice.  A physics engine like that is, like anything else, just a tool.  Sometimes it's the right tool for the job, sometimes it's not.

Share this comment


Link to comment

I'm in progress with the same thing, but in 3D. For the slopes(and actually all walkable surfaces) I use the 90 degrees rotated normal of the ground for the waking direction, that way the "walking" velocities are always perpendicular to the ground.

Additionally I disable the gravity when the player is grounded.
I'm still not happy with my implementation, I will write when I do it correctly.

Share this comment


Link to comment

This game looks awesome. Also, a very nice choice of themes.

I can't wait to play this game. :D

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Advertisement