Back to timer/update issue - Printable Version
+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Game Programming Fundamentals (/forum-7.html)
+--- Thread: Back to timer/update issue (/thread-2247.html)
Back to timer/update issue - Talyn - Oct 21, 2008 10:29 PM
I have been having a hell of a time getting my program to update at a 60Hz cycle and be able to normalize it so that an object will move 1 unit in 1 second. Does anyone have any advice or sample code I could take a look at? I'm using Obj-C in a SDL main loop. I tried using the callback-thing OSC gave me some time ago, but it isn't working out anymore. Thanks a lot!
EDIT: Wow, kicking myself for this one. I didn't multiply movement by time delta yet. This may not completely solve my problem, but for future reference, I'm getting closer...
Back to timer/update issue - OneSadCookie - Oct 21, 2008 11:43 PM
This is the standard link on the subject.
With SDL, use SDL_GetTicks() (and remember that it returns milliseconds elapsed).
Back to timer/update issue - Talyn - Oct 21, 2008 11:50 PM
OneSadCookie Wrote:This is the standard link on the subject.
Wow, that link is freaking cool! Thanks for the advice. I looked into SDL_GetTicks() before reading this a figured it out from there, but the article you provided should give some really cool insight into proper frame syncing. Thanks again, OSC!
Well, with that in mind, I now have a functional physics engine built in Obj-C. It took me about 2 days of heavy programming and quite a bit of scratch notebook paper, but it's now ready for a complete overhaul. Thank you guys for always having the right answers, and for being willing to help out.