Back to timer/update issue

Member
Posts: 215
Joined: 2008.06
Post: #1
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...

Mac users swear by their computers, PC users swear at their computers. ~Unknown

iSayz
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #2
This is the standard link on the subject.

http://www.sacredsoftware.net/tutorials/...tion.xhtml

With SDL, use SDL_GetTicks() (and remember that it returns milliseconds elapsed).
Quote this message in a reply
Member
Posts: 215
Joined: 2008.06
Post: #3
OneSadCookie Wrote:This is the standard link on the subject.

http://www.sacredsoftware.net/tutorials/...tion.xhtml

With SDL, use SDL_GetTicks() (and remember that it returns milliseconds elapsed).

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.

Mac users swear by their computers, PC users swear at their computers. ~Unknown

iSayz
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Game Timer larswik 10 6,219 Dec 4, 2012 03:35 PM
Last Post: AnotherJake
  I need a timer Caveman 2 2,877 Aug 17, 2008 07:38 AM
Last Post: Caveman