Results 1 to 6 of 6

Thread: Timing

  1. #1

    Thread Starter
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    For my Nibbles Revenge, I have used 2 types of timing:

    1. Do...Loop
    2. Timer1_Timer

    Method 2 is too slow, while Method 1 will be different for everycomputer and the time needs to be changed in between (eg - 20 frames a second start-game to 35 fps mid-game, etc.) The frame rates are strictly for timing purposes.

    I need a timing type that is faster than do...loop because I KNOW my computer can go faster, and one that is controlled. ANYBODY???
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

  2. #2
    Frenzied Member HarryW's Avatar
    Join Date
    Jan 2000
    Location
    Heiho no michi
    Posts
    1,827
    Use GetTickCount, and loop until 30 ms (for 33 fps) or however long you want has passed. It's really very easy.

    Code:
    Public Declare Function GetTickCount Lib "kernel32" Alias "GetTickCount" () As Long
    It returns the number of milliseconds since system startup. While that may seem rather useless, you can take values and use the difference as a measure of how much time has elapsed.
    Harry.

    "From one thing, know ten thousand things."

  3. #3
    Lively Member
    Join Date
    Jun 2000
    Posts
    124

    Cool

    Harry, i'm just guessing but that might be what he means by do...loop. just my guess, though
    On Error Resume Screaming...

  4. #4
    Frenzied Member HarryW's Avatar
    Join Date
    Jan 2000
    Location
    Heiho no michi
    Posts
    1,827
    Well he said it "will be different for every computer", which it wouldn't be if he was using GetTickCount.
    Harry.

    "From one thing, know ten thousand things."

  5. #5
    Lively Member
    Join Date
    Jun 2000
    Posts
    124

    touché!

    Good point. I'd forgotten about that.

    On a somewhat related note, I just wrote a game and its timing method is a do loop with a sleep statement, which should be consistent for every CPU. You can check it out in the Games and Graphics forum in the post titled "check this out".
    On Error Resume Screaming...

  6. #6
    Lively Member
    Join Date
    Jun 2000
    Posts
    124
    On Error Resume Screaming...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width