Timing of Events

0 favourites
  • 4 posts
From the Asset Store
14 amazing sound files of game events like Level Ups, Level Completes, object spawn, object taking etc.
  • Hey, guys.

    Had a question on timing of events in game.

    I'm doing variable timers so far and they seem to work great, even for syncing animation frames to sound. I tested on my mobile android phone and saw no difference vs. pc.

    Doing another global variable "clock" to control timing of events/transition effects.


    However, in debug view, under "system", I also noticed "wall clock", "time (system time)", and "time scale". If you let these run for a while (don't think it would be a major issue in what I'm doing, but still...), there are vast differences between all 4, including my variable clock.

    I also noticed some people add dt to their timer variables. I've used dt before to account for differences in system "times" before for many things, but here?

    I did some Goggling on "scirra wall clock", but I'm still unclear on the differences and the pros and cons of each approach and pitfalls if any.

    Would making a global variable clock say adding 0.01 every 0.01 seconds (system-> every 0.01 seconds, add 0.01 to global variable) pretty much make it full proof vs. any system?

  • Wall Clock time grabs your machine's time relative to the startup of a project, and system time does that in its own environment * by time scale (or dt/delta time.)

    Since Variable timers reference the system time, they are essentially the same thing

    If you were designing something of a multiplayer game, wall clock time would be the better option. In any other situation, using system time would definitely be the way to go. I try to avoid Wall Clock time if I can. It really makes your project more streamlined and will probably save you a lot of headaches down the road of development.

  • Implementing a system clock is the way to go, wall clock can be easy abused because it uses the user time, which he can easy change to get some kind of advantage.

    I had a simple clock on my game implement with 3 variable, 1 for seconds, 1 for minutes and 1 for hours, every 1 second when the game should be running I increment the second variable by 1, when it gets to 60 I reset it to 0, and add 1 to minutes, when minutes get to 60 I reset it to 0 and add 1 to hours. You can make a simple clock like that, and If you want to continue where it stoped after the game is closed, you can keep the variable values in a json file and load that on game start.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Thanks guys, that is very interesting.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)