Arrrr, make it time-based movements!
I can make 10 points in 1 second since the ball is moving so fast ;)
It's unplayable here.
My first game - complete!
OK. Does anyone have any suggestions to locking the frame rate to say, 30? Basically I have a loop that calls Game_Main_Proc();
I think you could do something like:
I think you do someting similar to that. Or so I read. I can look it up and correct myself unless someone here will do that for me.
do{//some code herestart_time=GetTickCount();//some extra code herewhile((GetTickCount() - start_time) < 33);
I think you do someting similar to that. Or so I read. I can look it up and correct myself unless someone here will do that for me.
Ya. Sorry i forgot to mention that its all in milliseconds and 33 milliseconds is about 30fps.
Very nice! I have yet to complete my own pong clone :)
But it is too fast! I can't really play it because it goes so quick!
Thermo
But it is too fast! I can't really play it because it goes so quick!
Thermo
GetTickCount() returns milliseconds, so 33 would lock it at 30 fps or so.
33ms = .033s
.033s * 30 = .99s
so 1 frame should take up 33 ms or so if u r shooting for 30 fps
33ms = .033s
.033s * 30 = .99s
so 1 frame should take up 33 ms or so if u r shooting for 30 fps
Don't lock the FPS. Look into frame-rate independent movement. The basic idea is that you measure the amount of time the previous frame took (in seconds) and multiply the next frame's movement by that delta. Locking the frame rate is asking for trouble.
When I have fixed this frame rate problem I will write a tutorial which takes you through making this game. This will a) hopefully make me learn more and b) help people who don't really 'get' putting it all together. Il put a link in this beginners forum so if you want the source look for that soon (tday, tmoro).
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement