GML Delta-Timing (Movement & Alarms)

Discussion in 'Tutorials' started by matharoo, Dec 11, 2018.

  1. matharoo

    matharoo Udemy Instructor

    Joined:
    Jul 9, 2016
    Posts:
    779
    GM Version: GMS2
    Target Platform: ALL
    Download: https://www.dropbox.com/s/6ntwlhiqkfoqiah/delta-timing.yyz?dl=0
    Links: N/A

    Summary:
    Delta-timing is used to make sure the game doesn't actually slow down due to low FPS. This tutorial teaches you how to implement delta-timing and also use it with alarms.

    Tutorial:
     
  2. NeZvers

    NeZvers Member

    Joined:
    Mar 24, 2018
    Posts:
    194
    I'm doing tests myself and last thing I want to solve is animation end with script. Without delta it was pretty easy to calculate, but with delta I found out that after setting room_speed to 99999 and use imgSpeed instead of image_speed (which is set to 0) you can hit image_number(and over) on image_index for one game frame and use it as sprite switch, but haven't tested further yet.
     
    matharoo likes this.
  3. Simon Gust

    Simon Gust Member

    Joined:
    Nov 15, 2016
    Posts:
    2,967
    Thank you @matharoo, very cool.

    I do have a question though.
    In terms of unlocking room_speed, is it wise to set it to 9999 for example or is there a value that is just right?
     
    matharoo likes this.
  4. matharoo

    matharoo Udemy Instructor

    Joined:
    Jul 9, 2016
    Posts:
    779
    I don't see why you would want to set the room_speed to 9999. Perhaps it has an effect that I'm not aware of? I would just keep it as 60.
     
    The Reverend likes this.
  5. Smiechu

    Smiechu Member

    Joined:
    Jul 14, 2017
    Posts:
    609
    To make the game compatible with all possible screen refresh rates?
    But even then I find it more reasonable to set it around 200-300fps.
     
    matharoo likes this.
  6. NeZvers

    NeZvers Member

    Joined:
    Mar 24, 2018
    Posts:
    194
    Room speed like that unlocks any frame limit that might be. In my tests, I have a game running around actual 1400fps.
    If your delta calculations are right then that means whatever system you run, you'll get max possible fps.
    That brings its own challenges but looks neat and smooth. It's not needed and maybe you can keep it at 120 to have max reasonable fps, dunno if displays can play it faster.

    Actually, you can have a frame limit option in-game settings for players (not to waste processing power on phantom frames), and since you have delta timing down the game will run amazing.
     
    Last edited: Dec 22, 2018
    DaMuffin and matharoo like this.
  7. The Reverend

    The Reverend Member

    Joined:
    Sep 8, 2016
    Posts:
    487
    Me too and for mobiles even at 30fps. I hate when games drain my battery in no time :)
     
    NeZvers and matharoo like this.
  8. NeZvers

    NeZvers Member

    Joined:
    Mar 24, 2018
    Posts:
    194
    99999 Is for testing purposes. As I said, after handling delta timing it's easy to give the option to the player to set frame limit him/her-self.
     
    matharoo likes this.
  9. BigBrotherBear

    BigBrotherBear Member

    Joined:
    Sep 17, 2016
    Posts:
    6
    Would it be affected by screens with 120Hz if I set it to 60 fps?
     
  10. matharoo

    matharoo Udemy Instructor

    Joined:
    Jul 9, 2016
    Posts:
    779
    I think it will still be limited to 60.
     
  11. NeZvers

    NeZvers Member

    Joined:
    Mar 24, 2018
    Posts:
    194
    Your screen doesn't affect room_speed.
    And it really isn't good thought to run massive room_speed, 120 is good enough if you want max FPS and you have a display that supports that.
     

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