Pausing in the message loop

This is a discussion on Pausing in the message loop within the Game Programming forums, part of the General Programming Boards category; Hey, I'm new to game programming. Actually OpenGL. I'm wondering if it is a bad idea to have a small ...

  1. #1
    Registered User IdioticCreation's Avatar
    Join Date
    Nov 2006
    Location
    Lurking about
    Posts
    229

    Pausing in the message loop

    Hey,

    I'm new to game programming. Actually OpenGL. I'm wondering if it is a bad idea to have a small pause (maybe 10 - 20 milliseconds) In the message loop. I guess is what I'm trying to do is slow the fps, and that is the only way I can think of. Is this supposed to be done a different way?

    Thanks,
    David

  2. #2
    Registered User
    Join Date
    Nov 2005
    Posts
    545
    It would be a bad idea to pause in the message loop becuase you want to be able to read the inputs as quickly as possible to stop any lag.
    Last edited by bumfluff; 01-22-2007 at 03:18 AM.

  3. #3
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,598
    As you add more things to your game the FPS concern will go down. You will eat them up fairly fast if you are not careful. You can tune your game to use a set FPS utilizing a bit of mathematics.

  4. #4
    S Sang-drax's Avatar
    Join Date
    May 2002
    Location
    Göteborg, Sweden
    Posts
    2,072
    Why do you want to slow the FPS?

    Adding a pause is not a bad idea, it will work fine, but what are you trying to achieve?
    Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling

  5. #5
    Registered User IdioticCreation's Avatar
    Join Date
    Nov 2006
    Location
    Lurking about
    Posts
    229
    Quote Originally Posted by Bubba
    As you add more things to your game the FPS concern will go down. You will eat them up fairly fast if you are not careful. You can tune your game to use a set FPS utilizing a bit of mathematics.
    Thanks Bubba, that makes sense.

    Sang-drax, I have a real basic Open GL app and like Bubba is saying since there isn't much to process the fps is super high.
    Last edited by IdioticCreation; 01-22-2007 at 03:11 PM.

  6. #6
    GA ichijoji's Avatar
    Join Date
    Nov 2002
    Posts
    179
    The fps will always be different on different machines, so it's a good idea to use the clock to make the timing in your game independent of the fps. This can be harder than it sounds, though, as my physics system will testify to.
    Illusion and reality become impartiality and confidence.

  7. #7
    Registered User
    Join Date
    Oct 2003
    Posts
    29
    Code:
    while (running)
    {
        deltaTime = clock() - lastTime;
        lastTime = clock();
        object.position = object.position + object.velocity*deltaTime;
        draw(object);
    }

  8. #8
    Registered User IdioticCreation's Avatar
    Join Date
    Nov 2006
    Location
    Lurking about
    Posts
    229
    So if you use a clock you aren't guaranteed a constant frame rate, just that movement will occur at the same rate? Yeah I can see how that could get complicated. Thanks for the example, rainmanddw!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Window message loop (Keys)
    By Blackroot in forum Windows Programming
    Replies: 3
    Last Post: 09-12-2006, 06:15 PM
  2. Personal Program that is making me go wtf?
    By Submeg in forum C Programming
    Replies: 20
    Last Post: 06-27-2006, 01:13 AM
  3. Message loop not working...
    By Hunter2 in forum Windows Programming
    Replies: 24
    Last Post: 07-03-2003, 03:17 PM
  4. Help, the window gets killed......
    By incognito in forum Game Programming
    Replies: 2
    Last Post: 05-28-2002, 03:22 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21