Any suggestions for a platformer game?

I have been using CoronaSDK for a while but I am totally new to build a platformer game.

What I know right now is that I can use engines like MTE(Million Title Engine, not supported though) to build maps and I don’t know much else.

Anyone can give me some advises? For example,

Any tutorial you suggest?

What are the best tools you think I can use to build a platformer game? (most importantly, the tools to build the map? anything else that can help to build platformer? )

Any suggestion will be helpful. Thanks a lot in advance.

Hi, I’m actually building a platformer game as well!

Sorry for the self-promotion, but in case you weren’t aware of it, Dusk is an alternative to MTE that’s open-source, just as fast, actively developed, and easier to use. It’s on GitHub: http://github.com/GymbylCoding/Dusk-Engine

So basically, you’ll build the map with Tiled, then load it up in Dusk or MTE in your game. You use Tiled properties or Box2D physics to make a colliding floor. I highly recommend using a homemade collision system rather than Corona’s “real” physics. You can read a few reasons why here: http://www.learn-cocos2d.com/2013/08/physics-engine-platformer-terrible-idea/

For roll-your-own physics, the definitive guide to platformer physics can be found here: http://higherorderfun.com/blog/2012/05/20/the-guide-to-implementing-2d-platformers/. Alternatively, you can check out the excellent Sonic physics guide here (a little more in-depth): http://info.sonicretro.org/SPG:Solid_Tiles

Once you have a good physics system set up, go on to interaction, events, and what-have-you. Then, when you have a solid base to work on, you’ll be able just to churn out the levels.

Good luck!

  • Caleb

@Caleb

Thanks for your suggestion. I didn’t think of making my own physics but it seems quite important for a platformer game.

Since you are building one too, is it hard to implement own-physics? How much time/effort should I expect? Any major issue I should be aware of in advance?

any further reference available? I am totally new on this and it seems a bit of hard for me.

@Caleb

Another thing is… after I saw some comments under the article: http://www.learn-cocos2d.com/2013/08/physics-engine-platformer-terrible-idea/

I can’t decide if I should implement own-physics or just use box2d.

Most of these have simple solutions, many of which you would also need to implement in a custom collision engine.

Moving Platform Hell
Kinematic bodies. If your physics engine doesn’t support them then find one that does.

Walking on Sunshine, Not
Just change where you’re drawing the sprites.

Tilemap Collisions Ain’t Easy
There’s a simple solution for this that doesn’t involve edge shapes. Google is your friend.

Physics contact detection is expensive
You don’t seem to understand how a physics engine works.

Physics are alwaaa-a-a-ays glit-tch-tch-tch-y
If you need a lot of bodies on screen, lower the iterations. If you need more accuracy, increase the iterations. Done.

There’s got to be a speed limit on everything
There’s a global settings for this. There’s also way to have bodies with infinite speed. You’d also run into the same issue with a custom collision engine.

Tweak the hell out of this world
You have to tweak the hell out of any world.

Speaking of Movement
Again, you’re mentioning things that are easily fixable or that you would also encounter in a custom collision engine.

Is it too early or too late?
I’ll add that you appear to be misusing the physics engine. You’re not supposed to set the position and velocity directly (unless you’re using a kinematic body).

I make my own physics. I love this but you need a good understandig of logic and trigonometry, otherwise I wouldn’t bother.

@joe528:

Another very important reason not to use Box2D physics is tile borders: The usual way to add physics to tiles is to add a body to each tile. However, then, when the player goes from one tile to another, it may or may not “catch” at the seam between them. You have to work through this with changing the player body shape, setting the velocity every frame, and such as that.

This issue (as well as others, most of which are outlined in the article) has bothered me for a very, very long time. I’m using custom-made physics in my platformer game as a result.

And as for difficulty to implement, it’s not too difficult if you have a good guide. For example, it took me about one programming session (which for me is only about two hours) to get the initial version (walls, floors, ceilings) of platforming physics down with the Sonic guide I linked to. There’s no feeling like having a solid platformer physics base that you wrote yourself :D.

But! Platformer physics above the basic level can be a slightly advanced field of programming, and if you just want to “get it done”, you can try with Box2D. You just need to be aware of the pitfalls.

  • Caleb

I agree with Caleb: having your “own” physics engine is great! You control every little detail, and if something doesn’t work as expected, you can just rewrite to fix it, instead of endless tweaking and workarounds. I’m impressed by Caleb’s two hours so I should mention that it would take me longer, but if you think you could master this, I would definitely go for it.

I was never able to get a good Mario / Sonic feel with Box2D, while rolling my own did it almost instantly - superfuntime! :slight_smile:

Hi, I’m actually building a platformer game as well!

Sorry for the self-promotion, but in case you weren’t aware of it, Dusk is an alternative to MTE that’s open-source, just as fast, actively developed, and easier to use. It’s on GitHub: http://github.com/GymbylCoding/Dusk-Engine

