|
strange timer behaviour |
Frank Drebin
Member #2,987
December 2002
|
ok i got the default game loop while (!key[KEY_ESC]) { while (speed_counter>0) { game(); speed_counter--; } draw_game(); //while (speed_counter==0) rest(1); }
this way i get 100+ FPS. |
Jonatan Hedborg
Member #4,886
July 2004
|
Are you using vsync or tripple-buffering?
|
Frank Drebin
Member #2,987
December 2002
|
no just double buffering. |
Kitty Cat
Member #2,815
October 2002
|
Resting isn't accurate. Resting for 1ms will cause you to rest closer to 10ms (giving you 100 FPS max). Then add in the time to do the logic and render each frame, and possible background tasks in the system, and you'll get less than 100 FPS. What's your speed if you use rest(0) instead of rest(1)? -- |
Frank Drebin
Member #2,987
December 2002
|
for rest(0) it's the same thing. |
Arthur Kalliokoski
Second in Command
February 2005
|
Maybe something has turned on your vid card vsync. Just a week ago my favorite old DOS editor could use the extended keys again for no reason that I could see. "I hate computers, they're so nasty and complex. I could just pinch them" Marvin the Martian They all watch too much MSNBC... they get ideas. |
Frank Drebin
Member #2,987
December 2002
|
in this case is there any way to disable vsync or do i have to reintstall the older version of mingw? |
Kitty Cat
Member #2,815
October 2002
|
I doubt its your compiler. There should be an option in your video card settings to force vsync on or off, or leave it application defined. I doubt it's a vsync issue though. What version of Allegro do you have? -- |
Goalie Ca
Member #2,579
July 2002
|
Calling rest(1) forces the OS to put the process on the queue and hence reschedule it. 10ms time slices isn't too uncommon. Quick guess, you using windows? ps: This is why its not a "real-time" os. ------------- |
Frank Drebin
Member #2,987
December 2002
|
yes its in windows (and linux) and newest allegro |
Thomas Fjellstrom
Member #476
June 2000
|
Quote: even if rest(1) would delay more than 10 ms Tasks/Threads get 10ms slices, its more than possible to loose 100ms after doing your slice, it all depends on the system load, and the priorities all threads are running at. edit, You CANNOT depend on the scheduler doing anything in a non real time OS. -- |
Frank Drebin
Member #2,987
December 2002
|
ok i reinstalled the older verision of the compiler with no success. |
BrknPhoenix
Member #7,304
June 2006
|
edit: Eh nevermind, not entirely sure what you're getting at |
Kitty Cat
Member #2,815
October 2002
|
Quote: so whats the difference betwenn a 50 and a 100 BPS timer About twice as many tics (meaning more logic calls, and more attempted frames drawn). If your system is just barely keeping up at 100FPS with no resting, it can lose several frames if you try to rest any. -- |
Frank Drebin
Member #2,987
December 2002
|
i know that 100 is twice as fast as a 50 BPS timer... and without rest(1) i get around 150 FPS so this shouldn't be the problem. [edit]
|
Kitty Cat
Member #2,815
October 2002
|
Both rest(0) and rest(1) give me 55~60 FPS with that. Granted though, X isn't the best at getting the fastest speed. -- |
Frank Drebin
Member #2,987
December 2002
|
yes someone try it in windows! |
|