Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

AK47

Time based movement code on graphics card problem and please test my game too

This topic is 5329 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi guys, I've just completed a 3d breakout clone. I've tested my game on different computers without graphics card, and it works fine. I mailed my game to this developer to look at, and the feedback was that the game speed was too high and collision detection failed. I suspect that my fixed time movement code doesn't work on graphics card. #include <windows.h> #include <mmsystem.h> //______________________________________________________________________________ float TIMER::GetTime() { return ( (float) ( timeGetTime() - timerStartTime) ); } //______________________________________________________________________________ void TIMER::ClampFrameRate(const float secondsPerFrame) { time2 = GetTime()*0.001f; float diffTime = time2-time1; while (diffTime < secondsPerFrame) { Sleep(1); time2 = GetTime()*0.001f; diffTime = time2-time1; } time1 = GetTime()*0.001f; } //______________________________________________________________________________ void GAMELOOP::LoopForever() { //All object movement code here, like ball->pos.x++ ClampFrameRate(0.015f); //66 frame per second } //____________________________________________________________________________ I did test the code by lowering the frame rate and see whether it clamps the game speed, it works on my Pentium III and Celeron computer without graphics card. Should I use another time function like multimedia time function or something like that? Or did I miss something? One guy suggested that I include opengl.dll in my game folder so the game will only run on software rendering, but that looks fishy... You can have a look at my game at http://www.angelfire.com/games5/ak47fh/center.html The game runs on opengl and windows. Thanks and regards AK47 [edited by - AK47 on April 12, 2004 2:16:34 AM]

Share this post


Link to post
Share on other sites
Advertisement
you shouldnt really be clamping the frame rate
it should render as fast as possible and everything should move at a specified number of units per second

edit: u can do this by calculating the time elapsed between frames and multiplying it by the speed of the object

also here is some more info on timeGetTime

Windows NT/2000: The default precision of the timeGetTime function can be five milliseconds or more, depending on the machine. You can use the timeBeginPeriod and timeEndPeriod functions to increase the precision of timeGetTime.

Use the QueryPerformanceCounter and QueryPerformanceFrequency functions to measure short time intervals at a high resolution.

[edited by - eFoDay on April 12, 2004 3:41:22 AM]

Share this post


Link to post
Share on other sites
Thanks. Yeah you got a point there, I should let it run as fast as possible. I clamped the frame rate because the function is so convenient; you dont have to multiply frame rate in every object.

But I am still wondering why the frame rate clamping function failed. This developer is saying that the ball moves at impossible speed, humanly impossible to catch. And the game''s option menu overlaps the main menu, I suspect probably due to game speed. TimeGetTime() is inaccurate but shouldn''t be so extreme.


Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!