So basically, you’ll build the map with Tiled, then load it up in Dusk or MTE in your game. You use Tiled properties or Box2D physics to make a colliding floor. I highly recommend using a homemade collision system rather than Corona’s “real” physics. You can read a few reasons why here: http://www.learn-cocos2d.com/2013/08/physics-engine-platformer-terrible-idea/

For roll-your-own physics, the definitive guide to platformer physics can be found here: http://higherorderfun.com/blog/2012/05/20/the-guide-to-implementing-2d-platformers/. Alternatively, you can check out the excellent Sonic physics guide here (a little more in-depth): http://info.sonicretro.org/SPG:Solid_Tiles

Once you have a good physics system set up, go on to interaction, events, and what-have-you. Then, when you have a solid base to work on, you’ll be able just to churn out the levels.

Good luck!

  • Caleb

@Caleb

Thanks for your suggestion. I didn’t think of making my own physics but it seems quite important for a platformer game.

Since you are building one too, is it hard to implement own-physics? How much time/effort should I expect? Any major issue I should be aware of in advance?

any further reference available? I am totally new on this and it seems a bit of hard for me.

@Caleb

Another thing is… after I saw some comments under the article: http://www.learn-cocos2d.com/2013/08/physics-engine-platformer-terrible-idea/

I can’t decide if I should implement own-physics or just use box2d.

Most of these have simple solutions, many of which you would also need to implement in a custom collision engine.

Moving Platform Hell
Kinematic bodies. If your physics engine doesn’t support them then find one that does.

Walking on Sunshine, Not
Just change where you’re drawing the sprites.

Tilemap Collisions Ain’t Easy
There’s a simple solution for this that doesn’t involve edge shapes. Google is your friend.

Physics contact detection is expensive
You don’t seem to understand how a physics engine works.

Physics are alwaaa-a-a-ays glit-tch-tch-tch-y
If you need a lot of bodies on screen, lower the iterations. If you need more accuracy, increase the iterations. Done.

There’s got to be a speed limit on everything
There’s a global settings for this. There’s also way to have bodies with infinite speed. You’d also run into the same issue with a custom collision engine.

Tweak the hell out of this world
You have to tweak the hell out of any world.

Speaking of Movement
Again, you’re mentioning things that are easily fixable or that you would also encounter in a custom collision engine.

Is it too early or too late?
I’ll add that you appear to be misusing the physics engine. You’re not supposed to set the position and velocity directly (unless you’re using a kinematic body).

I make my own physics. I love this but you need a good understandig of logic and trigonometry, otherwise I wouldn’t bother.

@joe528:

Another very important reason not to use Box2D physics is tile borders: The usual way to add physics to tiles is to add a body to each tile. However, then, when the player goes from one tile to another, it may or may not “catch” at the seam between them. You have to work through this with changing the player body shape, setting the velocity every frame, and such as that.

This issue (as well as others, most of which are outlined in the article) has bothered me for a very, very long time. I’m using custom-made physics in my platformer game as a result.

And as for difficulty to implement, it’s not too difficult if you have a good guide. For example, it took me about one programming session (which for me is only about two hours) to get the initial version (walls, floors, ceilings) of platforming physics down with the Sonic guide I linked to. There’s no feeling like having a solid platformer physics base that you wrote yourself :D.

But! Platformer physics above the basic level can be a slightly advanced field of programming, and if you just want to “get it done”, you can try with Box2D. You just need to be aware of the pitfalls.

  • Caleb

I agree with Caleb: having your “own” physics engine is great! You control every little detail, and if something doesn’t work as expected, you can just rewrite to fix it, instead of endless tweaking and workarounds. I’m impressed by Caleb’s two hours so I should mention that it would take me longer, but if you think you could master this, I would definitely go for it.

I was never able to get a good Mario / Sonic feel with Box2D, while rolling my own did it almost instantly - superfuntime! :slight_smile:

Can someone please post an example of “home made physics” please? :slight_smile: … just for a starting point.

Sure, I’ll get you started. The basis is that you create an enterFrame function that says, for a given object, something like this:

if touching == "left" then object.xSpeed = object.xSpeed - object.xAcceleration elseif touching == "right" then object.xSpeed = object.xSpeed + object.xAcceleration else object.xSpeed = object.xSpeed \* object.xFriction end object.xPosition = object.xPosition + object.xSpeed

Mind you, this is just the very very start, and only for horizontal motion. Can you try this out and get back to me to say if you could turn this into something that works and that you understand? Next step is adding vertical movement!

Can someone please post an example of “home made physics” please? :slight_smile: … just for a starting point.

Sure, I’ll get you started. The basis is that you create an enterFrame function that says, for a given object, something like this:

if touching == "left" then object.xSpeed = object.xSpeed - object.xAcceleration elseif touching == "right" then object.xSpeed = object.xSpeed + object.xAcceleration else object.xSpeed = object.xSpeed \* object.xFriction end object.xPosition = object.xPosition + object.xSpeed

Mind you, this is just the very very start, and only for horizontal motion. Can you try this out and get back to me to say if you could turn this into something that works and that you understand? Next step is adding vertical movement!