WaitTimer(60) quick question
Blitz3D Forums/Blitz3D Beginners Area/WaitTimer(60) quick question
| ||
The technique below produces lovely results when my monitor refresh rate is set to 60Hz (the same as the code below), but if I change the monitor to say 75Hz, things become really jerky. Is this because the code is out of SYNC with the user's monitor refresh rate ? Is there a way around this without using delta-time ? frameTimer=CreateTimer(60) While Not KeyHit(1) WaitTimer(frameTimer) update_game() draw_game() Wend |
| ||
Like I said the above code doesn't produce smooth results unless the user's monitor is at 60Hz, so.... I suppose what I'm asking is if there's a technique to find out the user's refresh rate, create a timer based on this figure then only update the screen only 60 times each second ? eg. user's monitor Hz = 100 frametimer=createTimer(100) while not keyhit(1) waitTimer(frametimer) (code here to only draw screen 60 times per second instead of 100) Wend That way I get smooth updates as the timer is set to the user's refresh rate. However, as I'm only a beginner is it feasible to limit drawing to only 60 times a second, instead of whatever the monitors refresh rate is ? |
| ||
I think using "Flip false" can help, but the graphics will give interlacing problems. |
| ||
try this: http://www.blitzbasic.com/codearcs/codearcs.php?code=95 cheers, chi |
| ||
thanks all flip false never gives good results for me - its supposed to be the same as flip except the cpu waits for the vertical blank, doesn't it ? Always leaves my sprites jerking along |
| ||
Flip false doesn't wait for the vsync. It is good for testing purposes. You can see the actual speed of your program. I think you could also use tween rendering, I believe the castle demo of Blitz is using that. |
| ||
b32, so whats tween rendering ? Could that be perhaps running at a nominal framerate and only rendering x frames per second eg. if my game timing were based on 60Hz, and the user was running his screen at 80Hz, I'd only render 60 frames out of the 80 possible per sec ? |
| ||
It has something to do with the combination of CaptureWorld and RenderWorld. This is where I read about the castle demo: http://www.blitzbasic.com/b3ddocs/command.php?name=RenderWorld Here is another thread about it: http://www.blitzbasic.com/Community/posts.php?topic=37621 |
| ||
And my own tutrial on tweening: http://www.blitzbasic.co.nz/codearcs/codearcs.php?code=1497 |
| ||
Hey John, That's really good, I'm gonna go and takea moment to revise my klnowledge. Thanks for that! IPete2. |
| ||
..here you can find all answers to your questions.. http://home.cmit.net/rwolbeck/programmingtutorial/ |