Platformer Prototype

Show off your games, demos and other (playable) creations.
DrLuke
Prole
Posts: 9
Joined: Mon Jan 04, 2010 11:15 pm

Re: Platformer Prototype

Post by DrLuke »

that's dt for you :)
DrLuke
Prole
Posts: 9
Joined: Mon Jan 04, 2010 11:15 pm

Re: Platformer Prototype

Post by DrLuke »

I added a fixed timestep now. Aka you can't fall through the floor when moving the window anymore.

http://dl.dropbox.com/u/28079852/PlatformerProto14.love
User avatar
BlackBulletIV
Inner party member
Posts: 1261
Joined: Wed Dec 29, 2010 8:19 pm
Location: Queensland, Australia
Contact:

Re: Platformer Prototype

Post by BlackBulletIV »

I wouldn't use a fixed timestep, it's better to limit how much delta time Box2D gets access to:

Code: Select all

local left = dt
local step = .03

while left > 0 do
  world:update(step)
  left = left - step
end
Another way to fix this problem (by my observations) would be to use Body:setBullet. Set that to true, and Box2D will check for collision in a "real-time" way.
User avatar
Lafolie
Inner party member
Posts: 809
Joined: Tue Apr 05, 2011 2:59 pm
Location: SR388
Contact:

Re: Platformer Prototype

Post by Lafolie »

I'm curious, does this microstep/window movement phenomena only apply to box2D-style physics? I plan on making a platformer one day and I was wondering if I'd have to take this into account using pseudo physics.
Do you recognise when the world won't stop for you? Or when the days don't care what you've got to do? When the weight's too tough to lift up, what do you? Don't let them choose for you, that's on you.
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Platformer Prototype

Post by bartbes »

It depends on your calculations, but most calculations do, in fact, need small timesteps for them to at least look like they're accurate.

So, in general:
The smaller the timestep, the more accurate the result. (in most cases, if you recalculate from the start, this is not the case)

Now, as for why this is, these formulas have been created and verified with dt approaching 0, if that means anything to you.
DrLuke
Prole
Posts: 9
Joined: Mon Jan 04, 2010 11:15 pm

Re: Platformer Prototype

Post by DrLuke »

I am not using box2d. I made everything myself!
User avatar
BlackBulletIV
Inner party member
Posts: 1261
Joined: Wed Dec 29, 2010 8:19 pm
Location: Queensland, Australia
Contact:

Re: Platformer Prototype

Post by BlackBulletIV »

The problem would come from the fact that calculations are done using the delta time. For example:

Code: Select all

body.x = body.x + body.vx * dt
The longer the delta time, the more that it added to the position of the object. Unless setBullet is set to true, Box2D will just move the object by whatever body.vx * dt happens to be without checking whether anything was in between.
DrLuke wrote:I am not using box2d. I made everything myself!
Ah ok, but the same thing still applies. When doing your physical updates, limit the delta time as I showed above.

EDIT: 777 posts! :awesome:
bmzz
Prole
Posts: 16
Joined: Fri May 06, 2011 9:21 am

Re: Platformer Prototype

Post by bmzz »

when the player stand on ground and i hit right(or left) gently, player will Jitter.
DrLuke
Prole
Posts: 9
Joined: Mon Jan 04, 2010 11:15 pm

Re: Platformer Prototype

Post by DrLuke »

bmzz wrote:when the player stand on ground and i hit right(or left) gently, player will Jitter.
Yeah, that's a problem with the friction, soon to be solved.
DrLuke
Prole
Posts: 9
Joined: Mon Jan 04, 2010 11:15 pm

Re: Platformer Prototype

Post by DrLuke »

Fasten your seatbelts and don't let any limbs hang outside of the table's boundaries, I'm presenting you:
Collisions with triangles!

ncSoY.png
ncSoY.png (30.43 KiB) Viewed 549 times

http://dl.dropbox.com/u/28079852/Collisions16.love
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 2 guests