Page 1 of 1

Making an old school player character (and physics)

Posted: Sat Dec 22, 2012 8:41 am
by spectralcanine
Hello.

I have some previous experience with Box2D and I could never manage to get an old-school player character movement going.
The problems always start, of course, when you add surfaces with angles, like triangles and circles.

I really want the old feeling of games like The Lost Vikings, so I am wondering if I should even bother using Box2D or just make my own physics and support my own pre-defined shapes (thinking about rectangles, 30/45/60 degrees triangles, circles, quarter-circles).

The main issues with Box2D regarding angled surfaces are of course going up/down at different speeds, sliding when not moving, not being able to jump when starting to move on them because you kind of "jump" above the surface, I think that anyone who made scroller games with Box2D know what I am talking about.

I tried a whole lot of methods, with the player moving with a rotating circle as his legs being the most stable one, but it still doesn't cut it.

I hardly need actual physics except for simple movement in my game. It really adds up to pushing stuff on water so it keeps moving (no friction), pushing boulders without velocity (you push and it immediately starts moving with you, you stop and it immediately stops), and that's about it.
Note that all of this isn't actually physically accurate so it will probably have to be hacked in Box2D too...

So, the question really is - should I even bother with Box2D?

Thanks.

Re: Making an old school player character (and physics)

Posted: Sat Dec 22, 2012 10:39 am
by micha
I'd advice you against using Box2D for a simple platformer.

The game you mentioned, The lost vikings, didn't have any irregular shapes, as far as I know. Only square blocks. For this kind of physics Box2D is overkill.

On the resources page in the wiki https://love2d.org/wiki/Free_Game_Resources you find some tutorials on game physics. Have a look at The guide to implementing 2D-platformers and the other tutorials in the physics/movement section.

You can also find a good tutorial here: http://www.explodingrabbit.com/forum/en ... al-01.669/. Here you can directly follow how different parts of the movement physics are implemented. It helped me a lot.

Re: Making an old school player character (and physics)

Posted: Sat Dec 22, 2012 2:36 pm
by spectralcanine
That was kind of my opinion too, but I wondered if anyone did manage to get something decent in Box2D.

The Lost Vikings specifically has rectangles and 45 degree triangles if I remember correctly, which might be enough for me (45 degree triangles are very easy for collision detection too), but I might also want 30/60 degree triangles which are a bit harder, since they need to be split into two different tiles.

Thanks for both of those links. While I already have experience in 2D games from scratch, they are still both very helpful.

Re: Making an old school player character (and physics)

Posted: Mon Dec 31, 2012 4:52 am
by scutheotaku
spectralcanine wrote:That was kind of my opinion too, but I wondered if anyone did manage to get something decent in Box2D.

The Lost Vikings specifically has rectangles and 45 degree triangles if I remember correctly, which might be enough for me (45 degree triangles are very easy for collision detection too), but I might also want 30/60 degree triangles which are a bit harder, since they need to be split into two different tiles.

Thanks for both of those links. While I already have experience in 2D games from scratch, they are still both very helpful.
Yeah, there are a lot of different ways to have slopes of all different angles. The aforementioned "Guide to Implementing 2D Platformers" article ( http://higherorderfun.com/blog/2012/05/ ... atformers/ ) is a really good start. It also can't hurt to look at other people's platformers and platformer engines to see how they handle this sort of thing.