Posted By
|
Message
|
Billybobjoe198
Registered 12/01/2007
Points 221
|
20th February, 2020 at 20/02/2020 21:11:48 -
I've been working on a little game along the lines of parappa the rapper, and the mimic rapping game in Panic on Funkotron.
I've noticed that the "current channel position" only returns a value every 10ms.
There's also a looping inconsistency of 10ms.
If I run the event
If "channelpos(1) = 100" Then "set counter to channelpos(1)"
The counter will show 100 on the first loop, the 109 on the second, 108 on the third, etc etc until hitting 100 again, then loops back to 109.
I will get the exact same thing if I ran the event
If "channelpos(1) = 105" Then "set counter to channelpos(1)"
Does anyone know of a way to force it to return every ms accurately?
Right now to bandaid it I've made all the values it checks against
round((channelpos(1) - 5)*0.1)*10
I was thinking there might be something cryptic like telling MMF to calculate floats by making sure there's a decimal somewhere in the expression.
n/a
|
Sketchy Cornwall UK
Registered 06/11/2004
Points 1970
|
20th February, 2020 at 20/02/2020 23:15:24 -
I don't know what framerate your application is running at, but maybe that's part of the problem. At 60fps, the duration of each frame (ie. how often your events are tested) is a bit over 16ms, which is a relatively long time (and not a multiple of 10ms either, which might lead to a recurring pattern).
And obviously if there's any slow down (if the game can't maintain a perfect 60fps, which it probably can't) then that's going to change things too.
Plus the built-in timer only measures the time at the start of the frame, whereas the actual time when you get the playback position may be affected by events that take place earlier in the same frame (or who even knows when that time is retrieved?).
And if you were trying to export this to Javascript, it would never be possible because all browsers intentionally cripple the high-precision timer, as it was the only way they could find to defeat a certain kind of malware attack.
But yeah, I don't think you can expect too much from CF2.5 in terms of precision timing, although there is a micro-precision timer extension object available (won't help with media playback timing).
n/a
|
Billybobjoe198
Registered 12/01/2007
Points 221
|
21st February, 2020 at 21/02/2020 01:57:30 -
I have the FPS cap at 1,000 right now, and when I set a counter to framerate it returns values consistently above 700 on my PC. I've been mindful of frame rate and limited lots of non essential things to every 5ms to every 10ms if it ends up acceptable to try to minimize performance impact, especially for active resizing and ink effects.
It's probably just a limitation of the software, and a bit of over expectation of accuracy from me.
Thanks for the reply.
n/a
|
The_Antisony At least I'm not Circy
Registered 01/07/2002
Points 1341
|
22nd February, 2020 at 22/02/2020 19:28:15 -
Most beat-matching games don't test audio position directly from an audio track. They'll either test for note position in a midi file or rely on timestamps stored in a local INI (or something like it). Even then, the biggest problem is that MMF may update once every 16 milliseconds on your PC, but without a way of determining runtime framerate on any other computer or platform, that'll cause an inaccuracy.
If you're willing to junk the idea of exporting to anything except Windows, you might be able to get around this inaccuracy by using the DLL object to play audio through bass.dll instead of MMF.
http://www.un4seen.com/bass.html
I believe that version of bass.dll does support high-precision synchronization, but calling DLL files from MMF can be a real b****.
http://www.un4seen.com/doc/
https://create-games.com/article.asp?id=517
ChrisD> Employer: Say, wanna see a magic trick?
ChrisD> Employee: Uhh… sure, boss.
ChrisD> Employer: Your job! It just disappeared! Pack your things and leave! Pretty good trick, huh?
|
|
|