Skip to main content
GameDev.net gamedev.net

PRO Tired of ads? Read GameDev.net ad-free and help keep the community independent with GameDev Pro — $3/month.

platformer

platformer

Aardvajk
Aardvajk
Journal of Aardvajk · · 1 min read
652 3
Right. Based on the general feeling from the thread on the subject, I've decided that a fixed time-step physics update, seperated from the rendering, is the only viable way to write a 2D platformer that will be frame-rate independant.

Someone has pointed me to a first class article on the subject, so I now reckon I can start to proceed. I need to test the approach out thoroughly tonight, then I can start building a test application to post somewhere and hopefully get loads of you lot with different monitor refresh rates to test and report back any problems to me.

Good stuff. Nice to have a project on the go again.

Also, today I drew snow on my avatar. Happy Christmas. [EDIT - got bored with that so now my Orc sprite is my avatar, and he's wearing a very cool airbrush-based Santa hat, if I say so myself].

[EDIT]

Fixed timestep seems to work like a charm, as per the figures below. The first figure is the highest pixel attained and the second is the proportion of a second (in actual time) the entire jump took to execute. The lines represent the loop running with no Sleep() then with Sleep()s of 10, 20, 30, 40 and 50:

305, 0.664305, 0.662305, 0.656305, 0.666305, 0.681305, 0.664


Then the result with no Sleep(), but the time each frame divided by two (to simulate a 120 fps set up):

305, 0.664


Fantastic results and exactly what I wanted. And no more messing about with Vy-=300*Time; nonsense either!

Groovy. This guy is my new favourite explains-physics-to-idiots person.

Discussion

Loading comments...