3

I'm currently working on making a game inspired by Guitar Hero and Frets on Fire, so far everything's been going well - I've written a script that can parse .chart files generated by the FeedBack Editor into usable data.

My concern is how would I go about to make sure the timing is correct_(I'm gonna have to convert these beat values into ms instead)_? The files I'm parsing hold values such as these;

0 = N 1 120
120 = N 2 120
240 = N 3 576

Where the first integer is at what beat the note should occur, N is whether or not the note is a hammer-on, then the Fret ID_(Green or Red etc)_ and the length of the note, again in beats.

I'm worried that songs will easily go out of sync if there's sudden FPS lag spikes, what would be a way to prevent it from going out of sync?

I've tried to find sources to figure out how they make sure that the timing on the notes is correct, but I can't seem to find anything useful.

Dealman
  • 127
  • 1
  • 2
  • 9
  • Most songs do not conform to a strict tempo so a summary like the .chart is too simple for keeping in sync with a recording. Choosing songs with a stricter tempo and pre-processing the music using quantization would help. It also doesn't look like you know when the first beat is, so I would also suggest pre-processing there too. Otherwise you will not know what is the cause of going out of sync. I suggest debugging with a simple electronically generated metronome recording. – ryanpattison Jun 10 '15 at 17:11

1 Answers1

1

This is a hard problem, because it depends on your audio player API. To make it work correctly, you'd need to have a function in your player that returns the current playing position. Let's say your player API has a method to get the position in milliseconds.

I would do the synchronization in native code, because if you use the value within lua, GC could kick in and throw you out of sync. Just use lua to parse the timings and set up arrays of structs (or something similar) for the native code.

llogiq
  • 13,815
  • 8
  • 40
  • 72
  • I guess I might have taken water over my head then :P The problem is that I'm making this... "game" within another game. The game I'm scripting within does use the BASS Library, so I am able to get and set the sound position - but it uses seconds, and not milliseconds - so it wouldn't be very accurate I'm afraid... – Dealman Jun 10 '15 at 11:58
  • @Dennis it uses seconds, but in floating point so the fraction is milliseconds, no? – ryanpattison Jun 10 '15 at 14:13
  • @rpattiso: You were indeed correct, it returns a floating point with plenty of decimals - 7.5110430839002. Does anyone have any clue how games like Frets on Fire and Guitar Hero make sure that notes that the notes in the beginning are timed correctly? I can't find any useful information on the matter whatsoever, I do believe a remake of Frets on Fire, called FoFix or something was open source - guess I might look for that, maybe I can find some clues :) Edit: To clarify a bit, I'm not entirely sure how to make use of the first value which is related to BPM in some way or another. – Dealman Jun 10 '15 at 15:10