1. Hey! Guest! The 33rd GMC Jam will take place between May 23rd, 12:00 UTC (Friday noon) and May 27th, 12:00 UTC (Monday noon). Why not join in! Click here to find out more!
    Dismiss Notice

delta_time question

Discussion in 'Programming' started by FeNniX, Mar 13, 2019.

  1. FeNniX

    FeNniX Member

    Joined:
    Jan 24, 2019
    Posts:
    16
    So, I want to implement delta_time in game that has moving objects. Main reason for that is to maintain same speed if fps drops.

    All objects have in creating code: motion_add(direction, speed); and step event is empty.

    So, best thing would be to add speed in step event and update every frame right?
     
    Last edited: Mar 13, 2019
  2. samspade

    samspade Member

    Joined:
    Feb 26, 2017
    Posts:
    1,822
    If you want to use delta_time you can't use speed or motion_add or any of the built in GML functions that rely on the built in movement variables. Game Maker updates these automatically once per step and it is completely outside of your control.

    If you want to use delta time, you'll need to use your own variables.

    It might not be worth worrying about. Delta time is great for many things but it isn't a necessity. It will also complicate a lot of other things (e.g. probability calculations, sprite animation, etc.). I wouldn't use it unless you have a specific reason to. Off the top of my head, the two main reasons to do it would be you want to implement slow motion or some version of something like that, or your game is going to be complicated enough to be worth the extra headache.
     

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