hyperPad hyperPad Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Login

    Time in frames

    Scheduled Pinned Locked Moved Comments & Feedback
    5 Posts 4 Posters 914 Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Aidan_FireA Offline
      Aidan_Fire
      last edited by Aidan_Fire

      Similarly to how some behaviours let you use screen % instead of metres, things with durations (more specifically Timers and Waits) could have the option to work in frames rather than seconds. As it is now, to have a timer for every frame you would use 0s, or 0.01666...s (since 0s can have some problems). It would be pretty cool to be able to choose how many frames something waits or delays in a timer, instead of multiplying 0.01666... by the amount of frames delay you want. Also that makes me wonder whether it is possible for a timer running on 0.01666...s to ever skip a frame.

      1 Reply Last reply Reply Quote 0
      • MurtazaM Offline
        Murtaza Admin
        last edited by

        This isn't the best approach of doing this.
        Frames are not consistent, so you don't actually want to do anything based on frames. On some devices (or due to behaviour logic) this can result in slow motion, or fast motion. Kind of unpredictable.

        What you would want to do is something in every render cycle (Some people call these "ticks". While we don't expose this exactly, timer of 0 is pretty much this.

        If you do in fact want to wait for a certain amount of frames, then what you can do is use the play animation behaviour and have an animation with your desired frames playing some where off screen. Then when the animation is done do some thing. It's kind of a hacky trick. But may work depending on what you're trying to do.

        Aidan_FireA 1 Reply Last reply Reply Quote 0
        • Aidan_FireA Offline
          Aidan_Fire @Murtaza
          last edited by Aidan_Fire

          @murtaza I suppose render cycle might've been more what I meant. I didn't know the difference between frames and render cycles even existed. Timer 0s doesn't seem to work properly (at least not in movement behaviours), have timer 0s → move by some small distance, the object seems to stutter every second, but timer every 0.01666... doesn't.

          So how does this difference work? At maximum performance, a game runs at 60 frames per second, but how many render cycles? If the game starts lagging, do both of these slow down, or just the frames?

          iTap DevelopmentI 1 Reply Last reply Reply Quote 0
          • RobinsonXR Offline
            RobinsonX
            last edited by

            Yeah, sometimes Timers don't cooperate with transform behaviors. Objects stutter behind. You can see some graphical glitches on my latest game due to this. I think there is a way around it, it just may be very complex to do.

            1 Reply Last reply Reply Quote 0
            • iTap DevelopmentI Offline
              iTap Development @Aidan_Fire
              last edited by

              @aidan-oxley a while back I had a timer of 0 moving an object, and had to use 0.01666 too.

              I don’t know if this is right, but when I looked it up I found that it had to do with movement on a 0 timer not always being in sync with the frames.....so like the object might move twice between frames and then once between the next frames. Maybe just if the the fps fluctuated.
              But if the timer is 1/60 or 0.01666... It supposedly keeps the movement in time with the frames.

              Not sure if this is actually true, but it seems to work.

              1 Reply Last reply Reply Quote 0
              • First post
                Last post