Actually stopping time (not dt)

0 favourites
  • 10 posts
From the Asset Store
2D fighting template based in the game that defined the fighting games genre.
  • In a game I've been working on, I required timing accuracy to approx. 1/10th of a second. I tried to use dt for this, but events wouldn't properly initiate via a dt tracking global/local variable, so I was forced to continue using regular "time", the kind you get when you use a condition of "system -> time = x seconds".

    I would really appreciate any helping in determining a means of manipulating this form of time in C2. I would love to be able to reset it, freeze it, and change it's value.

    I've spoken of this before, but dt was the only alternative at the time, and it plainly doesn't work for my project due to an unknown cause of imprecision. And yes, I know that 1/10th of a second doesn't conform with the framerate of most games, but the "time" variable still manages to respond to tenths of a second just fine, whereas dt does not.

    So, is there any way to manipulate the "time"? If there isn't, I would really appreciate this feature being added if possible.

    Thank you!

  • Don't think that's going to happen.

    Least not with javascript.

    Then definitely not on mobiles.

  • newt

    Javascript has an internal clock that can't be easily manipulated?

  • Not with that kind of precision.

  • newt

    I'm not looking for precision, for some reason the "time" is precise enough, or at least acts as though it is. I just need a way to tell the "time" to reset, stop, or change values. I can't use dt for this.

    Thanks for your responses!

  • Well dt has nothing to do with time. It's the time since the last frame, and that's it.

    What you should do is use a variable, that you can control, as your measure of time. Basically set the variable to the system time.

    But the problem is not all browsers are that accurate at keeping time.

    Most mobiles are absolutely terrible at it.

  • Hmm, I know this sounds stupid, but I don't recall if I tried setting a variable to system time...I think I may have though...I'll test it out when I get some extra time. Thanks newt.

    I still wouldn't mind the ability to control the time variable, though. :)

  • Are you trying to do a timer that does something after a tenth of a second? Like newt said use a variable and add dt to it every tick.

    Say you call your variable "timer"; don't do a condition like this to see when a tenth of a second has passed.

    timer = 0.1

    "timer" will almost never be exactly 0.1, instead use ">=".

    timer >= 0.1

    and add a "trigger once" condition after it.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The system time is also based on dt, so using dt in a variable should be about as good as comparing the system time. Like R0J0hound pointed out, a common mistake is to compare for an exact time, which is almost never triggered because time jumps in ~16ms steps with a lot of random variation. The system 'time equals...' condition automatically works around this, but for your own events you'll need to handle it yourself. The best way to handle it is something like: time greater than 0.1, trigger once.

  • Thanks Ashley and R0J0hound, I'll give that a go again! I do feel as though I recall it not working for me even under those conditions, but I could be mistaken.

    I appreciate the help guys!

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