User Tag List

Results 1 to 7 of 7

Thread: Timer relative to game speed

  1. #1
    Clicker Multimedia Fusion 2 DeveloperiOS Export ModuleSWF Export ModuleXNA Export Module

    Join Date
    Jul 2010
    Location
    Italy
    Posts
    368
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Timer relative to game speed

    Hi all!
    I finally received my Mac Mini bought a week ago on eBay and I've tried a game on my iPod touch.
    I have an effect in my game that slows it down (I will fix it, it is not subject of this thread). The problem is that, in general, when the game slows down, and it can for many reasons like an effect on an older device, many apps open with multitasking, etc..., the Timer does not! I'll try to explain better: my game consists of levels to finish in a given time. If the game slows down, for the player becomes impossible to finish some levels, because they don't have enough time if the character walks slower.

    Please, I really need help to understand how can I increment a Counter every 00"-10 in the best speed, but if the game slows down then the counter is incremented slower, relative to the game speed.

    I really hope you can help me. Thank you in advanced for your answers!

  2. #2
    Clicker Multimedia Fusion 2 DeveloperiOS Export ModuleSWF Export Module
    Francois's Avatar
    Join Date
    Jul 2006
    Location
    Montpellier, France
    Posts
    6,920
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)

    Re: Timer relative to game speed

    Just do every 10" increment counter : every catches up when the game slows down.

  3. #3
    Clicker Multimedia Fusion 2 DeveloperiOS Export ModuleSWF Export ModuleXNA Export Module

    Join Date
    Jul 2010
    Location
    Italy
    Posts
    368
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Timer relative to game speed

    At the moment I'm using Every 00"-10, but it doesn't adapt when the game slows down.
    There is a level in my game that becomes impossible when there is an effect that slows down the game. It doesn't depend on the player skills, just the character isn't fast enough.
    I don't know what can I do to solve this problem.
    Thanks again.

  4. #4
    Clicker Multimedia Fusion 2 DeveloperiOS Export ModuleSWF Export ModuleXNA Export Module

    Join Date
    Jul 2010
    Location
    Italy
    Posts
    368
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Timer relative to game speed

    I've found a solution!
    It's not the best, but it works.
    Instead of having:
    Every 00"-10
    -Add 1 to Counter

    I have a global variable "Clock", and I have the following events:
    Always
    -Set Clock to (Clock+1) Mod 10
    Clock = 0
    -Add 1 to Counter

    One game loop seems to be less than 1/100th of seconds, so I don't get actual time ellapsed. But the nice part is it's slowdowns-safe!
    I've tried both with and without the effect that slows down the game, both on iPad simulator and real iPod device, and doing the same movements to complete the level, adds the same amount to the Counter!

  5. #5
    Forum Moderator Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleMac Export ModuleSWF Export Module
    AndyH's Avatar
    Join Date
    Jun 2006
    Location
    UK
    Posts
    1,445
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Re: Timer relative to game speed

    That sounds like it solves your problem nicely. Also take a look at the thread titled keeping things moving in the sub firum here. It shows how everything can be controlled to move at the same speed when the game slows down or speeds up. The example demonstrates movement of an object, but you can apply the multiplier to anything, such as animation or a counter.
    Andy H @ ovine.net
    Awful Jokes - a new cartoon every day: http://awful.ovine.net/
    Ovine's games: http://www.ovine.net

  6. #6
    Clicker Multimedia Fusion 2 DeveloperiOS Export ModuleSWF Export ModuleXNA Export Module

    Join Date
    Jul 2010
    Location
    Italy
    Posts
    368
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Timer relative to game speed

    Thank you, I'll have a look!

  7. #7
    Clicker Fusion 2.5 DeveloperiOS Export Module

    Join Date
    Nov 2010
    Posts
    62
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Timer relative to game speed

    The way I've solved this in the past is somewhat similar to your solution. In order to have your app not have lapses when it gets slowdown, the first step is never to use the built in timer object.

    So instead, create a 'Universal Counter' (and make it hidden) and set an event that says: Always -> Add one to counter.

    What will happen is that the counter will count to 50 every second, as the default of MMF apps is 50 frames per second. Then, you base all your timer events off of this Universal Counter instead of the timer object.

    That way, if your game slows down (the fps drops below 50), all of your events are directly relying on that fps, so they will also keep pace with the counter and not with 'Real Time'.

Similar Threads

  1. "Every" Timer -- Increase the Speed
    By Taft in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 18th April 2013, 11:39 PM
  2. Timer Events/Restrict actions vs in-game counters
    By Cossin in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 28th June 2010, 07:07 PM
  3. 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
  4. The Timer and Machine-independent speed
    By Mico in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 10th April 2009, 12:32 AM
  5. Timer with adjustable speed Example
    By MODule in forum File Archive
    Replies: 10
    Last Post: 7th June 2007, 02:46 PM

Posting Permissions

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