User Tag List

Results 1 to 7 of 7

Thread: Decreased Framerate ruins Timer?

  1. #1
    Clicker Fusion 2.5 DeveloperHTML5 Export Module

    Join Date
    Jun 2013
    Posts
    26
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Decreased Framerate ruins Timer?

    The timer is a key aspect in the engine of my game. I designed a core principle of my game around "every 10 subtract 1 from alterable value a". 10 presumably being 10 milliseconds. I'd been testing the game at 60fps for months flawlessly but recently decided trying it at 30fps and even 120fps. When the framerate changes, the timer fails and is completely different to what it was doing at 60fps. I didn't think this was supposed to happen which is why I specifically chose to use the timer for so many events. Is the timer supposed to be dynamic with the fps or am I missing somethine?? Very frustrated and confused!

  2. #2
    Clicker Fusion 2.5 DeveloperHTML5 Export Module

    Join Date
    Jun 2013
    Posts
    26
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Okay I've done some testing and this is absolutely bizarre and VERY VERY aggravating.

    -create a new application.
    -create a new frame
    -create a counter
    -create one and only one event...
    -Every 1/100 of a second add 1 to counter

    If you set the framerate to 5fps, the timer will add VERY very slowly.
    If you set the framerate to 200fps, the timer adds VERY VERY quickly.

    I thought the whole point of a timer is to have a consistent reference point.

    I've tried changing the vsync and machine independent speed to see if that changes at all but NOTHING helps.

    Whats the point in having a timer if it's completely relative to framerate??
    How am I supposed to create a consistent program if the framerate totally changes the timing of the game?

  3. #3
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleUniversal Windows Platform Export Module

    Join Date
    May 2014
    Posts
    97
    Mentioned
    7 Post(s)
    Tagged
    0 Thread(s)
    What you're probably looking for is delta time. Best to make your own timer to fiddle with this.

    Here's an example that should nudge you in the right direction. Good luck!

    Timer.mfa

  4. #4
    Clicker

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleSWF Export ModuleXNA Export ModuleInstall Creator Pro
    nivram's Avatar
    Join Date
    Jul 2006
    Location
    Bandon, Oregon
    Posts
    6,729
    Mentioned
    9 Post(s)
    Tagged
    0 Thread(s)
    Delta timing insures that your game runs at the same speed regardless of framerate.
    For example:
    A 60 FPS game with the following code:


    Always
    - Set X Position of "Object 1" to X Position of "Object 1" + 1


    Will move the object 60 pixels PER Second (60 fps / 1 pixels per frame = 60 pixels traveled")


    A 30 FPS game with the following code:


    Always
    - Set X Position of "Object 1" to X Position of "Object 1" + 1


    Will move the object 30 pixels PER Second (30 fps / 1 pixels per frame = 30 pixels traveled"). If you use delta timing and you tell the object to move 60 pixels over the course of 1 second, it will move 60 pixels no matter the fps. Even at 5 fps, the object will move 60 pixels every 5 frames.

    Marv
    ​458 TGF to CTF 2.5+ Examples and games
    http://www.castles-of-britain.com/mmf2examples.htm

  5. #5
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCiOS Export ModuleInstall Creator Pro
    Julian82's Avatar
    Join Date
    May 2012
    Location
    outbuddies.com
    Posts
    937
    Mentioned
    47 Post(s)
    Tagged
    0 Thread(s)
    The way you set up a timer for counter an movement control will only work if you make sure the framerate is always able to execute your timestep. In your example you set the timer to 10 ms, that will demand a minimum framerate of 100 FPS to be executed properly, thatís why 30, 60 and 120 FPS all give you different results. 30 and 60 are simply too slow to catch the counter. When testing your game lower 100 FPS youíre basically running a framerate dependent always event instead of a counter. 60 FPS has a timestep limit of 16,7 ms, 30 FPS has a limit of 33 ms. As the others said delta time calculation is the way to go. Hope that helps a bit.

  6. #6
    Clicker Fusion 2.5 DeveloperHTML5 Export Module

    Join Date
    Jun 2013
    Posts
    26
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Raxabit, Marv, and Julian82 thank you guys so much for the help. This is all making sense now. Thank you!
    I had no clue what delta time is so now I will use that.
    I had gotten so emotional and upset last night but now that you guys have helped I'm a lot calmer now lol.

  7. #7
    Clicker Fusion 2.5 MacFusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleSWF Export ModuleInstall Creator Pro
    Christian_Wheel's Avatar
    Join Date
    Mar 2010
    Location
    Los Angeles
    Posts
    344
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I wonder if selecting "machine independent speed" might be a one-click solution to this issue? Obviously developing your own timer is a better solution but it could be worth trying in the meantime.

Similar Threads

  1. iOS 2.5 ruins apps
    By animdude in forum iOS Export Module 2.5
    Replies: 13
    Last Post: 28th April 2014, 11:53 AM
  2. Does timer speed increase with the framerate?
    By MechatheSlag in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 7th April 2010, 08:34 PM
  3. Detecting if value decreased
    By Ran_TH in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 2nd July 2009, 02:02 PM
  4. invisible rectangle ruins my back drop
    By vincent in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 24th May 2009, 04:11 PM
  5. [bug] 'no tick frame' ruins 2x scaling
    By Ohyea in forum Multimedia Fusion 2 - Technical Support
    Replies: 6
    Last Post: 31st July 2008, 11:16 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •