wacky physics with lowered fps...

dave05
Unregistered
 
Post: #1
for those of you who don't know, i'm working on a 2d game.

okay, so I've decided I don't need VAR yet, since apparently, even 100 sprites onscreen at a time (400 vertices, no big deal) has a frame rate of 999 (which is simply what I arbitrarily chose as max frame rate, never actually expecting to reach it)

but when i draw explosions, the frame rate drops to 300-400, not that this is a problem, or... not that it should be in my opinion.. Anyways, all my movement is based on a variable I call gSixtyOverFramesPerSecond, so that I update a sprites frame 60 times per second. works fine. except that when the frame rate goes down to 300ish, all my sprites seem to slow down, to about 80% of their previous speed, and then return to normal once the explosions dissipate. The explosions only add 20 "sprites" (particles) per occurence, but i do change the glBlendFunc when using them, so... whatever, I don't care, in fact, I'm ecstatic that i'm getting over 100fps.

Anyways, i'm confused, but I'm sure this is a common problem. Suggestions?
Quote this message in a reply
Member
Posts: 509
Joined: 2002.05
Post: #2
I am pretty sure that it is something your doing, because like you said you are never getting below a few hundred FPS. Its hard to help with no code or anything but I would go back through your code by hand and make suer you are actually calling the render sprites once every 1/60th of a second. Also, is everything time based or frame based (like are you accelerating the same amount each frame or is it relative to frame time?)
Quote this message in a reply
Sage
Posts: 1,199
Joined: 2004.10
Post: #3
Or, similarly, I'd have the update logic run at a *constant* rate, with FPS running at whatever you can pull off with what's left over. A lot of physics engines don't play well with variable timesteps...
Quote this message in a reply
dave05
Unregistered
 
Post: #4
well, it turned out that the max fps i set was too high.. i changed it to 120, and now everything works fine. I guess the float precision wasn't good enough with such high frame rates.

tomorrowplusx, that's an interesting idea, and it's in fact what I've always done up until using openGL.

now I'm going to sync whatever the vScan is and base the maximum frame rate on that. because with 120 fps, and 135 refresh rate, i'm dropping lots of frames and it looks funky.

anyways thanks for the suggestions.
Quote this message in a reply
Member
Posts: 208
Joined: 2005.04
Post: #5
this might be of interest to you:

http://developer.apple.com/documentation...835-117520
Quote this message in a reply
Sage
Posts: 1,403
Joined: 2005.07
Post: #6
checkout one sad cookies ThreadedNewton program on http://www.onesadcookie.is-a-geek.net/svn/repos/
Quote this message in a reply
Post Reply