User Tag List

Results 1 to 6 of 6

Thread: Help with calculating time, please :)

  1. #1
    Clicker Fusion 2.5 DeveloperiOS Export ModuleSWF Export Module
    Yima's Avatar
    Join Date
    Feb 2008
    Location
    Sweden
    Posts
    104
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Help with calculating time, please :)

    In the game I am working on, I want to keep track of how long the player has been playing. I want the time taking to be more accurate than whole seconds, so I need to make use of the 1/100 part of the default time keeping system somehow.

    Apparently 1/100 is not 1/100 of a second. When I use a counter that adds one "second" each time it reaches 100, based on the 1/100 system, it takes longer than a second. It seems, however, that I get the correct result if I assume that the 1/100 really is 1/60 (adding one second to time each time the counter reaches 60 works).

    Pseudo code below, to make it more clear:

    Every 00"-01:
    > Add one to Counter

    Counter = 100
    >Add one to Seconds (Does not work. It takes over a second for Counter to reach 100)
    >Set Counter to 0

    However this works:

    Every 00"-01:
    > Add one to Counter

    Counter = 60
    >Add one to Seconds
    >Set Counter to 0

    The question is why MMF2 lists the time as 1/100, when it really is 1/60 (if we assume that the number is counting seconds, and not something else). A wild guess is that the 1/100 is somehow bound to the frame rate, rather than actual time, and if that's the case I don't see how I can keep track of 1/100:s of a second (not really neccessary, but would be nice :P).

    Thanks in advance for any answers.

  2. #2
    Clicker Fusion 2.5 DeveloperFusion 2.5 DeveloperAndroid Export ModuleiOS Export Module

    Join Date
    May 2013
    Posts
    142
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    I had no idea the every 1/100 was not always 1/100th of a second but I've just tested it and you're right. You are right about it relating to the frame rate as well; if the frame rate is n where n < 100 frames per second then the "Every 1/100" event will only occur n times per second. If n>= 100 frames per second then the "Every 1/100" event will occur 100 times per second as expected.

    Try replacing the first event with:

    - Every 00"-02 -> Add two to counter

    This should work as long as the frame rate is >= 50 frames per second.

  3. #3
    Clicker Fusion 2.5 DeveloperiOS Export ModuleSWF Export Module
    Yima's Avatar
    Join Date
    Feb 2008
    Location
    Sweden
    Posts
    104
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks! That did work, and it actually makes sense that it works, although it's not very intuitive. The problem seems to be that MMF2 can't do things faster than 1/60:th of a second. Even though you can set the frame rate higher than 60, the game loop seems to be capped at 60. I tried setting the frame rate to 100, but that produced the same result as when it was 60.

    The question now is if I should have 1/100:th of a second, that increases by 2 per loop (which people are used to), or 1/60:th of a second that increases by 1 per loop (resulting in slightly better precision). I'll likely go with 1:100:ths, since that's less weird

  4. #4
    Clicker Fusion 2.5 DeveloperFusion 2.5 DeveloperAndroid Export ModuleiOS Export Module

    Join Date
    May 2013
    Posts
    142
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Glad it worked although changing the frame rate to 100fps (or higher) did work on my computer - don't know why that should be.

  5. #5
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    Popcorn's Avatar
    Join Date
    Jun 2006
    Location
    Norway, Bergen
    Posts
    2,345
    Mentioned
    12 Post(s)
    Tagged
    0 Thread(s)
    Maybe this helps:

    * Always
    - Add 1 to Counter

    Time = (Counter / Framerate) * 100


    Remember to convert Counter to float before doing the calculation:

    Time = Int(((value( "Counter" )+0.0)/FrameRate)*100)

  6. #6
    Clicker Fusion 2.5
    Fusion 2.5 (Steam)
    BackStaged's Avatar
    Join Date
    Aug 2010
    Location
    France
    Posts
    693
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Interesting post, I will use certainly later, thanks all

Similar Threads

  1. calculating hours
    By matte in forum Multimedia Fusion 2 - Technical Support
    Replies: 0
    Last Post: 8th March 2013, 02:58 PM
  2. Calculating milliseconds?
    By mobichan in forum iOS Export Module Version 2.0
    Replies: 8
    Last Post: 5th March 2013, 07:44 PM
  3. Calculating text
    By richardh in forum Multimedia Fusion 2 - Technical Support
    Replies: 5
    Last Post: 27th February 2010, 02:09 AM
  4. Calculating bandwidth?
    By Tiny in forum Lacewing
    Replies: 8
    Last Post: 12th January 2009, 09:07 PM
  5. Calculating an arc/trajectory
    By McPhisto in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 24th March 2008, 03:53 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
  •