Page 1 of 1

Advice on a Rhythm Game

Posted: Tue Jul 14, 2015 4:02 pm
by mirrornoir
Hi, I don't needs support as much as I'd like some advice on the best way to achieve a rhythm game I'm working on. My plan is to make a clone of a rhythm game called Final Fantasy: Thetarhythm (you can see some gameplay here) similar to how osu is a clone of Elite Beat Agents and Phase Shift is a clone of Rock Band. Basically to have music from all kinds of games rather than just Square Enix, with the end goal of allowing users to add their own songs. Do note while I have some coding experience I'm still a beginner but I have fooled around with Love2D before.

The gameplay shouldn't be too hard to implement, what I'm stuck up on is the best way to chart out the "notes" and keep a updatable database of songs. I've been looking into using libxml for both with something like:

Code: Select all

<note type="hold">
    <time>1:50:12</time> 
    <lane>4</lane>
    <duration>120</duration>
</note>    
But that's probably going to be a pain to do by hand and not very friendly to end users and I'm guessing coding some kind of editor would be pretty difficult. I'd just like to know if there's a better way to go about this that I don't know about.

Also just curious if there's anything code wise I should be doing to prevent desyncs, etc. Sorry if this isn't the right place to ask all of this, I know this is mostly for problems with code.

Re: Advice on a Rhythm Game

Posted: Tue Jul 14, 2015 6:22 pm
by Linkpy
Hellooooo !
I'm stuck up on is the best way to chart out the "notes"
I've got some rhythmic game experiences.

Firstly, if you keep a XML file format :
And, the first think I see the is the "<time>1:50:12</time>"... :x
For simpler handle of time, you may use :
  • Milliseconds timestamp ;
  • Seconds timestamp ;
  • Beat timestamp (a note on the first beat, a note on the second, etc) ;
Having note's time offset like will this be a pain : It will be easy done with string.match, but it will be slow, and (normally) these files will be edited with a third-party program (an editor~), so they don't need to be so clear for a humain.

Secondly, if you want something else :
You can use Marshal (like I call it) file : this is simply a Lua table saving into a file (loading need some security), and are very easy to use, but not the fastest (Lua need to parse the file, and then compile it).

You can also use textual file, like osu! do. Each line can be a note :

Code: Select all

-- Offset in ms, type (hold or single), lane
11012,2,4
Can be parsed easily with a string splitter function (Google : lua split string).

Or, you have all kind of file format that can suit (if you don't really target the efficiency) : JSON, YAML, etc.

and keep a updatable database of songs
Same as above, you can use the file format that you want, if this fit your needs ! :)

I'm guessing coding some kind of editor would be pretty difficult
Not really. This is just GUI. The difficulty come from the GUI. How to do an efficient GUI ? Etc etc. It's not the big problem.

Also just curious if there's anything code wise I should be doing to prevent desyncs, etc
For desyncs, you have a simple first thing : an user defined offset, which is applied on all note time offset. You can also use the position of the audio source : Source:tell() rather than a timer, so you will be at the source time, and not at a time which can be desync'ed.

And, finally, this is the place for this kind of questions ^^
I hope that my answer will be useful :emo:

Re: Advice on a Rhythm Game

Posted: Tue Jul 14, 2015 6:34 pm
by davisdude
Check out these links for some advice on keeping in sync and making a rhythm game in general:
https://www.reddit.com/r/gamedev/commen ... ic/c78aawd
https://www.reddit.com/r/gamedev/commen ... te_how_to/

Re: Advice on a Rhythm Game

Posted: Tue Jul 14, 2015 6:45 pm
by Linkpy
Oh, I learn new things !
I forgot about the visual latency. And I didn't know about the playhead problem :emo:

Re: Advice on a Rhythm Game

Posted: Tue Jul 14, 2015 11:40 pm
by mirrornoir
Great, thanks guys. @Linkpy, yeah that XML timestamp was just an example, I realized as I was typing that out that it didn't make any sense that way. As for the GUI I'm trying out loveframes because this game is probably going to be pretty UI heavy (especially a song browser). You're right about an editor, but this is honestly my first real project outside of trying to learn various languages so I'll have to puzzle out how to implement it. Nice info about source:tell(), that looks much more reliable. I'm familiar with what those other games do for audio/visual lag and I'll probably implement a similar calibration utility in the options.

@davisdude, thanks for the links, tons of info there and they look to be really helpful. I really only started on this last night and so far my research was just what other people have done rhythm games wise in love2D. I'll give these a good read for sure.

Awesome stuff. Thanks for the info, I'm pretty new to this so I wasn't really sure if what I had in mind was the best way to go about it.