User Tag List

Results 1 to 7 of 7

Thread: More precise timer?

  1. #1
    No Products Registered

    Join Date
    Jan 2007
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    More precise timer?

    Hello,

    I am using the demo version to try to create a sort of rhythm game (kind of like Lumines) and I'm struggling with getting an accurate timer. Here is my problem: I need an event to occur on every 'beat' of the song - however, the timer is only accurate to 1/100th of a second. This creates a problem that when I call this event every, for example, 0.69 seconds, after about thirty seconds of game time, the beat will be noticably off with the timer. This is because I need the event to occur every 0.69535 seconds, but I have to round alot of important information because the timer isn't precise enough.

    I tried setting a counter to the amount of time elapsed since the frame has begun (which for some reason is in 1/1000th of a sec) and tried using (Timer)mod(695) [if my event needs to occur every .695 seconds], and check when the result is zero. I thought this might be a clever way to get a more precise timer, however the events seem to occur so fast that the condition == 0 is rarely ever triggered at all.

    Is there anything I can do to force it to give me a more precise timer , using any tricks perhaps? Or maybe a bit of mathematical genius to create some sort of "offset" or "padding" to add to the counter every so often in order to keep it syncronized with the songs beat?

    Anyone ever try to create an application like this before?

  2. #2
    Forum Moderator Fusion 2.5 DeveloperHTML5 Export ModuleiOS Export ModuleSWF Export Module
    DavidN's Avatar
    Join Date
    Jun 2006
    Location
    Boston, MA, USA
    Posts
    4,044
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: More precise timer?

    Events in MMF2 are only checked on every frame no matter how accurate the timer is - and with a default FPS of 50, that makes the timer being divisible by 695 on any frame pretty unlikely - that caused the behaviour that you saw.

    What format is the song in? I know that ModFusion has a "Get beat" action or something similar, but I've never tried it so I'm unsure as to its usefulness.

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

    Join Date
    Jul 2006
    Posts
    1,027
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: More precise timer?

    FireMonkey once made an extension for MMF1.5 for a similar problem (though his was the reverse of this?), I believe. However, I don't think it was converted and he may no longer have the source or even be around...

    http://www.clickteam.com/CTforum/showflat.php3?Cat=&Board=upload&Number=144747&page =&view=&sb=&o=&vc=1

  4. #4
    Forum Moderator Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export ModuleInstall Creator Pro
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)

    Join Date
    Jun 2006
    Location
    England
    Posts
    3,546
    Mentioned
    4 Post(s)
    Tagged
    1 Thread(s)

    Re: More precise timer?

    It is an example and scriptlet/widget, not an object.
    .:::.Joshtek.:::.

  5. #5
    Clicker Multimedia Fusion 2 DeveloperiOS Export ModuleSWF Export Module

    Join Date
    Jul 2006
    Posts
    1,027
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: More precise timer?

    Whoops :S you're right.

  6. #6
    No Products Registered

    Join Date
    Jan 2007
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: More precise timer?

    I sort of figured it out using the modulus technique. I just set a counter to the (timer)mod(461.538) [event occurs every .461538 seconds], and whenever the user presses a key in sync with the beat, I can use the value of that counter to determine exactly how close the key press was to the actual beat. Using this method gives me 6 decimal point precision - and the beat will be perfectly syncronized with the song all the way through.

    However, using this technique, I won't be able to count the beats - since I can't rely on the game catching the counter at 0 - this doesn't really affect the game though as it's not really necessary information for my application, and I'm thinking I would even be able to twist some things around to get a beat counter anyways.

    My only concern is how well this will transfer over to other computers, and if any noticable differences could take place from machine to machine... if anyone wants to help maybe I could upload my test project so far and see how it runs on your guys machines?

  7. #7
    Forum Moderator Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export ModuleInstall Creator Pro
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)

    Join Date
    Jun 2006
    Location
    England
    Posts
    3,546
    Mentioned
    4 Post(s)
    Tagged
    1 Thread(s)

    Re: More precise timer?

    You may want to enable "machine independent speed" in application properties.
    .:::.Joshtek.:::.

Similar Threads

  1. Allow me to be more precise! Going High Res !!!
    By Aloan in forum Multimedia Fusion 2 - Technical Support
    Replies: 8
    Last Post: 13th January 2016, 02:23 PM
  2. Precise collision judging
    By simatten in forum Multimedia Fusion 2 - Technical Support
    Replies: 5
    Last Post: 23rd September 2013, 05:15 PM
  3. Which is the better way to make precise calculations?
    By Ls2 in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 14th December 2011, 12:20 AM
  4. Precise collision detection...
    By RGBreality in forum Multimedia Fusion 2 - Technical Support
    Replies: 5
    Last Post: 7th July 2010, 04:00 AM
  5. Precise position detection with PMO
    By Atherton in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 19th August 2009, 07:26 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
  •