1. Hello Guest! It's with a heavy heart that we must announce the removal of the Legacy GMC Archive. If you wish to save anything from it, now's the time! Please see this topic for more information.
    Dismiss Notice

Should you reset game_time counter?

Discussion in 'Programming' started by kupo15, Jul 31, 2019.

  1. kupo15

    kupo15 Member

    Joined:
    Jun 20, 2016
    Posts:
    796
    I'm sure most are familiar with the practice of keeping track of game time since the start of the game and also using that variable for game behaviors. For example, some enemies in games use the global game time for spawning and things like that instead of proximity to player which is why some speedruns are tricky.

    Anyway, should you be manually resetting this counter at some point? What will happen if you endlessly allow the game time variable to tick up and a player keeps the game on for a long time?
     
  2. NightFrost

    NightFrost Member

    Joined:
    Jun 24, 2016
    Posts:
    2,005
    I would assume it behaves like any other variable that reaches its maximum value and flips over back to zero. Or if it is treated as being allowed negative values, it flips to negative maximum halfway through (when the highest bit gets set).
     
  3. kupo15

    kupo15 Member

    Joined:
    Jun 20, 2016
    Posts:
    796
    That's what I was thinking that it would overflow at some number. So then set it and forget it? Or maybe manually resetting it at an appropriate time would give more control against unintended things
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice