Including delta-time in fast loop movement?

Welcome to our brand new Clickteam Community Hub! We hope you will enjoy using the new features, which we will be further expanding in the coming months.

A few features including Passport are unavailable initially whilst we monitor stability of the new platform, we hope to bring these online very soon. Small issues will crop up following the import from our old system, including some message formatting, translation accuracy and other things.

Thank you for your patience whilst we've worked on this and we look forward to more exciting community developments soon!

Clickteam.
  • Hey guys! :)

    I've been manually building a small platform engine, nothing fancy, but I thought I'd include a delta-time.

    It works okay, all the speeds are exactly what I want them them to be, but when the frame-rate goes a way down, the character will move more and more pixels at once.
    So many pixels it's going through my collision detectors. Well, I kind of figured out this would happen.

    So I took a look of fast loops, I can start fast loop say 5 times, and add 1 pixel so it will check all the 5 pixels but keep the speed. This could work, but I can't figure how to use delta-time here.

    I could start fast loop... say 5 times *deltatime, but it will round and won't be quite as accurate as I'd like it to be. Though the difference is nothing huge, but just thinking.

    Anyways, any good ideas? :)

    Currently working on Please login to see this link.
    Released games: Please login to see this link. and Please login to see this link.

  • Please login to see this picture.


    Figure 2 is a scenario where the delta (of timer) is larger than 1, meaning the framerate is very low.

    Please login to see this link.

  • Tompa,
    sorry for the somewhat silly question,
    but I'm curious if you create on your own these graphic examples,
    or if you have a large library, or maybe a programmer's bible XD
    full of examples covering most of coding situations/tasks?

    I find them very... peculiar X), in a really cool way. I like that!
    (kinda reminiscent of the astounding collection of retro-graphics from Nintendo games you often showcase on your Fusion examples)

    a selection of my Fusion examples can be found Please login to see this link.

  • XD XD
    an image tells more than thousands words!
    (well, once you get it X))


    (sorry for going off-topic J3sseM)

    a selection of my Fusion examples can be found Please login to see this link.

  • Hi tompa!

    Not sure I understand that image, though it looks cool!
    To me it looks like there are a three beer mugs, some zelda triangles and...

    Does that include fast loops? If I have acceleration does not using floor round it, so it's not the same depending of the frame rate?

    No worries schrodinger! :D

    Currently working on Please login to see this link.
    Released games: Please login to see this link. and Please login to see this link.

  • Don't you just take your absolute velocity and see if it's greater than one pixel. If so you perform x amount of fast loop to move the object one pixel at a time checking for a collision each pixel. Each time you check a pixel you reduce your velocity by 1.0.

    I.e. Xvel = 7.635
    Then cal fastloop 7 times (round down to nearest whole number)

    On fastloop try to move one pixel at a time
    New velX is 0.635 now

    No accuracy lost.

    For my engine I use:

    XSpeed = XSpeed + accelx*deltatime
    VelX = XSpeed x DeltaTime
    Then I test to see if abs(VelX) > 1 pixel as above in the example.

    I credit mine working from the examples of tompa and solarb :)

  • Jesse
    Fastloop is a tool to refine your execution of this concept. You can use them if you want to.

    Try applying acceleration as a force over time. The Greek symbol for delta is a triangle. In this case it refers to delta of the hardware timer between mainloops (also called gameloop).
    The beer mugs are beer mugs, I'm glad you saw that.

    Please login to see this link.

  • tompa
    I am decelerating to a target. Where my accelerations is calculated on each axis and my acceleration is calculated to follow this logic:

    Start to slow down the object when TimeToBrake * Speed >= distance left to travel
    TimeToBrake = CurrentSpeed/Acceleration

    On diagonals I guess I'm going twice as fast as when I just go up or down though as I'm not using sin or cos. Does that answer your question? I'm still learning its my first game.

  • Thanks guys, I will most definitely check these out! :)
    I think I got it now. Though I'm working something very light at the moment, I'm not even sure delta is needed here. :)

    But does not hurt to learn the idea behind, so thanks!

    Currently working on Please login to see this link.
    Released games: Please login to see this link. and Please login to see this link.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!