Jump to content
  • Advertisement
Sign in to follow this  
zedz

platform games + physics libraries

This topic is 3348 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Does anyone have any advanced tips or better yet, papers on how to get a nice controllable player? with jumping etc Im interested in terrains that have a lot of slopes i.e. not like in mario world. From what Im seeing, I have to disable/severely limit the 'realistic' physics + roll my own movement routines. ta zed

Share this post


Link to post
Share on other sites
Advertisement
I highly recommend the Bullet physics engine! Bullet Homepage

It's a full 3D physics engine that I found pretty easy to set up and work with. Not painless! You have to figure out how they built their physics engine. But within a day I had decent simulations to work with. It is fast and powerful.

They have some controllable player support (and in fact I submitted a minor patch to add some functionality to it) but if I remember jumping support wasn't fully there. But you could add your own custom jumping behavior pretty easily.

I think for a platformer you'd find it will give you great physics with low CPU/memory overhead.

Share this post


Link to post
Share on other sites
great ad :)
Sorry I think you misunderstand, Im not looking for a physics lib I have 2 or 4 already!
from my experimenting basically for a good platformer u want to disable the physics library (cause it looks crap).
My question is any papers on how to best control the player, i.e. any tests/studies done on what ppl find most satisfying + as a sub question how to fit this in with a physics lib.

Share this post


Link to post
Share on other sites
Assuming you're talking about a 2d sidescroller platformer:

Physics can work fine for platformers, as long as you disable one of the dimensions (the one that goes into the screen).

Havok (I'm sure most other libs as well) has a character controller example which you can easily change to ignore one dimension, and you can even adjust it to make the jumping more manageable.

Share this post


Link to post
Share on other sites
Quote:
Original post by zedz
from my experimenting basically for a good platformer u want to disable the physics library (cause it looks crap).

Totally agree - you don't want to leave platformer physics (and in fact any physics under direct control of) up to a generic physics engine. You'll end up with awkward, glitchy control (the most obvious example being Little Big Planet's glitchy jump strengths and rather floaty feel).

I'd recommend having lots of tweekable properties in your player physics - acceleration, top speed, friction etc. that you can easily change while the game is running. Tiny changes in these can result in a totally different feel so you need rapid feedback. I also find it useful to separate out these into their separate components (eg. rather than having a top speed, have a xTopSpeed and a yTopSpeed).

More specifically, I usually go for high acceleration and high top speeds, which means that you can go from stood still to full speed (and vice versa) in a handful of frames. This usually feels more precise than "realistic" friction and acceleration would be. And if you really need to don't be afraid to actually snap the player into different states if required to keep things responsive, it's usually completely unnoticeable.

Share this post


Link to post
Share on other sites
Quote:
Original post by OrangyTang
Quote:
Original post by zedz
from my experimenting basically for a good platformer u want to disable the physics library (cause it looks crap).

Totally agree - you don't want to leave platformer physics (and in fact any physics under direct control of) up to a generic physics engine.


I think it depends a lot on the simulator, and on how you model the player. This is a topic on which I wish there was a lot more material available, it seems like many people are working on it but no one has found a great solution yet. (I definitely agree about LPB's too-sloppy feel).


If you use a plain rigid body with regular collision/friction/etc. then it will be hard to replicate the feel of a platformer, but you should be able to express any desired movement in terms of constraints which the simulator will solve, so that you get your arbitrary platformer movement without breaking the simulation (i.e things will still interact nicely). The player's "body" would then be a frictionless shape which is moved around by constraints which control its position/velocity, rather than by directly setting position/velocity (which won't play well with other constraints).

For instance, if you want your player to move 5 units to the right, you would create a constraint (position- or velocity-level) which will move them 5 units to the right. This could be a "proper" constraint (between a nearby ground object and the player, so that you have action-reaction forces felt by the ground), or a "fake" constraint (between the global/world frame and the player, so that the player's movement force are added from nowhere).

By adjusting the constraint parameters (maximum force, softness, etc) you should be able to find a good middle-ground between "player is too unresponsive, but interacts well" and "player is snappy but pushes things around too violently".

At least, this is our approach; it's not perfect yet, but it's definitely promising :)

Share this post


Link to post
Share on other sites
Quote:

I'd recommend having lots of tweekable properties in your player physics - acceleration, top speed, friction etc. that you can easily change while the game is running. Tiny changes in these can result in a totally different feel so you need rapid feedback.

yeah thanks, Ill think Ill setup something like this so I can alter properties ingame

my discoveries so far

low friction if the players moving (with input)
high friction if not (thus comes to a standstill quickly after running + wont slide down a slope)

move in the 90degree angle relation to the slope (i.e. dont just move left + let the physics engine push you up a slope, even though it sorta looks right)

allow the player some movement in air

find out players velocity + base the new additional velocity on that

have different gravity when in the air than when on the ground

Quote:
This is a topic on which I wish there was a lot more material available, it seems like many people are working on it but no one has found a great solution yet.
yes lotsa info on SSAO etc but nothing on this topic, its not sexy enuf :)

Share this post


Link to post
Share on other sites
FWIW something else to do is whenever the player makes a movement contrary to what they have previously been moving then detect that cancel out all movement in that direction and then add new velocity

eg
running down a slope, player presses jump
detect the player is moving downwards thus cancel vertical velocity then add upwards velocity

this adds heaps to how tight the controls feel

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!