Too fast!
This isn't really a problem, it's more of a query. One of the current games I'm working on is a 2D openGL game which right now is currently working fine with one exception. The thing is absolutely flying. So what I'm wondering is what is/are some of the preferred methods of limiting the speed without really dropping frame rates? Before I've used Tickcounts to limit my previous games but that also dropped the frame rates and I'm thinking there has got to be a more elegant way of doing this. I'd rather do it the right way the first time then to have to go back and fix it later on. Thanks!
how about calculating object's actual positions for a measured time interval
Here is one for BASIC
At beginnging of loop:
ttime=timer
At end of loop:
stime=timer-ttime
In bewteen:
x=x+pixels_per_second*ttime
At beginnging of loop:
ttime=timer
At end of loop:
stime=timer-ttime
In bewteen:
x=x+pixels_per_second*ttime
"Most nutritionists say that Twinkies are bad. But they're not, they're very very good."
NSTimer?
Use d=vt to move your objects, rather than using a constant d.
(That is, use time-based rather than frame-based animation)
(That is, use time-based rather than frame-based animation)
Quote:Originally posted by OneSadCookie
Use d=vt to move your objects, rather than using a constant d.
(That is, use time-based rather than frame-based animation)
Right now the sprites are set with a given velocity, x and y which are ints. The screen is set as 800x600. It's also probably pushing upwards of about 80 fps. With this set up it's basically delta d=v. Do I just count the ticks per time through the movement functions and when it hit's a threshold (say 4 ticks) then run through the movement functions and check for input?
Sync to VBL, so you only update as fast as the display device can refresh. There's no point in going any faster.
see http://developer.apple.com/technotes/tn/tn2014.html
see http://developer.apple.com/technotes/tn/tn2014.html
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| fast billboards | reubert | 2 | 2,419 |
Oct 7, 2004 04:41 AM Last Post: OneSadCookie |
|
| how fast should this be? | <seb> | 3 | 3,329 |
Feb 25, 2003 12:51 PM Last Post: <seb> |
|

